﻿document.domain = "gamehi.co.kr";
var openOtpWin = null;

//-----------Korean text-------------

var NoLoginAlert1 = "해당 서비스는 로그인 하셔야 이용하실 수 있습니다.";
var search_string_check1 = "검색어를 입력하세요.       ";
var search_string_check2 = "검색어는 두글자 이상이어야 합니다";
var login_check_msg = "로그인후 이용해 주세요.";

//------------------------------------

///global variable declaration///	
    _WEB_URL 		= "http://dekaron.gamehi.co.kr";
    _FILEWEB_URL    = "http://filedekaron.gamehi.co.kr";
    _MFILEWEB_URL   = "http://mfiledekaron.gamehi.co.kr";
	_SecureUrl		= "https://secure.gamehi.co.kr";
    _IMG_URL        = "http://imgdekaron.gamehi.co.kr";
    _PORTALWEB_URL  = "http://www.gamehi.co.kr";
//FRAME name
    _TARGET_MAIN 	= "dkr_main";		//main frame name
    _TARGET_HIDDEN 	= "dkr_hidden";		//hidden frame name
    _TARGET_TOP 	= "dkr_top";		//top frame name

var ctl_name = 'ctl00_ContentPlaceHolder1_';   
var d = "theForm.ctl00$ContentPlaceHolder1$";
var df = "ctl00$ContentPlaceHolder1$";
var c = 'ctl00$ContentPlaceHolder1$'; 
var ver_msg = function(t, msg){alert(msg);eval(t).value='';eval(t).focus(); return false;}
var df_ver_msg = function(t, msg){alert(msg);getObject(t).value='';getObject(t).focus(); return false;}
var is_ing = false;
function check_ing()
{
	if(is_ing)
	{
		alert("처리 중 입니다.\n잠시만 기다려 주세요.");
		return false;
	}
	else
	{
		is_ing = true;
		return true;
	}
}
//value of browser heignt gap
    _HEIGHT_DIFF    = 23;
/*************** BROWSER DOM NAME START ***************/
function getObject(elementId) { 
    if (document.getElementById) 
        { return document.getElementById(elementId);}
    else if (document.all) { 
        return document.all[elementId];}
    else if (document.layers) {
        return document.layers[elementId];}
}

/*************** login alert *****************/

function msg_login() 
{
	alert(login_check_msg);
	if (typeof(document._frmLeftLogin._user_id) == "object")
	{
		document._frmLeftLogin._user_id.focus();
	}
}

/*************** FILE Function *****************/

function file_extension(img, before, after)
{
    var ext = img.substring(img.lastIndexOf('.'));
    var filename = img.substring(0, img.lastIndexOf('.'));
    
    filename = filename.substring(filename.lastIndexOf(before)) == before ? filename.substring(0,filename.lastIndexOf(before)) : filename;

    return filename + after + ext;
}

/*************** MAIN Function *****************/

function mainLeft_Menu(name, num, contact)
{
    var path = _IMG_URL + "/images/_common/main/";
    var img = new Array('img_knight.jpg','img_hunter.jpg','img_magi.jpg','img_summ.jpg','img_sag.jpg','img_bagi.jpg','img_aloken.jpg');
        
    for(var i=1;i <= num; i++)
    {
        getObject(name+i).src = file_extension(getObject(name+i).src, '_on', (contact == i ? '_on' : ''));
        if(i==contact){
            getObject("character_bar").src = path + img[i-1];
        }
    }
}


/*************** IMAGE FUNCTION START ***************/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
		
		var pop_window = "";
		
		pop_window = window.open(theURL,winName,features);
    
    return;
}



///// popup open
function Open_WIndow(gourl,windowname,sizewidth,sizeheight)
{
	var setWin;
	setWin=winSetting(sizewidth,sizeheight,0);
	window.open(gourl,windowname, setWin);
}

	

