/***************************************************************************
 * filename : head.js<br>
 * °øÅëÀ¸·Î »ç¿ëµÇ´Â ÇÔ¼ö¹× ¼Ó¼º<br>
 *
 * @version	: 1.0
 * @author	: free270
****************************************************************************/
if(HEAD_CLASS!=null) {
	alert("[head.js]´Â ÀÌ¹Ì include µÇ¾îÀÖ½À´Ï´Ù!!");
}
var HEAD_CLASS = true;

//BODYÅÂ±×ÀÇ onLoad() ÀÌº¥Æ®¿¡¼­ È£ÃâÇÏ´Â ÇÔ¼ö
function init(){
	//ÇØ´çÆäÀÌÁö³»¿¡¼­ overridingµÇ¾îÁü
}
function popupEvent(){}
function init_start(){
	// code here ...  init()ÇÔ¼ö°¡ ÇØ´çÆäÀÌÁö³»¿¡¼­ overridingµÇ¾îÁö±â ¶§¹®¿¡ ±× ÀÌÀü¿¡ ½ÇÇàÇÏ°íÀÚ ÇÏ´Â ±â´ÉÀ» ¿©±â¿¡ ³ÖÀ¸½Ã¿À	
	init();

	setTimeout("popupEvent();", 2000);	
}


//[ ¹Ù·Î°¡±â ÇÔ¼ö ] ==================================================================================================
function logiCheck()
{
	goLogin();
}

