/*******************************************************************************
* Æû À¯È¿¼º °Ë»ç¿¡ »ç¿ëµÇ´Â ÆÐÅÏ Á¤ÀÇ
*******************************************************************************/
var patterns = new Array();

patterns["num"]		= /^[0-9]+$/;
patterns["han"]		= /^[°¡-ÆR]+$/;
patterns["eng"]		= /^[a-zA-Z]+$/;
patterns["eng_num"]	= /^[0-9a-zA-Z]+$/;
patterns["email"]	= /^[_a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+\.[a-zA-Z]+$/; 
patterns["url"]		= /^[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/; 
patterns["img"]		= /.+(\.jpg|\.gif|\.bmp|\.png|\.jpeg)+$/gi;
patterns["at"]		= /^[0-9]+$/;

/*******************************************************************************
* ¿µ¹®°ú ¼ýÀÚ¸¸ Ã¼Å©
*******************************************************************************/
function isEngNum(str)
{
	if(str.match(patterns["eng_num"]))	return true;
	else							return false;
}


/*******************************************************************************
* @Ã¼Å©
*******************************************************************************/
function isAt(str)
{
	if(str.match(patterns["at"]))	 	return true;
	else							return false;
}


/*******************************************************************************
* ¼ýÀÚ Ã¼Å©
*******************************************************************************/
function isNum(str)
{
	if(str.match(patterns["num"]))	return true;
	else							return false;
}


/*******************************************************************************
* °ø¹éÁ¦°Å
*******************************************************************************/
function trim(str)
{
	return str.replace(/^\s+|\s+$/g, '');
}

function delSpace(str)
{
	return str.replace(/\s+/g, '');
}


/*******************************************************************************
* ¼ýÀÚ¸¸ °¡´É
*******************************************************************************/
function objDelChar(obj)
{
	obj.value = obj.value.replace(/[^0-9]+/g, "");
}


function delChar(str)
{
	return str.replace(/[^0-9]+/g, "");
}


/*******************************************************************************
* ÀÔ·ÂÆû ¼ýÀÚ¸¸ °¡´É
*******************************************************************************/
function numChk(obj)
{
	if(obj.value.match(/[^0-9]/))
	{
		window.alert('¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼¼¿ä.'); obj.value = '';
		return false; 
	}
}


/*******************************************************************************
* ÀÌÅë»ç ¹øÈ£ Ã¼Å©
*
* str	- ÀüÈ­¹øÈ£
*******************************************************************************/
var tel = new Array("010", "011", "016", "017", "018", "019");

function isHandPhone(str)
{
	var flag = false;
	
	if(str.length > 9 && str.length < 12)
	{
		for(var i = 0; i < tel.length; i++)
		{
			if(str.substring(0, 3) == tel[i])
			{
				flag = true;
				break;
			}
		}
	}
	return flag;
}



/*******************************************************************************
* Ã¼Å©¹Ú½º ¼±ÅÃµÇ¾î ÀÖ´ÂÁö
*******************************************************************************/
function isChecked(form, obj_name)
{
	var is_checked_flag = false;
	var length = form.elements.length;

	for (var i = 0; i < length; i++)
	{
		if(form.elements[i].name == obj_name && form.elements[i].checked == true)
		{
			is_checked_flag = true;
			break;
		}
	}

	return is_checked_flag;
}


/*******************************************************************************
* Ã¼Å©ÀüÃ¼¼±ÅÃ/ÇØÁ¦ 
*******************************************************************************/
function checkboxall(f) {
    field = eval(f);
    // Ã¼Å©ÆûÀÌ ÀÖ´ÂÁö °Ë»ç
    if(typeof(field)!="object"){
        alert("µî·ÏµÈ ±×·ìÀÌ ¾ø½À´Ï´Ù.");
        return;
    }
    if (document.frm.allChk.checked == true) {
        for (i = 0; i < field.length; i++) {
            field[i].checked = true;
        }
        return;
    }
    else {
        for (i = 0; i < field.length; i++) {
            field[i].checked = false;
        }
        return;
    }
}




// ÁÖ¼Ò°Ë»ö
function post(flag)
{
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = 420 / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = 350 / 2;
	top2 = parent_pop_h - pop_h;

	window.open('/member/zip_search.asp?flag='+flag,'zip','width=420,height=350,left='+left2+',top='+top2+',scrollbars=yes');
}


// È¸¿øÁ¤º¸
function custInfo(pk) 
{
	var width = 650;	
	var height = 680;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;


	window.open('./member1_edit.asp?pk_num='+pk, 'custEdit','width='+width+',height='+height+',left='+left2+',top='+top2+',statusbar=no,scrollbars=yes,toolbar=no')
}

// ¸ÞÀÏº¸³»±â
function sendMail(pk) 
{
	var width = 700;	
	var height = 450;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;

	window.open('./pop_mail.asp?pk_num='+pk, 'sendMail','width='+width+',height='+height+',left='+left2+',top='+top2+',statusbar=no,scrollbars=yes,toolbar=no')
}

// ¹®ÀÚº¸³»±â
function sendSms(pk) 
{
	var width = 500;	
	var height = 230;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;

	window.open('./pop_sms.asp?pk_num='+pk, 'sendMail','width='+width+',height='+height+',left='+left2+',top='+top2+',statusbar=no,scrollbars=yes,toolbar=no')
}


// ¾ÆÀÌµð°Ë»ö
function searchID(id)
{
	var width = 400;	
	var height = 280;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("id_search.asp?id=" + id,"Áßº¹È®ÀÎ","location=no,directories=no,status=no,scrollbars=0,resizable=no,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}

// ¸ÞÀÏ°Ë»ö
function searchMail(email1,email2)
{
	var width = 400;	
	var height = 280;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("../member/mail_search.asp?email1="+email1 + "&email2="+email2,"Áßº¹È®ÀÎ","location=no,directories=no,status=no,scrollbars=0,resizable=no,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}

function searchMail(email1,email2,id)
{
	var width = 400;	
	var height = 280;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("../member/mail_search.asp?email1="+email1 + "&email2="+email2+ "&id="+id,"Áßº¹È®ÀÎ","location=no,directories=no,status=no,scrollbars=0,resizable=no,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}

// Á¦Ç°½ºÅ©·¦
function scrap(cateCode,pk)
{
	/*
	var width = 300;	
	var height = 200;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("scrap_add.asp?prodPk=" + pk,"½ºÅ©·¦","location=no,directories=no,status=no,scrollbars=0,resizable=no,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
	*/
	frameScrapProc.location.href="scrap_add.asp?list_code2="+cateCode+"&prodPk=" + pk;
}


// ´Ù¿î·Îµå Ã¢
function prodDownload(pk, gubun) {

	var width = 680;	
	var height = 500;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	if (gubun == 0) {
		window.open("/products/downloadpop/download.asp?pk="+pk,"´Ù¿î·Îµå","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
	} else {
		window.open("/products/downloadpop/cad.asp?pk="+pk,"´Ù¿î·Îµå","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
	}

}


// Ä«Å×°í¸®¼±ÅÃ Ã¢
function popSelectCategory(opt) {

	var width = 450;	
	var height = 250;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("pop_selCategory.asp?opt="+opt,"selCategory","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}



// Ä«Å×°í¸®¼±ÅÃ Ã¢(ÀüÃ¼ÀÌµ¿)
function popSelectCategory2(code) {

	var width = 450;	
	var height = 250;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("pop_selCategory2.asp?code="+code,"selCategory","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}

// Ä«Å×°í¸®¼±ÅÃ Ã¢(ÀüÃ¼ÀÌµ¿)
function popSelectCategory3(code) {

	var width = 450;	
	var height = 250;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("pop_selCategory3.asp?code="+code,"selCategory","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}


// faq Ä«Å×°í¸®¼±ÅÃ Ã¢
function popFaqSelectCategory() {

	var width = 450;	
	var height = 250;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("pop_FaqSelCategory.asp","FaqSelCategory","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}


// ´ëÃ¼»óÇ° °Ë»öÃ¢
function popSearchProduct() {

	var width = 700;	
	var height = 350;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	window.open("pop_searchProduct.asp","searchProduct","scrollbars=1,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
}


// news/°øÁöÃ¢
function news(gubun, articleNum)
{
	var width = 700;	
	var height = 410;
	w_px = document.body.clientWidth; 
	h_px = document.body.clientHeight; 

	parent_pop_w = w_px / 2;
	pop_w = width / 2;
	left2 = parent_pop_w - pop_w;

	parent_pop_h = h_px / 2;
	pop_h = height / 2;
	top2 = parent_pop_h - pop_h;
	if (articleNum != "") {
		window.open("/common/news_notice_view.asp?part="+gubun+"&pk="+articleNum,"Áßº¹È®ÀÎ","location=no,directories=no,status=no,scrollbars=1,resizable=yes,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
	} else {
		window.open("/common/news_notice.asp?part=" + gubun,"Áßº¹È®ÀÎ","location=no,directories=no,status=no,scrollbars=1,resizable=yes,width="+width+",height="+height+",top="+top2+",left="+left2+",1")
	}
}


function goUrl(url) {

	opener.location.href = url;

}