///// window open setting	 
function winSetting(sizewidth,sizeheight,scrollType){
	var LeftPosition;
	var TopPosition;
	var settings;
	var status_type;
    
    if (xpie_SP2_verChk() == true )       // XP SP2 install yes or no check.
        status_type="yes";
    else
        status_type="no";
	
	status_type="no";

	LeftPosition = (screen.width) ? (screen.width-sizewidth)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-sizeheight)/2 : 0; 
	settings ='top='+TopPosition+',left='+LeftPosition+',width='+sizewidth+',height='+sizeheight+',status='+status_type+',scrollbars='+scrollType+',resizable=no'; 
	return settings;
} 


// XP SP2 install yes or no check.     (XP SP2 - yes install : true, - no install : false) 
function xpie_SP2_verChk(){     
    tmp_MSIE = window.navigator.userAgent.indexOf("MSIE"); 
    if(tmp_MSIE && window.navigator.userAgent.indexOf("SV1") > tmp_MSIE){    
        return true;  
    } else { 
        return false; 
    } 
} 



//////////////////// ShowHideLayer function End ///////////////////////////////

///return String of byte value.
function toByte(aquery) 
{
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;
	 
	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for (k=0;k<temp;k++)
	{
		onechar = tmpStr.charAt(k);

		if (escape(onechar).length > 4) {
			tcount += 2;
		}
		else if (onechar!='\r') {
			tcount++;
		}
	}
	return tcount;
}

///Trim function
function trim(inputString) {
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") {
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") {
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   /*
   while (retValue.indexOf(" ") != -1) { 
      retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); 
   }
   */
   return retValue; 
}


// time to input data, check to value is blank or null.
function isEmptyAll(strText)
{
	var str_len=0;  
	for (var i=0; i < strText.length;i++)
	{	
		//var str_temp = strText;
		if (strText.substring(i,i+1) != ' ') 
			str_len=str_len+1;		
	}

	if (strText.length == 0  ||  str_len == 0)  	// input blank
		return true;
	else
		return false;
}



//popup size is auto control to same document size.
var _popup_resizeCnt = 0
function popup_autoResize()
{
	var _HIEIGHT_MARGIN = 25;
	var _WIDTH_MARGIN   = 6;
	var _ect_h_margin=0;
	var _ect_w_margin=0;
	var win_height;
	var win_width;
	var contents_width=0;
	
	var objBody = self.document.body;
	if (_popup_resizeCnt > 0)
	{
		_ect_h_margin = ((objBody.scrollHeight-objBody.offsetHeight)+4);
		if (_ect_h_margin<1) _ect_h_margin = 0;
		_ect_w_margin = ((objBody.scrollWidth-objBody.offsetWidth));
		if (_ect_w_margin<1) _ect_w_margin = 0;
	}
	win_height  = objBody.scrollHeight + (objBody.offsetHeight-objBody.clientHeight) + _HIEIGHT_MARGIN + _ect_h_margin;
	win_width	= objBody.scrollWidth + (objBody.offsetWidth-objBody.clientWidth)  + _WIDTH_MARGIN + _ect_w_margin;

	contents_width = popup_getBodyWidth(objBody) + _WIDTH_MARGIN + _ect_w_margin;
	if (win_width > contents_width)	// 
		win_width = contents_width;

	try{
		self.resizeTo(win_width, win_height);
		_popup_resizeCnt++;
		if ((objBody.scrollHeight!=objBody.offsetHeight || objBody.scrollWidth!=objBody.offsetWidth) && _popup_resizeCnt < 2)
			popup_autoResize();
		else
			popup_autoResizeReset();
	}catch(e){ }
}

function popup_autoResizeReset()
{
	_popup_resizeCnt = 0
}


function popup_getBodyWidth(objBody)
{
	var i;
	var contents_w=0;
	var objParent;
	try{
		body_margin = 0;
		if (objBody.leftMargin)
			body_margin += parseInt(objBody.leftMargin);
	}catch(e){ body_margin = 4; }
	
	if(objBody.children.length)
	{
		for(i=0; i< objBody.children.length; i++)
		{
			if(contents_w<objBody.children[i].clientWidth)
				contents_w = objBody.children[i].clientWidth;
		}
	}
	return contents_w + body_margin;
}



