function chkForm(f)
{ 
	var i,currEl;

	for(i = 0; i < f.elements.length; i++){ 
		currEl = f.elements[i]; 
		//ÇÊ¼ö Ç×¸ñÀ» Ã¼Å©ÇÑ´Ù.  
		if (currEl.getAttribute("required") != null) { 
			if(currEl.type == "TEXT" || currEl.type == "text" || 
			   currEl.tagName == "SELECT" || currEl.tagName == "select" || 
			   currEl.tagName == "TEXTAREA" || currEl.tagName == "textarea"){ 
				if(!chkText(currEl,currEl.hname)) return false; 

			} else if(currEl.type == "PASSWORD" || currEl.type == "password"){ 
				if(!chkText(currEl,currEl.hname)) return false; 

			} else if(currEl.type == "CHECKBOX" || currEl.type == "checkbox"){

				if(!chkCheckbox(f, currEl,currEl.hname)) return false; 

			} else if(currEl.type == "RADIO" || currEl.type == "radio"){ 
				if(!chkRadio(f, currEl,currEl.hname)) return false; 

			}
		}
		// ÀÔ·Â ÆäÅÏÀ» Ã¼Å©ÇÑ´Ù.
		if(currEl.getAttribute("option") != null && currEl.value.length > 0){ 
			if(!chkPatten(currEl,currEl.option,currEl.hname,currEl.optname)) return false; 
		} 
	}
	return true;
} 

function chkPatten(field,patten,name,optname)
{ 
	var regNum =/^[0-9]+$/; 
	var regPhone =/^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/; 
	var regMail =/^[_a-zA-Z0-9-]+@[._a-zA-Z0-9-]+\.[a-zA-Z]+$/; 
	var regDomain =/^\s*['http://']+[\w\~\-\.]+\.[\w\~\-]+(\.[\w\~\-]+)+\s*$/g;
	var regUrl =/^\s*['http://']+[\w\~\-]+(\.[\w\~\-]+)+\s*/g; 
	var regAlpha =/^[a-zA-Z]+$/; 
	var regHost =/^[a-zA-Z-]+$/; 
	var regHangul =/[°¡-ÆR]/; 
	var regHangulEng =/[°¡-ÆRa-zA-Z]/; 
	var regHangulOnly =/^[°¡-ÆR]*$/; 
	var regId = /^[a-zA-Z]{1}[a-zA-Z0-9_-]{4,15}$/; 
	var regDate =/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/; 

	patten = eval(patten); 
	if(!patten.test(field.value)){		
		if(optname) alert(optname);
		else alert(name + "\n\nÇ×¸ñÀÇ Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù."); 

		field.focus(); 
		return false; 
	} 
	return true; 
} 

function chkText(field, name)
{ 
	if(field.value.length < 1){ 
		alert(name); 
		field.focus(); 
		return false; 
	} 
	return true; 
}

function chkCheckbox(form, field, name)
{	
	fieldname = eval(form.name+'.'+field.name);	
	if (!fieldname.checked){
		alert(name); 
		field.focus(); 
		return false; 
	}
	return true; 
}

function chkRadio(form, field, name)
{
	fieldname = eval(form.name+'.'+field.name);
	for (i=0;i<fieldname.length;i++) {
		if (fieldname[i].checked){
			return true; 
		}
	}
	alert(name); 
	field.focus(); 
	return false; 
}

function moveFocus(num,fromform,toform)
{	
	var str = fromform.value.length;
	if(str == num){
		if (event.keyCode!=8 && event.keyCode!=46)  toform.focus();		
	}
}


//¿ìÆí¹øÈ£ °Ë»öÃ¢ ¶ç¿ì±â
function zipopen(num){
	window.open("../member/search_post.php?mode="+num,"_box","width=536,height=350,scrollbars=yes");
}

// »õÃ¢ ¶ç¿ì±â
function openwindow(name, url, width, height, scrollbar) {
	scrollbar_str = scrollbar ? 'yes' : 'no';
	var win = window.open(url, name, 'width='+width+',height='+height+',scrollbars='+scrollbar_str+',status=yes');
	win.focus();
}


function gopage(selname){
	var i=selname.selectedIndex;
	if(selname.options[i].value) location=selname.options[i].value;
}

function __getBrowserType() {
    var userAgent = navigator.userAgent;

    if ( userAgent.indexOf('Opera') > 0 )
        return "OPERA";
    else if ( userAgent.indexOf('Firefox') > 0 )
        return "FIREFOX";
    else
        return "MSIE";

}

