/************************************************
 * createElement - Jquery						*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: Jquery Loading							*
 * Rev: 										*
 ************************************************/
function loadJquery()
{
	var strJsFile= "http://static.mgoon.com/js/jquery.js";
	loadJS(strJsFile);
}
/************************************************
 * createElement - javascript					*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: JS Loading								*
 * Rev: 										*
 ************************************************/
function loadJS(url,p) {
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = url;
	if(!p){document.getElementsByTagName('head')[0].appendChild(script);}
	else{$(p).appendChild(script);}
}
/************************************************
 * createElement - CSS							*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: CSS Loading							*
 * Rev: 										*
 ************************************************/
function loadCSS(url) {
	var CSS = document.createElement('link');
	CSS.type = 'text/css';
	CSS.rel = 'stylesheet';
	CSS.href = url;
	document.getElementsByTagName('head')[0].appendChild(CSS);
}
/************************************************
 * createElement - iframe						*
 * gilhyun										*
 * Date: 2009/10								*
 * memo: iframe Loading							*
 * Rev: 										*
 ************************************************/
function loadIframe(url,w,h,DIV) {
	if(navigator.appName == "Microsoft Internet Explorer") {
		var iframe = document.createElement('<iframe src="#" frameborder="0" scrolling="no" width="'+w+'" height="'+h+'">');
	}else{
		var iframe = document.createElement('iframe');
	}
	iframe.src = url;
	iframe.scrolling = "no";
	iframe.frameborder = "0";
	iframe.width = w;
	iframe.height = h;
	$(DIV).appendChild(iframe);
}
/************************************************
 * ADcopy										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: view:붙여넣을곳 , copy:복사할내용			*
 * Rev: 										*
 ************************************************/
function ADcopy(view,copy){
	var viewDIV = $(view);
	var copyDIV = $(copy).innerHTML;
	viewDIV.innerHTML = copyDIV;
	copyDIV.addClass = 'hide';
	$(copy).innerHTML = '';
}
/************************************************
 * flash										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: swf Loading(배너기본)					*
 * Rev: 										*
 ************************************************/
function mFlashWrite(url,w,h,id,bg,win,vars)
{
	var mflashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowFullScreen' value='true' />"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='base' value='.' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' base='.' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always'  allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	document.write(mflashStr);
}
/************************************************
 * IE : Flicker Bug								*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: IE6 SP2 부터 가능 						*
 * Rev: 										*
 ************************************************/
function flickerBug()
{
	try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}
}

/************************************************
 * Ajax (page loading)							*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
var showContents = function(url,DIVid) {
  var respond = $(DIVid);
  new Ajax.Request(url, {
	method: 'get', onSuccess: function(req) {
	  respond.innerHTML = req.responseText;
	  historyHandler.add(url);
	  var urlNum = changenum(url);
	}, onFailure: function() {
	  respond.innerHTML = 'respond error';
	}
  });
};
/************************************************
 * Tab											*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function mTab(p,tabNum,loadPagesName,createDIV,changeTab)
{
	showContents(loadPagesName+p+'.html',createDIV);
	//window.scrollTo(0,0);
	for(var i = 1; i <= tabNum ; i++) {
	  eval("$('"+changeTab+i+"')").removeClassName('on');
	}
	$(changeTab+p).addClassName('on');
}
/************************************************
 * getStyle										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function getStyle(elementID, propertyName)
{
	var element = document.getElementById(elementID);if (element.currentStyle){var propertyValue = element.currentStyle[propertyName];}else if (window.getComputedStyle){var computedStyle = document.defaultView.getComputedStyle(element,null);var propertyValue = computedStyle.getPropertyValue(propertyName);}return propertyValue;
}
/************************************************
 * String										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 글자 자르기								*
 * Rev: 										*
 ************************************************/
