function viewdetail(brandcode){
   showdetail('visible',brandcode);
}

var optionJsonData = null;
var stockInfo = null;

function viewlayerbasket(temp,item,type){
   if(temp=='visible'){
      var pars = 'item='+item+'&type=' + type;
      new Ajax.Updater('basketpage','/shop/gobasket.layer.html', {
            method:'post',
            evalScripts:true,
            parameters:pars

        });
      if(typeof(document.all('basketpage'))!='undefined'){
         var _x = document.body.clientWidth/2 + document.body.scrollLeft -250;
         var _y = document.body.clientHeight/2 + document.body.scrollTop - 200;

         basketpage.style.width=380;
         basketpage.style.height=200;
         basketpage.style.posLeft=_x;
         basketpage.style.posTop=_y;
         basketpage.style.zIndex='20000';
      }
   }
   if(typeof(document.all('basketpage'))!='undefined'){
      basketpage.style.visibility=temp;
   }
}

function showdetail(temp,brandcode){
   if(temp=='visible'){
      var pars = 'request=ajax&brandcode=' + brandcode;
      new Ajax.Updater('detailpage','/shop/detailpage.html', {
            method:'post',
            evalScripts:true,
            parameters:pars,
            onComplete: function(req, json) {
                optionJsonData = json.optionJsonData;
                stockInfo = json.stockInfo;
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = '/js/option_validate.js';
                document.getElementsByTagName('head')[0].appendChild(script);
            }
        });
      if(typeof(document.all('detailpage'))!='undefined'){
         var _x = document.body.clientWidth/2 + document.body.scrollLeft -250;
         var _y = document.body.clientHeight/2 + document.body.scrollTop - 200;

         detailpage.style.posLeft=_x;
         detailpage.style.posTop=_y;
         detailpage.style.zIndex='10000';
      }
   }
   if(typeof(document.all('detailpage'))!='undefined'){
      detailpage.style.visibility=temp;
   }
}

function imageview(temp,type) {
   
   var windowprops = "height=350,width=450,toolbar=no,menubar=no,resizable=no,status=no";
   if (type=="1"){
      windowprops+=",scrollbars=yes";
      imgsc="yes";
   }else imgsc="";
   if (temp.length==0) { alert("Å«ÀÌ¹ÌÁö°¡ ¾ø½À´Ï´Ù."); return ; }
   n4=(document.layers)?true:false;
   if (n4)
      url = "/shop/image_view.html?scroll="+imgsc+"&image=/shopimages/"+db+"/" + escape(temp);
   else
      url = "/shop/image_view.html?scroll="+imgsc+"&image=/shopimages/"+db+"/" + temp;
             
   window.open(url, "win", windowprops);
 }
