/* Navigation */

function initNavigation(seq) {
	var nav = document.getElementById("topmenu_eng");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	
	allA = nav.getElementsByTagName("a");
	for(k = 0; k < allA.length; k++) {

		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			//alert(event.button);
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq]) {
						nav.menu[seq].onmouseover();	
					} else if(nav.current) {			
						if( seq != 0)
						this.current.parentNode.className = this.current.parentNode.className.replace(" over","");						
						if (nav.current.submenu)						
							nav.current.submenu.style.display = "none";
						nav.current = null;					
					}
				}
			}, 500);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {		
				if( seq !=0)
				nav.current.parentNode.className = nav.current.parentNode.className.replace(" over","");			
				if (nav.current.submenu)				
					nav.current.submenu.style.display = "none";
				nav.current = null;
			}
			
			if (nav.current != this) {
				if( seq !=0)
		this.submenu.parentNode.className +=" over";			
				if (this.submenu)		{						
					this.submenu.style.display = "block";
				}
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}






/*ÀüÃ¼ ÆäÀÌÁö blur È¿°ú
function bluring(){
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;*/

//--- ¸ÞÀÏÁÖ¼Ò ------------
function AntiSpam(id) { window.open('/neverspam/antispamin.php?UniqId='+id,'AntiSpam','width=650,height=380,left=1,top=1'); }



/** openwindow **/
function OnPageEdit(openUrl, openName, openWidth, openHeight, openScroll){
		window.open(openUrl, openName, "toolbar=no,menubar=no, width="+openWidth+",height="+openHeight+",left=50,top=50 scrollbars="+openScroll+"");
	}


//Images RollOver JPG
function JpgOn(imgEl){
	imgEl.src = imgEl.src.replace(".jpg", "_on.jpg");
}
function JpgOut(imgEl){
	imgEl.src = imgEl.src.replace("_on.jpg", ".jpg");
}