String.prototype.cut = function(len)
{
 var str = this;
 var l = 0;
 for (var i=0; i<str.length; i++) {
  l += (str.charCodeAt(i) > 128) ? 2 : 1;
  if (l > len) return str.substring(0,i);
 }
 return str;
}
String.prototype.bytes = function()
{
 var str = this;
 var l = 0;
 for (var i=0; i<str.length; i++) l += (str.charCodeAt(i) > 128) ? 2 : 1;
 return l;
}
/************************************************
 * gnb toggleSearch								*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/

function toggleSearch()
{
	var eID = document.getElementById('cat_list');
	var cat_title = document.getElementById('cat_title');
	var cat_out = document.getElementById('cat_list_bg');
	if(getStyle('cat_list',"display")=='none'){eID.style.display = 'block';cat_title.style.backgroundPosition='70px -338px';cat_out.style.display = 'block';}
	else{Search_hide();}
}
function Search_hide()
{
	var eID = document.getElementById('cat_list');
	var cat_title = document.getElementById('cat_title');
	var cat_out = document.getElementById('cat_list_bg');
	eID.style.display = 'none';cat_title.style.backgroundPosition='70px -308px';cat_out.style.display = 'none';
}

/************************************************
 * gnb search cat change						*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 검색셀렉트								*
 * Rev: 										*
 ************************************************/
function gnbSearch_catchanger(tit)
{
	var change = document.getElementById('cat_list');
	var cat_select = document.getElementById('cat_select');
	var cat_title = document.getElementById('cat_title');
	change.style.display='none';
	cat_select.value = tit;
	cat_title.innerHTML= tit;
	cat_title.style.backgroundPosition='70px -308px';
}
/************************************************
 * gnb sitemap									*
 * gilhyun										*
 * Date: 2009/21								*
 * memo: 더보기레이어								*
 * Rev: 										*
 ************************************************/