String.prototype.trim = function()
{
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.left = function(len)
{
	return this.substr(0, len);
}
String.prototype.right = function(len)
{
	return this.substr(this.length-len, len);
}

var Verifier = {
	isAlpha 	: function(i_str) { return (i_str.search(/[a-z]/gi) > -1);	},			//English
	isDigit 	: function(i_str) { return (i_str.search(/[0-9]/gi) > -1); },			//decimal number
	isAlphaDigit: function(i_str) { return (i_str.search(/[^A-Za-z0-9]/gi) > -1); },	//English,decimal number
	isEmail 	: function(i_str) { return EmailUtil.isRegular(i_str);  },
	isHangul 	: function(i_str) { return (i_str.search(/[가-힣]/) > -1); }				//test Korean.
}


var EmailUtil = 
{
	isRegular : function (i_email)
	{
		var checkTLD = 0;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|co|co.kr|pe.kr)$/;
		
		var emailPatten = /^(.+)@(.+)$/;
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipdomainPatten=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom = validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var frontPatten=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPatten=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=i_email.match(emailPatten);
		
		if (matchArray == null) {
			return false;
		}

		var front=matchArray[1];
		var domain=matchArray[2];
		for (i=0; i<front.length; i++) {
			if (front.charCodeAt(i)>127) {
				return false;
			}
		}

		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				return false;
			}
		}

		if (front.match(frontPatten) == null) {
			return false;
		}

		var IPArray = domain.match(ipdomainPatten);
		if (IPArray != null) {
			for (var i = 1; i <= 4; i++) {
				if (IPArray[i] > 255) {
					return false;
				}
			}
			return true;
		}
		
		var atomPat = new RegExp("^" + atom + "$");
		var domainArr = domain.split(".");
		var len = domainArr.length;
		for (i = 0; i < len; i++) {
			if (domainArr[i].search(atomPat)==-1) {
				return false;
			}
		}

		if (checkTLD && domainArr[domainArr.length-1].length!=2 && 
			domainArr[domainArr.length-1].search(knownDomsPat)==-1) {
			return false;
		}

		if (len<2) {
			return false;
		}

		return true;
	}
}


var InputControl = {
	numberOnly : function () {		//onkeypress="return InputControl.numberOnly()"
		return (event.keyCode >= 48 && event.keyCode <= 57);
	},
	
	autoTab : function (currObj, maxLen, nextObj) {  ////onkeydown="autoTab(this, 6, document.frm.resident_no1)" 
		if(event.keyCode==9 || event.shiftKey || event.keyCode==16) //16=shift+tab
			return;
		if (currObj.value.length >= maxLen) 
			nextObj.focus();
	}
}

//	내용보기 페이지의 Top 버튼	시작
var layerHeight = 370; // 화면상의 레이어 높이.
var layerHeight_bn = 322; // 화면상의 레이어 높이.
function CheckUIElements(gubun){
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

	yMenuFrom   = parseInt (divMenu.style.top, 10);

	if(gubun =="main")
	{
		yMenuTo     = document.body.scrollTop + layerHeight; // 레이어 Y 좌표
	}
	else
	{
		yMenuTo     = document.body.scrollTop + layerHeight_bn; // 레이어 Y 좌표
	}

	

	timeoutNextCheck = 500;

	if ( yMenuFrom != yMenuTo ) {
		yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );

		if ( yMenuTo < yMenuFrom ) {
			yOffset = -yOffset;
		}
		
		if (gubun =="main")
		{
			if(parseInt(layerHeight) < document.body.scrollTop)
			{
				divMenu.style.top = document.body.scrollTop;
			}
			else
			{
				divMenu.style.top = layerHeight
			}

		}
		else
		{
			if(parseInt(layerHeight_bn) < document.body.scrollTop)
			{
				divMenu.style.top = document.body.scrollTop ;
			}
			else
			{
				divMenu.style.top = layerHeight_bn
			}
		}
		

		timeoutNextCheck = 10;
	}

	setTimeout ("CheckUIElements('"+gubun+"')", timeoutNextCheck);
}

