
CJ_isIE=document.all;
CJ_isNN=!document.all&&document.getElementById;
CJ_isHot=false;
CJDivMove = "";

CJDivPop=CJ_isIE ? document.all.CJPopupLayer : document.getElementById("CJPopupLayer");  

function CJPopMove2(e){
    offsetx=CJ_isIE ? event.clientX : e.clientX;
    offsety=CJ_isIE ? event.clientY : e.clientY;
    nowX=parseInt(CJDivPop.style.left);
    nowY=parseInt(CJDivPop.style.top);
	oldx = CJ_isIE ? event.clientX-nowX : e.clientX-nowX
	oldy = CJ_isIE ? event.clientY-nowY : e.clientY-nowY
    MoveEnabled=true;
    document.onmousemove=CJPopMove;
}

function CJPopMove(e){
  if (!MoveEnabled) return;
  CJDivPop.style.left=CJ_isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  CJDivPop.style.top=CJ_isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function CJPopupLayerCookie(c_name) { // ¿À´Ã ÇÏ·ç ÀÌÃ¢ ¿­Áö  ¾Ê±â
	
	if(CJ_isIE){		
	if(event.clientX-nowX!=oldx||event.clientY-nowY!=oldy)
	return false;
	}
	var today = new Date() ;
	today.setDate(today.getDate() + 1) ;
	today.setHours(0);
	today.setMinutes(0);
	today.setSeconds(0);
	document.cookie = c_name + "=no;expires=" + today.toGMTString() ;
	CJDivPop.style.display="none"
}

function CJPopupLayerDomainCookie(c_name, domain) { // ¿À´Ã ÇÏ·ç ÀÌÃ¢ ¿­Áö  ¾Ê±â
	
	if(CJ_isIE){		
	if(event.clientX-nowX!=oldx||event.clientY-nowY!=oldy)
	return false;
	}
	var today = new Date() ;
	today.setDate(today.getDate() + 1) ;
	today.setHours(0);
	today.setMinutes(0);
	today.setSeconds(0);
	document.cookie = c_name + "=no;expires=" + today.toGMTString() + ((domain) ? "; domain =" + domain : "");
	CJDivPop.style.display="none"
}

function CJPopupLayerSet(str,c_name){ // ·¹ÀÌ¾î ÆË¾÷
	if (document.cookie.indexOf(c_name + "=no")== -1){

	CJDivPop.style.display = "block" ;
	sw=document.body.clientWidth ;
	sh=document.body.clientHeight ;

		if(str=="CJPopupLayer_Set01"||str=="CJPopupLayer_Set02"){
			div_left = (sw-424)/2 ;
			div_top = (sh-504)/2 ;
		} else {
			div_left = (sw-374)/2 ;
			div_top = (sh-484)/2 ;
		}
	CJDivPop.style.left = div_left ;
	CJDivPop.style.top = div_top ;
	}
}

function CJPopupLayerClose(){ // ·¹ÀÌ¾î ´Ý±â
	if(CJ_isIE){		
	if(event.clientX-nowX!=oldx||event.clientY-nowY!=oldy)
	return false;		
	}
	CJDivPop.style.display="none"
}

function CJPopupLayerMove(div_left,div_top){ // ·¹ÀÌ¾î ÀÌµ¿
	CJDivPop.style.left = div_left ;
	CJDivPop.style.top = div_top ;
	CJDivMove = "y";
}

function CJPopMove3(){

	sw=document.body.clientWidth ;
	sh=document.body.clientHeight ;
	str = document.getElementById("CJPopupLayer").getElementsByTagName("div")[0].id

		if(str=="CJPopupLayer_Set01"||str=="CJPopupLayer_Set02"){
			div_left = (sw-424)/2 ;
			div_top = (sh-504)/2 ;
		} else {
			div_left = (sw-374)/2 ;
			div_top = (sh-484)/2 ;
		}
	if(CJDivMove!="y"){
	CJDivPop.style.left = div_left ;
	CJDivPop.style.top = div_top ;
	}
}

CJDivPop.onmousedown=CJPopMove2;
CJDivPop.onmouseup=Function("MoveEnabled=false");
window.onresize=CJPopMove3;

function CJPopLayerADDot(pageID,c_name)
{
	if (document.cookie.indexOf(c_name + "=no")== -1){
		document.write ("<IFRAME WIDTH=0 HEIGHT=0 NORESIZE SCROLLING=No FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 SRC='http://adserver.netmarble.net/RealMedia/ads/adstream_sx.ads/layer.popup.netmarble.net/" + pageID + "@Dot'></iframe>");
	}	
}