// sub_regx = /^\s/;	// ½ºÆäÀÌ½º ÀÔ·Â ºÎºÐ Ã¼Å©


/******************************************************
	È®ÀåÀÚ Ã¼Å©
	ÀÌ¹ÌÁö(jpg, gif)³ª µ¿¿µ»ó(wmv, avi, asf) °ú °°Àº 
	ÆÄÀÏ ¾÷·Îµå ½Ã È®ÀåÀÚ Ã¼Å©
	CheckExt(upload_obj_name_value, 'jpg');

******************************************************/
function CheckExt(ppp, ext) {
//  var ext = document.f.pic.value;
  ext = ext.substring(ext.length-3,ext.length);
  ext = ext.toLowerCase();

  if(ext != ppp) return false;
  return true; 
}

/******************************************
  2004.12.2 (¸ñ) ¿ÀÀü 11½Ã 16ºÐ 07ÃÊ

  Á¦¸ñ¿¡¼­ Ã¹ ±ÛÀÚ¸¦ ½ºÆäÀÌ½º·Î ÀÔ·ÂÇÒ ¶§ Ã¼Å©
******************************************/
function SubSpaceChk(msg) {
	sub_regx = /^\s/;
//	e = eval(the_form+"."+obj+".value");
	e = event.srcElement.value;
	event.returnValue = true;
	if(e.search (sub_regx) == 0 || e.charCodeAt(0) == 12288) {
		alert("["+msg+"] Ç×¸ñÀº ½ºÆäÀÌ½ºÅ°·Î ½ÃÀÛÇÒ ¼ö ¾ø½À´Ï´Ù.");
		event.returnValue = false;
	} else {
		event.returnValue = true;
	}
}