//	내용보기 페이지의 Top 버튼	끝
//	페이지의 오른배너	시작

function CheckUIElements_bn(){
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
	yMenuFrom   = parseInt (divMenu1.style.top, 10);
	yMenuTo     = document.body.scrollTop + layerHeight_bn; // 레이어 Y 좌표

	timeoutNextCheck = 500;

	if ( yMenuFrom != yMenuTo ) {
		yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );

		if ( yMenuTo < yMenuFrom ) {
			yOffset = -yOffset;
		}

		divMenu1.style.top = parseInt (divMenu1.style.top, 10) + yOffset;

		timeoutNextCheck = 10;
	}

	setTimeout ("CheckUIElements_bn()", timeoutNextCheck);
}

function stalkerLayerFromTop(stalkerLayer, stalkerLayerHeight,gubun) {
	if (stalkerLayer == "" || stalkerLayer == null) {
		return false;
	}

	stalkerLayerHeight = stalkerLayerHeight;
	divMenu = stalkerLayer;
	if(gubun =="main")
	{
		divMenu.style.top = document.body.scrollTop + layerHeight;  // IE use layer Y coordinate.
	}
	else
	{
		divMenu.style.top = document.body.scrollTop + layerHeight_bn;  // IE use layer Y coordinate.
	}
	
	divMenu.style.visibility = "visible";
	CheckUIElements(gubun);
	return true;
}

//	End // Top button of view contents page



    
    function checkEnter(evt) 
	{
		var evt  = (evt) ? evt : ((event) ? event : null);
		var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
		if ((evt.keyCode == 13) && (node.type!="textarea")) {event.returnValue = false; return false;}
	}
	
	
    function sendsearch3(filename, codecontroller, stringcontroller)
    {
		var searchcode = document.getElementById(codecontroller).value;
		
		var cname = document.getElementById(stringcontroller);
		
    	var searchstring = cname.value;
    	
		
		
        if ( isEmptyAll(cname.value)  ){
            alert(search_string_check1);
            cname.focus();
            return false;
        }
    	if(cname.value.length < 2)
    	{
    		alert(search_string_check2);
    		cname.focus();
    		return false;
    	}
    	
    	
    	gourl = filename + "?searchCode=" + searchcode + "&searchString=" + escape(searchstring);
    	
    	location.href(gourl);	
    	
    	return false;
    }
    
    function sendsearch5(filename, codecontroller, stringcontroller, sortValue)
    {
		var searchcode = document.getElementById(codecontroller).value;
		
		var cname = document.getElementById(stringcontroller);
		
    	var searchstring = cname.value;
    	
		
		
        if ( isEmptyAll(cname.value)  ){
            alert(search_string_check1);
            cname.focus();
            return false;
        }
    	if(cname.value.length < 2)
    	{
    		alert(search_string_check2);
    		cname.focus();
    		return false;
    	}
    	
    	
    	gourl = filename + "?searchCode=" + searchcode + "&searchString=" + escape(searchstring) + "&ntc_sort="+sortValue;
    	
    	location.href(gourl);	
    	
    	return false;
    }
    
  

    function sendsearch6(filename, codecontroller1, codecontroller2, stringcontroller, sort, server_id)
    {
		var searchcode1 = document.getElementById(codecontroller1).value;
		var searchcode2 = document.getElementById(codecontroller2).value;
		
		var cname = document.getElementById(stringcontroller);
		
    	var searchstring = cname.value;
    	
		
		
        if ( isEmptyAll(cname.value)  ){
            alert(search_string_check1);
            cname.focus();
            return false;
        }
    	if(cname.value.length < 2)
    	{
    		alert(search_string_check2);
    		cname.focus();
    		return false;
    	}
    	
    	
    	gourl = filename + "?searchCode1=" + searchcode1 + "&searchCode2=" + searchcode2 + "&searchString=" + escape(searchstring) + "&p_server_id=" + server_id + "&p_state_sort=" + sort;
    	
    	location.href(gourl);	
    	
    	return false;
    }
