//###°øÅë ¼³Á¤
var testCheck = false; //³¯Â¥¿Í »ó°ü¾øÀÌ changui.seoul.go.kr¿¡ ÆË¾÷ ¶ç¿î´Ù.

//####ºÎ¸ðÃ¢ ¼³Á¤
var parent_width = "332"; //¶ç¿ïÆË¾÷Ã¢ ³ÐÀÌ
var parent_height = "249"; //¶ç¿ïÆË¾÷Ã¢ ³ôÀÌ
var parent_startDt = "200804071330"; //ÆË¾÷½ÃÀÛÀÏ
var parent_endDt = "200804110200"; //ÆË¾÷Á¾·áÀÏ

//###ÀÚ½ÄÃ¢ ¼³Á¤
var aaa = location.href.split("/");
//alert(aaa[0]+"//"+aaa[2]);


function getPublicCookie(Name) {
	var search = Name + "="
	if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
		offset = document.cookie.indexOf(search)
		if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
			offset += search.length
			end = document.cookie.indexOf(";", offset)
			if (end == -1)
					end = document.cookie.length
			return unescape(document.cookie.substring(offset, end));
		} else { return ""; }
	} else { return ""; }
}

function isPublicEventPeriod(start,end) {
	var dtNow = new Date();
	var s1 = start.substring(0,4);
	var s2 = start.substring(4,6);
	var s3 = start.substring(6,8);
	var s4 = start.substring(8,10);
	var s5 = start.substring(10,12);
	var i_s1 = parseInt(s1,10);
	var i_s2 = parseInt(s2,10)-1;
	var i_s3 = parseInt(s3,10);
	var i_s4 = parseInt(s4,10);
	var i_s5 = parseInt(s5,10);
	var e1 = end.substring(0,4);
	var e2 = end.substring(4,6);
	var e3 = end.substring(6,8);
	var e4 = end.substring(8,10);
	var e5 = end.substring(10,12);
	var i_e1 = parseInt(e1,10);
	var i_e2 = parseInt(e2,10)-1;
	var i_e3 = parseInt(e3,10);
	var i_e4 = parseInt(e4,10);
	var i_e5 = parseInt(e5,10);
	var dtStart  = new Date(i_s1,i_s2,i_s3,i_s4,i_s5);  // Month : 0~11... !!!!!!!
	var dtEnd  = new Date(i_e1,i_e2,i_e3,i_e4,i_e5);  // Month : 0~11... !!!!!!!

	if ( dtNow < dtStart ){return 1;}
	else if ( dtStart <= dtNow && dtNow <= dtEnd){return 2;}
	else { return 3;}
}

function publicPopupService(){
	window.open("publicPopup.html","publicPopup","resizable=no,width="+parent_width+",height="+parent_height+", left=0, top=0,scrollbars=no");
}

//ÆË¾÷ ·¹ÀÌ¾î ¼³Á¤ ½Ã°£ ÁöÁ¤
var checkPublicTimelayor = isPublicEventPeriod(parent_startDt,parent_endDt);
if(testCheck){
	if ( getPublicCookie( "publicPopup" ) != "1" ) {
		publicPopupService();
	}
}else{
	if (checkPublicTimelayor==2){
		if ( getPublicCookie( "publicPopup" ) != "1" ) {
			publicPopupService();
		}
	}
}