//Images RollOver gif
function GifOn(imgEl){
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function GifOut(imgEl){
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}


//*SideMenu *// sus_menu_1_1.gif
function sideMenu(menuIdx){
	for(i=1 ; i<=54 ; i++){
		try{
			objLayer = document.getElementById("sub"+i);

			if (i<=9){
				objImg = document.getElementById("sus_menu_"+i);
			}else{
				objImg = document.getElementById("sus_menu"+i);
			}
			if(i == menuIdx){
			 	objImg.src = objImg.src.replace(i+".gif", i+"r.gif");
				objLayer.style.display = "block";
			}else{
				objImg.src = objImg.src.replace(i+"r.gif", i+".gif"); 
				objLayer.style.display = "none"; 
			} 
		}catch(e){ }  
	} 
}


//Quick menu
function getPosition(){
	var start, end, scale, term;
	start = parseInt (document.getElementById('quickservice_layer').style.top, 0);
	end = document.documentElement.scrollTop + 260; //263
	term = 5;

	if ( start != end ) {
	scale = Math.ceil( Math.abs( end - start ) / 20 );
		if ( end < start )	scale = -scale;
		document.getElementById('quickservice_layer').style.top = parseInt (document.getElementById('quickservice_layer').style.top, 0)+ scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveBanner() {
	document.getElementById('quickservice_layer').style.top = document.documentElement.scrollTop + 260 + "px";  //263
	getPosition();
	return true;
};

/*########################################################
@ ³¯Â¥°¡ Á¦´ë·Î ÀÔ·ÂµÇ¾ú´ÂÁö Ã¼Å©ÇÑ´Ù.
@ param fyear,fmonth,fday : ³â,¿ù,ÀÏ
@ return String (½ÇÆÐ(fail)/¼º°ø(alldate:³â¿ùÀÏÀ» ÇÕÄ£°ª))	
#########################################################*/
function dateCheck(fyear,fmonth,fday) {	
	alldate = new Array(3);
	alldate[0] = "fail";
	ftotal_days = 0;
	fdate = fyear+fmonth+fday;
	fdatelen = fdate.length;
	
/*-----------------------------------------------------------
* ¼ýÀÚ°¡ ¾Æ´Ñ ¹®ÀÚ°¡ ÀÖ´ÂÁö Ã¼Å©
*-----------------------------------------------------------*/
	for(i=0; i<fdatelen; i++) {										
		if(fdate.charCodeAt(i) <45 || fdate.charCodeAt(i) >57){					
			return alldate;
		}
	}	

/*-----------------------------------------------------------
* ³âµµ°¡ 4ÀÚ¸®ÀÎÁö Ã¼Å©
*-----------------------------------------------------------*/	
	if(fyear.length != 4) {						
		return alldate;
	}

/*-----------------------------------------------------------
* ´ÞÀÌ 1~12ÀÎÁö Ã¼Å©
*-----------------------------------------------------------*/	
	if(fmonth < 1 || fmonth > 12){		
		return alldate;
	}

/*-----------------------------------------------------------
* ´ÞÀÌ 1ÀÌ¸é 01·Î ¹Ù²Û´Ù.
*-----------------------------------------------------------*/	
	if(fmonth.length == 1) {											
		fmonth = "0"+fmonth;
	}

/*-----------------------------------------------------
* ½ÃÀÛ³âµµÀÇ ¸¶Áö¸·ÀÏÀÚ¸¦ ±¸ÇÑ´Ù.
*-----------------------------------------------------*/
	if(fmonth=="01" || fmonth=="03" || fmonth=="05" || fmonth=="07" || fmonth=="08" || fmonth==10 || fmonth==12) {	
		ftotal_days = 31;
	}else if(fmonth == "02"){
		if(((fyear % 4 == 0) && (fyear % 100 !=0)) || (fyear % 400 == 0)){
			ftotal_days = 29;
		}else{
			ftotal_days = 28;
		}
	}else{
		ftotal_days = 30;
	}

/*-----------------------------------------------------
* ÀÏÀÚ°¡ ¸¶Áö¸· ÀÏÀÚº¸´Ù Å«Áö¸¦ ±¸ÇÑ´Ù.
*-----------------------------------------------------*/
	if(fday < 1 || fday > ftotal_days){
		return alldate;
	}

/*-----------------------------------------------------
* ÀÏÀÚ°¡ 1ÀÌ¸é 01·Î ¹Ù²Û´Ù.
*-----------------------------------------------------*/
	if(fday.length == 1) {
		fday = "0"+ fday;
	}

/*-----------------------------------------------------
* ³â¿ùÀÏÀ» ÇÕÃÄ¼­ ¸®ÅÏÇÑ´Ù.
*-----------------------------------------------------*/
	alldate[0] = fyear;
	alldate[1] = fmonth;
	alldate[2] = fday;
	
	return alldate;
}



/*########################################################
@ ½ÃÀÛ³¯Â¥°¡ ¸¶Áö¸·³¯Â¥ º¸´Ù ÀûÀºÁö Ã¼Å©
@ param str,len : ¹®ÀÚ,Á¦ÇÑÅ©±â
@ return boolean 	
#########################################################*/
function dateRange(fyear,fmonth,fday,eyear,emonth,eday) {
	fdate = fyear + fmonth + fday;
	edate = eyear + emonth + eday;
	if(fdate > edate){
		return false;	
	}else{
		return true;
	}
}



/*########################################################
@ ±ÛÀÚ Å©±â°¡ ¸Â´ÂÁö Ã¼Å©
@ param str,len : ¹®ÀÚ,Á¦ÇÑÅ©±â
@ return boolean 	
#########################################################*/
function lengthCheck(str,len) {	
	num = 0;
	strlen = str.length;
	for(i=0; i<strlen; i++){
		if(str.charCodeAt(i) >=0 && str.charCodeAt(i) <=128){
			num= num+1;
		}else{
			num= num+2;
		}	
	}
	
	if (num > len) {
		return false;
	}else{
		return true;
	}
}


/*########################################################
@ ³¯Â¥¿¡ ¸Â´Â ¿äÀÏÀ» Ãâ·ÂÇÑ´Ù.
@ param year,month,day : ³â,¿ù,ÀÏ
@ return String (½ÇÆÐ(fail)/¼º°ø(¿äÀÏÀÌ¸§)	
#########################################################*/

/*-----------------------------------------------------------
* °ªÀ» ¹Þ¾Æ¼­ ¿äÀÏÀ» °è»êÇÑ µÚ return ÇÏ´Â ÇÔ¼ö
*-----------------------------------------------------------*/	
function find_yoil(year, month, day) {
	var nYear =  parseInt(year); 
	var nMonth = parseInt(month); 
    var nDay =  parseInt(day); 
	var nDayOfWeek = cala_weekday(nMonth, nDay, nYear);
         
    return day_display(nDayOfWeek);
}

/*-----------------------------------------------------------
* ¿äÀÏÀ» °è»êÇÏ´Â ÇÔ¼ö
*-----------------------------------------------------------*/	
function cala_weekday( x_nMonth, x_nDay, x_nYear) { 

        if(x_nMonth >= 3){         
                x_nMonth -= 2; 
        } 
        else { 
                x_nMonth += 10; 
        } 

        if( (x_nMonth == 11) || (x_nMonth == 12) ){ 
                x_nYear--; 
        } 

        var nCentNum = parseInt(x_nYear / 100); 
        var nDYearNum = x_nYear % 100; 

        var g = parseInt(2.6 * x_nMonth - .2); 

        g +=  parseInt(x_nDay + nDYearNum); 
        g += nDYearNum / 4;         
        g = parseInt(g); 
        g += parseInt(nCentNum / 4); 
        g -= parseInt(2 * nCentNum); 
        g %= 7; 
         
        if(x_nYear >= 1700 && x_nYear <= 1751) { 
                g -= 3; 
        } 
        else { 
                if(x_nYear <= 1699) { 
                        g -= 4; 
                } 
        } 
         
        if(g < 0){ 
                g += 7; 
        } 
         
        return g; 
} 

/*-----------------------------------------------------------
* ¿äÀÏ¿¡ ÇØ´çÇÏ´Â stringÀ» °è»êÇÏ´Â ÇÔ¼ö
*-----------------------------------------------------------*/	

function day_display(x_nDayOfWeek) { 
	var day_name;
    if(x_nDayOfWeek == 0) { 
        day_name = "ÀÏ"; 
    } 
    else if(x_nDayOfWeek == 1) { 
        day_name = "¿ù"; 
    } 
    else if(x_nDayOfWeek == 2) { 
		day_name = "È­";
    } 
    else if(x_nDayOfWeek == 3) { 
		day_name = "¼ö";
	} 
    else if(x_nDayOfWeek == 4) { 
		day_name = "¸ñ";
    } 
    else if(x_nDayOfWeek == 5) { 
		day_name = "±Ý";
    } 
    else if(x_nDayOfWeek == 6) { 
		day_name = "Åä";
    } 
	else {
		day_name = "fail";
	}
	
	return day_name;
} 

/*########################################################
@ ÁÖ¹Îµî·Ï¹øÈ£¸¦ Ã¼Å©ÇÑ´Ù.
@ param juminNo : ÁÖ¹Îµî·Ï¹øÈ£
@ return boolean 	
#########################################################*/
function isJuminType(juminNo) {
	
	var birthYear = juminNo.substring(0,2);
	var birthMonth = juminNo.substring(2,4);
	var birthDay = juminNo.substring(4,6);	
	var genderBit = juminNo.substring(6,7);

	// ÁÖ¹Î¹øÈ£ ÀÚ¸®¼ö°¡ 13ÀÚ¸®°¡ ¾Æ´Ï¸é false
	if (juminNo.length != 13) {
		return false;
	}
	
	// ÁÖ¹Î¹øÈ£Áß ¼ýÀÚ°¡ ¾Æ´Ñ°ªÀÌ Æ÷ÇÔµÇ¾îÀÖÀ¸¸é false
	for (i=0; i<juminNo.length; i++){
		numCheck = juminNo.substring(i,i+1);
		if (numCheck < '0' || numCheck > '9'){ 
			return false;
		}
	}
	
	// ÁÖ¹Î¹øÈ£ (6)¹øÂ° ÀÚ¸®¼ö°¡ "1" ¶Ç´Â "2"ÀÌ¸é 1900³â´ë»ýÀÌ°í, "3" ¶Ç´Â "4"ÀÌ¸é 2000³â´ë»ýÀÌ´Ù.
	if (genderBit == '1' || genderBit == '2') {
		birthYear = "19" + birthYear
	} else if (birthYear == '3' || birthYear == '4') {
		birthYear = "20" + birthYear
	} else {
		return false;
	}
	
	// »ý³â¿¡ µû¸¥ ¿ù°ú ÀÏÀÌ ¹üÀ§¾È¿¡ ÀÖ´Â°¡ Ã¼Å©ÇÑ´Ù.(À±³â È®ÀÎ)
	var days;
	if (birthMonth==1 || birthMonth==3 || birthMonth==5 || birthMonth==7 || birthMonth==8 || birthMonth==10 || birthMonth==12)  days=31;
	else if (birthMonth==4 || birthMonth==6 || birthMonth==9 || birthMonth==11) days=30;
	else if (birthMonth==2)  {
		if (((birthYear % 4)==0) && ((birthYear % 100)!=0) || (birthYear==0)) days=29;
	  	else days=28;
	}
	
	if (birthDay > days) {
		return false;
	}
   
	// check digit bit	
	var checkBit = 0;
	var checkDigit = juminNo.substring(12,13);
	
	checkBit = checkBit + juminNo.substring(0,1) * 2;
	checkBit = checkBit + juminNo.substring(1,2) * 3
	checkBit = checkBit + juminNo.substring(2,3) * 4;
	checkBit = checkBit + juminNo.substring(3,4) * 5;
	checkBit = checkBit + juminNo.substring(4,5) * 6;
	checkBit = checkBit + juminNo.substring(5,6) * 7;
	
	checkBit = checkBit + juminNo.substring(6,7) * 8;
	checkBit = checkBit + juminNo.substring(7,8) * 9;
	checkBit = checkBit + juminNo.substring(8,9) * 2;
	checkBit = checkBit + juminNo.substring(9,10) * 3;
	checkBit = checkBit + juminNo.substring(10,11) * 4;
	checkBit = checkBit + juminNo.substring(11,12) * 5;
		
	checkBit = (11 - (checkBit % 11)) % 10;
	if (checkBit != checkDigit) {
		return false;	
	}
        
	return true;
}

/*########################################################
@ ¼ýÀÚ¿¡ comma¸¦ Âï´Â´Ù.
@ param value : ¼ýÀÚ¸¦ ¹Þ¾Æ¿Â´Ù.
@ return String (½ÇÆÐ(fail)/¼º°ø(comma°¡ ÂïÈù ¿äÀÏ)	
#########################################################*/
function wonCheck(str){
	returnVal = "false";	
   	strlen = str.length;

//	¼ýÀÚ¿Í comma°¡ ¾Æ´ÑÁö Ã¼Å©
	for(i=0; i<strlen; i++) {															
		if(str.charCodeAt(i)!=44 && (str.charCodeAt(i) <48 || str.charCodeAt(i) >57)){	
			return returnVal;
		}
	}

//	comma°¡ ÀÖÀ¸¸é comma¸¦ ¾ø¾Ø´Ù.
  	str_01 = "";
  	str_02 = str.split(",");
	for(k=0;k<str_02.length;k++) {
		str_01 = str_01+str_02[k];		
  	}

//	°ªÀÇ Å©±â°¡ 10ÀÚ¸® º¸´Ù Å©¸é
	if(str_01.length >10) {					
		return returnVal;
	}

// ÀÚ¸®¼ö¿¡ ¸Â°Ô comma¸¦ ³Ö´Â´Ù.
	comma_01="";
	comma_02="";
	comma_03="";
	str_01Len = str_01.length;
	strVal_01 = str_01.substring(str_01Len - 3,str_01Len);
	strVal_02 = str_01.substring(str_01Len - 6,str_01Len-3);
	strVal_03 = str_01.substring(str_01Len - 9,str_01Len-6);
	strVal_04 = str_01.substring(0,str_01Len-9);
	if(str_01Len >3) comma_01 = ",";
	if(str_01Len >6) comma_02 = ",";
	if(str_01Len >9) comma_03 = ",";
	strVal =strVal_04 + comma_03 + strVal_03 + comma_02 + strVal_02 +comma_01 + strVal_01 ;
	
	return strVal;
}
/*########################################################
@ ¼ýÀÚ¿¡ comma¸¦ »©°í ¾ÕµÚ °ªÀ» ºñ±³ÇÑ´Ù.
@ param value : ¼ýÀÚ¸¦ ¹Þ¾Æ¿Â´Ù.
@ return String (½ÇÆÐ(fail)/¼º°ø(comma°¡ ÂïÈù ¿äÀÏ)	
#########################################################*/
function wonCompare(str1, str2){
	returnVal = "false";	
   	
//	comma°¡ ÀÖÀ¸¸é comma¸¦ ¾ø¾Ø´Ù.
  	str1_01 = "";
  	str1_02 = str1.split(",");
	for(k=0;k<str1_02.length;k++) {
		str1_01 = str1_01+str1_02[k];
  	}
//	comma°¡ ÀÖÀ¸¸é comma¸¦ ¾ø¾Ø´Ù.
  	str2_01 = "";
  	str2_02 = str2.split(",");
	for(k=0;k<str2_02.length;k++) {
		str2_01 = str2_01 + str2_02[k];
  	}

//comma¸¦ »« °ªÀ» ¼­·Î ºñ±³ ÇÑ´Ù.
	if (eval(str1_01) > eval(str2_01)) {
		return returnVal;
	}

	return true;
}
/*########################################################
@ comma¸¦ »« ±ÛÀÚ Å©±â°¡ ¸Â´ÂÁö Ã¼Å©
@ param str,len : ¹®ÀÚ,Á¦ÇÑÅ©±â
@ return boolean 	
#########################################################*/
function comlengthCheck(str,len) {	
	num = 0;


//	comma°¡ ÀÖÀ¸¸é comma¸¦ ¾ø¾Ø´Ù.
  	str_01 = "";
  	str_02 = str.split(",");
	for(k=0;k<str_02.length;k++) {
		str_01 = str_01+str_02[k];
  	}
	strlen = str_01.length;
	
	for(i=0; i<strlen; i++){
		if(str.charCodeAt(i) >=0 && str.charCodeAt(i) <=128){
			num= num+1;
		}else{
			num= num+2;
		}	
	}
	
	if (num > len) {
		return false;
	}else{
		return true;
	}
}

//¸ÞÀÏ Çü½ÄÃ¼Å©(¸ÂÀ¸¸é true Æ²¸®¸é false)
function isMailType(name,message){
	var standard="0123456789abcdefghijklmnopqrstuvwxyz_-.@";
	if(name.value.indexOf("@")==-1||name.value.indexOf(".")==-1){
		alert(message);
		name.focus();
		return false;
	}else{
		for (i=0;i<name.value.length;i++ ){
			if(standard.indexOf(name.value.charAt(i))==-1){
				alert(message);
				name.focus();
				return false;
				break;
			}
		}
	}
	return true;
}

//°ø¶õÁ¦°Å
function trim(strValue){
	var rValue="";
	for(i=0;i<strValue.length;i++){
		if(strValue.charAt(i)==" "){
			rValue=rValue+"";
		}else{
			rValue=rValue+strValue.charAt(i);
		}
	}
	return rValue;
}
//³ÎÃ¼Å©(³ÎÀÌ¸é true, ³ÎÀÌ¾Æ´Ï¸é false)
function isNull(name,message){
	if(!trim(name.value)){
		alert(message);
		name.value="";
		name.focus();
		return true;
	}
}
// Initialize arrays. 
var months = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); 
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); 
var days = new Array("ÀÏ", "¿ù", "È­", "¼ö", "¸ñ", "±Ý", "Åä"); 
var targetField;

var X;
var Y;

function showCalendar(target)
{
	X = (event.clientX + document.body.scrollLeft) - 100;
    Y = (event.clientY + document.body.scrollTop)+10; 
	document.all['cal'].style.display='block';
	document.all['cal'].style.left=X; //left;
	document.all['cal'].style.top=Y; //top;

	targetField = target;

	document.onmousedown = hideCal;
}

function hideCal()
{
	currentX = (event.clientX + document.body.scrollLeft);
	currentY = (event.clientY + document.body.scrollTop);

	if (currentX < X || currentX > (X+150) || currentY < Y || currentY > (Y+190))
	{
		document.all['cal'].style.display='none';
	}

}

function getDays(month, year) 
{ 
	// Test for leap year when February is selected. 
	if (1 == month) 
	return ((0 == year % 4) && (0 != (year % 100))) || 
	(0 == year % 400) ? 29 : 28; 
	else 
	return daysInMonth[month]; 
} 

function getToday() 
{
	// Generate today's date. 
	this.now = new Date(); 
	this.year= this.now.getYear(); 
	this.year = this.year % 100; 
	/* -------------------------------------------------------------*/ 
	// Y2K incompatibility.. added 1900 if last 2 digits of year 
	// were >= 50, added 2000 if < 50. 

	this.year = ((this.year < 50) ? (2000 + this.year) : (1900 + this.year)); 
	/* -------------------------------------------------------------*/ 
	if (((this.year % 4 == 0) && !(this.year % 100 == 0))||(this.year % 400 ==0)) 
	daysInMonth[1]++; 

	this.month = this.now.getMonth(); 
	this.day = this.now.getDate(); 
} 

	// Start with a calendar for today. 
	today = new getToday(); 

function newCalendar() 
{
	today = new getToday();
	var parseYear = parseInt(document.all.year.value);
	var newCal = new Date(parseYear, document.all.month.selectedIndex, 1);
	var day = -1;
	var startDay = newCal.getDay();
	var daily = 0;

	if ((today.year == newCal.getYear()) && (today.month == newCal.getMonth()))
		day = today.day;
	// Cache the calendar table's tBody section, dayList. 
	var tableCal = document.all.calendar.tBodies.dayList;
	var intDaysInMonth = getDays(newCal.getMonth(), newCal.getYear());
	for (var intWeek = 0; intWeek < tableCal.rows.length; intWeek++)
		for (var intDay = 0; intDay < tableCal.rows[intWeek].cells.length; intDay++)
		{
			var cell = tableCal.rows[intWeek].cells[intDay];
			// Start counting days.
			if ((intDay == startDay) && (0 == daily))
				daily = 1;
			// Highlight the current day.
			cell.className = (day == daily) ? "today" : "";
			// Output the day number into the cell. 
			if ((daily > 0) && (daily <= intDaysInMonth)) 
				cell.innerText = daily++; 
			else 
				cell.innerText = ""; 
		} 
} 

function getDate() 
{ 
	if ("TD" == event.srcElement.tagName) 
	// Test whether day is valid. 
	if ("" != event.srcElement.innerText) { 
		sYear=year.value; 
		sMonth=month.options(month.selectedIndex).text; 
		(sMonth < 10)?(sMonth="0"+sMonth.toString()):(sMonth=sMonth.toString()); 
		sDay=event.srcElement.innerText; 
		(sDay < 10)?(sDay="0"+sDay.toString()):(sDay=sDay.toString()); 

		var click_date = sYear.toString()+sMonth.toString()+sDay.toString(); 
		var targetFormField = eval(targetField);

		targetFormField.value = click_date.substring(0,4)+"-"+click_date.substring(4,6)+"-"+click_date.substring(6);

		document.all['cal'].style.display='none';
	} 
}







