<!-- ÀÚ¹Ù ½ºÅ©¸³Æ® ÆÄÀÏ-->


//Àü¿ªº¯¼ö ¼±¾ð###################################################################
//Àå¹Ù±¸´ÏÃ¢, wishlist À» ¶ç¿ï¶§ ±âÁ¸¿¡ Ã¢ÀÌ ÀÖ´ÂÁö È®ÀÎÇÏ±â À§ÇÑ º¯¼ö
var cartview;
//profile
var profile;
//°ßÀûÃ¢, InvoicePrintµîÀÇ rptÃ¢
var quotview;
//catalog
var catalog;
//Card receipt
var receiptView;
//Giro View
var giroview;
//sial.com
var sialCom;
//CasNo list
var casnoview;
//noticePopup
var noticePopup;
var noticemore;
//Product Highlights
var highlight;
//event & promotion
var proevent;
//pation at the main page
var inform;
var inform2;
//¾È³», helpÃ¢
var winHelp;
//´Ù·®Àç°í°Ë»ö Ã¢
var stockSearch;
//Invoice print window
var invview;
//card manual popup
var cardmanual;
//###########################################################################

//ÀÚ¹Ù½ºÅ©¸³Æ® trim¿ªÈ° ÇÔ¼ö
String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

//Starts the onMouseOver of Quick-Menu on the left ##############################################
function qMenuOver(imgName) {
	var imgSrc = '../../image/quick_img/' + imgName + '2.gif';
	 document.images[imgName].src = imgSrc;
}
//Ends the onMouseOver of Quick-Menu on the left ##############################################




//Starts the onMouseOut of Quick-Menu on the left ##############################################
function qMenuOut(imgName) {
	var imgSrc = '../../image/quick_img/' + imgName + '.gif';
	document.images[imgName].src = imgSrc;
}
//Ends the onMouseOut of Quick-Menu on the left ##############################################




