
function pop(url){
    win =  "width=660,height=710,toolbars=0,location=0,directories=0,top=0,left=0,menubar=0,scrollbars=1,resizable=0";
    popWindow=window.open(url,"pop1",win);
}	

function pop_resize(url,iw,ih){
    win =  "width="+iw+",height="+ih+",toolbars=0,location=0,directories=0,top="+(screen.availHeight-ih)/2+",left="+(screen.availWidth-iw)/2+",menubar=0,scrollbars=1,resizable=0";
    window.open(url,"pop2",win);
}	

function pop_noresize(url,iw,ih){
    win =  "width="+iw+",height="+ih+",toolbars=0,location=0,directories=0,top="+(screen.availHeight-ih)/2+",left="+(screen.availWidth-iw)/2+",menubar=0,scrollbars=0,resizable=0";
    popWindow=window.open(url,"pop3",win);
}	

function pop_center(url,iw,ih){
	var resizeHeight

	if(ih>screen.availHeight-100) {
		resizeHeight=screen.availHeight-100
	}
	else {
		resizeHeight=ih
	}

    var x = ( screen.availWidth - iw)/2;
    var y = ( screen.availHeight-100 - resizeHeight)/2;

    win =  "width="+iw+",height="+resizeHeight+",left="+x+",top="+y+",toolbars=0,location=0,directories=0,menubar=0,scrollbars=1,resizable=0";
    popWindow=window.open(url,"pop",win);
}	


// ½ÃÀÛ³¯Â¥¿Í Ãß°¡°³¿ù¼ö·Î ½ÃÀÛ³¯Â¥¸¦ ´õÇÏ¿© ¸®ÅÏÇÑ´Ù.
// ÀÔ·Â¹Þ´Â ³¯Â¥Çü½ÄÀº yyyy-mm-dd ÀÌ°í Ãß°¡°³¿ù¼ö´Â ¼ýÀÚ ÀÌ¾î¾ß ÇÑ´Ù.
function get_agu(ymd, addNum){ 
	var ymd = ymd.split("-"); 
	var oDate;
	var yDate, mDate, dDate
	
	oDate = new Date(); 
	oDate.setFullYear(ymd[0]); 
	oDate.setMonth(parseInt(parseInt(ymd[1])+parseInt(addNum))); 
	oDate.setDate(ymd[2]); 
	
	yDate = new String(oDate.getFullYear())
	mDate = new String(oDate.getMonth())
	dDate = new String(oDate.getDate())
	
	if(mDate.length == 1){
		mDate = "0" + mDate;
	}
	if(dDate.length == 1){
		dDate = "0" + dDate;
	}
    return yDate + '-' + mDate + '-' + dDate;
} 

// ³¯Â¥ ºñ±³ÇÏ¿© ³¡³ª´Â ³¯Â¥º¸´Ù ºü¸¥Áö ´Ê´ÂÁö¸¦ °Ë»çÇÔ.
// ³¯Â¥´Â yyyy-mm-dd Çü½ÄÀ¸·Î ÀÔ·Â
function check_dateCompare(sDate, eDate){
	
	if(eDate==""){
		var now = new Date(); 
		var year = now.getYear(); 
		var month = now.getMonth()+1; 
		var day = now.getDate(); 
		var eDate = year+'-'+month+'-'+day;
	}

	arrSdate=sDate.split("-"); 
	arrEdate=eDate.split("-"); 
	
	strSyear=arrSdate[0];
	strSmonth=arrSdate[1]-1;
	strSday=arrSdate[2];
	
	strEyear=arrEdate[0];
	strEmonth=arrEdate[1]-1;
	strEday=arrEdate[2];
	
	var StartDate = new Date(strSyear, strSmonth, strSday);
	var EndDate = new Date(strEyear, strEmonth, strEday);
	var toDate= new Date();
	
	var intChar=(parseInt(parseInt(EndDate.getTime())-StartDate.getTime()));
	
	return intChar
}


