<!--
/*
##-----------------------------------------------------------------------------##
## ¼ö Á¤ ÀÏ : 2005.03.24  
## ¼³    ¸í : SALEWA °ü¸®ÀÚ ÀÎµ¦½º ÆäÀÌÁö 
##-----------------------------------------------------------------------------##
*/

  //* isEmpty(Æû.ÇÊµå.value)
  //* val = isEmpty(Æû.ÇÊµå.value)
  //* val°¡ true ¸é ºñ¾îÀÖ´Â ÇÊµå¶ó´Â ~~ 
  //* return false/true
	function isEmpty(txt) {
		for (var i=0; i<=txt.length-1; i++) {
			var ch = txt.charAt(i);
			if ( ch != ' ' && ch != '\t' ) {
				return false;
			}
		}
		return true;	//ÀÔ·ÂµÊ
	}
  //¸ÞÀÏÁÖ¼Ò Ã¼Å©
  function isEmail(txtBox, msg) {
    var fb_leng = txtBox.value.length;
    var atcnt = 0;
    var dotcnt = 0;
    for (var i=0; i<fb_leng; i++) {
      if ( txtBox.value.charAt(i) == '@' )
        atcnt += 1;
      if ( txtBox.value.charAt(i) == '.' )
        dotcnt += 1;
    }
    
    if ( atcnt < 1 ) {
      alert(msg);
      txtBox.focus();
      return false;
    }
    if ( dotcnt < 1 ) {
      alert(msg);
      txtBox.focus();
      return false;
    }

    // .com .net co.kr .org  :: µÚ¿¡¼­ 4¹øÂ°°¡ . ÀÌ°Å³ª 3,6°¡ Á¡ÀÌ¾î¾ß ÇÑ´Ù.
    dot4 = txtBox.value.charAt(txtBox.value.length - 4);
    dot3 = txtBox.value.charAt(txtBox.value.length - 3);
    dot6 = txtBox.value.charAt(txtBox.value.length - 6);

    if ( (dot4 != '.') && ((dot3 != '.') || (dot6 != '.')) ) {
      alert(msg);
      txtBox.focus();
      return false;
    }
    return true;
  }