//Starts the sub-Menu on the Top #######################################################
function findObj(n, d) { //v4.0
  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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function showHideLayers() { //v3.0
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
	  if ((obj=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;
	}
}
//Ends the sub-Menu on the Top ########################################################

//Starts basic function for asp page ######################################################

//¼ýÀÚÀÔ·Â Ã¼Å©
function keycheck() {
        if((event.keyCode < 48)||(event.keyCode > 57)) {
            event.returnValue=false;
        }
	}

//Àå¹Ù±¸´Ï ¹öÆ°(»õÃ¢) ÇÁ·Î¼¼½º
function insertCart(){
	//ÅØ½ºÆ®¹Ú½º Ã¼Å©ÇÏ¿© ¼ö·® È®ÀÎ
	var qtychk=false;
	for(var i = 0; i < document.frmInsertCart.length; i++) {
		if(document.frmInsertCart.elements[i].type == 'text') {
			if (Number(document.frmInsertCart.elements[i].value)>0)	{
				qtychk = true;
			}
		}
	}

	if (qtychk)	{
		if (cartview!=null){
			cartview.close();
		}
		cartview = window.open('./insertcart.asp','CARTMAIN','left=200, top=200, width=660, height=500, scrollbars=yes');
		document.frmInsertCart.target = 'CARTMAIN';
		document.frmInsertCart.submit();
		return true;
	}else{
		alert('¼ö·®À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.');
		return false;
	}
}

//Àå¹Ù±¸´Ï ¹öÆ°(ÀÏ°ýÀç°í°Ë»ö¿¡¼­) ÇÁ·Î¼¼½º - »ç¿ë ¾ÈÇÔ
function insertCart2(){
	//ÅØ½ºÆ®¹Ú½º Ã¼Å©ÇÏ¿© ¼ö·® È®ÀÎ
	var qtychk=false;
	for(var i = 0; i < document.frmInsertCart.length; i++) {
		if(document.frmInsertCart.elements[i].type == 'text') {
			if (Number(document.frmInsertCart.elements[i].value)>0)	{
				qtychk = true;
			}
		}
	}

	if (qtychk)	{
		//document.frmInsertCart.target = './hidecart.asp?ID=INSERT';
		document.frmInsertCart.submit();
		return true;
	}else{
		alert('¼ö·®À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.');
		return false;
	}
}



//¹Ù·ÎÁÖ¹®ÇÏ±â ¹öÆ°
function DorderExec(){
	var qtychk=false;
	for(var i = 0; i < document.frmInsertCart.length; i++) {
		if(document.frmInsertCart.elements[i].type == 'text') {
			if (Number(document.frmInsertCart.elements[i].value)>0)	{
				qtychk = true;
			}
		}
	}
	if (qtychk)	{
		document.frmInsertCart.target = ''
		document.frmInsertCart.action="./order_cnfm_before.asp";
		document.frmInsertCart.submit();
	}else{
		alert('¼ö·®À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.');
		return false;
	}
}

function viewCart(sid){
	if (cartview!=null){
			cartview.close();
		}
		//alert(sid);
	cartview = window.open('../../function/Order/insertcart.asp?SID=' + sid ,'CARTMAIN','left=200, top=50, width=660, height=500, scrollbars=yes');
}

function viewProfile(){
	if (profile!=null){
			profile.close();
		}
	profile = window.open('../../function/home/profile.asp','PROFILE','left=200, top=50, width=660, height=700, scrollbars=yes');
}


function viewWishlist(sid){
	if (cartview!=null){
			cartview.close();
		}
	cartview = window.open('../../function/Order/wishlist.asp?SID=' + sid,'CARTMAIN','left=200, top=50, width=660, height=700, scrollbars=yes');
}

function viewQuotation(sid){
	if (quotview!=null){
		quotview.close();
	}
	quotview = window.open('../../function/Order/DoQuotation.asp?SID=' + sid,'VIEWQUOTATION','left=200, top=50, width=650, height=700, scrollbars=yes');
}

//Catalog Page open
function viewCatalog(){
	if (catalog!=null){
		catalog.close();
	}
	catalog = window.open('../../catalog/catalog.asp','CATALOG','left=200, top=50, width=800, height=900,  scrollbars=yes,status=no');
}

//WishList Ãß°¡
function wishAdd(p,sid){
	if (cartview!=null){
			cartview.close();
		}
	cartview = window.open('../../function/Order/wishlist.asp?ID=ADD&SID=' + sid + '&PRODCD=' + p,'CARTMAIN','left=200, top=50, width=660, height=700, scrollbars=yes');
}

//´Ù·®Àç°í°Ë»ö Ã¢ ¿ÀÇÂ
function ManySearch(){
	deleteCookie("STOCKSEARCH");
	if (stockSearch!=null){
			stockSearch.close();
		}
	stockSearch = window.open('../../function/home/manySearch.asp','STOCKSEARCH','left=200, top=50, width=660, height=630,status=no');
}

//Insert Cart from Wish List
function inserCart_AtWish(){
	//Á¦Ç°¼±ÅÃ È®ÀÎ
	var qtychk=false;
	for(var i = 0; i < document.insertCartProcess.length; i++) {
		if(document.insertCartProcess.elements[i].type == 'checkbox') {
			if (Number(document.insertCartProcess.elements[i].checked))	{
				qtychk = true;
			}
		}
	}
	if (qtychk)	{
		document.insertCartProcess.submit();
	}else{
		alert('Á¦Ç°À» ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä.');
		return false;
	}
}

//WishList¿¡¼­ ¼±ÅÃµÈ Á¦Ç° »èÁ¦
function selDel_AtWish(sid){
	//Á¦Ç°¼±ÅÃ È®ÀÎ
	var qtychk=false;
	for(var i = 0; i < document.insertCartProcess.length; i++) {
		if(document.insertCartProcess.elements[i].type == 'checkbox') {
			if (Number(document.insertCartProcess.elements[i].checked))	{
				qtychk = true;
			}
		}
	}
	if (qtychk)	{
		document.insertCartProcess.action="../order/wishlist.asp?ID=SELDEL&SID=" + sid;
		document.insertCartProcess.submit();
	}else{
		alert('Á¦Ç°À» ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä.');
		return false;
	}
}


//Qty up, down ÇÁ·Î¼¼½º
function qtyup(k,amt){
	var str;
	str = k;
	if (str.value < 99){
		hTotAmt.innerText = parseFloat(hTotAmt.innerText) + parseFloat(amt)
		TotAmt.innerText = fmtcur(hTotAmt.innerText)
		TotQty.innerText = parseFloat(TotQty.innerText) + 1
		str.value = Number(str.value) + 1;
	}else {
		alert("ÃÖ´ë ÁÖ¹®¼ö·®Àº 99°³ ÀÔ´Ï´Ù.");
	}
}
function qtydown(k,amt){
	var str;
	str = k;
	if (str.value > 0){
		hTotAmt.innerText = parseFloat(hTotAmt.innerText) - parseFloat(amt)
		TotAmt.innerText = fmtcur(hTotAmt.innerText)
		TotQty.innerText = parseFloat(TotQty.innerText) - 1
		str.value = Number(str.value) - 1;
	}else {
		alert("ÁÖ¹®¼ö·®Àº À½¼ö°¡ µÉ ¼ö ¾ø½À´Ï´Ù.");
	}
}

//Àå¹Ù±¸´Ï ¼ö·®º¯°æ
function qtySave(){
	document.frmCartAdjustment.submit();
	alert("¼ö·®ÀÌ º¯°æµÇ¾ú½À´Ï´Ù.");
}

//Àå¹Ù±¸´Ï ¸ðµÎ »èÁ¦
function AllClear(k){
	//alert(k);
	if (k=="CART"){
		if (confirm("Àå¹Ù±¸´Ï¸¦ ¸ðµÎ »èÁ¦ÇÏ½Ã°Ú½À´Ï±î ?")){
			document.frmCartAllClear.submit();
		}else{
			return false;
		}
	}else if (k=="WISH"){
		if (confirm("Wish List¸¦ ¸ðµÎ »èÁ¦ÇÏ½Ã°Ú½À´Ï±î ?")){
			document.frmWishAllClear.submit();
		}else{
			return false;
		}
	}

}

//Àå¹Ù±¸´Ï¿¡¼­ ¿À´õ·Î...
function orderExec(){
	opener.location.href="./order_cnfm.asp";
	self.close();
}

//WishList¿¡¼­ ProdSearchÃ¢ À¸·Î
function ProdSearch_AtChildWindow(b, p){
	var brand;
	var prodno;
	brand = "" + b;
	prodno = "" + p;
	opener.location.href="../order/order.asp?ID=SEARCH&BRAND=" + brand + "&CatNo=" + prodno;
	self.close();
}

//Æ÷¸Ë º¯°æ - ÀÚ¹Ù½ºÅ©¸³Æ®¿ë
function fmtcur(c) {
		var s = String(c);
		var buf = "";
		s = reversestr(s);
		for(var i = 0; i < s.length; i++) {
			if(i % 3 == 0 && i > 0) buf += ",";
			buf += s.substr(i, 1);
		}
		return reversestr(buf);
}

function reversestr(c) {
		var buf = "";
		var s  = String(c);
		for(var i = 0; i < s.length; i++) {
			buf += s.substr(s.length - i - 1, 1);
		}
		return buf;
	}

//±ÛÀÚ¼ö Á¦ÇÑ ÇÔ¼ö
function fc_chk_byte(aro_name,ari_max)
{

   var ls_str     = aro_name.value; // ÀÌº¥Æ®°¡ ÀÏ¾î³­ ÄÁÆ®·ÑÀÇ value °ª
   var li_str_len = ls_str.length;  // ÀüÃ¼±æÀÌ

   // º¯¼öÃÊ±âÈ­
   var li_max      = ari_max; // Á¦ÇÑÇÒ ±ÛÀÚ¼ö Å©±â
   var i           = 0;  // for¹®¿¡ »ç¿ë
   var li_byte     = 0;  // ÇÑ±ÛÀÏ°æ¿ì´Â 2 ±×¹Ü¿¡´Â 1À» ´õÇÔ
   var li_len      = 0;  // substringÇÏ±â À§ÇØ¼­ »ç¿ë
   var ls_one_char = ""; // ÇÑ±ÛÀÚ¾¿ °Ë»çÇÑ´Ù
   var ls_str2     = ""; // ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¸é Á¦ÇÑÇÒ¼ö ±ÛÀÚÀü±îÁö¸¸ º¸¿©ÁØ´Ù.

   for(i=0; i< li_str_len; i++)
   {
      // ÇÑ±ÛÀÚÃßÃâ
      ls_one_char = ls_str.charAt(i);

      // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù.
      if (escape(ls_one_char).length > 4)
      {
         li_byte += 2;
      }
      // ±×¹ÜÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù.
      else
      {
         li_byte++;
      }

      // ÀüÃ¼ Å©±â°¡ li_max¸¦ ³ÑÁö¾ÊÀ¸¸é
      if(li_byte <= li_max)
      {
         li_len = i + 1;
      }
   }

   // ÀüÃ¼±æÀÌ¸¦ ÃÊ°úÇÏ¸é
   if(li_byte > li_max)
   {
      alert( "ÃÖ´ë ÇÑ±Û" + (ari_max/2) + "±ÛÀÚ, ¿µ¹®" + ari_max + "±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. ");
      ls_str2 = ls_str.substr(0, li_len);
      aro_name.value = ls_str2;

   }
   aro_name.focus();
}

//ÁÖ¹®ÁøÇà Àü È®ÀÎ ÀÛ¾÷
function doOrder(){
	var obj = document.frmOrderCnfm;
	var mail = obj.email.value.toLowerCase();

	if (obj.chk_app.value=="N"){
		if (obj.payment_plan.value.length==0) {
			alert("´ë±Ý°áÁ¦ °èÈ¹À» ÀÔ·ÂÇÏ¼¼¿ä");
			obj.payment_plan.focus();	
			return false;
		}
	}

	if(obj.chk_cust.value != "2" && obj.chk_cust.value != "6" ){
		if(!obj.chk_ok.checked){
		alert("¼¼±Ý°è»ê¼­ Á¤º¸¸¦ È®ÀÎÇÏ¼¼¿ä");
		obj.chk_ok.focus();	
		return false;
		}
	}
	

	if (obj.contact.value==""){
		alert("ÁÖ¹®ÇÏ½Ã´Â ºÐÀÇ ¼ºÇÔÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.");
		obj.contact.focus();
		return false;
	}
	if (obj.EBill.value=="Y"){
		if (obj.ebillcust.value=="") {
			alert("ÀüÀÚ¼¼±Ý°è»ê¼­ ¹ÞÀ¸½Ã´Â ºÐÀÇ ¼ºÇÔÀ» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.");
			obj.ebillcust.focus();
			return false;
		}
	}

	if (mail==""){
		alert("EmailÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.");
		obj.email.focus();
		return false;
	}
	//if (mail.indexOf("hanmail.net")>0){
	//	alert("hanmail.netÀº »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
	//	obj.email.focus();
	//	return false;
	//}
	//if (mail.indexOf("daum.net")>0){
	//	alert("daum.netÀº »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
	//	obj.email.focus();
	//	return false;
	//}
	//if (mail.indexOf("nate.com")>0){
	//	alert("nate.comÀº »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
	//	obj.email.focus();
	//	return false;
	//}
	//if (mail.indexOf("lycos.co.kr")>0){
	//	alert("lycos.co.krÀº »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
	//	obj.email.focus();
	//	return false;
	//}

	if (obj.cellphone.value==""){
		alert("¿¬¶ô°¡´ÉÇÑ ÇÚµåÆù ¶Ç´Â ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.");
		obj.cellphone.focus();
		return false;
	}

	if(confirm("ÁÖ¹®À» Ã³¸®ÇÕ´Ï´Ù.\n\nµÚ·Î°¡±â¸¦ ´©¸£°Å³ª, ÁøÇàÁßÀÎ Ã¢À» Àý´ë·Î ´ÝÁö ¸¶½Ã±æ ¹Ù¶ø´Ï´Ù.\n\nÁÖ¹®ÇÏ½Ã°Ú½À´Ï±î ?")){
		obj.submit();
	}
}

//WishList¿¡¼­ ¸¶¿ì½º ¿À¹ö½Ã ¸¶¿ì½º¾ÆÀÌÄÜ º¯°æ
function makeCursorHand(obj){
	obj.style.cursor = "hand";
}
function makeCursorHand2(obj){
	obj.style.cursor = "hand";
	obj.bgColor = "#eeeeee";
}
function makeOut(obj){
	obj.bgColor = "white";
}

//WishList¿¡¼­ ¸¶¿ì½º ¿À¹ö½Ã °£·«ÇÑ ¼³¸í Ãâ·Â
function showHide(key)
{
	var div = eval("document.all.div_" + key);
	if(div.style.display == '') {
		div.style.display = "none";
	}else{
		if (key < 4)
			div.style.top = event.y +document.body.scrollTop;
		else if(key < 8 && key >= 4)
			div.style.top = event.y +document.body.scrollTop;
		else
			div.style.top = event.y +document.body.scrollTop;

		div.style.left = event.x+document.body.scrollLeft;
		div.style.display = "";
/*
		var startY = -100;
		div.style.left = 300;
		div.style.top = startY;


		while (startY <  200){
			startY = startY + 1;
			div.style.top = startY;
			div.style.display = "";
		}
*/
	}
}

//Stock Avail¿¡¼­ ¸¶¿ì½º ¿À¹ö½Ã °£·«ÇÑ ¼³¸í Ãâ·Â
function showHide2(key)
{
	var div = eval("document.all.I" + key);
	if(div.style.display == '') {
		div.style.display = "none";
	}else{
		if (key < 4)
			div.style.top = event.y +document.body.scrollTop;
		else if(key < 8 && key >= 4)
			div.style.top = event.y +document.body.scrollTop;
		else
			div.style.top = event.y +document.body.scrollTop;

		div.style.left = event.x+document.body.scrollLeft;
		div.style.display = "";
	}
}

//Quick Menu¿¡¼­ ¸¶¿ì½º ¿À¹ö½Ã °£·«ÇÑ ¼³¸í Ãâ·Â
function showHide3(key)
{
	var div = eval("document.all.Q" + key);
	if(div.style.display == '') {
		div.style.display = "none";
	}else{
		if (key == 1)
			div.style.top = event.y + 10;
		else if(key == 2)
			div.style.top = event.y + 10;
		else if(key == 3)
			div.style.top = event.y + 10;
		else if(key == 4)
			div.style.top = event.y + 10;
		else if(key == 5)
			div.style.top = event.y + 10;
		else if(key == 6)
			div.style.top = event.y + 10;
		else if(key == 7)
			div.style.top = event.y + 10;


		div.style.left = 30
		div.style.display = "";
	}
}



//Delivery page ÀÛ¾÷
function deli_detail(oc,od,c){
	document.frmdelidetail.OrderCd.value= oc;
	document.frmdelidetail.OrderDate.value= od;
	document.frmdelidetail.Contact.value= c;
	document.frmdelidetail.action="./delivery_detail.asp";

	document.frmdelidetail.submit();
}

//Card »ó¼¼³»¿ª Á¶È¸
function cardDetail(trno){
	document.frmCardDetail.action = "./cardpay_detail.asp";
	document.frmCardDetail.TRNO.value = trno;
	document.frmCardDetail.submit();

}

//Quotation detail
function quot_detail(q) {
	document.frmQuotView.qcd.value = q;
	document.frmQuotView.submit();
}

//Invoice View
function InvView(oc,n, custcd){
	//var args = new Object;
	//args.window = window;
	if (invview!=null){
			invview.close();
		}
	window.open('../order/view_Inv.asp?OrderCd=' + oc + '&InvNo=' + n + '&CUSTCD=' + custcd,'INVVIEW','left=200, top=50, width=650, height=700, scrollbars=yes');
	//showModalDialog('../order/view_Inv.asp?OrderCd=' + oc + '&InvNo=' + n,args,"dialogWidth=650,dialogHeight=700");
}

//card manual popup
function CardManual(){
	if(cardmanual!=null){
			cardmanual.close();
	}
	window.open('./cardmanul.asp','CardManual','left=300, top=200, width=400, height=200,  scrollbars=no');
}


//test session problem
function InvView2(){
	//var args = new Object;
	//args.window = window;
	//if (invview!=null){
	//		invview.close();
	//	}
	window.open('page1.asp');
	//showModalDialog('../order/view_Inv.asp?OrderCd=' + oc + '&InvNo=' + n,args,"dialogWidth=650,dialogHeight=700");
}

//Excell Invoice View
function xlsSave(p,o,i){
	if(p=='C'){
		location.href = '../order/saveToXls.asp?SID=' + i;
	}else if(p=='O') {
		location.href = '../order/saveToXls2.asp?OrderCd=' + o;
	}else if(p=='I') {
		location.href = '../order/saveToXls3.asp?OrderCd=' + o + '&InvNo=' + i;
	}
}


//Giro page
function giroView(oc,n){
	if (giroview!=null){
			giroview.close();
		}
	giroview = window.open('./giroview.asp?OrderCd=' + oc + '&InvNo=' + n,'INVVIEW','left=150, top=100, width=640, height=300, scrollbars=no');
}
//nitoce Popup
function popupNotice(n){
	if (noticePopup!=null){
			noticePopup.close();
		}
	noticePopup = window.open('./noticePopup.asp?newsid=' + n,'NOTICE','left=100, top=150, width=300, height=300, scrollbars=no');

	//if (noticePopup != null) {
	//	alert("ÇöÀç ÆË¾÷ÀÌ Â÷´ÜµÈ »óÅÂÀÔ´Ï´Ù. \n\n 'µµ±¸ ¡æ ÆË¾÷Â÷´Ü ¡æ ÆË¾÷À»Ç×»óÇã¿ë' À¸·Î ¼³Á¤ÇØ ÁÖ½Ã±â¹Ù¶ø´Ï´Ù.");
		//location.href = "./popuphelp.html";
	//}

}

//nitoce More
function noticeMore(){
	if (noticemore!=null){
			noticemore.close();
		}
	noticemore = window.open('../../function/home/more.asp','NOTICEMORE','left=150, top=100, width=450, height=340, scrollbars=no');
}

//Product Highlight
function highLight(l){
	if (highlight!=null){
			highlight.close();
		}
	highlight = window.open(l,'PRODHIGHLIGHT','left=100, top=50, width=900, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes');
}

//Promotion & event
function proEvent(l){
	if (proevent!=null){
			proevent.close();
		}
	proevent = window.open('./promotion.asp?ID=' + l ,'PROMOTION','left=100, top=150, width=880, height=700, scrollbars=yes, menubar=yes, status=yes, toolbar=yes');
}

//Promotion & event
function proEvent2(l){
	if (proevent!=null){
			proevent.close();
		}
	proevent = window.open(l ,'Event','left=410, top=150, width=420, height=500,scrollbars=no');
}


// ±¸Á¶°Ë»ö
function structure(l){
	if (highlight!=null){
			highlight.close();
		}
	highlight = window.open(l,'STRUCTURE','left=100, top=50, width=1100, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes');
}

//¸ÞÀÎ ¾Æ·¡ ÀÎÆ÷¸ÞÀÌ¼Ç¸Þ´º
function informOpen(l,t){
	if (inform!=null){
			inform.close();
		}
	if(t=="NIGHT") {
		inform = window.open(l,'INFORM','left=100, top=50, width=477, height=500');
	}else if(t=="LGCARD"){
		inform = window.open(l,'INFORM','left=100, top=50, width=800, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes');
	}else if(t=="KCS"){
		inform = window.open(l,'INFORM','left=50, top=20, width=650, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes');
	}else if(t=="ACTA"){
		// = window.open(l,'INFORM','left=100, top=50, width=600, height=580');
		inform = window.open(l,'INFORM','left=100, top=50, width=800, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes');
	}else if(t=="TARGETRON"){
		inform = window.open(l,'INFORM','left=100, top=50, width=500, height=550');
	}else if(t=="YFG"){
		inform = window.open(l,'INFORM','left=100, top=50, width=800, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes');
	}else{
		inform = window.open(l,'INFORM','left=410, top=200, width=600, height=387');
	}
}

//ÀÓ½Ã Ãß°¡ ÇÔ¼ö - À¥»çÀÌÆ® ¼³¹®Á¶»ç ¿ë
function informOpen2(l,t){
	if (inform2!=null){
			inform2.close();
		}
	if(t=="WEBSURVEY") {
		inform2 = window.open(l,'WEBSURVEY','left=200, top=200, width=480, height=300');
	}
}


//help ¿ÀÇÂ
function winHelpOpen(l,w,h){
		if (winHelp!=null){
			winHelp.close();
		}
		winHelp = window.open(l,'WINHELP','left=100, top=50, width=' + w + ', height=' + h + ', ,menubar=no, status=no, resizable, toolbar=no, scrollbars=yes');
}

//Mouse¿À¹ö½Ã Ä¿¼­ º¯°æ
function makeCursorHand(obj)
{
	obj.style.cursor = "hand";
}

//ÀüÃ¼¼±ÅÃ & ÀüÃ¼¼±ÅÃÇØÁ¦
function allcheck(obj){ //ÀüÃ¼ ÇØÁ¦
	if (obj=="WISH")	{
		for(var i = 0; i < document.insertCartProcess.length; i++) {
			if(document.insertCartProcess.elements[i].type == 'checkbox') {
					var ele = document.insertCartProcess.elements[i];
					ele.checked = ! ele.checked;
			}
		}
	}
	if (obj=="CARD")	{
		for(var i = 0; i < document.invlist.length; i++) {
			if(document.invlist.elements[i].type == 'checkbox') {
					var ele = document.invlist.elements[i];
					ele.checked = ! ele.checked;
			}
		}
	recalc1(0,0,0,0,0);
	}
     return;
}

//Áö³­°ßÀû »èÁ¦
function quotdel(q) {
	if(confirm("¸ñ·Ï¿¡¼­ »èÁ¦ÇÕ´Ï´Ù.")){
		document.frmDel.qcd.value = q;
		document.frmDel.submit();
	}
}


//CardCancel process
function payCancel(trno, tid, sno, ctype, ano){
	if (confirm("½ÂÀÎ¹øÈ£ " + ano + " ¸¦ Ãë¼ÒÇÕ´Ï´Ù. Ãë¼ÒÇÏ½Ã°Ú½À´Ï±î ?" + "\n\n" + "(Ãë¼ÒµµÁß Ã¢À» ´Ý°Å³ª, »õ·Î°íÄ§À» ÇÏ¸é ¿À·ù°¡ ¹ß»ýÇÒ ¼ö ÀÖ½À´Ï´Ù.)"))	{
		document.cookie = "Begin_Cancel_App=Y"
		document.frmPayCancel.tranxno.value = trno;
		document.frmPayCancel.title.value = tid;
		document.frmPayCancel.sequence_no.value = sno;
		document.frmPayCancel.CardType.value = ctype;
		document.frmPayCancel.submit();
	}
}

function profileSave(){
	document.frmProfileAdjust.submit();
}

//Ä«µå°áÁ¦ Ã¼Å©È®ÀÎ
function recalc1(yy,sn,ocd,ty,ivat) {
	var buf = "";
	var docall = document.all;
	var inv;
	var amt = 0;
	var oc = 0, vat = 0, net = 0;
	var InvCheck = false;
	var popup= 'N';

	if(ty == '5'){
		for(var i = 0; i < document.invlist.length; i++) {
			if(document.invlist.elements[i].type == 'checkbox') {
				if(document.invlist.elements[i].name == 'selInvoice' && document.invlist.elements[i].value== ocd + '@' + ivat){
					if(document.invlist.elements[i].ty == '5' && document.invlist.elements[i].checked){

						popup = 'A';
					}else if(document.invlist.elements[i].ty == '5' && ! document.invlist.elements[i].checked){

						popup = 'C';
					}
					for(var j = 0; j < document.invlist.length; j++) {
						if(document.invlist.elements[i].checked && document.invlist.elements[j].ser == sn){
							document.invlist.elements[j].checked = true;
						}else if(! document.invlist.elements[i].checked && document.invlist.elements[j].ser == sn){
							document.invlist.elements[j].checked = false;
						}

					}
				}
			}
		}
	}
	for(var i = 0; i < document.invlist.length; i++) {
		if(document.invlist.elements[i].checked) {
			amt += parseInt(document.invlist.elements[i].amt);
			oc += parseInt(document.invlist.elements[i].oc);
			vat += parseInt(document.invlist.elements[i].vat);
			net += parseInt(document.invlist.elements[i].net);
		}
	}

	document.all.totamt.innerText = fmtcur(amt);
	totoc.innerText = fmtcur(oc);
	totvat.innerText = fmtcur(vat);
	totnet.innerText = fmtcur(net);

	if(popup == 'A'){
		alert("Ã¼Å©ÇÏ½Å Invoice´Â Bill No : " + yy + "-" + sn + " À¸·Î ¹­¿©ÀÖ´Â InvoiceÀÔ´Ï´Ù. " + '\n' + yy + "-" + sn + "¸¦ ¸ðµÎ °áÁ¦ÇÕ´Ï´Ù.");
	} else if(popup == 'C'){
		alert("Ã¼Å©ÇÏ½Å Invoice´Â Bill No : " + yy + "-" + sn + " À¸·Î ¹­¿©ÀÖ´Â InvoiceÀÔ´Ï´Ù. " + '\n' + yy + "-" + sn + "¸¦ ¸ðµÎ Ãë¼ÒÇÕ´Ï´Ù.");
	}
}

//°áÁ¦¿äÃ» Ã¼Å©
function sbmt_check() {
	var amt;
	amt =document.all.totnet.innerText;
	if(amt == 0 ||  amt == 'NaN' ){
		alert("°áÁ¦ÇÏ½Ç Invoice¸¦ ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä.");
		return false;
	}

	if(document.invlist.cardType.selectedIndex > 0 && document.invlist.cardType.selectedIndex < 6){
		alert("°áÁ¦ ÆäÀÌÁö·Î µ¥ÀÌÅÍ¸¦ Àü¼ÛÇÕ´Ï´Ù.\n\nº¸¾È Á¤º¸Ã¢ÀÌ ³ª¿À¸é '¿¹'¸¦ ´­·¯ÁÖ¼¼¿ä.\n\n\n°áÁ¦ µµÁß »õ·Î°íÄ§, µÚ·Î°¡±âµîÀ» ´©¸£½Ã¸é °áÁ¦°¡ Áßº¹µÇ°Å³ª, ´©¶ôµÉ ¼ö ÀÖ½À´Ï´Ù.");
		document.invlist.submit();
	}
	else{
		alert("°áÁ¦ÇÏ½Ç Ä«µå¸¦ ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä.");
		//document.invlist.CardType.focus();
		return false;
	}
}

function sbmt_reset(){
	document.all.totamt.innerText = fmtcur(0);
	document.all.totoc.innerText = fmtcur(0);
	document.all.totvat.innerText = fmtcur(0);
	document.all.totnet.innerText = fmtcur(0);
	document.invlist.reset();
	}

//DealerCard
function dealerCard(){
	window.open('./before_DealerCard.asp','DEALERCARD','left=250, top=100, width=500, height=460, scrollbars=no');
}

//Dealer Card ³»¿ª Á¶È¸
function DPayView(){
	window.open('http://www.psys.co.kr/sigmaDealer/','DEALERCARD','left=200, top=100, width=900, height=700, scrollbars=yes');
}

//Card ¿µ¼öÁõ Ãâ·Â
function receiptPrint(tid, sno, com, ctype){
	if (receiptView!=null){
		receiptView.close();
	}
	if (ctype=='L0' || ctype=='L1'){
		if (tid.substr(-1,5)=='2949e'){
			receiptView = window.open('http://www.psys.co.kr/Member/ReceiptType.asp?VanType=d&Terminal_id=' + tid + '&sequence_no=' + sno + '&mode=SIGMA&UserName=' + com + '&Flag=' + ctype,'CARDREIPT','left=400, top=300, width=300, height=150, scrollbars=no') ;
		}else{
			receiptView = window.open('https://www.psys.co.kr/member/SIGMA_ReceiptType.asp?VanType=C&Terminal_id=' + tid + '&sequence_no=' + sno + '&mode=SIGMA&UserName=' + com + '&Flag=' + ctype,'CARDREIPT','left=400, top=300, width=300, height=150, scrollbars=no') ;
		}
	}else if(ctype=='L2'){
		receiptView = window.open('http://www.psys.co.kr/Member/ReceiptType.asp?VanType=d&Terminal_id=' + tid + '&sequence_no=' + sno + '&mode=SIGMA&UserName=' + com + '&Flag=' + ctype,'CARDREIPT','left=400, top=300, width=300, height=150, scrollbars=no') ;
	}else if(ctype=='K0'){
		receiptView = window.open('https://www.psys2.co.kr/member/SIGMA_ReceiptType.asp?VanType=C&Terminal_id=' + tid + '&sequence_no=' + sno + '&mode=SIGMA&UserName=' + com + '&Flag=' + ctype,'CARDREIPT','left=400, top=300, width=300, height=150, scrollbars=no') ;
	}

}

//Á¦Ç°°Ë»ö
function searchSbmt(){
	if (document.frmProdSearch.searchTxt.value.trim() == ''){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		document.frmProdSearch.searchTxt.focus();
		return false;
	}else{
		document.frmProdSearch.submit();
		return true;
	}
}

//chemdb -> Order
function ProdDetail(b, p){
	var brand;
	var prodno;
	brand = "" + b;
	prodno = "" + p;
	location.href="../order/order.asp?ID=SEARCH&BRAND=" + brand + "&CatNo=" + prodno;
}

//get More Information
function moreInform(p,l){
//	if (l=="ÀÌ°÷¿¡ Lot No¸¦ ÀÔ·ÂÇÏ¼¼¿ä" || l.trim()==""){
//		alert("Lot No¸¦ È®ÀÎÇÏ¼¼¿ä.");
//		return false;
//	}else {
//		if (sialCom!=null){
//			sialCom.close();
//		}
		//sialCom = window.open('http://www.sigmaaldrich.com/catalog/search/CertOfAnalysisPage/' +  p + '?LotNo=' + l,'SIALCOM','left=100, top=50, width=900, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes') ;
        sialCom = window.open('http://www.sigmaaldrich.com/catalog/AdvancedSearchPage.do','SIALCOM','left=100, top=50, width=900, height=700, ,menubar=yes, status=yes, resizable, toolbar=yes, scrollbars=yes') ;
//		return true;
//	}
}

//get More Information2
function moreInform2(p,b){
	if (sialCom!=null){
		sialCom.close();
	}
	sialCom = window.open('http://www.sigmaaldrich.com/catalog/search/ProductDetail/' + b + '/' + p,'SIALCOM','left=100, top=50, width=900, height=700, ,menubar=yes, status=no, resizable, toolbar=yes, scrollbars=yes') ;
	return true;

}

//µ¿ÀÏ CasNo ListÃ¢
function casNoView(casno){
	if (casnoview!=null){
			casnoview.close();
		}
	casnoview = window.open('./samecasno.asp?CasNo=' + casno,'CASNO','left=150, top=100, width=660, height=700, scrollbars=yes');
}
//Ends basic function for asp page #######################################################

//±âº» ÇÔ¼öµé
 /**
  * ÄíÅ°°ª ÃßÃâ
  * @param cookieName ÄíÅ°¸í
  */
 function getCookie( cookieName )
 {
  var search = cookieName + "=";
  var cookie = document.cookie;

  // ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
  if( cookie.length > 0 )
  {
   // ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
   startIndex = cookie.indexOf( cookieName );

   // ¸¸¾à Á¸ÀçÇÑ´Ù¸é
   if( startIndex != -1 )
   {
    // °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
    startIndex += cookieName.length;

    // °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
    endIndex = cookie.indexOf( ";", startIndex );

    // ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
    if( endIndex == -1) endIndex = cookie.length;

    // ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
    return unescape( cookie.substring( startIndex + 1, endIndex ) );
   }
   else
   {
    // ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
    return false;
   }
  }
  else
  {
   // ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
   return false;
  }
 }



 /**
  * ÄíÅ° ¼³Á¤
  * @param cookieName ÄíÅ°¸í
  * @param cookieValue ÄíÅ°°ª
  * @param expireDay ÄíÅ° À¯È¿³¯Â¥
  */
 function setCookie( cookieName, cookieValue, expireDate )
 {
  var today = new Date();
  today.setDate( today.getDate() + parseInt( expireDate ) );
  document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";";
 }



 /**
  * ÄíÅ° »èÁ¦
  * @param cookieName »èÁ¦ÇÒ ÄíÅ°¸í
  */
 function deleteCookie( cookieName )
 {
  var expireDate = new Date();

  //¾îÁ¦ ³¯Â¥¸¦ ÄíÅ° ¼Ò¸ê ³¯Â¥·Î ¼³Á¤ÇÑ´Ù.
  expireDate.setDate( expireDate.getDate() - 1 );
  document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
 }

 /*
  * ¿©·¯Á¦Ç°Àç°í°Ë»ö
  */
function selectProd(){
	var b = false;
	document.frmSelectProd.target='SELPAGE';
	document.frmSelectProd.prodno.value = document.frmSelectProd.prodno.value.toUpperCase();
	var brand = document.frmSelectProd.brand.value;
	var prodno = document.frmSelectProd.prodno.value;

	if (document.frmSelectProd.prodno.value.trim()==""){
		alert("Á¦Ç° ¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä");
		b = false;
		document.frmSelectProd.prodno.focus();
	}else{
		document.frmSelectProd.prodno.value='';
		document.SELPAGE.location.href = 'selected.asp?STYPE=I&brand=' + brand + '&prodno=' + prodno;
	}

	return b;
}

function delStockSearch(){
	var sel = document.frmSelCnfm.prodlist.selectedIndex;
	//alert(sel);
	document.frmSelCnfm.action = "./selected.asp?STYPE=D";
	if (sel==-1){
		alert("»èÁ¦ÇÒ Á¦Ç°À» ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä. \n\nShift ¶Ç´Â Ctrl Å°¸¦ ´©¸¥ ÈÄ Á¦Ç°À» ¼±ÅÃÇÏ¸é ÇÑ¹ø¿¡ ¿©·¯Á¦Ç°À» »èÁ¦ÇÒ ¼ö ÀÖ½À´Ï´Ù.");
	}else{
		document.frmSelCnfm.submit();
	}
}

function cnfmStockSearch(){
	parent.document.CNFMPAGE.location.href = './cnfmSearch.asp?STYPE=S';
}


function onUID(u){
	alert('ÇöÀç Á¢¼ÓµÈ ¹øÈ£´Â ' + u + ' ÀÔ´Ï´Ù.');
}

function popUp_script(url){
	window.open(url ,'popup','left=100, top=150, width=840, height=700, scrollbars=yes, menubar=no, status=yes, toolbar=yes');
}