function send_wish(temp, temp2, opt_type) {
    if ($('option_type')) {
        wishvalidateSubmit(temp, $(document.detailform),baskethidden);
        //validateSubmit(temp, $(document.detailform));
        return;
    }

   if(temp2!=""){
      document.detailform.opts.value="";
      for(i=0;i<temp2;i++){
         document.detailform.opts.value+=document.detailform.mulopt[i].selectedIndex+",";
		 document.detailform.optslist.value+=document.detailform.mulopt[i].value+"[||]";
      }
   }
   if(typeof document.detailform.spcode!="undefined" && document.detailform.spcode.selectedIndex<2){
       temp2=document.detailform.spcode.selectedIndex-1;
       if(typeof document.detailform.spcode2=="undefined" || document.detailform.spcode2.type == 'hidden') temp3=1;
       else temp3=document.detailform.spcode2.selectedIndex-1;
       /*
       if(num.length > 0 && num[(temp3-1)*10+(temp2-1)]==0){
           alert('¼±ÅÃÇÏ½Å »óÇ°ÀÇ ¿É¼ÇÀº Ç°ÀýµÇ¾ú½À´Ï´Ù. ´Ù¸¥ ¿É¼ÇÀ» ¼±ÅÃÇÏ¼¼¿ä');
           document.detailform.spcode.focus();
           return;
       }
       */
   }
   if (opt_type == 'NL' || opt_type == 'NU') {
       document.detailform.optslist.value = '';
       if (document.detailform.spcode.selectedIndex > 1) {
           document.detailform.optslist.value = document.detailform.spcode.options[document.detailform.spcode.selectedIndex].text+"[||]";
       }
       if (typeof document.detailform.spcode2!="undefined" && document.detailform.spcode2.selectedIndex > 1) {
           if (document.detailform.spcode2.type != 'hidden') document.detailform.optslist.value += document.detailform.spcode2.options[document.detailform.spcode2.selectedIndex].text+"[||]";
       }
   }

   if(typeof baskethidden!="undefined" && baskethidden=="Y"){
       document.detailform.ordertype.value+= "|parent.";
       document.detailform.target = "loginiframe";
   }else if(typeof baskethidden!="undefined" && baskethidden=="A"){
       document.detailform.ordertype.value+= "|parent.|layer";
       document.detailform.target = "loginiframe";
   }

   document.detailform.action = '/shop/shopdetail.html';
   document.detailform.mode.value = 'wish';
   document.detailform.optiontype.value = opt_type;
   //document.detailform.target  = "new";	
   
   document.detailform.submit();
}
 function send(temp,temp2) {
    // ÆÄ¿ö¿É¼ÇÀÎ °æ¿ì¿¡ validate¸¦ ¾Æ·¡ ÇÔ¼ö·Î º¸³»¹ö¸²
    if ($('option_type')) {
        validateSubmit(temp, $(document.detailform),baskethidden);
        //validateSubmit(temp, $(document.detailform));
        return;
    }

   if (document.detailform.amount.value.length==0)
   {  alert("ÁÖ¹®¼ö·®À» ÀÔ·ÂÇÏ¼¼¿ä."); document.detailform.amount.focus();return; }
   if (isNaN(document.detailform.amount.value))
   {  alert("ÁÖ¹®¼ö·®¿¡ ¼ýÀÚ¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
      document.detailform.amount.focus(); return; }
   if(temp=="baro") document.detailform.ordertype.value='baro';
   if(temp2!=""){
      document.detailform.opts.value="";   
      for(i=0;i<temp2;i++){
         if(document.detailform.optselect[i].value==1 && document.detailform.mulopt[i].selectedIndex==0){
            alert('ÇÊ¼ö¼±ÅÃ Ç×¸ñÀÔ´Ï´Ù. ¿É¼ÇÀ» ¹Ýµå½Ã ¼±ÅÃÇÏ¼¼¿ä');
            document.detailform.mulopt[i].focus();
            return;
         }
         document.detailform.opts.value+=document.detailform.mulopt[i].selectedIndex+",";
      }
   }
   if(typeof document.detailform.spcode!="undefined" && document.detailform.spcode.selectedIndex<2){
      alert('¿É¼ÇÀ» ¼±ÅÃÇÏ¼Å¾ß ±¸¸Å°¡ °¡´ÉÇÕ´Ï´Ù.');
      document.detailform.spcode.focus();
      return;
   }
   if(typeof document.detailform.spcode2!="undefined" && document.detailform.spcode2.selectedIndex<2){
      alert('¿É¼ÇÀ» ¼±ÅÃÇÏ¼Å¾ß ±¸¸Å°¡ °¡´ÉÇÕ´Ï´Ù.');
      document.detailform.spcode2.focus();
      return;
   }
   if(typeof document.detailform.spcode!="undefined" && document.detailform.spcode.selectedIndex<2){
       temp2=document.detailform.spcode.selectedIndex-1;
       if(typeof document.detailform.spcode2=="undefined") temp3=1;
       else temp3=document.detailform.spcode2.selectedIndex-1;
       if(num[(temp3-1)*10+(temp2-1)]==0){
           alert('¼±ÅÃÇÏ½Å »óÇ°ÀÇ ¿É¼ÇÀº Ç°ÀýµÇ¾ú½À´Ï´Ù. ´Ù¸¥ ¿É¼ÇÀ» ¼±ÅÃÇÏ¼¼¿ä');
           document.detailform.spcode.focus();
           return;
       }
   }
   if(typeof baskethidden!="undefined" && baskethidden=="Y"){
       document.detailform.ordertype.value+= "|parent.";
       document.detailform.target = "loginiframe";
   }else if(typeof baskethidden!="undefined" && baskethidden=="A"){
       document.detailform.ordertype.value+= "|parent.|layer";
       document.detailform.target = "loginiframe";
   }
   document.detailform.submit();
 }
 function count_change(temp)
 {
   var test=document.detailform.amount.value;
   if(temp==0){
      test++;
   }else if(temp==1){
      if(test> 1) test--;
   }
   document.detailform.amount.value=test;
 }
  function login_chk(tmp){
     alert ("È¸¿ø¿¡°Ô¸¸ Á¦°øÀÌ µÇ´Â ¼­ºñ½ºÀÔ´Ï´Ù.\n¿ì¼± ·Î±×ÀÎÀ» ÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
     location.href="/shop/member.html?type=wish&brandcode="+tmp;
  }

function warehousing_call(temp) {
    win = window.open('/shop/soldout_sms_pop.html?brandcode=' + temp, 'soldout_sms', 'width=450, height=330');
    win.focus();
}

function MS_CyScrap(shopurl, branduid, key, sid) {
    var xml_url = escape('http://' + shopurl + '/cy_scrap.html?branduid=' + branduid + '&key=' + key);
    var cyScrap_url = 'http://api.cyworld.com/openscrap/shopping/v1/?xu=' + xml_url + '&sid=' + sid;

    window.open(cyScrap_url, 'cyopenscrap', 'width=450,height=410');
}