function mgoon_hotmenu_open(ID)
{
	var eID = document.getElementById(ID);
	if(getStyle(ID,"display")=='none'){eID.style.display = 'block';}else{eID.style.display = 'none';}
}
/************************************************
 * rolling										*
 * gilhyun										*
 * Date: 2009/12								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function scrolling(objId,sec1,sec2,speed,height){
  this.objId=objId;
  this.sec1=sec1;
  this.sec2=sec2;
  this.speed=speed;
  this.height=height;
  this.h=0;
  this.div=$(this.objId);
  this.htmltxt=this.div.innerHTML;
  this.div.innerHTML=this.htmltxt+this.htmltxt;
  this.div.isover=false;
  this.div.onmouseover=function(){this.isover=true;self.ov();self.Stop();}
  this.div.onmouseout=function(){this.isover=false;self.ot();}
  var self=this;
  this.div.scrollTop=0;
  window.setTimeout(function(){self.play()},this.sec1);
}
scrolling.prototype={
  play:function(){
    var self=this;
    if(!this.div.isover){
      this.div.scrollTop+=this.speed;
      if(this.div.scrollTop>this.div.scrollHeight/2){
        this.div.scrollTop=0;
      }else{
        this.h+=this.speed;
        if(this.h>=this.height){
          if(this.h>this.height|| this.div.scrollTop%this.height !=0){
            this.div.scrollTop-=this.h%this.height;
          }
          this.h=0;
          window.setTimeout(function(){self.play()},this.sec1);
          return;
        }
      }
    }
    window.setTimeout(function(){self.play()},this.sec2);
  },
  prev:function(){
    if(this.div.scrollTop == 0)
    this.div.scrollTop = this.div.scrollHeight/2;
    this.div.scrollTop -= this.height;
  },
  next:function(){
    if(this.div.scrollTop ==  this.div.scrollHeight/2)
    this.div.scrollTop =0;
    this.div.scrollTop += this.height;
  },
  Stop:function(){
    this.div.scrollTop =0;
  },
  ov:function(){
    this.div.addClassName("on");
  },
  ot:function(){
    this.div.removeClassName("on");
  }
};
/************************************************
 * mgoon scripts - 	search						*
 * mgoon										*
 * Date: 										*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function checkKeyword()
{
	isCheckKeywordAd = false;
	//$('ad_SearchTxt').hide();
	$('keyword').focus();
}
function goSearch(str)
{
	document.gnbForm.keyword.value = str;
	submitSearchGnb(document.gnbForm);
}
function submitSearchGnb(theForm)
{
	if(theForm.keyword.value.length == 0) {

		if( isCheckKeywordAd && keywordAdHref ) {

			window.open( keywordAdHref + "", keywordAdTarget + "" );
			return;
		} else {

			alert("검색어를 입력해주세요.");
			theForm.keyword.focus();
			return;
		}
	}

	searchType = document.getElementById('cat_select').value;
	theForm.method = "GET";
	theForm.target = "";

	if( searchType == false || searchType == "전체")theForm.action="http://www.mgoon.com/search/search.htm";
	else if(searchType == "동영상") theForm.action="http://www.mgoon.com/search/search.htm";


	theForm.submit();
}
/************************************************
 * mgoon scripts - 	resizeFrame					*
 * mgoon										*
 * Date: 										*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function resizeFrame(frmName) {
	var frm = document.getElementById(frmName);
	frm.style.height = "auto";
	contentHeight = frm.contentWindow.document.documentElement.scrollHeight;
	frm.style.height = contentHeight + 10 + "px";
}

/************************************************
 * createCookie									*
 * minsoo										*
 * Date: 2010/07								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

/************************************************
 * getCookie									*
 * minsoo										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function getCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0){
			var value = c.substring(nameEQ.length,c.length);
			return value
		}
	}
	return null;
}

/************************************************
 * eraseCookie									*
 * minsoo										*
 * Date: 2010/07								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function eraseCookie(name) {
	createCookie(name,"",-1);
}

/************************************************
 * goFlexUpload									*
 * minsoo										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/

function goFlexUpload()
{

   var userId=getCookie('userId');
   var nameCheck=getCookie('nameCheck');

   if(userId==null || userId==""){
       alert('로그인해주세요.');
       location.href = "http://www.mgoon.com/login/login.htm?force_check=1&returnUrl="+location.href;
   }else if(nameCheck!=null && nameCheck==0){
        	location.href = "http://www.mgoon.com/member/check_name.jsp?returnUrl="+location.href;

   }else{
      var uploadWin=window.open("http://www.mgoon.com/jsp/upload/flex_upload.jsp","uploadWin","width=500,height=667,resizeable=1");
      uploadWin.focus();
   }

}
/************************************************
 * display toggle								*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function display(ID)
{
   var ele = $(ID);
   if(getStyle(ID,'display') == "none"){ele.style.display = "block";}
   else{ele.style.display = "none";}
}
/************************************************
 * RoyaltyInfo popup							*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 저작권 팝업								*
 * Rev: 										*
 ************************************************/
