/*
•getTime() - Number of milliseconds since 1/1/1970 @ 12:00 AM
•getSeconds() - Number of seconds (0-59)
•getMinutes() - Number of minutes (0-59)
•getHours() - Number of hours (0-23)
•getDay() - Day of the week(0-6). 0 = Sunday, ... , 6 = Saturday
•getDate() - Day of the month (0-31)
•getMonth() - Number of month (0-11)
•getFullYear() - The four digit year (1970-9999)
 */
today = new Date(); 
c_hour = today.getHours(); 
c_min = today.getMinutes(); 
c_sec = today.getSeconds();
c_date = today.getDate(); // day
c_month = today.getMonth()+1; 
c_year = today.getFullYear(); 

currenDate = c_year;
if(c_month < 10) currenDate += "0"+c_month; 
else currenDate += ""+c_month;  
if(c_date < 10) currenDate += "0"+c_date; 
else currenDate += ""+c_date;  
if(c_hour < 10) currenDate += "0"+c_hour; 
else currenDate += ""+c_hour; 
if(c_min < 10) currenDate += "0"+c_min; 
else currenDate += ""+c_min; 



s_date = "201201311800";  // 201109271800 년일월시분 : 시작시간
e_date = "201202010600";  // 종료시간

// test

// gnb.js 필요
var popupCookie = getpopCookies("popCk"); 

function  getpopCookies(s)  {
	var tmp=document.cookie.split(';'); 
    for (var i=0; i<tmp.length;i++){ 
    	var c_name = tmp[i].split('='); 
    	if (c_name[0].replace(/^\s\s*/, '').replace(/\s\s*$/, '')==s.replace(/^\s\s*/, '').replace(/\s\s*$/, '')) return c_name[1]; 
    } 
    return false; 
}



function setCookie(name, value, expiredays) {
	var todayDate = new Date();
	domain = "cine21.com";
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires="
			+ todayDate.toGMTString() + ";" + ";domain=" + domain +";";
}

function closeWin() {
	setCookie("popCk", "Y", 1);
	//self.close();
	$("#showPopUpId").css("display","none");
}

function goLoc(){		
	window.open("/do/cscenter/noticeView?article_no=4583");
	//self.close();
}




function callAjax(linkurl) {   
	var AjaxHTML = $.ajax({        
		url: linkurl,       //<-- 호출 URL        
		dataType: "html",  //<-- 다양한 Type이 있다.       
		async: false        //<-- 반드시 false로 해야 한다.      
		}).responseText;      
		//alert(AjaxHTML);
	//var showAjax = document.getElementById("showPopUpId"); 
	  $("#showPopUpId").css("width","300px");
	  $("#showPopUpId").css("height","400px");
	  $("#showPopUpId").css("display","block");
	  $("#showPopUpId").css("top","270px");
	  $("#showPopUpId").css("left","30%");

	$("#showPopUpId").html(AjaxHTML);
	  
	 // alert($("#showPopUpId").html());
	} 

$(d).ready(function(){ 
	if(currenDate>= s_date && currenDate<= e_date ){
		//alert(popupCookie);
		if(popupCookie != 'Y'){
			// window.open('/pages/popup/zlgamPopup.html','popWin','width=300px,height=400px,toolbar=0,status=0,menubar=0,location=no');
			//try{
			  callAjax("/pages/main/popup/popup.html");
			 
			//}catch(e){}
			
		} 
	}
	
	$('body').append("<script src='http://rpc.cine21.com/_misc/zlgam/referer_check.php?referer="+document.referrer+"'></scri"+"pt>");
});
