document.oncontextmenu = new Function ('return false');
document.ondragstart = new Function ('return false');
document.onselectstart = new Function ('return false');
//top.document.title = "µÎ¶õ³ë¸ôÀÔ´Ï´Ù"

function bookmark()
{
	window.external.AddFavorite('http://mall.duranno.com', 'µÎ¶õ³ë¸ô')
}


function createRequest(){
	request = false; 
	
	try {
		request = new XMLHttpRequest();
	} catch (trymicrosoft) {
		try {
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (othermicrosoft) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				request = false;
			}  
		}
	}
	
	if (!request)
	alert("XMLHttpRequest Error");
}	

function ajaxRequestXML(pUrl, pMethod, pFunc, pSend){
	createRequest();	
	
	// ¿äÃ» ¿­±â
	request.open(pMethod, pUrl, true);
	request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ecu-kr');

	// ÄÝ¹é ¸Þ¼Òµå Àü¼Û, send()Àü¿¡ ¼³Á¤ÇÒ °Í!
	request.onreadystatechange = pFunc;
	
	// ¿äÃ» Àü¼Û
	request.send(pSend);	
}




function EmptyCheck(str){
	for (index = 0; index < str.length; index++)
	{
		if (str.charCodeAt(index) != 32 && str.charCodeAt(index) != 9
		&& str.charCodeAt(index) != 13 && str.charCodeAt(index) != 10)
			return false;
	}
	
	return true;
} 