function goRoyaltyInfo()
{
    var url="http://www.mgoon.com/customer/royaltyInfo.htm?decorator=popup&confirm=true";
    window.open(url,"royalty","width=630,height=616");
}
/************************************************
 * showNicknameMenu								*
 * mgoon										*
 * Date: 										*
 * memo: 유저닉네임 클릭시 뜨는 레이어				*
 * Rev: 										*
 ************************************************/
 function makeNicknameMenuHTML(member)
{
	strHTML = "		<div id=\"bMenuBg\"></div>"
		 + "		<ul class=\"bList\">"
		 + "			<li><a href=\"javascript:goStation3(" + member + ");\" class=\"rollover\"><img src=\"http://img.mgoon.com/images/balloonM01_off.gif\" alt=\"스테이션 가기\"><img src=\"http://img.mgoon.com/images/balloonM01_on.gif\" alt=\"스테이션 가기\" class=\"rollover\"></a></li>"
		 + "			<li><a href=\"javascript:sendMessage(" + member + ");\" class=\"rollover\"><img src=\"http://img.mgoon.com/images/balloonM02_off.gif\" alt=\"쪽지보내기\"><img src=\"http://img.mgoon.com/images/balloonM02_on.gif\" alt=\"쪽지보내기\" class=\"rollover\"></a></li>"
		 + "			<li><a href=\"javascript:addAddress(" + member + ");\" class=\"rollover\"><img src=\"http://img.mgoon.com/images/balloonM03_off.gif\" alt=\"지인신청하기\"><img src=\"http://img.mgoon.com/images/balloonM03_on.gif\" alt=\"지인신청하기\" class=\"rollover\"></a></li>"
		 + "		</ul>";
	return strHTML;
}
function showNicknameMenu(e, member)
{
   	if(member <= 0) {
   		alert("탈퇴 회원입니다.");
   		return;
   	}

	if(!$('bMenu')){
		var createbMenu = document.createElement('div');
		createbMenu.id='bMenu';
		document.getElementsByTagName('body')[0].appendChild(createbMenu);
		Event.observe('bMenu', 'mouseout', function() { hideNicknameMenu(); } );
		Event.observe('bMenu', 'mouseover', function() { show(); } );
	}

	objDiv = document.getElementById("bMenu");
	xcoord = mouseX(e) - 10;
	ycoord = mouseY(e) - 10;
	objDiv.style.left = xcoord + "px";
	objDiv.style.top = ycoord + "px";

	objDiv.innerHTML = makeNicknameMenuHTML(member);
	objDiv.style.display = "inline";
}
function mouseX(e) {
   var posx = 0;
   if (!e) var e = window.event;

   if (e.pageX)
   {
      posx = e.pageX;
   }
   else if (e.clientX)
   {
      posx = e.clientX + document.documentElement.scrollLeft;
   }

   return posx;
}
function mouseY(e) {
   var posy = 0;
   if (!e) var e = window.event;
   if (e.pageY) { //FF
      posy = e.pageY;
   }
   else if (e.clientY)   { //IE
      posy = e.clientY + document.documentElement.scrollTop;
   }
   return posy;
}
function show()
{
	objDiv = document.getElementById("bMenu");
	objDiv.style.display = "inline";
}

function hideNicknameMenu()
{
	objDiv = document.getElementById("bMenu");
	objDiv.style.display = "none";
}

/************************************************
 * loding										*
 * gilhyun										*
 * Date: 2009/10								*
 * memo: 										*
 * Rev: 										*
 ************************************************/

function ajaxLodingMSG(ID,MSG)
{
	$(ID).update(MSG);
}

/************************************************
 * onload										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
window.onload = function ()
{
	//all
	flickerBug();//IE6 Flicker Bug
}


/*
	mainpage
*/


/************************************************
 * Main hotclipTab								*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
var hotclipListNumFull = 5;
var hotclipListNum = 1;
function hotclipList_nx()
{
	hotclipListNum++;
	if(hotclipListNumFull<hotclipListNum){showContents('hotclipList1.html','mainHotclip');hotclipListNum = 1;}
	else{showContents('hotclipList'+hotclipListNum+'.html','mainHotclip');}
}
function hotclipList_pv()
{
	hotclipListNum--;
	if(hotclipListNum==0){showContents('hotclipList'+hotclipListNumFull+'.html','mainHotclip');hotclipListNum = hotclipListNumFull;}
	else{showContents('hotclipList'+hotclipListNum+'.html','mainHotclip');}
}
/************************************************
 * setTitle										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function setTitle(title)
{
	var changeTitle = $('setTitle');
	var tit = title.cut(45);
	var bytes = title.bytes();
	if(bytes>45){tit = tit+"...";}
	changeTitle.innerHTML = ": "+tit;
	changeTitle.title = title;
}
/************************************************
 * NowScroll									*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 작업중									*
 * Rev: 										*
 ************************************************/
function getPosition()
{
	var t=$('site_cover').scrollHeight;
	t=t+','+$('site_cover').scrollTop;
	$('Position').innerHTML=t;
}



/*
	viewpage
*/


