//¾ÆÀÌÇÁ·¹ÀÓ »çÀÌÁî Á¶Àý
var oldFn="";
function resizeFrame(name){
	var oBody = document.body;
	var oFrame = parent.document.all(name);
	var min_height = 10; //iframeÀÇ ÃÖ¼Ò³ôÀÌ(³Ê¹« ÀÛ¾ÆÁö´Â °É ¸·±âÀ§ÇÔ, ÇÈ¼¿´ÜÀ§, ÆíÁý°¡´É)
	var min_width = 10; //iframeÀÇ ÃÖ¼Ò³Êºñ
	var i_height = oBody.scrollHeight + (oBody.offsetHeight-oBody.clientHeight);
	var i_width = oBody.scrollWidth + (oBody.offsetWidth-oBody.clientWidth);

	if(i_height < min_height) i_height = min_height;
	if(i_width < min_width) i_width = min_width;
	oFrame.style.height = i_height;
	oFrame.style.width = i_width;
}


function viewImage(imgLayer, imgName){
	// imgLayer ÀÌ¹ÌÁö ·¹ÀÌ¾î¸í
	// imgName  ÀÌ¹ÌÁö È­ÀÏ¸í
	filepath="product_image/"+imgName; //ÀÌ¹ÌÁö ½ÇÁ¦°æ·Î

	if (document.all && document.images[imgLayer].filters){
		document.images[imgLayer].filters.revealTrans.stop()
		document.images[imgLayer].filters.revealTrans.apply()
	}

	document.images[imgLayer].src=filepath;

	if (document.all && document.images[imgLayer].filters) {
		document.images[imgLayer].filters.revealTrans.play();
	}
}


function toggleMenu(currMenu) {
	if (document.all) {
		thisMenu = eval("document.all." + currMenu + ".style")
		if (thisMenu.display == "block") thisMenu.display = "none"
		else thisMenu.display = "block"
		return false
	}
	else return true
}

function timeCall() {
	var timestr, apm, day;
    now   = new Date();

	var month = ""+(now.getMonth()+1);
	var date = ""+now.getDate();
	var minute = ""+now.getMinutes();
	var sec = ""+now.getSeconds();

	if(now.getHours()>12) {
		apm="¿ÀÈÄ";
		hour=""+(now.getHours()-12);
	}
	else {
		apm="¿ÀÀü";
		hour=""+now.getHours();
	}

	if(now.getDay()==1) day="(¿ù)";
	else if(now.getDay()==2) day="(È­)";
	else if(now.getDay()==3) day="(¼ö)";
	else if(now.getDay()==4) day="(¸ñ)";
	else if(now.getDay()==5) day="(±Ý)";
	else if(now.getDay()==6) day="(Åä)";
	else if(now.getDay()==0) day="(ÀÏ)";

	if(month.length==1) month="0"+month;
	if(date.length==1) date="0"+date;
	if(hour.length==1) hour="0"+hour;
	if(minute.length==1) minute="0"+minute;
	if(sec.length==1) sec="0"+sec;

	timestr=""+now.getYear();
	timestr=timestr+" . "+month;
	timestr=timestr+" . "+date;
	timestr=timestr+"  "+day;

	timeForm.clock1.value=timestr;

	timestr1=""+hour;
	timestr1=timestr1+" :"+minute;
	timestr1=timestr1+" :"+sec+" ["+apm+"]";

	timestr1=apm+" . "+hour;
	timestr1=timestr1+" : "+minute;
	timestr1=timestr1+" : "+sec;

	timeForm.clock2.value=timestr1;

	window.setTimeout("timeCall();", 1000);
}

//¼ýÀÚ°¡ ¾Æ´Ñ°æ¿ì´Â ºñ¿ì°í ´Ù½Ã ½ÃÀÛ
function numCheck() {
	val=event.srcElement.value;
	str=" "+"0123456789";
	for(i=0;i<val.length;i++) {
		if(str.indexOf(val.substring(i,i+1))<=0) {
			alert("¼ýÀÚ¸¸ÀÔ·ÂÇÏ¼¼¿ä");
			event.srcElement.value="";
			event.srcElement.focus();
			return;
		}
	}
}

//¼ýÀÚ°¡ ¾Æ´Ñ°æ¿ì´Â ºñ¿ì°í ´Ù½Ã ½ÃÀÛ
function phoneCheck() {
	val=event.srcElement.value;
	str=" -0123456789";
	for(i=0;i<val.length;i++) {
		if(str.indexOf(val.substring(i,i+1))<=0) {
			alert("Àß¸øµÈ ÀüÈ­¹øÈ£ÀÔ´Ï´Ù.");
			event.srcElement.value="";
			event.srcElement.focus();
			return;
		}
	}
}