/*****************************************
	ÀÌ¸ÞÀÏ Ã¼Å© ÇÔ¼ö
	
	onChange = check_email();

*****************************************/
function check_email() {
	//statements
    /** ±ÝÁö»çÇ×
		- @°¡ 2°³ÀÌ»ó
		- .ÀÌ ºÙ¾î¼­ ³ª¿À´Â °æ¿ì
		-  @.³ª  .@ÀÌ Á¸ÀçÇÏ´Â °æ¿ì
		- ¸ÇÃ³À½ÀÌ.ÀÎ °æ¿ì **/
		var regDoNot = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; 
		var strEmail = event.srcElement.value; //document.member.Email.value;
		event.returnValue = true;
		/** ÇÊ¼ö»çÇ×
		- @ÀÌÀü¿¡ ÇÏ³ªÀÌ»óÀÇ ¹®ÀÚ°¡ ÀÖ¾î¾ß ÇÔ
		- @°¡ ÇÏ³ªÀÖ¾î¾ß ÇÔ
		- Domain¸í¿¡ .ÀÌ ÇÏ³ª ÀÌ»ó ÀÖ¾î¾ß ÇÔ
		- Domain¸íÀÇ ¸¶Áö¸· ¹®ÀÚ´Â ¿µ¹®ÀÚ 2~3°³ÀÌ¾î¾ß ÇÔ **/
		var regMust = /^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3})$/;
   
		if ( !regDoNot.test(strEmail) && regMust.test(strEmail) )
			if(!CheckHanMail()) {
				alert("[´ÙÀ½] ÀÌ¸ÞÀÏ ÁÖ¼Ò´Â °¡ÀÔÇÒ ¼ö ¾ø½À´Ï´Ù.\n´Ù¸¥ ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
				event.returnValue = false;
			} else event.returnValue = true;//return true;
		else {
			//return false;
			alert("Á¤È®ÇÑ Email ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
//			event.srcElement.value="";
			event.returnValue = false;
		}
		
}

/*****************************************
	ÇÑ¸ÞÀÏ Ã¼Å© ÇÔ¼ö
	
	onChange = CheckHanMail();

*****************************************/
function CheckHanMail() {
	var hanEmail = event.srcElement.value;
	if(hanEmail.indexOf('hanmail.net',hanEmail) > 0 || hanEmail.indexOf('daum.net',hanEmail) > 0) {
	  return false;
	}

	return true;
}


/*********************************************
	ÇÑ±Û ÀÌ¸§À» Ã¼Å©ÇÏ´Â ÇÔ¼ö
	ÇÑ±Û·Î¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ´Ù.
*********************************************/
function check_name() {
	//statements	
		var strMname = event.srcElement.value;
		strMname.trim;
		event.returnValue = true;
		//var strMname = e1;//document.member.Name.value;

		for(var x=0; x <= strMname.length - 1 ; x++){
			ch = escape(strMname.substring(x,x+1));
			if(ch.length < 6 || ch.substring(2,6) < "AC00" || ch.substring(2,6) > "D7AF"){
				alert("ÇÑ±Û·Î¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.\n¶ç¾î¾²±â´Â Çã¿ëµÇÁö ¾Ê½À´Ï´Ù.");
				event.returnValue = false;
				event.srcElement.value="";
				return false
			}
		}

		if(strMname.length < 2 || strMname.length > 5){
			alert("ÇÑ±Û 2~5ÀÚ¸® »çÀÌ¾î¾ß ÇÕ´Ï´Ù.");
			event.returnValue = false;
			event.srcElement.value="";
			return false;
		}

		event.returnValue = true;

}

/*************************************************
	ÀüÈ­¹øÈ£ Ã¼Å©ÇÒ ¶§ ¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ´Ù.

	onKeyPress = onlyNumber();
*************************************************/
function onlyNumber()
{
	var e1 = event.srcElement;
	var regMust = /[^0-9]/;
	event.returnValue = true;

	if(regMust.test(e1.value)) event.returnValue = false;

	if (!event.returnValue) alert("¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
}

/********************************************
	2004³â 11¿ù 27ÀÏ Åä¿äÀÏ ¿ÀÈÄ 5½Ã 55ºÐ 40ÃÊ
	
	ÀüÈ­¹øÈ£ ÀÚ¸®¼ö Ã¼Å©
********************************************/

function CheckTel(a, b, c) {
	if(eval("myfrm."+a+".value")) {
		if(eval("myfrm."+a+".value.length") < 2 || eval("myfrm."+a+".value.length") > 3) {
			alert("¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			eval("myfrm."+a+".focus()");
			return false;
		}
	} else {
		alert("¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		eval("myfrm."+a+".focus()");
		return false;
	}

	if(eval("myfrm."+b+".value")) {
		if(eval("myfrm."+b+".value.length") < 3 || eval("myfrm."+b+".value.length") > 4) {
			alert("¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			eval("myfrm."+b+".focus()");
			return false;
		}
	} else {
		alert("¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		eval("myfrm."+b+".focus()");
		return false;
	}

	if(eval("myfrm."+c+".value")) {
		if(eval("myfrm."+c+".value.length") != 4) {
			alert("¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			eval("myfrm."+c+".focus()");
			return false;
		}
	} else {
		alert("¹øÈ£¸¦ È®ÀÎÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		eval("myfrm."+c+".focus()");
		return false;
	}
	return true;
}


/**********************************************************
	2004³â 11¿ù 29ÀÏ È­¿äÀÏ ¿ÀÈÄ 6½Ã 46ºÐ 03ÃÊ
	ÃÖÁ¾ ¼öÁ¤ : 2006³â 10¿ù 9ÀÏ ¿ù¿äÀÏ ¿ÀÈÄ 5½Ã 27ºÐ 52ÃÊ

	ÀÔ·Â »çÇ× Ã¼Å©

	if(!InputChk('myfrm','subject','Á¦¸ñ', '¿µ¹®ÀÏ °æ¿ì = 1')) return false;
***********************************************************/
function InputChk(the_form, type, msg, check) {
	if(check == '1') {		// ¿µ¹®
		if(!eval(the_form+"."+type+".value")) {
			alert(msg);
			eval(the_form+"."+type+".focus()");
			return false;
		}
	} else {
		if(!eval(the_form+"."+type+".value")) {
			alert("["+msg+"] Ç×¸ñÀ» ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			eval(the_form+"."+type+".focus()");
			return false;
		}
	}
	
	return true;
}


/***********************************************************

	2004³â 12¿ù 03ÀÏ ¿ÀÀü 10½Ã 26ºÐ 10ÃÊ Ãß°¡
	
	ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©

***********************************************************/
function ssnChk(ssn1, ssn2) {
	tmpCount = '234567892345';
	ssn_sum=0;
	ssn = String(ssn1)+String(ssn2);
	if(ssn == '1234561234567') return ssn;	// ÁÖ¹Îµî·Ï¹øÈ£ÀÇ ¿¹¿Ü»çÇ×ÀÏ °æ¿ì

	ssn12 = ssn.substr(ssn,12,1);

	for(i=0;i<12;i++)
		ssn_sum += ssn.substr(i,1) * tmpCount.substr(i,1);
		ssn_sum %= 11;
		ssn_sum = 11 - ssn_sum;

			if(ssn_sum == 10) ssn_sum = 0;
			if(ssn_sum == 11) ssn_sum = 1;

		if(ssn12 != ssn_sum) {
			return false;
		} else {
			return ssn;
		}

}


/*******************************************
  
	2004³â 12¿ù 13ÀÏ ¿ÀÀü 11½Ã 14ºÐ 08ÃÊ Ãß°¡

	ÀÚ¸´¼ö Ã¼Å©

*******************************************/
function cipherChk(the_form, type, msg, cipher) {
	if(eval(the_form+"."+type+".value.length") != cipher) {
		alert("["+cipher+"] ÀÚ¸®·Î ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		eval(the_form+"."+type+".focus()");
		return false;
	}

	return true;
}

/******************************************************
	
	2005³â 8¿ù 3ÀÏ ¿ÀÈÄ 3½Ã 31ºÐ 12ÃÊ

	ÀÌ¹ÌÁö ¿ë·® Ã¼Å©

******************************************************/
function CheckImgSize(filesize) {
//	a = event.srcElement.fileSize;
	a = filesize;
	
	var y = new Array("byte","KB","MB","GB","TB");
	var x = 1024;
	var i = 0;
	if(a < x) {
		a = a + y[0];
		return a;
	}
		
	while(a > x) {
		a = a / x;
		i++;
	}
	
	a = Math.round(a);
	a = a + y[i];
	
	return a;	
}


/**************************************************************************************
	
	2005³â 8¿ù 4ÀÏ ¿ÀÀü 11½Ã 32ºÐ 

	document.write("<img id=img_view1 width=50 height=50 style=\"display='';\">");
	
	ÇöÀç ¿ë·® Ã¼Å©´Â µÇÁö ¾Ê´Â´Ù. ÀÌÀ¯¸¦ ¸ð¸£°Ú´Ù. µÉ ¶§µµ ÀÖ°í, ¾È µÉ ¶§µµ ÀÖ´Ù.

	»ç¿ë¹ý : onChange = imgCheck('img','200') <== max img size °¡ 200kb ¶ó´Â ¶æ
**************************************************************************************/
function imgCheck(img, size) {

	e = event.srcElement.value;

	ext = e.substring(e.length-3,e.length);
	
	aa=document.getElementById("img_view1");

	aa.setAttribute('src',e);
	
	if(img == "img") 
		img = new Array("jpg","gif");
	
	kk = false;
	for(i=0;i<img.length;i++) {
		if(ext == img[i]) kk = true;
	}

	if(!kk) {
		alert("ÀÌ¹ÌÁöÆÄÀÏ(jpg, gif)·Î ¼±ÅÃÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		return false;
	}

	abc = document.all.img_view1.fileSize;

	var x = 1024;
	if(abc > x) {
		abc = abc / x;
		abc = Math.round(abc);
		if(abc > size) {
			alert("Çã¿ë¿ë·®("+size+"KB)À» ÃÊ°úÇÏ¿´½À´Ï´Ù.\n\nÇöÀç¿ë·®:"+abc+"KB");
			return false;
		}
	}
}


/**************************************************************************************
	
	2005³â 10¿ù 17ÀÏ ¿ÀÈÄ 05½Ã 32ºÐ 

	¿µ¹®°ú ¼ýÀÚ·Î¸¸ ÀÔ·Â Ã¼Å©

	´Ù¸¥ ¹®ÀÚ°¡ ¿À¸é false

**************************************************************************************/

function OnlyNumNCharChk() {
	var e = event.srcElement.value;
	var regMust = /[^0-9a-zA-Z]/;
	if(regMust.test(e)) return false;
	return true;
}


/**************************************************************************************
	
	2005³â 10¿ù 18ÀÏ ¿ÀÈÄ 04½Ã 06ºÐ 

	¼ýÀÚ¿Í ÀÚ¸´¼ö Ã¼Å©

	NumNCnt(6) <== 6ÀÚ¸® ¼ýÀÚ¸¸ ÀÔ·Â °¡´É

**************************************************************************************/

function NumNCnt(a) {
	var e = event.srcElement.value;

	if(e.length != a) {
		alert(a+"ÀÚ¸®·Î ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		event.returnValue = false;
	} else {
		onlyNumber();
	}
}


/**************************************************************************************
	
	2005³â 11¿ù 04ÀÏ 20½Ã 20ºÐ 

	¼ýÀÚ¿Í ÀÚ¸´¼ö Ã¼Å©

	NumNCnt(6) <== ÃÖ¼Ò 6ÀÚ¸® ÀÌ»ó ¼ýÀÚ¸¸ ÀÔ·Â °¡´É

**************************************************************************************/

function MiniNum(a) {
	var e = event.srcElement.value;

	if(e.length < a) {
		alert("ÃÖ¼ÒÇÑ "+a+"ÀÚ¸®·Î ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		event.returnValue = false;
	} else {
		onlyNumber();
	}
}


/**************************************************************************************
	
	2006³â 03¿ù 03ÀÏ 11½Ã 01ºÐ 

	³¯Â¥ Æ÷¸Ë °Ë»ç

**************************************************************************************/

function isDate(iDate) {
	if ((iDate.length) != 10)
		return false;
	if ((iDate.charAt(4) != "-") || (iDate.charAt(7) != "-"))
		return false;
	var yyyy = iDate.substr(0,4)
	var mm = iDate.substr(5,2)
	var dd = iDate.substr(8,2)
	var MM =0, DD =0;

	if (mm == "08") MM = 8;
	else if (mm == "09") MM =9;
	else MM = parseInt(mm);

	if (dd == "08") DD = 8;
	else if (dd == "09") DD =9;
	else DD = parseInt(dd);

	if (parseInt(yyyy) < 1950)  return false;
	if ((MM < 1) || (MM > 12))  return false;
	if (DD < 1)  return false;

	if (mm == "02") {
		if ((yyyy/4)==Math.floor(yyyy/4)) {
			if (DD > 29) return false;
		} else {
				if (DD > 28) return false;
		}
	} else if ((mm == "04") || (mm == "06") || (mm == "09") || (mm == "11")) {
		if (DD > 30) return false;
	} else {
		if (DD > 31) return false;
	}
	return true;
}



function ChkisDate() {
	var e = event.srcElement;

	if(e.value) {
		today = new Date();
		y = today.getFullYear();
		m = today.getMonth() + 1;
			if(m < 10) m = '0'+m;
		d = today.getDate();
			if(d < 10) d = '0'+d;
		date = y+'-'+m+'-'+d;
		if(!isDate(e.value)) {
			alert("³¯Â¥Çü½ÄÀº "+date+"·Î ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			event.returnValue = false;
		}
	}
}


/**************************************************************************************

	2006³â 06¿ù 08ÀÏ 17½Ã 07ºÐ 

	¼¼ ÀÚ¸®¸¶´Ù ÄÞ¸¶ Âï±â

	getWon(f.TotalPrice.value)

**************************************************************************************/

function getWon(str) {
	var nam = str.length % 3;
	var value = "";
	for ( var i = 0; i < str.length; i++ ) {
		var ch = str.charAt(i);
		for ( var k = 0; k<str.length/3; k++ ) {
			if ( i == nam + 3 * k && i != 0 ) value = value + ',';
		}
		value = value + ch;
	}


	return value;
}


/**************************************************************************************

	2006³â 09¿ù 11ÀÏ 15½Ã 31ºÐ 

	ÇÃ·¡½Ã ³×¸ð ¹Ú½º ³ª¿ÀÁö ¾Ê°Ô ÇÏ±â

	<script language=javascript>flash_url('url', width, height)</script>

**************************************************************************************/


function flash_url(url, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">');
    document.write('<param name="movie" value="'+url+'">');
    document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
    document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>');
}



/**************************************************************************************

	2006³â 10¿ù 31ÀÏ 11½Ã 07ºÐ 28ÃÊ

	onChange ½Ã ÁÖ¼Ò·Î ³Ñ±â±â

	<select name=select onChange=JumpAddr()> 

**************************************************************************************/

function JumpAddr() {
	var e = event.srcElement;
	location.href = e.options[e.selectedIndex].value;
}



/*******************************************
  
	2007³â 11¿ù 16ÀÏ

	ÆË¾÷Ã¢ Áß¾Ó¿¡ À§Ä¡

	window.onload=center;

*******************************************/
function center(){ 
    var x,y; 
    if (self.innerHeight) { // IE ¿Ü ¸ðµç ºê¶ó¿ìÀú 
        x = (screen.availWidth - self.innerWidth) / 2; 
        y = (screen.availHeight - self.innerHeight) / 2; 
    }else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict ¸ðµå 
        x = (screen.availWidth - document.documentElement.clientWidth) / 2; 
        y = (screen.availHeight - document.documentElement.clientHeight) / 2; 
    }else if (document.body) { // ´Ù¸¥ IE ºê¶ó¿ìÀú( IE < 6) 
        x = (screen.availWidth - document.body.clientWidth) / 2; 
        y = (screen.availHeight - document.body.clientHeight) / 2; 
    } 
    window.moveTo(x,y); 
} 

/*******************************************
  
	2007³â 11¿ù 20ÀÏ

	ÀÌ¹ÌÁö ÆË¾÷Ã¢ Áß¾Ó¿¡ À§Ä¡

	onClick=openImageWinCenter(this.src);

*******************************************/
function openImageWinCenter(imageRef){
    var x,y,w,h,loadingMsg;
    w=300;
	h=100;
    x=Math.floor( (screen.availWidth-(w+12))/2 );
	y=Math.floor( (screen.availHeight-(h+30))/2 );

    loadingMsg="<table width=100% height=100%><tr><td valign=center align=center>&nbsp;</td></tr></table>";

    with( window.open("","",'height='+h+',width='+w+',top='+y+',left='+x+',scrollbars=no,resizable=no') ) {
        document.write(
        "<body topmargin=0 rightmargin=0 bottommargin=0 leftmargin=0>",
        loadingMsg,
        "<img src=\""+imageRef+"\" hspace=0 vspace=0 border=0 style=cursor:hand  onmousedown=\"window.close();\" onload=\"document.title=this.src;document.body.removeChild(document.body.children[0]);window.resizeTo(this.width+12,this.height+30);window.moveTo(Math.floor( (screen.availWidth-(this.width+12))/2),Math.floor( (screen.availHeight-(this.height+30))/2 ));\"><br>",
        "</body>");
        focus();
    }
}

/*******************************************
  
	2007³â 11¿ù 23ÀÏ

	ÆË¾÷ ÀüÃ¼Ã¢À¸·Î ¶ç¿ì±â

	onClick=WindowFullScreen('http://ebig.pe.kr');

*******************************************/
function WindowFullScreen(url) {
	popupwindow = window.open("about:blank");
	popupwindow.moveTo(0,0);
	popupwindow.resizeTo(screen.availWidth,screen.availHeight);
	popupwindow.location.href = url;
}