/************************************************
 * HD on off									*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function HDonoff(classname)
{
	var playermod = $('contents');
	var FlashPlayer = $('viewplayer');
	if(classname=='HDon'){playermod.className='HDon';FlashPlayer.executeCommand('SCALEMODE','2');}
	else if(classname=='HDonAD'){playermod.className='HDonAD';}
	else if(classname=='HDon_full'){
		playermod.className='HDon_full';$('playerbt_w_op').style.display='none';$('playerbt_w_cl').style.display='block';$('minstall').style.width='950px';$('minstall').style.height='560px';$('minstall_cov').style.height='560px';

		// 와이드 화면시 광고 태그를 붙이기 위한 호출
		//loadIframe("http://opt.mgoon.com/NetInsight/text/mgoon/web/click@click",0,0,'contents');
	}
	else if(classname=='full'){FlashPlayer.executeCommand('FULLSCREEN');}
	else{playermod.className='';$('playerbt_w_op').style.display='block';$('playerbt_w_cl').style.display='none';$('minstall').style.width='500px';$('minstall').style.height='423px';$('minstall_cov').style.height='423px';}
}

/************************************************
 * Player										*
 * mgoon										*
 * Date: 										*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function fun_FlashPlayer_size(VID, w, h, pID)
{

 var strView = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+w+'" height="'+h+'" id="' + pID + '" align="middle"> ' +
  '<param name="allowScriptAccess" value="always" /> ' +
  '<param name="allowFullScreen" value="true" /> ' +
  '<param name="movie" value="http://play.mgoon.com/Video/V'+ VID + '/" /> ' +
  '<param name="quality" value="high" /> ' +
  '<param name="wmode" value="transparent" />' +
  '<embed src="http://play.mgoon.com/Video/V' + VID + '/" wmode="transparent" quality="high" width="'+w+'" height="'+h+'" allowFullScreen="true" name="' + pID + '" id="' + pID + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';

 document.write(strView);
}
function FlashPlayer_Chk(VID, w, h, playType,viralType){

 var strView = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+w+'" height="'+h+'" id="viewpage" align="middle"> ' +
  '<param name="allowScriptAccess" value="always" /> ' +
  '<param name="allowFullScreen" value="true" /> ' +
  '<param name="movie" value="http://play.mgoon.com/'+playType+'/V'+ VID + '/" /> ' +
  '<param name="FlashVars" value="viral='+viralType+'">'+
  '<param name="quality" value="high" /> ' +
  '<param name="wmode" value="transparent" />' +
  '<embed src="http://play.mgoon.com/'+playType+'/V'+ VID +'/"  FlashVars="viral='+viralType+'" wmode="transparent" quality="high" width="'+w+'" height="'+h+'" allowFullScreen="true" name="viewplayer" id="viewplayer" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';

 document.write(strView);
}
/************************************************
 * loadPage										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
var loadPage = function(page,loadEl,NumFull,n)
{
	var ListNumFull = NumFull;
	var ListNum = 1;
	if(n=='pv')
	{
		ListNum++;
		if(ListNumFull<ListNum){showContents(page+'1.html',loadEl);ListNum = 1;}
		else{showContents(page+ListNum+'.html',loadEl);}
	}
	if(n=='nx')
	{
		ListNum--;
		if(ListNum==0){showContents(page+ListNumFull+'.html',loadEl);ListNum = ListNumFull;}
		else{showContents(page+ListNum+'.html',loadEl);}
	}
}
/************************************************
 * dragText										*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function selectText() {
	var selectionText = "";
	var TextID = $('pageTitle');
	if (document.getSelection) {
		selectionText = document.getSelection();
	} else if (document.selection) {
		selectionText = document.selection.createRange().text;
	}

	return selectionText;
}
function dragText(event) {
	if (event.pageX || event.pageY) {mouseX = event.pageX;mouseY = event.pageY;}
	else if (event.clientX || event.clientY) {mouseX = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;mouseY = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;}

	var mouseX = mouseX - 10;
    var mouseY = mouseY + 20;
	var console = $('console');
	var stNum = selectText().length;
	var keyword = encodeURI(selectText());


	if(keyword){
	console.innerHTML = "<a href=\"http://www.mgoon.com/search/search.htm?keyword="+keyword+"\">엠군에서 <span>"+selectText()+"</span> 검색하기<span class='aw'></sapn></a>";
	console.style.display = "block";
	console.style.top = mouseY+"px";
	console.style.left = mouseX+"px";
	}
	else{console.style.display = "none";}
}
/************************************************
 * Togle Container								*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function togle_container(ID)
{
	var bt = $(ID);
	if(bt.className=='on'){bt.className='';}
	else{bt.className='on';}
}
/************************************************
 * play_info Open								*
 * gilhyun										*
 * Date: 2009/09								*
 * memo: 										*
 * Rev: 										*
 ************************************************/