//¼ýÀÚ¸¸ ÀÔ·ÂÇØ¾ß ÇÒ ¶§
  function isNumber(txtBox, msg) {
    var num = "0123456789";
    for (var i=0; i<txtBox.value.length; i++) {
      if (num.indexOf(txtBox.value.charAt(i)) == -1) {
        alert(msg);
        txtBox.focus();
        return false;
      }
    }
    return true;
  }
  //*  
  //* ¸ÞÀÎÈ­¸é °ü·Ã
  //*
  //ÄíÅ°°ª ±Á±â
  function setCookie( name, value, expiredays ) {
    var todayDate = new Date();
    todayDate.setDate( todayDate.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
  }
  //ÄíÅ°°ª °¡Á®¿À±â
  function getCookie(name)
  {
    var nameOfCookie = name + "=";	
    var x = 0;
    while ( x <= document.cookie.length )
    {
      var y = (x+nameOfCookie.length);
      if ( document.cookie.substring( x, y ) == nameOfCookie ) {
        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
          endOfCookie = document.cookie.length;
        return unescape( document.cookie.substring( y, endOfCookie ) );
      }
      x = document.cookie.indexOf( " ", x ) + 1;
      if ( x == 0 )
        break;
    }
    return "";
  }

  //¹è°æ»öº¯°æ
  function ChangeBackGround(val,bgbox) {
    document.body.style.backgroundImage = "url('/common/image/color_bg"+val+".jpg')";
    setCookie("SFZ_SALEWA_BG", val, 1);
    var img = "/common/image/foot_color"+val+"_on.gif";
    document.images[bgbox].src= img;
    /*
    mouseout ½Ã ¤Ì¤Ì;;
    */
  }
  //¹è°æ»öº¯°æ
  function ChangeBackGround1(val,bgbox) {
    setCookie("SFZ_SALEWA_BG", val, 1);
    document.location.reload();
  }

  //È¸»ç¾àµµº¸±â
  function PopUpCompanyMap() {
    window.open("/company/sub03_pop.htm", "", "width=523,height=392");
  }
  //´ë¸®Á¡¾àµµÆË¾÷
  function PopUpMap(map) {
    window.open("/dealership/pop.htm?img="+map, "", "width=400,height=300");
  }
  //´ë¸®Á¡ ¸ñ·Ï ÆË¾÷
  /*
01 = ¼­¿ï
02 = ÀÎÃµ/°æ±â
03 = °­¿ø
04 = ÃæÃ»µµ/´ëÀü
05 = Àü¶óµµ/±¤ÁÖ
06 = ºÎ»ê
07 = ´ë±¸
08 = °æºÏ/¿ï»ê
09 = °æ³²
10 = Á¦ÁÖ
  */
  function PopUpDealership(a) {
    window.open("/dealership/pop_list.htm?area="+a,"","width=414,height=404");
  }
  //´ë¸®Á¡ »ó¼¼º¸±â 
  function ViewDealership(code) {
    opener.location.href = "/dealership/index_main.html?code="+code;
    self.close();
  }
  //´ë¸®Á¡°³¼³¹®ÀÇ
  function OpenDealership(frm) {
  var frm = document.frmOpen;
    if ( isEmpty(frm.inp_name.value) ) {
      alert("ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä");
      frm.inp_name.focus();
      return false;
    }
    if ( isEmpty(frm.inp_tel1.value) ) {
      alert("¿¬¶ôÃ³¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä");
      frm.inp_tel1.focus();
      return false;
    }
    if ( isEmpty(frm.inp_tel2.value) ) {
      alert("¿¬¶ôÃ³¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä");
      frm.inp_tel2.focus();
      return false;
    }
    if ( isEmpty(frm.inp_tel3.value) ) {
      alert("¿¬¶ôÃ³¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä");
      frm.inp_tel3.focus();
      return false;
    }
    if ( !isNumber(frm.inp_tel1, "¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä") ) {
      return false;
    }
    if ( !isNumber(frm.inp_tel2, "¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä") ) {
      return false;
    }
    if ( !isNumber(frm.inp_tel3, "¼ýÀÚ¸¸ ÀÔ·ÂÇØ ÁÖ¼¼¿ä") ) {
      return false;
    }
    if ( isEmpty(frm.inp_email.value) ) {
      alert("¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
      frm.inp_email.focus();
      return false;
    }
    if ( !isEmail(frm.inp_email, "¸ÞÀÏÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä") ) {
      return false;
    } 
    if ( isEmpty(frm.inp_memo.value) ) {
      alert("¹®ÀÇÇÏ½Ç ³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
      frm.inp_memo.focus();
      return false;
    }
    frm.action = "/mail/mail_form.php";
    frm.submit();
  }

  /*
  right event banner
  */
  function EventBanner() {
    window.open("http://www.salewazone.co.kr/");
  }
  /*
  // top menu
  */
  //top menu
  function TopMenu(val) {
    if ( val == 1 ) {
      CompanyTopMenu(1);
    } else if ( val == 11 ) {
      CompanyTopMenu(1);
    } else if ( val == 12 ) {
      CompanyTopMenu(2);
    } else if ( val == 13 ) {
      CompanyTopMenu(3);
    } else if ( val == 14 ) {
      CompanyTopMenu(4);
    } else if ( val == 15 ) {
      CompanyTopMenu(5);
    } else if ( val == 16 ) {
      CompanyTopMenu(6);
    } else if ( val == 2 ) {
      ProductTopMenu('010000');
    } else if ( val == 3 ) {
      DealershipTopMenu(1);
    } else if ( val == 31 ) {
      DealershipTopMenu(1);
    } else if ( val == 32 ) {
      DealershipTopMenu(2);
    } else if ( val == 33 ) {
      DealershipTopMenu(3);
    } else if ( val == 4 ) {
      ECatalogTopMenu();
    } else if ( val == 41 ) {
      ECatalogTopMenu();
    } else if ( val == 42 ) {
      ECardTopMenu();
    } else if ( val == 5 ) {
      MediaTvTopMenu();
    } else if ( val == 51 ) {
      MediaTvTopMenu();
    } else if ( val == 52 ) {
      MediaMagazineTopMenu();
    } else if ( val == 6 ) {
      CustomerNoticeTopMenu();
    } else if ( val == 61 ) {
      CustomerNoticeTopMenu();
    } else if ( val == 62 ) {
      CustomerInfoTopMenu();
    } else if ( val == 63 ) {
      CustomerFabricTopMenu();
    } else if ( val == 64 ) {
      CustomerEmailTopMenu();
    } else if ( val == 65 ) {
      CustomerFaqTopMenu();
    } else {
      alert("¸Þ´º¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.");
      history_back(-2);
    }

  }

  //company
  function CompanyTopMenu(val) {
	  if (val == 4)  {
		//location.href = "mailto:dowi@korea.com";	
		location.href='/company/sub0'+val+'.htm';
	  } else {
	    location.href='/company/sub0'+val+'.htm';
	  }
  }
  //product
  function ProductTopMenu(val) {
    location.href = "/product/index_main.html?cat="+val;
  }
  //dealership
  function DealershipTopMenu(val) {
    if ( val == 2 ) {
      window.open("http://cafe.daum.net/togethersalewa");
    } else if ( val == 3 ) {
      window.open(" http://211.234.125.107/intra/index.jsp");
    } else {
      location.href = "/dealership/index_main.html";
    }    
  }  
  //esalewa-catalog
  function ECatalogTopMenu() {
    location.href = "/esalewa/index_catalog.html";
  }
  //esalewa-ecard
  function ECardTopMenu() {
    location.href = "/esalewa/index_main.html";
  }
  //media
  function MediaTvTopMenu(){
    location.href = "/media/index_tv.html";
  }
  function MediaMagazineTopMenu(){
    location.href = "/media/index_magazine.html";
  }
  //customer
  function CustomerNoticeTopMenu(){
    location.href = "/customer/board/index_notice.html";
  }
  function CustomerInfoTopMenu(){
    location.href = "/customer/board/index_info.html";
  }
  function CustomerFabricTopMenu(){
    location.href = "/customer/fabric/index_main.html";
  }
  function CustomerEmailTopMenu(){
    location.href = "/customer/index_mail.html";
  }
  function CustomerFaqTopMenu(){
    location.href = "/customer/faq/faq01.htm";
  }

  //*  
  //* °ü¸®ÀÚÈ­¸é °ü·Ã
  //*
  
  //°ü¸®ÀÚ ·Î±×ÀÎ ¹Ú½º
  function LogInChk(frm) {
    if ( isEmpty(frm.inp_id.value) ) {
      frm.inp_id.focus();
      alert("°ü¸®ÀÚ ¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
      return false;
    }
    if ( isEmpty(frm.inp_pwd.value) ) {
      frm.inp_pwd.focus();
      alert("°ü¸®ÀÚ ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
      return false;
    }
  }

/* 2006.02.15 IE ¼³°è º¯°æ¿¡ µû¸¥ ¾÷µ¥ÀÌÆ® */
function flashMovie(fid,src,wid,hei,fvs,wmd) {
  this.fPrint = '';
  this.Id = document.getElementById(fid);
  this.Src = src;
  this.Width = wid;
  this.Height = hei;
  this.FlashVars = (fvs != undefined)? fvs :'';
  this.Wmod = (wmd != undefined)? wmd :'';
  if(isObject(Id)) {
    fPrint = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"';
    fPrint += ' width="'+Width+'"';
    fPrint += ' height="'+Height+'">';
    fPrint += '<param name="movie" value="'+Src+'">';
    fPrint += '<param name="quality" value="high">';
    fPrint += (FlashVars != null) ? '<param name="FlashVars" value="'+FlashVars+'">' : ''; 
    fPrint += (Wmod != null) ? '<param name="wmode" value="'+Wmod+'">' : '';
    fPrint += '<embed';
    fPrint += ' src="'+Src+'"';
    fPrint += (FlashVars != null) ? ' FlashVars="'+FlashVars+'"' : '';
    fPrint += (Wmod != null) ? ' wmode="'+Wmod+'"' : '';
    fPrint += ' quality="high"';
    fPrint += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
    fPrint += ' type="application/x-shockwave-flash"';
    fPrint += ' width="'+Width+'"';
    fPrint += ' height="'+Height+'"';
    fPrint += '></embed>';
    fPrint += '</object>';
    Id.innerHTML = fPrint;
//    document.write(fPrint);
  }
}

function isObject(a) {
    return (a && typeof a == 'object');
} 
//-->