// ³â, ¿ù ¼¿·ºÆ® ¹Ú½º¿¡ ´ëÀÔ
// ÆÄ¶ó¹ÌÅÍ : select name, option ½ÃÀÛ°ª, option Á¾·á°ª, option selected °ª
//      ex : (p_sMonth, 1, 12, 6) - > p_sMonth¶ó´Â ¼¿·ºÆ®¿¡ 1¿ù¿¡¼­ 12¿ù±îÁö option°ªÀ» ÁØ´Ù. ´Ü 6¿ù·Î selected ÇÑ´Ù.
function changeMakeDay(tgt,fr,to,def) {

	var cnt = 0;
	var form = document.frm;

	form.elements[tgt].options.length=0;
	var str='';

	for ( var i=fr; i<=to; i++){     
		newItem=new Option(cnt);
		form.elements[tgt].options[cnt]=newItem;
		form.elements[tgt].options[cnt].text=i;
		form.elements[tgt].options[cnt].value=i;

		if(i==def) {
			form.elements[tgt].options[cnt].selected=true;
		}
		cnt++;
	}  
}

// ÀÏÀÚ ¼¿·ºÆ® ¹Ú½º¿¡ ´ëÀÔ
function changeDay(vName,vYear,vMonth){
	var form = document.frm;

	// ½ÃÀÛ³¯Â¥ ¼³Á¤
	var v_sdate = new Date(eval("form."+vYear+".value"),eval("form."+vMonth+".value"),0);
	var v_slastDay = v_sdate.getDate();
	
	changeMakeDay(vName,1,v_slastDay,1);
} 

function tabChangeMore(obj,num,imgId,total,chkNum) {
	//var link = ['/lib/News/info_List.asp?v_DetailCode=11017','/lib/News/info_List.asp?v_DetailCode=all','/lib/News/premium_List.asp?v_planCode=90001&v_DetailCode=106001','/cust/notice_list.asp'];
	var link = ['/lib/News/info_List.asp?v_DetailCode=all','/lib/News/premium_List.asp?v_planCode=90001&v_DetailCode=106001','/cust/notice_list.asp'];
	var tabmore = document.getElementById("tabmore");
	for (i=1; i<=total; i++)	{
		var imgIds = document.getElementById(imgId+i);
		var imgSrc = imgIds.getAttribute("src");
		if (i==num)	{
			document.getElementById(obj+i).style.display = '';
			imgIds.setAttribute("src",imgSrc.replace("_off","_on"));
			if(chkNum == 1) {
				tabmore.href =link[i-1];
				tabmore.firstChild.style.display = 'block';
			}
			else tabmore.firstChild.style.display = 'none';
		}
		else {	
			document.getElementById(obj+i).style.display = 'none';
			imgIds.setAttribute("src",imgSrc.replace("_on","_off"));
		}
	}
}

var SponsorBanner_mouseEvent = 1;

// SponsorScroll("divÅÂ±× id", ¹è³Ê1°³³ôÀÌ, µô·¹ÀÌ, 1Ä­ÀÌµ¿¼Óµµ, 0);
function SponsorScroll(divName, vHeight, vDelay, vSpeed, vHeight2){

	if(eval(divName + "_mouseEvent")){
		var divTag = document.getElementById(divName);
		var vTag, i;
		vHeight2++;
			if(vHeight2 < vHeight){
				divTag.style.top = -vHeight2;
				setTimeout("SponsorScroll('" + divName + "', " + vHeight + ", " + vDelay + ", " + vSpeed + ", " + vHeight2 + ");", vSpeed);
			}else{
				vTag = divTag.getElementsByTagName("TABLE");
				divTag.appendChild(vTag[0]);
				divTag.style.top = 0;
				setTimeout("SponsorScroll('" + divName + "', " + vHeight + ", " + vDelay + ", " + vSpeed + ", 0);", vDelay);
			}
	}else{
		setTimeout("SponsorScroll('" + divName + "', " + vHeight + ", " + vDelay + ", " + vSpeed + ", " + vHeight2 + ");", vSpeed);
	}

	return true;
}