function play_info()
{
   var el = $('movie_memo');
   var elbt = $('bt__more');
   display('play_info');
   if(el.style.height == "auto"){el.style.height = "20px";el.style.overflow = "hidden";elbt.innerHTML='상세정보보기';elbt.removeClassName('open');}
   else{el.style.height = "auto";el.style.overflow = "visible";elbt.innerHTML='상세정보닫기';elbt.addClassName('open');}

}

function goStation3(member)
{
	var url="/jsp/common/getMemberAccount.jsp"
	var param = "member="+member;
	var myAjax = new Ajax.Request(url,
		{
			method: 'post',
			parameters: param,
			onComplete: moveStation3
		});
}

function moveStation(stationid)
{
	window.open( "/mystation/main.htm?id=" + stationid, "_blank" );
	//location.href="/mystation/main.htm?id=" + stationid;
}

function moveStation3(re)
{

	var member = re.responseText.evalJSON();
	window.open( "http://station.mgoon.com/" + member.account, "_blank" );
	//location.href="http://station.mgoon.com/" + member.account;
}

function sendMessage(member)
{
   var userId=getCookie('userId');

     if(userId==null || userId==""){
       location.href="http://www.mgoon.com/login/login.htm?returnUrl="+encodeURIComponent(location.href);
   }else{
	   if(member==userNo){
	     alert("자기 자신에게는 쪽지를 보낼수 없습니다.");
          return;
       }
		var  url="/mypage/message/popupSend.htm?member="+member+"&sender=${cookie.userNo.value}";
		window.open(url,"addressP","width=400,height=290");
   }
}
function addAddress(member)
{
   var userId=getCookie('userId');
   var userId=getCookie('userNo');
   if(userId==null || userId==""){
     location.href="http://www.mgoon.com/login/login.htm?returnUrl="+encodeURIComponent(location.href);
   }else{
    if(member==userNo){
     alert("자기 자신은 주소록에 추가 할 수 없습니다");
     return;
    }
    url="/mypage/address/address_propose_popup.htm?member="+member+"&sender="+userNo;
    window.open(url,"addressP","width=400,height=290");
   }
}

function goView(id, target)
{
	var f = document.createElement("form");
	f.method = "get";
	f.action = "/view.htm";
	if(target) f.target = target;
	document.body.appendChild(f);

	var hdn = document.createElement("input");
	hdn.type = "hidden";
	hdn.name = "id";
	hdn.value = id;

	f.appendChild(hdn);

	f.submit();

	//location.href="/view.htm?id=" + id;
}
function goViewNew(id)
{
	//var newwin = window.open();
	var f = document.createElement("form");
	f.target = "_blank";
	f.method = "get";
	f.action = "/view.htm";
	document.body.appendChild(f);

	var hdn = document.createElement("input");
	hdn.type = "hidden";
	hdn.name = "id";
	hdn.value = id;

	f.appendChild(hdn);

	f.submit();

	//location.href="/view.htm?id=" + id;
}
function goTag(id)
{
	location.href="/tag.htm?id=" + id;
}