/*숫자면 true 아인면 false*/
function isNumber(str){
	count=0;
	if (str.length < 1) 
		return false;
	for (i=0;i<str.length;i++){
		if(str.charAt(i)<'0' || str.charAt(i)>'9') count++;
	}
	if(count!=0)
		return false;
	else 
		return true;
}

function downFile_loc(a_sort) //기본가이드,PDS
    {    

        switch(a_sort) {

        case "gameDown01":      // 게임다운로드 
            alert('     준비중 입니다.              ');
        break;  

        // 그래픽카드 
        case "ATI_win98":       // 그래픽카드 ATI win98
            document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_ati/6-2_wme_dd_cp_30314.exe";
        break;

        case "ATI_win2k":       // 그래픽카드 ATI win2k
            //document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_ati/6-4_xp-2k_dd_ccc_wdm_enu_31959.exe";
            document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_ati/7-11_xp32_dd_ccc_wdm_enu_54435.exe";
        break;

        case "ATI_winvista":       // 그래픽카드 ATI winvista
            document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_ati/7-11_vista64_dd_ccc_wdm_enu_54442.exe";
        break;

        //
        case "NVI_win98":       // 그래픽카드 nvidia win98
            //document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_nvidia/81.98_forceware_win9x_english.exe";
            document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_nvidia/81.98_forceware_win9x_international.exe";
        break;

        case "NVI_win2k":       // 그래픽카드 nvidia win2k       
            //document.location.href=_MFILEWEB_URL + "/_DownUtil/graphic_nvidia/84.21_forceware_winxp2k_international_whql.exe";
            document.location.href=_MFILEWEB_URL + "/_DownUtil/graphic_nvidia/93.71_forceware_winxp2k_international_whql.exe";
        break;

        case "NVI_winxp":       // 그래픽카드 nvidia winxp
            document.location.href= _MFILEWEB_URL + "/_DownUtil/graphic_nvidia/163.75_forceware_winxp_32bit_international_whql.exe";
        break;

        case "NVI_winvista":       // 그래픽카드 nvidia winvista       
            document.location.href=_MFILEWEB_URL + "/_DownUtil/graphic_nvidia/163.75_forceware_winvista_64bit_international_whql.exe";
        break;

        // DIRECTX
        case "directx_win98":       // 다이렉트x win98
            document.location.href= _MFILEWEB_URL + "/_DownUtil/dxwebsetup.exe";
        break;

        case "directx_win2k":       // 다이렉트x win2k       
            document.location.href=_MFILEWEB_URL + "/_DownUtil/dxwebsetup.exe";
        break;

        case "dual_core":       // DUAL CORE Patch DownLoad
            document.location.href=_MFILEWEB_URL + "/_DownUtil/Setup.exe";
        break;

        }

    }
    
    
    //IFRAME 사이즈를  문서의내용에 맞게 자동으로 설정한다. - 최지환.
    var _iframe_autoResize_timer;
    var _iframe_autoResize_count=0;
    function iframe_autoResize()
    {
	    _iframe_autoResize_timer = setInterval("iframe_autoResizeProc()", 100)
    }

    function iframe_autoResizeProc() 
    {
        document.domain = "gamehi.co.kr";
	    var objtb_main;
	    try {
		    var objBody = self.document.body;
		    var i_height = objBody.scrollHeight + (objBody.offsetHeight-objBody.clientHeight);
		    var i_width = objBody.scrollWidth + (objBody.offsetWidth-objBody.clientWidth);

		    //self.resizeTo(objtb_main.clientWidth, objtb_main.clientHeight);
		    var objFrame = self.parent.document.all(self.name);
		    objFrame.style.height = i_height;
		    objFrame.style.width = i_width;
		    clearInterval(_iframe_autoResize_timer);
		    _iframe_autoResize_count = 0;
	    } catch(e) {}
    	
	    _iframe_autoResize_count++;
	    if(_iframe_autoResize_count>600)
	    {
		    clearInterval(_iframe_autoResize_timer);
		    _iframe_autoResize_count = 0;
	    }
    }
    