/**************************************************************************
	fucntion	:	°ø¹éÃ¼Å©
	input	:	elem(°´Ã¼), elemCaption(Å¸ÀÌÆ²)
	ouput	:	true(°ø¹é)
***************************************************************************/
function isEmpty(elem, elemCaption){
	if (elem.value)
		for (index = 0; index < elem.value.length; index++)
		{
			// °ø¹é ¹®ÀÚ(13), ¼öÆòÅÇ(HT-9), ¿£ÅÍ(CR-13, LF-10)°¡ ¾Æ´Ñ°Ô ÇÏ³ª¶óµµ ÀÖÀ¸¸é...
			if (elem.value.charCodeAt(index) != 32 && elem.value.charCodeAt(index) != 9
			&& elem.value.charCodeAt(index) != 13 && elem.value.charCodeAt(index) != 10)
				return false;
		}
	alert(elemCaption + "À»(¸¦) ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	elem.focus();
	return true;
} 

/***************************************************************************
	fucntion	:	¹®ÀÚ¿­ Ã¼Å©
	input	:	elem(°´Ã¼), elemCaption(Å¸ÀÌÆ²), lenMin(ÃÖ¼Ò±æÀÌ), lenMax(ÃÖ´ë±æÀÌ), 
					iFlag = 0 : ¿µ¹®ÀÚ, ¼ýÀÚ, '_', '-', '.' ¸¸ Çã¿ë(¾ÆÀÌµð µî Ã¼Å©) 
					iFlag = 1 : ¼ýÀÚ¸¸ Çã¿ë
					iFlag = 2 : ÇÑ±Û¸¸ Çã¿ë
	ouput	:	true,false
***************************************************************************/
function stringCheck(elem, elemCaption, lenMin, lenMax, iFlag){
	if (elem.value.length < lenMin || elem.value.length > lenMax){
		if(lenMin==lenMax)
			alert(elemCaption + 'Àº(´Â) ' + lenMin + 'ÀÚ¸®ÀÔ´Ï´Ù');
		else
			alert(elemCaption + 'Àº(´Â) ' + lenMin + '~' + lenMax + 'ÀÚ±îÁö °¡´ÉÇÕ´Ï´Ù');
			
		elem.focus();	
		return false;
	} 
	
	//iFlag = 0 : ¿µ¹®ÀÚ, ¼ýÀÚ, '_', '-', '.' ¸¸ Çã¿ë(¾ÆÀÌµð µî Ã¼Å©)
	if ( eval(iFlag) == 0 ){
		var str=/^[A-Za-z0-9]+$/;		
		if(!str.test(elem.value)){
			alert(elemCaption + ' ÀÔ·ÂÀº ¿µ¹®, ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù');
			elem.focus();
			return false;
		}
	}	
	
	//iFlag = 1 : ¼ýÀÚ¸¸ Çã¿ë
	else if ( eval(iFlag) == 1){
		var str=/^[0-9]+$/;		
		if(!str.test(elem.value)){
			alert(elemCaption + ' ÀÔ·ÂÀº ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù');
			elem.focus();
			return false;
		}
	}	
	
	//iFlag = 2 : ÇÑ±Û¸¸ Çã¿ë
	else if( eval(iFlag) == 2){
		var str=/\s/;		
		if(str.test(elem.value)){
				alert(elemCaption + '¿¡´Â °ø¹éÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù');	
				elem.focus();
				return false;			
		}
	} 
	
	//iFlag = 3 : ¼ýÀÚ, . ¸¸ Çã¿ë
	else if ( eval(iFlag) == 3){
		var str=/^[0-9.]+$/;		
		if(!str.test(elem.value)){
			alert(elemCaption + ' ÀÔ·ÂÀº ¼ýÀÚ, .¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù');
			elem.focus();
			return false;
		}
	}		
	
	//iFlag = 4 : ¿µ ¹®
	else if ( eval(iFlag) == 4 ){
		var str=/^[A-Za-z ]+$/;		
		if(!str.test(elem.value)){
			alert(elemCaption + ' ÀÔ·ÂÀº ¿µ¹®¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù');
			elem.focus();
			return false;
		}
	}	
	
	//iFlag = 5 : ¼ýÀÚ, - ¸¸ Çã¿ë
	else if ( eval(iFlag) == 5){
		var str=/^[0-9-]+$/;		
		if(!str.test(elem.value)){
			alert(elemCaption + ' ÀÔ·ÂÀº ¼ýÀÚ, .¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù');
			elem.focus();
			return false;
		}
	}		
	return true;
}

/********************************* 
¼³¸í : ÀÌ¸ÞÀÏ Çü½Ä Ã¼Å©
*********************************/
function checkEmail(elem){
	if ( elem == null || elem.value == "" ) return;
	//	var str=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 	var str=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	
	if ( !str.test(elem.value) )
	{
		alert("E-mail ÁÖ¼Ò Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		elem.focus();
		return false;
	}
	return true;
}

function addEvent( obj, type, fn ) {
    if (obj.addEventListener) obj.addEventListener( type, fn, false ); //FF
    else if (obj.attachEvent) { //IE
        obj["e"+type+fn] = fn;
        obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
        obj.attachEvent( "on"+type, obj[type+fn] );
    }
}

function CommaIn(num) {
	 var f = String(num);
    var minusFlag = false;
    var decimalString1="";
    var decimalString2="";
    var tempString1 = "";
    var tempString2 = "";
    var tempString3 = "";
    var i=0;
        if (f.indexOf(".") != -1) { //¼Ò¼öÁ¡ÀÌ Æ÷ÇÔµÈ ¼ýÀÚÀÎÁö È®ÀÎ
            decimalString1 = f.substring(0, f.indexOf(".")); //. À­ºÎºÐ
            decimalString2 = f.substring(f.indexOf(".")+1);  //. ´ÙÀ½ ºÎºÐ
        } else {
            var decimalString1 = f;
        }
        if (decimalString1.substring(0,1) == "-") { //¸¶ÀÌ³Ê½º(-) ±âÈ£°¡ ÀÖ´ÂÁö È®ÀÎ
      minusFlag = true;
      decimalString1 = decimalString1.substring(1);
        }
        for(i=decimalString1.length-1; i>-1; i--) { //¼ýÀÚ¸¦ µÚÁý±â
      tempString1 = tempString1 + decimalString1.charAt(i);
        }
        for (i=0; i<tempString1.length; i++) { //µÚÁýÀº ¼ýÀÚ¿¡ ÄÞ¸¶(,) ³Ö±â
      if ((i%3) == 0) {
                if (i != 0) { tempString2 = tempString2 + ","; }
            }
            tempString2 = tempString2 + tempString1.charAt(i);
        }
        for (i=tempString2.length-1; i>-1; i--) { //ÄÞ¸¶(,)³ÖÀº ¼ýÀÚ ´Ù½Ã µÚÁý±â
            tempString3 = tempString3 + tempString2.charAt(i);
        }
        if (decimalString2 != "") { //¼Ò¼öÁ¡ ºÙÀÌ±â
            tempString3 = tempString3 + "." + decimalString2;
        }
        if (minusFlag) { //¸¶ÀÌ³Ê½º(-)°¡ ÀÖ¾ú´ø °æ¿ì¿¡
            tempString3 = "-" + tempString3;
        }
        return  tempString3;
}

function CommaOut(num) {
    var tempString1 = "";
    var tempString2 = "";
    var i=0;
    tempString1 = num;

    for (i=0; i<tempString1.length; i++) { //µÚÁýÀº ¼ýÀÚ¿¡ ÄÞ¸¶(,) »©±â
  if ((i%3) == 0) {
            if (i != 0) { tempString2 = tempString2 + ""; }
        }
        if ( tempString1.charAt(i) != "," ) {
            tempString2 = tempString2 + tempString1.charAt(i);
        }
    }
    return tempString2;
}

/********************************* 
¼³¸í : ¼ýÀÚ¸¸ ÀÔ·Â
*********************************/
function num_only(){
   if ((window.event.keyCode == 8) || (window.event.keyCode == 46)) { //¹é½ºÆäÀÌ½ºÅ°¿Í delÅ°´Â ¸Ô°ÔÇÑ´Ù.
      window.event.returnValue=true;
   } else if( (window.event.keyCode<48) || (window.event.keyCode>57) ) {
      window.event.returnValue=false;
  }
}
  

/********************************* 
¼³¸í : Æ÷Ä¿½º ÀÌµ¿
*********************************/
function NextFocus(obj1, obj2, len){
	if (obj1.value.length == len){
		obj2.focus();
	}
}

//ÀÔ·ÂÇÑ tabIndex·Î °´Ã¼¸®ÅÏ
function GetObjectByTabIndex(index){
	for (i = 0; i < document.forms[0].length; i++){
		tmp = document.forms[0].elements[i];
		if (tmp.tabIndex == index){
			return tmp;
		}
	}
	return null;
}



function AjaxRequest(strResponseURL,fSuccess, fError, frm)
{
	var httpObj = new Ajax.Request
	(
		strResponseURL, 
		{
			 method:'post',
		    parameters:Form.serialize(frm),    
		    onSuccess:fSuccess,
		    onFailure:fError 
		}
	);
}



/**************************************************************************
	fucntion	:	³¯Â¥Çü½Ä Ã¼Å©
	input	:	elem(°´Ã¼), elemCaption(Å¸ÀÌÆ²)
	ouput	:	true(YYYY-MM-DD)
***************************************************************************/
function FormatDate(elem, elemCaption){
	var day = elem.value;
	var dateArr = 	day.split("-");
	var str=/^[0-9]+$/;

	if (dateArr.length != 3){
		alert(elemCaption + "ÀÇ ³¯Â¥ Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.(YYYY-MM-DD)");
		elem.focus();
		return false;
	}
	
	for(var i = 0 ; i < dateArr.length ; i++){
		if(!str.test(dateArr[i])){
			alert(elemCaption + "ÀÇ ³¯Â¥ Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.(YYYY-MM-DD)");
			elem.focus();
			return false;
		}
	}
	
	if (dateArr[0].length != 4){
		alert(elemCaption + "ÀÇ ¿¬µµÀÇ Çü½Ä(YYYY)ÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");		
		elem.focus();
		return false;
	}
	
	if (dateArr[1].length != 2){
		alert(elemCaption + "ÀÇ ¿ùÀÇ Çü½Ä(MM)ÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");		
		elem.focus();
		return false;
	}	

	if ((Number(dateArr[1]) < 1) || (Number(dateArr[1]) > 12)){
		alert(elemCaption + "ÀÇ ¿ùÀ» 1~12 »çÀÌ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.");		
		elem.focus();
		return false;
	}		
	
	if (dateArr[2].length != 2){
		alert(elemCaption + "ÀÇ ÀÏÀÇ Çü½Ä(DD)ÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");		
		elem.focus();
		return false;
	}		
	
	if ((Number(dateArr[2]) < 1) || (Number(dateArr[2]) > 32)){
		alert(elemCaption + "ÀÇ ÀÏÀ» 1~31 »çÀÌ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.");		
		elem.focus();
		return false;
	}	
		
	return true;
	
}

/********************************* 
¼³¸í : ³¯Â¥ Â÷ÀÌ
*********************************/
function DATEDIFF(date1, date2){
	var v1=date1.split("-");
	var v2=date2.split("-"); 
	
 	var a1=new Date(v1[0],v1[1],v1[2]).getTime();
 	var a2=new Date(v2[0],v2[1],v2[2]).getTime();

	return (a2 - a1) /(1000*60*60*24);
}

/********************************* 
¼³¸í : ·Î±×ÀÎ Ã¢
*********************************/
function login_pop(surl){
	parent.location.href = "/member/login_page.asp?prepage=" + surl;
}


/********************************* 
¼³¸í : ÀÌ¹ÌÁö º¯°æ 
*********************************/
function setImage(obj, src1){
	var elementImg = document.getElementById(obj);	
   elementImg.setAttribute("src", src1); 
}

/********************************* 
¼³¸í : °³Ã¼ ³ôÀÌ º¯°æ
*********************************/
function setObjHeight(obj, h){
	obj.height = h;
}


/********************************* 
¼³¸í : »õÃ¢
*********************************/
function WinOpen(lnk, nam,iw,ih,sb, iflg){
	if (iflg == 0){
		it = 0; il=0
	}else if(iflg == 1){
		it = (screen.width -iw)/2; il = (screen.Height-ih)/2
	}
	window.open(lnk, nam, 'width='+iw+',height='+ih+',top='+it+',left='+il+',scrollbars='+sb)
}

/********************************* 
¼³¸í : Á¦¸ñ Å¬¸¯!!
*********************************/
function ClickContent(no, icnt, nam){
	var obj = document.getElementById(nam + no);
	var objDis = obj.style.display;

	for(var i=0; i <= icnt; i++){document.getElementById(nam+ i).style.display = "none";}

	if ((objDis == "none") || (objDis == ""))
		obj.style.display = "block";	
	else
		obj.style.display = "none";	
	
	setHeight();
}

/********************************* 
¼³¸í : Ã¼Å©¹Ú½º Ã¼Å©ÇÏ±â
*********************************/
function AllCheck(frm, svalue){		
	var obj;

	for( i=0; i< frm.length; i++){		
		obj = frm.elements[i];
		if (obj.type=='checkbox' && (typeof(obj) == "[object]" || typeof(obj) == "object"))	obj.checked = svalue;
	}	
}



/********************************* 
¼³¸í : Ã¼Å©¹Ú½º Ã¼Å©ÇÏ±â
*********************************/
function NameCheck(frm, nam, svalue){		
	var obj;
	
	for( i=0; i< frm.length; i++){		
		obj = frm.elements[i];
		
		if (obj.type=='checkbox' && (typeof(obj) == "[object]" || typeof(obj) == "object") && (obj.name.substring(0,4) == nam))	obj.checked = svalue;
	}	
}

/********************************* 
¼³¸í : Ã¼Å©¹Ú½º Ã¼Å© count
*********************************/
function getCheckBoxCount(frm)
{
	var j = 0;
	for( i=0; i< frm.length; i++){
		e=frm.elements[i];
		if (e.type=='checkbox' && e.checked) j++
	}
	return j;		
}

/********************************* 
¼³¸í : ¼îÇÎ°¡ÀÌµå > »óÇ°Æò °¡ÀÌµå Å¬¸¯
*********************************/
function ClickReview(no, cnt){
	location.href = "#Review";
	Freview.ClickContent(no, cnt, 'con');

}


/********************************* 
¼³¸í : ÄíÆù¹Þ±â
*********************************/
function getCoupon(no){
	ajaxRequestXML("/detail/coupon_receive.asp?id=" + no , "GET", updateCoupon, null);
}

function updateCoupon(){
	if (request.readyState == 4){
	if (request.status == 200){	
		try{ 
				var returnData = eval('(' + request.responseText + ')');
				
				if (returnData.response[0].ierr == "1"){alert("ÄíÆù ¹ß±ÞÀ» ½ÇÆÐÇß½À´Ï´Ù!");return;}									
				if (returnData.response[0].irtn != "OK"){alert("ÄíÆùÀÌ ÀÌ¹Ì ¹ß±ÞµÇ¾ú½À´Ï´Ù!");return;}
				else{alert("ÄíÆùÀÌ ¹ß±ÞµÇ¾ú½À´Ï´Ù!");return;}
		}catch(e){
			alert("½ÇÆÐ!!");
		}	
	}
	else if (request.status == 404){ 
		alert("Request URL does not exist");
	}
	else{ 
		alert("ERROR : status cod is " + request.status);
	}
}		
}	

/********************************* 
¼³¸í : ÀÌº¥Æ® ÆäÀÌÁö·Î °í°í
*********************************/
function goEvent(){
	var obj = document.getElementById("sltEvent");
	var objV = obj.options[obj.selectedIndex].value;
	
	if (objV != "")	location.href = "/event/event.asp?eid=" + objV;
}

/********************************* 
¼³¸í : Element display
*********************************/
function ElementDispaly(nam, values){
	document.getElementById(nam).style.display = values;
}


/********************************* 
¼³¸í : ¹Ì¸®º¸±â
*********************************/
function Ebook(pre_itm_num){
	temp_url = "http://mall.duranno.com/ebook/" + pre_itm_num + "/" + pre_itm_num + ".htm";
	var newwindow = window.open(temp_url, "", "width=740,height=570,left=0,right=0,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no");
}


/********************************* 
	fucntion	:	¿É¼Ç °³º° Á¤º¸  start
*********************************/
var TotPri = 0;
var TotCnt = 0;
var TotI = 0

//ÃÊ±âÈ­
function SetInit(pri, cnt){
	TotPri = pri;
	TotCnt = cnt;
	TotI = 0
}


//¿É¼Ç Á¤º¸ °¡Á®¿À±â
function SetOptInfo(frm){
	var obj = document.getElementById("mtid_opt");
	var sValue = obj.options[obj.selectedIndex].value;
	
	ajaxRequestXML("/detail/detail_option_Info.asp?id=" + sValue , "GET", updateOption, null);
}	

//¿É¼Ç Á¤º¸
function updateOption(){	
	if (request.readyState == 4){
		if (request.status == 200){	
			try{ 
					var returnData = eval('(' + request.responseText + ')');
					
					if (returnData.response[0].opt_out_stk == "1"){location.reload();return;}									
					
					document.getElementById("opt_mny").value = returnData.response[0].opt_mny;
					document.getElementById("opt_lit_qty").value = returnData.response[0].opt_lit_qty;
					document.getElementById("opt_cnt").value = returnData.response[0].opt_lit_qty;
					document.getElementById("opt_stk").value = returnData.response[0].opt_stk;
					document.getElementById("opt_stk_use").value = returnData.response[0].opt_stk_use;
			}catch(e){
				alert("½ÇÆÐ!!");
			}	
		}
		else if (request.status == 404){ 
			alert("Request URL does not exist");
		}
		else{ 
			alert("ERROR : status cod is " + request.status);
		}
	}		
}	

//¿É¼Ç Ãß°¡
function AddOption(){
	if (!FF_DATA_CHK()) return; 
	
	
	var obj = document.getElementById("mtid_opt");
	var optId = obj.options[ obj.selectedIndex].value;
	var optName = obj.options[ obj.selectedIndex].text;
	var opt_cnt = document.getElementById("opt_cnt").value;
	var sel_cst = document.getElementById("sel_cst").value;
	var opt_mny = document.getElementById("opt_mny").value;
	var optIdSummary = document.getElementById(optId);
	var optPri = parseInt(opt_cnt) * (parseInt(sel_cst) + parseInt(opt_mny));	

	if (optIdSummary == null){		
		TotI++;
		
		if (TotI <= 10){OptionCreate(optId, optName, optPri);}
		else{alert("¿É¼ÇÀº 10°³±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù.");return;}
	}else{
		OptionUpdate(optId, optPri);
	}
	
	SetTotPri(optPri, parseInt(opt_cnt));		
}

//¿É¼Ç Ãß°¡½Ã Ã¼Å© »çÇ×
function FF_DATA_CHK(){	
	var obj = document.getElementById("mtid_opt");
	var tid = obj.options[obj.selectedIndex].value;	
	var opt_cnt = document.getElementById("opt_cnt");
	var opt_lit_qty = document.getElementById("opt_lit_qty");
	var opt_stk_use = document.getElementById("opt_stk_use");
	var opt_stk = document.getElementById("opt_stk");	
	var cnt = 0;
	
	try{
		cnt = document.getElementById("mtid_cnt_" + tid).value;
	}catch(ex){
		cnt = 0;
	}finally{
	}


	if(tid == ""){
		alert("¿É¼ÇÀ» ¼±ÅÃÇÏ½Ê½Ã¿À.");
		obj.focus();
		return false;
	}		
	
	if (isNaN(opt_cnt.value)){
		alert("¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
		opt_cnt.focus();
		return false;
	}

	if ((parseInt(opt_cnt.value) + parseInt(cnt) < parseInt(opt_lit_qty.value)) || (EmptyCheck(opt_cnt.value))){
		alert("ÃÖ¼Ò ÁÖ¹® ¼ö·®ÀÌ " + opt_lit_qty.value + "ÀÔ´Ï´Ù");
		opt_cnt.value = opt_lit_qty.value;
		opt_cnt.focus();
		return false;
	}			

	if (opt_stk_use.value == "Y"){				
		if (parseInt(opt_cnt.value) + parseInt(cnt) > parseInt(opt_stk.value)){	
			alert("ÇöÀç Àç°í°¡ " + opt_stk.value + "°³ ÀÔ´Ï´Ù.");
			opt_cnt.focus();
			return false;
		}
	}		
	
	return true;		
}


//¿É¼Ç Ãß°¡
function OptionCreate(pId, pName, pPri){
	var optionsSummary = document.getElementById("optionsSummary");
	var opt_cnt = document.getElementById("opt_cnt").value;
	var cdiv = document.createElement("div"); 	
	cdiv.setAttribute("id", pId);
	cdiv.style.background = "#F6F5F1";

	if (isNaN(pPri) == true){location.reload();return;}

	optionsSummary.appendChild(cdiv); 	
			
	var s = "<ul id='" + pId +"'>";
	s = s + "<li class='tit'>" + pName + "</li>"
	s = s + "<li class='cnt' id='cnt" + pId + "'>" + CommaIn(opt_cnt)+ "</li>"
	s = s + "<li class='pri' id='pri" + pId + "'>" + CommaIn(pPri) + "</li>"
	s = s + "<li class='del'><img src='/detail_images/bt_op_delete.gif' width='13' height='13' onclick='DelOption(" + pId + ")' style='cursor:pointer'/></li>"
	s = s + "<li class='hidden'><input type='text' name='mtid_id_" + pId +"' value='" + pId +"'></li>";
	s = s + "<li class='hidden'><input type='text' name='mtid_cnt_" + pId +"' value='" + opt_cnt + "'></li>";		
	s = s + "<li class='hidden'><input type='text' name='mtid_pri_" + pId +"' value='" + pPri + "'></li>";
	s = s + "</ul>"
	

	cdiv.innerHTML = s ;		
	optionsSummary.style.display = "block";
}


//¿É¼Ç ¾÷µ¥ÀÌÆ®
function OptionUpdate(pId, optPri){
	var mtid_cnt = document.getElementById("mtid_cnt_" + pId).value;
	var mtid_pri = document.getElementById("mtid_pri_" + pId).value;
	var opt_cnt = document.getElementById("opt_cnt").value;
	
	var cnt = parseInt(mtid_cnt) + parseInt(opt_cnt);
	var pri = parseInt(mtid_pri) + optPri;
	
	document.getElementById("cnt" + pId).innerText = cnt;
	document.getElementById("pri" + pId).innerText = CommaIn(pri);
	document.getElementById("mtid_cnt_" + pId).value = cnt;
	document.getElementById("mtid_pri_" + pId).value = pri;
	
}
	
//¿É¼Ç »èÁ¦
function DelOption(optId){
	var mtid_pri = document.getElementById("mtid_pri_"+ optId).value;
	var mtid_cnt = document.getElementById("mtid_cnt_"+ optId).value;
	
	TotI--;
	
	SetTotPri(parseInt(mtid_pri) * -1, parseInt(mtid_cnt) * -1);
	document.getElementById(optId).removeNode(true);	
}

//¿É¼Ç ±Ý¾× °è»ê
function SetTotPri(pri,cnt){
	TotPri = TotPri + pri;
	TotCnt = TotCnt + cnt;
	
	document.getElementById("totOrderPri").innerText = CommaIn(TotPri);
	document.getElementById("cnt").value = TotCnt;
		
	if (TotPri <= 0) {optionsSummary.style.display = "none"; SetInit(0,0)};
}

/********************************* 
	fucntion	:	¿É¼Ç °³º° Á¤º¸ end
*********************************/



/********************************* 
	fucntion	:	¿ìÆí¹øÈ£
*********************************/
function Zip(gubn){
	WinOpen("/common/zipsearch.asp?gubn=" + gubn, "zip", 440,290,"yes", 0)
}

/********************************* 
	fucntion	:	¿ÀºêÁ§Æ®
*********************************/
function getElement(obj){
	return document.getElementById(obj);
}

/********************************* 
	fucntion	:	 ÄíÅ°°ª ¼³Á¤
*********************************/
function setCookie(name, value, expiredays)
{
		var today = new Date();
		today.setDate( today.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
}

/********************************* 
// ÄíÅ°°ª °¡Á®¿À±â
*********************************/
function getCookie(key)
{
	var cook = document.cookie + ";";
		var idx =  cook.indexOf(key, 0);
		var val = "";

		if(idx != -1)
		{
  			cook = cook.substring(idx, cook.length);
  			begin = cook.indexOf("=", 0) + 1;
  			end = cook.indexOf(";", begin);
 	 		val = unescape( cook.substring(begin, end) );
		}

		return val;
}

function CreateControlFlash(DivID, w, h, sURL)
{
  getElement(DivID).innerHTML ='<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=' + w + ' height=' + h +'><param name="movie" value=' + sURL + '><param name="quality" value="high"><embed src=' + sURL + ' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width=' + w + ' height=' + h +'/></object>';
}

function getCartSmmary(){
	var s = ""
	s = "<div class='SummarySub'>";
	s = s + "<img src='/detail_images/pop_cart.gif' width='200' height='118'>"
	s = s + "<div id='SummaryBtn'>"
	s = s + "<a href='javascript:ElementDispaly(\"cartSummary\", \"none\")'><img src='/detail_images/pop_bt_continue.gif' width='82' height='31'></a>";
	s = s + "<a href='/order/Order01.asp' target='_parent'><img src='/detail_images/pop_bt_cart.gif' width='82' height='31'></a>";
	s = s + "</div>"
	s = s + "</div>"
	
	return s;
}


function getWishSmmary(){
	var s = ""
	s = "<div class='SummarySub'>";
	s = s + "<img src='/detail_images/pop_wish.gif' width='200' height='118'>"
	s = s + "<div id='SummaryBtn'>"
	s = s + "<a href='javascript:ElementDispaly(\"cartSummary\", \"none\")'><img src='/detail_images/pop_bt_continue.gif' width='82' height='31'></a>";
	s = s + "<a href='/member/mypage/wish.asp' target='_parent'><img src='/detail_images/pop_bt_wish.gif' width='82' height='31'></a>";
	s = s + "</div>"
	s = s + "</div>"
		
	return s;
}

function openView(itm_num){
	parent.getElement("viewItem").style.display = "block";
	parent.getElement("viewItem").style.top = Math.round((parent.document.documentElement.offsetHeight-450)/2+parent.document.documentElement.scrollTop)+'px';
	parent.getElement("viewItem").style.left = Math.round((parent.document.documentElement.offsetWidth-920)/2+parent.document.documentElement.scrollLeft)+'px';
	parent.FviewItem.location.href = "/detail/Item_Detail_View.asp?itm_num=" + itm_num;
}

function closeView(itm_num){
	parent.getElement("viewItem").style.display = "none";
	parent.FviewItem.location.href = "/detail/Item_Detail_View.asp?itm_num=" + itm_num;
}


// Àå¹Ù±¸´Ï ´ã±â °øÅë
function goCartAddCmm(div, itm_num, obj){
	var postParam = getSendParamCmm(1, div, itm_num);
	
	setSmrPosition(obj, itm_num);

	ajaxRequestXML("/order/Cart_Insert.asp", "POST", updateCartCmm, postParam);		
}

function getSendParamCmm(ord_cnt, ord_div, itm_num){
	var s = "", s1 = "";
	s = s + "itm_num=" + itm_num;
	s = s + "&cnt=" + ord_cnt;
	s = s + "&div=" + ord_div;
	
	return s + s1;
}	

/*
Àû¸³±Ý¼¥ - Àå¾Ö´ö(2009-12-01~2009-12-10) START
Ãß°¡»çÇ× : mbr_pot, ¿¡·¯ÄÚµå :  "P01", "P02"
Àû¸³±Ý¼¥ - Àå¾Ö´ö(2009-12-01~2009-12-10) END
*/
function updateCartCmm(){
	if (request.readyState == 4){
		if (request.status == 200){	
			try{ 
					var returnData = eval('(' + request.responseText + ')');
					var dberr = returnData.response[0].dberr;
					var div = returnData.response[0].div;
					var mbr_pot = returnData.response[0].mbr_pot;
					
			}catch(e){
				alert("½ÇÆÐ!!");
			}	
			
			if (dberr == "0"){
				if (div == "C") getElement("cartSummary").innerHTML = getCartSmmary();
				else getElement("cartSummary").innerHTML = getWishSmmary();
				
				ElementDispaly('cartSummary', 'block');
			}else if (dberr == "1"){
				var msg;
				if (div == "C") msg = "Àå¹Ù±¸´Ï ´ã±â¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.";
				else msg = "º¸°üÇÔ ´ã±â¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.";	
				alert("Àç°í°¡ ¾ø½À´Ï´Ù.\n" + msg);			
				location.reload();				
			}else if (dberr == "P01"){
				alert("Àû¸³±ÝÀÌ ºÎÁ·ÇÏ¿© ±¸¸ÅÇÏ±â¸¦ ½ÇÆÐÇß½À´Ï´Ù.\n³ªÀÇ Àû¸³±Ý : " + mbr_pot );											
			}else if (dberr == "P02"){
				alert("µÎ¶õ³ë¸ô È¸¿ø Àü¿ë ¼­ºñ½ºÀÔ´Ï´Ù.");							
				return;				
			}	
					

		}
		else if (request.status == 404){ 
			alert("Request URL does not exist");
		}
		else{ 
			alert("ERROR : status cod is " + request.status);
		}
	}				
}
// Àå¹Ù±¸´Ï ´ã±â °øÅë

// Àå¹Ù±¸´Ï ´ã±â »ó¼¼
function goCartAdd(div){		
	
	var postParam = "";
	var cnt;
	
	cnt = getElement("cnt").value;
	var mitm_lim_qty = getElement("mitm_lim_qty").value;
	
	if (getElement("MITM_OPT_USE").value == "Y"){
		var mtid_opt = getElement("mtid_opt").options[getElement("mtid_opt").selectedIndex].value;
		if (mtid_opt == ""){
			getElement("mtid_opt").focus();
			alert("¿É¼ÇÀ» ¼±ÅÃÇÏ½Ê½Ã¿À.");
			return;
		}
		
		if (parseInt(getElement("totOrderPri").outerText) <= 0){
		 	alert("¿É¼ÇÀ» Ãß°¡ÇØÁÖ½Ê½Ã¿À.");
		 	return;
		}
	}	
	
	if (cnt < parseInt(mitm_lim_qty)){
		alert("ÁÖ¹® ¼ö·®Àº " + mitm_lim_qty + "°³ ÀÌ»ó¸¸ °¡´ÉÇÕ´Ï´Ù.");	
		getElement("cnt").value = mitm_lim_qty;
		setSumPri();
		return;
	}			
	
	if (getElement("mitm_vir_chk").value == "1"){
		var mitm_vir_stk = getElement("mitm_vir_stk").value;
		if (cnt > parseInt(mitm_vir_stk)){
			alert("ÁÖ¹® ¼ö·®Àº " + mitm_vir_stk + "°³ ÀÌÇÏ¸¸ °¡´ÉÇÕ´Ï´Ù.");	
			getElement("cnt").value =mitm_vir_stk;
			setSumPri();
			return;			
		}
	}
		
	var iPresentCnt = getElement("iPresentCnt").value;
	if (parseInt(iPresentCnt) > -1 ){
		var present, vir_chk, presentNam;
		
		for(var i=0; i <= iPresentCnt; i++){
			present = parseInt(document.getElementById("PresentAmt" + i).value);
			vir_chk = document.getElementById("PresentVirChk" + i).value;
			presentNam = document.getElementById("presentNam" + i).value;
			
			if ((cnt > present) && (vir_chk == "Y")){
				if(!confirm("»çÀºÇ° " + presentNam + "ÀÇ ¼ö·®ÀÌ ºÎÁ·ÇÕ´Ï´Ù. ÁÖ¹®À» ÇÏ½Ã°Ú½À´Ï±î?")){
					return;
				}								
			}			
		}
	}
	
	postParam = getSendParam(cnt, div);

	ajaxRequestXML("/order/Cart_Insert.asp", "POST", updateCart, postParam);
	
}

function getSendParam(ord_cnt, ord_div){
	var s = "", s1 = "";
	s = s + "itm_num=" + getElement("itm_num").value;
	s = s + "&cnt=" + ord_cnt;
	s = s + "&div=" + ord_div;
	s = s + "&msp_num=" + getElement("msp_num").value;
	
	if (getElement("MITM_OPT_USE").value == "Y"){
		var child = document.getElementById("optionsSummary").childNodes;
		s = s + "&mtid_id="
		
		for(i=0; i < child.length; i++){
			if(child[i].id != 'dotline'){
				s = s + document.getElementById("mtid_id_" + child[i].id).value +  ",";
				s1 = s1 + "&mtid_cnt_" + child[i].id + "=" + document.getElementById("mtid_cnt_" + child[i].id).value;
			}
		}
	}
	
	return s + s1;
}

function setSumPri(){
	var cnt;
	var salePri = getElement("itm_sel_cst").value;
	cnt = getElement("cnt").value;
	getElement("totOrderPri").innerText = CommaIn(salePri * cnt);
}

/*
Àû¸³±Ý¼¥ - Àå¾Ö´ö(2009-12-01~2009-12-10) START
Ãß°¡»çÇ× : mbr_pot, ¿¡·¯ÄÚµå :  "P01", "P02"
Àû¸³±Ý¼¥ - Àå¾Ö´ö(2009-12-01~2009-12-10) END
*/
function updateCart(){
	if (request.readyState == 4){
		if (request.status == 200){	
			try{
					var returnData = eval('(' + request.responseText + ')');
					var dberr = returnData.response[0].dberr;
					var div = returnData.response[0].div;
					var mbr_pot = returnData.response[0].mbr_pot;

			}catch(e){
				alert("½ÇÆÐ!!");
			}	

			if (dberr == "0"){
				if (div == "C") getElement("cartSummary").innerHTML = getCartSmmary();
				else getElement("cartSummary").innerHTML = getWishSmmary();
						
				ElementDispaly('cartSummary', 'block');
				
			}else{
				var msg;
				if (div == "C") msg = "Àå¹Ù±¸´Ï ´ã±â¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.";
				else msg = "º¸°üÇÔ ´ã±â¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.";	
					
				if (dberr == "1"){
					alert("Àç°í°¡ ¾ø½À´Ï´Ù.\n" + msg);			
				}else if (dberr == "2"){
					alert("ÃÖ¼Ò ÁÖ¹® ¼ö·®ÀÌ»ó ÁÖ¹®ÇÏ¼Å¾ß ÇÕ´Ï´Ù.\n" + msg);			
				}else if (dberr == "3"){
					alert("Æ¯°¡ Çà»ç°¡ Á¾·áµÇ¾ú½À´Ï´Ù.\n" + msg);			
				}else if (dberr == "4"){
					alert("Àç°í°¡ ºÎÁ·ÇÕ´Ï´Ù.\n" + msg);			
				}else if (dberr == "P01"){
					alert("Àû¸³±ÝÀÌ ºÎÁ·ÇÏ¿© ±¸¸ÅÇÏ±â¸¦ ½ÇÆÐÇß½À´Ï´Ù.\n³ªÀÇ Àû¸³±Ý : " + mbr_pot );							
					return;				
				}else if (dberr == "P02"){
					alert("µÎ¶õ³ë¸ô È¸¿ø Àü¿ë ¼­ºñ½ºÀÔ´Ï´Ù.");							
					return;				
				}	
				
				location.reload();			
			}				

		}
		else if (request.status == 404){ 
			alert("Request URL does not exist");
		}
		else{ 
			alert("ERROR : status cod is " + request.status);
		}
	}		
}	
// Àå¹Ù±¸´Ï ´ã±â »ó¼¼

function fc_absoluteOffsetLeft(obj) {
	var left = obj.offsetLeft;
	var parent = obj.offsetParent;
	
	while (parent != document.body) {
		left += parent.offsetLeft;
		parent = parent.offsetParent;
	}
	
	return left;
}

function fc_absoluteOffsetTop(obj) {

	var top = obj.offsetTop;
	var parent = obj.offsetParent;
	
	while (parent != document.body) {
		top += parent.offsetTop;
		parent = parent.offsetParent;
	}
	
	return top;
}      

function goCate(obj){
	var svalue = obj.options[obj.selectedIndex].value;
	
	if (svalue.substring(0,1) == "0"){
		location.href = "/office/goods_step.asp?cate=" + svalue.substring(0, svalue.length-3) + "&cate1=" + svalue;
	}
}

// Ç°Àý ÀçÀÔ°í SMS ¿äÃ»
function smsRequest(itm, nam){
	WinOpen("/common/out_in_sms.asp?itm="+itm+"&nam="+nam, "mywin1",450,300,"no", 0);
}

// ¾ÆÀÌÇÁ·¹ÀÓ ½ºÅ©·Ñ ¾Èº¸ÀÌ±â ÀÚµ¿ ±æÀÌÃ¼Å©
 	function resizeHeight(fr) 
 	{
   		fr = typeof fr == 'string' ? document.getElementById(fr) : fr;
   		fr.setExpression('height', resizeid.document.body.scrollHeight);

 	}