function goLoginInfo(lpinfo){


	var returnUrl = "";

	returnUrl = escape(CURRENT_PAGE);

	loginPopup_pageUrl = "https://sso.hite.com/k_log/login.asp?login_channel=11&memcode=login&returnUrl=" + returnUrl+"&lpinfo="+lpinfo;
	var loginPopup = window.open(loginPopup_pageUrl, "login", "top=0,left=0,width=820, height=520,scrollbars=yes,resizable=no");

	if (loginPopup == null)
	{
		alert("·Î±×ÀÎ ÇÏ½Ç·Á¸é Â÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
	}

	loginPopup.focus();

}

function goLogin(url){

	var returnUrl = "";

	if(url == null){
		returnUrl = escape(CURRENT_PAGE);
	}else{
		returnUrl = escape(url);
	}

	loginPopup_pageUrl = "https://sso.hite.com/k_log/login.asp?login_channel=11&memcode=login&returnUrl=" + returnUrl;
	var loginPopup = window.open(loginPopup_pageUrl, "login", "top=0,left=0,width=820, height=520,scrollbars=yes,resizable=no");

	if (loginPopup == null)
	{
		alert("·Î±×ÀÎ ÇÏ½Ç·Á¸é Â÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
	}

	loginPopup.focus();

}

function goJoin(url){
	
	var returnUrl = "";

	if(url == null){
		returnUrl = escape(CURRENT_PAGE);
	}else{
		returnUrl = escape(url);
	}

	joinPopup_pageUrl = "https://sso.hite.com/k_log/login.asp?login_channel=11&returnUrl=" + returnUrl;
	var joinPopup = window.open(joinPopup_pageUrl, "login", "top=0,left=0,width=820, height=520,scrollbars=yes,resizable=no");

	if (joinPopup == null)
	{
		alert("È¸¿ø°¡ÀÔÀ» ÇÏ½Ç·Á¸é Â÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
	}

	joinPopup.focus();

}

function goModify(){

	var returnUrl = "";

	returnUrl = escape(CURRENT_PAGE);

	joinPopup_pageUrl = "https://sso.hite.com/k_log/edit.asp?returnUrl=" + escape(CURRENT_PAGE);
	var joinPopup = window.open(joinPopup_pageUrl, "login", "top=0,left=0,width=820, height=520,scrollbars=yes,resizable=no");

	if (joinPopup == null)
	{
		alert("È¸¿øÁ¤º¸¸¦ ¼öÁ¤ ÇÏ½Ç·Á¸é Â÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
	}

	joinPopup.focus();
}

function goLogout(){
	document.location = URL_ROOT + "member/xt_logout.asp?returnURL=" + escape(CURRENT_PAGE);
}



function goHome(){
	document.location = URL_ROOT;// + "index.asp";
}
function goSitemap(){
	document.location = URL_ROOT + "etc/sitemap.asp";
}

function goDirectLogin(p_current_page, p_sso_logininfo){
	document.location = URL_ROOT + "member/xt_login.asp?returnURL=" + escape(CURRENT_PAGE) + "&loginParam=" + escape(p_sso_logininfo);
}

function syncSSO(){
//	alert(URL_ROOT)
//	if(ISLOGINED != SSO_LOGINED){
//		if(ISLOGINED==true){
//			//goLogout();			
//			document.location = URL_ROOT + "member/xt_logout.asp?returnURL=" + escape(CURRENT_PAGE);;
//		}else{
//
//			document.location = URL_ROOT + "member/xt_login.asp?returnURL=" + escape(CURRENT_PAGE) + "&loginParam=" + escape(SSO_LOGININFO);
			//goDirectLogin(CURRENT_PAGE, SSO_LOGININFO);
//		}
//	}
}

function goLancelotHome(){
	goHome();
	//document.location = LANCELOT_ROOT;
}
function goCuttysarkHome(){
	//goHome();
	document.location = CUTTYSARK_ROOT;
}

function goNews(){
	document.location = URL_ROOT + "h_customer/news/list.asp";
}
function goEvent(){
//	document.location = URL_ROOT + "h_event/event/index.asp";
	document.location = URL_ROOT + "h_event/event/20050425/index.asp";
}
function goCustomer(){
	document.location = URL_ROOT + "h_customer";
}
function goEpisode(){
	document.location = URL_ROOT + "/h_episode/ep/list.asp";
}
function goLife(){
	//alert("ÁØºñÁßÀÎ ÆäÀÌÁö ÀÔ´Ï´Ù!")
	//document.location = URL_ROOT + "/h_life/index.asp";
}
function goCeo(){
	document.location = URL_ROOT + "/h_ceo/html/interview.asp";
}

/** For Flash menu interface *************************************************************/
function MM_controlShockwave(objStrNS,objStrIE,cmdName,frameNum) { //v2.0
	var objStr = (navigator.appName=='Netscape')?objStrNS:objStrIE;
	if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||	(objStr.indexOf('document.all[') ==0 && document.all ==null)){
		objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
	}
	if (eval(objStr) != null){
		eval(objStr+'.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
	}
} 

function goMenu(menu1, menu2, menu3, menu4){	
//	document.location = "/h_" + menu1 + "/index.asp";
	if(menu1==null) menu1 = "";
	if(menu2==null) menu2 = "";
	if(menu3==null) menu3 = "";
	if(menu4==null) menu4 = "";
	if(menu1=="") return;

//	alert("menu1=" + menu1 + ",menu2=" + menu2 + ",menu3=" + menu3);
	if(menu1=="entertain" && menu2=="05"){
		goCommunity();
		return;
	}
	document.location = "/gomenu.asp?menu1=" + menu1 + "&menu2=" + menu2 + "&menu3=" + menu3 + "&menu4=" + menu4;
}

//¿ìÆí¹øÈ£ °Ë»öÃ¢
function openFindZip(type){
	if(type==null) type = "";
	window.open(URL_ROOT + "h_customer/member/popup_findzip.asp?type=" + type, "popup_findzip", "width=316,height=316,resizable=no,scrollbars=yes,marginwidth=0,marginheight=0");
}
function FFOpen(link, winname, option){
	window.open(link, winname, option); 
	return;
}
function sendMail(from_email, from_name, to_email){
	open("/common/mail/send.asp?fe=" + escape(from_email) + "&fn=" + escape(from_name) + "&te=" + escape(to_email),'sendmail','width=600,height=300');
}

// ½½¶óÀÌµå¼î
function goSlideShow(num, list_opt){
	if(list_opt==null || !list_opt){
		list_opt = "N";
	}else if(list_opt){
		list_opt = "Y";
	}
    url = "/common/slideshow/slideshow.asp?album_no=" + num + "&list_opt=" + list_opt;
	window.open(url, 'slideshow', 'width=1024, height=800, status=no,toolbar=no,scrollbars=no,top=0,left=0,location=no,menubar=no, resizeable=no, fullscreen=yes');
}

function FlashPlay(Url, tWidth, tHeight)
{
   var tmpStr = "";
   tmpStr += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+ tWidth +"' height='"+ tHeight +"'>";
   tmpStr += "<param name='movie' value='"+ Url +"'>";
   tmpStr += "<param name='quality' value='high'>";
   tmpStr += "<param name='wmode' value='transparent'>";
   tmpStr += "<embed src='"+ Url +"' width='"+ tWidth +"' height='"+ tHeight +"' align='right' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed>";
   tmpStr += "</object>";
   
   document.write (tmpStr);
} 

function eventEnd() {
	alert("ÀÌº¥Æ®°¡ Á¾·áµÇ¾ú½À´Ï´Ù");
}

var zScrollId = 1;
var zScrollMouseOver = new Array();

function zScroll(rollingHeight) {
  this.id = zScrollId++;
  zScrollMouseOver[this.id] = false;
  this.obj = null;
  this.speed = 50;
  this.delay = 2000;
  this.style = '';

  if (typeof(rollingHeight) != "undefined")
    this.rollingHeight = rollingHeight;
  else
    this.rollingHeight = 24;

  this.status = false;
  this.amount = 0;

  this.curIndex = 0;
  this.itemCnt = 0;
  this.itemList = new Array();

  this.add = zScrollAdd;
  this.init = zScrollInit;
  this.start = zScrollStart;
  this.setSpeed = zScrollSetSpeed;
  this.setDelay = zScrollSetDelay;

  this.add("&nbsp;");
}
function zScrollAdd(val) {
  this.itemList[this.itemCnt] = "<table border=0 cellspacing=0 cellpadding=0 width=100% height="+this.rollingHeight+" style='table-layout:fixed;' onmouseover='zScrollMouseOver["+this.id+"] = true;' onmouseout='zScrollMouseOver["+this.id+"] = false;'><tr><td nowrap style='"+this.style+"'>"+val+"</td></tr></table>";
  this.itemCnt++;
}
function zScrollInit(obj) {
  this.obj = obj;
  this.start();
}
function zScrollSetSpeed(speed) {
  this.speed = speed;
}
function zScrollSetDelay(delay) {
  this.delay = delay;
}
function zScrollStart() {
  if (zScrollMouseOver[this.id])
  {
    setTimeout("zScroll.start();",this.speed);
    return;
  }

  if(this.status) {
    this.obj.scrollTop++;
    this.amount ++;
    if(this.amount+'px'==this.obj.style.height) {
      this.amount = 0;
      this.curIndex ++;
      if(this.curIndex >= this.itemCnt-1) this.status = false;
      setTimeout("zScroll.start();",this.delay);
    } else {
      setTimeout("zScroll.start();",this.speed);
    }		
  } else {
    if(this.obj.innerHTML) {
      this.obj.innerHTML = this.itemList[this.itemCnt-1];
      this.obj.scrollTop = 0;
      for(i=1;i<this.itemCnt;i++) {
        this.obj.innerHTML += this.itemList[i];
      }
      this.curIndex = 0;
    } else {
      for(i=0;i<this.itemCnt;i++) {
        this.obj.innerHTML += this.itemList[i];
      }
      this.curIndex = 0;
    }
    this.status = true;
    this.amount = 0;
    setTimeout("zScroll.start();",this.speed);
  }
}


//---------------------------------------------------//
	// @ SNS ±Û¾²±â
	//---------------------------------------------------//		
	function SNS(sns,page){
		var snsset			= new Array();
		var strUrl			= encodeURIComponent(page);
		//var strUrl		= encodeURIComponent("http://gooddownloader.com/2011/index.asp");
		var strFaceTitle	= encodeURIComponent("¶¼·ç¾Æ¿Í ÇÔ²²ÇÏ¸é °¨µ¿ÀÌ µÎ¹è! Power Culture ");
		var strTitle		= encodeURIComponent("¶¼·ç¾Æ¿Í ÇÔ²²ÇÏ¸é °¨µ¿ÀÌ µÎ¹è! Power Culture ");
		var strTag			= encodeURIComponent("¶¼·ç¾Æ¿Í ÇÔ²²ÇÏ¸é °¨µ¿ÀÌ µÎ¹è! Power Culture ");
		var strMsg			= strTitle + " " + strUrl;

		//alert(kind + "\n" + sns + "\n" + page);


		if(sns == "") sns = 'face'
		
		
		snsset['twit']	= "http://twitter.com/home?status=" + strMsg;
		snsset['face']	= "http://www.facebook.com/share.php?u="+strUrl+"&t=" + strFaceTitle;
		snsset['me2']	= "http://me2day.net/plugins/post/new?new_post[body]=" + strMsg + "&new_post[tags]=" + strTag;
		snsset['yozm']	= 'http://yozm.daum.net/api/popup/prePost?sourceid=' + strUrl + '&prefix=' + strMsg;
		
		//alert(snsset[sns]);
		window.open(snsset[sns]);
	}