function pop_charge(ChargeCode)
{
    if(ChargeCode == "" || ChargeCode == null)
        ChargeCode = "PGC01-01001";
    Open_WIndow(_SecureUrl + "/App/pop/pop_cash/pop_cash_agreement_main.aspx?charge_code=" + ChargeCode,"pop_charge",520,500);
}
    
function create_div(target_id){
    if(getObject(target_id) == null){
        var NewDiv = document.createElement("Div");
        NewDiv.id = target_id;
        NewDiv.width = NewDiv.height = 0;
        NewDiv.style.display = 'none';
        document.body.appendChild(NewDiv);
    }
}

var StickerAnimation = function(){};
StickerAnimation.prototype = {
		duration : null
	,	obj : null
	,	from : null
	,	to: null
	,	timer : 0
	,	step : 0
	,	start : function(obj,from,to, duration){
		var self = this;
		this.obj = obj;
		this.from = from;
		this.to = to;
		this.now = new Date;
		this.duration = duration || 1000;
		this._delta = this['_deltaExpo'];
		if(this.timer)
		{
			this.stop();
		}
		
		this.timer = setInterval(function(){self.run();}, 10);
	}
	,run : function()
	{
		var time = ((new Date) - this.now) / this.duration;
		var delta = this._delta(time);
		
		var step = Math.pow(2, this.step);
		var dep_y = (this.to.y - this.from.y) * delta;
		if(time > 1)
		{
			this.stop();
			this.end();
		}
		else
		{
			this.obj.style.top = (this.from.y + dep_y) + "px";
		}
	}
	,end: function()
	{
		this.obj.style.top = (this.to.y) + "px";
	}
	,stop : function()
	{
		clearInterval(this.timer);
		this.timer = 0;
	}
	,_deltaExpo: function(pos)
	{
		var p = 1 - pos;
		return 1 - Math.pow(2, 8 * (p - 1));
	}
}

var _quick_menu = {
		init : false
	,	sticker : null
	,	opts : []
	,	start : function(id, t_page, duration)
	{
		if(!this.init)
		{
			var self = this;
			var init_event = function(){self.oninit();};
			var scroll_event = function(){self.onscroll(t_page);};
			if(window.attachEvent)
			{
				window.attachEvent('onload', init_event);
				window.attachEvent('onscroll', scroll_event);
			}
			else
			{
				window.addEventListener('load', init_event, false);
				document.addEventListener('scroll', scroll_event, false);
			}
			this.init = true;
		}
		this.sticker = document.getElementById(id);
		this.opts.push({duration:duration});
	}
	,oninit : function()
	{
		this.sticker.style.top = "0px";
	}
	,onscroll : function(t_page)
	{
		var top = 0;
		var form;
		var to;
		var ttt = 0;
		if(t_page == "main")
		{
		    ttt = 360;
		}
		else
		{
		    ttt = 320;
		}
		if(typeof(window.pageYOffset) == 'number')
		{
			top = window.pageYOffset;
		}
		else if(document.body && document.body.scrollTop)
		{
			top = document.body.scrollTop;
		}
		else if(document.documentElement && document.documentElement.scrollTop)
		{
			top = document.documentElement.scrollTop;
		}
		
		from = parseInt(this.sticker.style.top);
		if(top > ttt)
		{
			to = top - ttt;
		}
		else
		{
			to = 0;
		}
		
		if(!this.sticker.animation)
		{
			this.sticker.animation = new StickerAnimation();
		}
		else
		{
			this.sticker.animation.stop();
		}
		
		this.sticker.animation.start(
			this.sticker, 
			{y:from},
			{y:to},
			this.opts.duration
		);
	}
}

function getCookie(name)
{
	var flag = document.cookie.indexOf(name+'=');
	if(flag!=-1)
	{
		flag += name.length + 1;
		end = document.cookie.indexOf(';',flag);
	    if(end==-1) end = document.cookie.length;
		return document.cookie.substring(flag,end);
	}
	else
	{
		return "";
	}
}