//·¹ÀÌ¾î ¸ð´ÞÃ¢À¸·Î ¶ç¿ì±â
function showModal(name, url, width, height) {
    var browser_type = __getBrowserType();

    if ( browser_type == "OPERA" || browser_type == "FIREFOX" ) {
        var qResult = window.open( url, name,
                        "Width:"+width+"px;Height:"+height+"px;toolbar:no;location:no;help:no;directories:no;status:no;menubar:no;scrollbars:no;resizable:no");
        return qResult;
    } else {
        var qResult = window.showModalDialog( url, this,
                        "dialogWidth:"+width+"px;dialogHeight:"+height+"px;toolbar:no;location:no;help:no;directories:no;status:no;menubar:no;scrollbars:no;resizable:no");
        return qResult;
    }	
}

//¾ÆÀÌÇÁ·¹ÀÓ ¸®»çÀÌÁî
function iframe_autoresize(arg) {
	arg.width = eval(arg.name+".document.body.scrollWidth")+18;
    arg.height = eval(arg.name+".document.body.scrollHeight");
}

var req;	//°ª º¸³¾ requestº¯¼ö 

//request°´Ã¼»ý¼º ÇÔ¼ö 
// function from http://www-128.ibm.com/developerworks/kr/library/j-ajax1/index.html 
function newXMLHttpRequest() {
	var xmlreq = false;

	if(window.XMLHttpRequest) {
		xmlreq = new XMLHttpRequest(); 
	} else if (window.ActiveXObject) { 
	    try { 
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP"); 
	    } catch (e1) { 
			try { 
		        xmlreq = new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (e2) {
		    }
	    }
	}
	return xmlreq; 
}

function rollon(imgid,imgName) {
	eval(imgName).style.visibility="visible";
}

function rolloff(imgid,imgName) {
	eval(imgName).style.visibility="hidden";
}

//Roll Over,Out °ü·Ã
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

function cut_str(cut_var){ //¼ýÀÚ 3ÀÚ¸® ¸¶´Ù , Âï±â
	str = ""+cut_var+""; 
	var retValue = ""; 
	var n;
	for(n=0; n<str.length; n++){ 
		if(n > 0 && (n%3)==0){
			 retValue = str.charAt(str.length - n -1) + "," + retValue; 
		 }else{ 
			 retValue = str.charAt(str.length - n -1) + retValue; 
		 }
	}
	return retValue; 
}

//¹®ÀÚ¿­À» Ä¡È¯
function replace_fun(str,re_str,get_str){
	var return_str;
	return_str = str.replace(re_str,get_str);

	return return_str;
}

function trim(str) {
    return str.replace(/(^\s*)|(\s*$)/g, "");
}

function sexyEyeIndex() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/08/mascara/intro.php', 'sexy_eye', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function fwMakeup() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/09/makeup/', '2007fw', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function nearSkin() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/10/nearskin/', 'nearSkin', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function nearSkin2() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/10/nearskin/index_01.php', 'nearSkin', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function M_Brand() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/10/M/new/index.php', 'M', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function M_perfect_cover() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/10/M/cover.php', 'M', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function bodyFeel() { 
	var newwin = window.open('http://shop.beautynet.co.kr/bodyfeel/brand/index.php', 'bodyfeel', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function colorgraphIndex() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/12/colorgraph/intro.php', 'colorgraphIndex', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function superAquaIndex() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/08/super_aqua/index_O2.php', 'super_aqua', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function superAquaEvent() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/08/super_aqua/Event.php', 'super_aqua', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function superAquaOxygen() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/08/super_aqua/Product_Line_Oxygen.php', 'super_aqua', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function superAquaO2() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/08/super_aqua/index_O2.php', 'super_aqua', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function superAquaPore() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/08/super_aqua/index_pore.php', 'super_aqua', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function revolutionMain() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/12/revolution/intro.html', 'revolution', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function misaMain() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2008/01/misa/', 'misa', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function misaEvent() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2008/01/misa/sub_event.php', 'misa', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function misaMain() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2008/01/misa/', 'misa', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function cureRevolutionMain() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/12/revolution/intro_1.html', 'revolution', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function revolutionReserch() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2007/12/revolution/sub_026.html', 'revolution', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}

function missha2008SS() { 
	var newwin = window.open('http://shop.beautynet.co.kr/event/2008/SS/', 'ss', 'top=0,left=0,width='+(screen.availWidth)+',height='+(screen.availHeight)+',toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1')
}