//ºñÈ°¼ºÈ­..
function checkCheckBox(form,val,obj1, obj2) {
	val=event.srcElement.checked;
	if(obj1=="COPYRIGHT") {
		if(val) {
			eval("form."+obj1+".style.background='#FFFFFF'");
			if(obj2!="") eval("form."+obj2+".style.background='#FFFFFF'");
		}
		else {
			eval("form."+obj1+".style.background='#EEEEEE'");
			if(obj2!="") eval("form."+obj2+".style.background='#EEEEEE'");
		}
	}
	else {
		if(val) {
			eval("form."+obj1+".style.background='#EEEEEE'");
			if(obj2!="") eval("form."+obj2+".style.background='#EEEEEE'");
		}
		else {
			eval("form."+obj1+".style.background='#FFFFFF'");
			if(obj2!="") eval("form."+obj2+".style.background='#FFFFFF'");
		}
	}
	return;
}

//Æ÷Ä¿½º ¸ø¿À°Ô..
function checkBlur(val) {
	if(val) event.srcElement.blur();
	return;
}

function imgPreView(layerId) {
	if(event.srcElement.value.match(/(.jpg|.jpeg|.gif|.png)$/))	{
		document.images[layerId].src = event.srcElement.value;
		document.images[layerId].style.display = "";
	}
	else document.images[layerId].style.display = "none";
}

function checkAll(form, chk) {
	if (chk == true) {
		for (var i=0; i<form.length;i++) {
			if (form[i].type == "checkbox" && form[i].checked == false) {
				form[i].checked = true;
			}
		}
	}
	else {
		for (var i=0; i<form.length;i++) {
			if (form[i].type == "checkbox" && form[i].checked == true) {
				form[i].checked = false;
			}
		}
	}
}

function checkEmail(field) {
	if(field.length>0) {
		if( ( field.indexOf(".")<0 ) ||( field.indexOf("@")<0) ) {
				alert("Àß¸øµÈ ¸ÞÀÏÁÖ¼ÒÀÔ´Ï´Ù.");
				event.srcElement.value="";
				event.srcElement.focus();
				return;
		}
	}
}


// ¾Æ½ºÅ°ÄÚµå°ªÀ» ÀÌ¿ëÇÑ ÇÑ±Û¸¸ ÀÔ·Â¹Þ±â
function hanCheck(str){
	if(str.length>0) {
		var len;
        len = str.length;
        for (i=0;i<len;i++) {
			if (str.charCodeAt(i) < 128 ) {
				alert('ÀÌ Ç×¸ñ¿¡´Â ÇÑ±Û¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.');
				event.srcElement.value="";
				event.srcElement.focus();
				return;
			}
		}
	}
}


function goWrite(url, time, qrystring) {
	self.location=url+"?refer="+time+qrystring;
}

function newWindow(url,windowName,property) {
	window.open(url,windowName,property);
}

//iframeÀ¸·Î formÀ» submit
function executeFormSubmit(frmObj){
	var oIFRAME=document.createElement("<IFRAME style='display:none' name='execformframe'></IFRAME>");
	document.body.appendChild(oIFRAME);
	frmObj.target='execformframe';
	frmObj.submit();
	return true;
}
//iframeÀ¸·Î urlÀ» href
function executeLocation(url){
	var oIFRAME=document.createElement("<IFRAME style='display:none'></IFRAME>");
	document.body.appendChild(oIFRAME);
	oIFRAME.src=url;
	return true;
}

function getCookie(name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i=0;

  while (i<clen) {
	  var j = i + alen;

	  if(document.cookie.substring(i,j) == arg) {
		  var end=document.cookie.indexOf(";",j);
		  if(end == -1) end=document.cookie.length;
		  return unescape(document.cookie.substring(j,end));
	  }

	  i=document.cookie.indexOf(" ",i) +1;
	  if(i==0) break;
  }
  return null;
}

function nextCursorFocus(form, charbyte, nextformElement) {
	var comment=event.srcElement.value;
	var len=comment.length;
	var tcount=0;
	if(len>=charbyte) {
		eval("form."+nextformElement+".focus()");
	}
	for (k=0;k<len;k++)	{
		onechar = comment.charAt(k);
		if (escape(onechar) =='%0D') { 
		} 
		else if (escape(onechar).length > 4) { 
			tcount += 2; 
		} 
		else { tcount++; }
	}
}