function setCookie(name,value) {
	var MinMilli = 1000 * 60;
	var HrMilli = MinMilli * 60;
	var DyMilli = HrMilli * 24;

	var todayDate = new Date();
	todayDate.setTime(Math.round(todayDate.getTime()/DyMilli + 1) * DyMilli);// 1day
	document.cookie = name + "=" + escape( value ) + "; expires=" + todayDate.toGMTString() + ";"
}




// Initializes a new instance of the StringBuilder class
// and appends the given value if supplied
function StringBuilder(value)
{
    this.strings = new Array("");
    this.append(value);
}

// Appends the given value to the end of this instance.
StringBuilder.prototype.append = function (value)
{
    if (value)
    {
        this.strings.push(value);
    }
}

// Clears the string buffer
StringBuilder.prototype.clear = function ()
{
    this.strings.length = 1;
}

// Converts this instance to a String.
StringBuilder.prototype.toString = function ()
{
    return this.strings.join("");
}

String.prototype.bytes = function() {
	var str = this;
	var c = 0;
	for (var i = 0; i < str.length; i++) {
		c += (str.charCodeAt(i) > 128) ? 2 : 1;
	}
	return c;
}



//popCouponloginCheck

function popCouponLoginCheck()
{
	if (is_login)
	{
		Open_WIndow(_SecureUrl + '/app/pop/pop_coupon/main.aspx?gamesite=DKR&gameservice=GH', 'coupon_pop', '450', '460');
	}
	else
	{
		if (confirm("로그인이 필요한 서비스입니다.\r\n로그인 하시겠습니까?"))
		{
		    //window.location.href = _SecureUrl + "/App/member/member_login/member_login_form.aspx?ret_url=" + escape(location);
		    __login();
		}
	}
}

function _enable_write()
{
	return true;
}

///// popup open
function Open_WIndowScroll(gourl,windowname,sizewidth,sizeheight, scrollType)
{
	var setWin;
	setWin=winSetting(sizewidth,sizeheight,scrollType);
	window.open(gourl,windowname, setWin);
}


function openFreeGift1(en)
{
	if (is_login)
	{
		Open_WIndow("/App/pop/pop_freeGift/pop_freeGift_single.aspx?eventNo=" + en, "pop_freeGift1", 528, 412);
	}
	else
	{
		if (confirm("로그인이 필요한 서비스입니다.\r\n로그인 하시겠습니까?"))
		{
		    //window.location.href = _SecureUrl + "/App/member/member_login/member_login_form.aspx?ret_url=" + escape(location);
		    __login();
		}
	}
}

function openFreeGift2(en)
{
	Open_WIndow("/App/pop/pop_freeGift/pop_freeGift_whole.aspx?eventNo=" + en, "pop_freeGift2", 528, 694);
}

function __login()
{
    window.location.href = _PORTALWEB_URL + "/App/member/member_login/member_login_form.aspx?ret_url=" + escape(location);
}

// account image
var _ai = {
	ih: 0,
	m: 382,
	init: function(o, e, u) {
		if ($("#prev_account").length == 0) {
			$("body").append("<p id='prev_account' style='position:absolute;top:-500px;left:-500px;'><img src='" + u + "' alt='' onload='_ai.loaded(this)' class='repImg' /></p>");
		}
	},
	move: function(e) {
		var t, l, bh, st;
		st = $(window).scrollTop();
		t = e.clientY - 3 + st;
		l = e.clientX + 12 + $(window).scrollLeft();
		bh = $('body').innerHeight();
		if (t + this.ih - st > bh) t = bh - this.ih + st;
		$("#prev_account").css({ "top": t + "px", "left": l + "px" }).fadeIn("fast");
	},
	loaded: function(o) {
		if (typeof (o) != 'undefined') this.ih = o.height + 2;
	},
	dispose: function() {
		$("#prev_account").remove();
	}
};
