
var __moveKey = [8, 37, 39, 46, 13, 9];
	/*
	key == 8  // 백스페이스 키
	key == 37 // 왼쪽 화살표 키
	 key == 39 // 오른쪽 화살표 키
	 key == 46 // DEL 키
	 key == 13 // 엔터 키
	 key == 9  // Tab 키
	*/


	/* vim: set expandtab tabstop=4 shiftwidth=4: */ 
	//+--------------------------------------------------------+ 
	//| Copyright : Song Hyo-Jin <shj at xenosi.de>            | 
	//+--------------------------------------------------------+ 
	//| License : BSD                                          | 
	//+--------------------------------------------------------+ 
	//
	//$Id: numberFormatting.js, 2008. 12. 09. crucify Exp $ 
	/*
	 * 	text = '123,4,4234.234,23523.2,342'; 
	 * text.toInt() == 12344234 
	 * text.toNum() == 12344234.23423523 
	 * text.numberFormat() = 12,344,234.234,235,23
	 */
	
	String.prototype.toInt = function() { 
		 if(/^-/.test(this)) { 
		     return this.replace(/\..*$/g, '').replace(/[^\d]/g, '') * -1; 
		 } else { 
		     return this.replace(/\..*$/g, '').replace(/[^\d]/g, '') * 1; 
		 } 
	}
	String.prototype.toNum = function() { 
		 if(/^-/.test(this)) { 
		     return this.replace(/(\.[^\.]+)\..*$/g, '$1').replace(/[^\d\.]/g, '') * -1.0; 
		 } else { 
		     return this.replace(/(\.[^\.]+)\..*$/g, '$1').replace(/[^\d\.]/g, '') * 1.0; 
		 } 
	}
	String.prototype.numberFormat = function() { 
		 var num = (this.toNum() + '').split(/\./); 
		 var commal = function(text) { 
		     var ret = text.replace(/(\d)(\d{3},)/g, '$1,$2'); 
		     if(ret == text) return ret; 
		     return commal(ret); 
		 } 
		 var commar = function(text) { 
		     var ret = text.replace(/(,\d{3})(\d)/g, '$1,$2'); 
		     if(ret == text) return ret; 
		     return commar(ret); 
		 } 
		 var ret = commal(num[0].replace(/(\d)(\d{3})$/g, '$1,$2')); 
		 if(num.length > 1) { 
		     ret += '.' + commar(num[1].replace(/^(\d{3})(\d)/g, '$1,$2')); 
		 } 
		 return ret; 
	} 

	 /**
	 * usage : 
	 * var form = document.form;
	 * var required = {
	 *	"name" : "이름을 입력해 주세요",
	 *	"phone" : "전화번호를 입력해 주세요."	
	 * };
	 * checkForm(form, required);
	 */
	
	 function checkForm(tForm, required) {
	 	
	  	for (var i in required) {
	    		var el = eval("tForm." + i);
	    		if (!el.value) {
	      			alert(required[i]);
	      			el.focus();
	      			return false;
	    		}
	  	}
	  	return true;
	 }
	 
	 /**
	 * 전자우편 체크
	 *
	 */
	 
	 function checkEmail(email) {
	       var pattern = /^(.+)@(.+)$/;
	       var atom = "\[^\\s\\(\\)<>#@,;:!\\\\\\\"\\.\\[\\]\]+";
	       var word="(" + atom + "|(\"[^\"]*\"))";
	       var user_pattern = new RegExp("^" + word + "(\\." + word + ")*$");
	       var ip_pattern = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	       var domain_pattern = new RegExp("^" + atom + "(\\." + atom +")*$");
	
	       var arr = email.match(pattern);
	       if (!arr) return false;
	       if (!arr[1].match(user_pattern)) return false;
	
	       var ip = arr[2].match(ip_pattern);
	       if (ip) {
	              for (var i=1; i<5; i++) if (ip[i] > 255) return false;
	       }
	       else {
	              if (!arr[2].match(domain_pattern)) return false;
	              var domain = arr[2].match(new RegExp(atom,"g"));
	              if (domain.length<2) return false;
	              if (domain[domain.length-1].length<2 || domain[domain.length-1].length>3)
	                     return false;
	       }
	       return true; 
	} 
	
	
	/**
	* return checkForeginNo('외국인번호13자리');
	* return checkJumin('주민번호13자리');
	* return checkBizNo('사업자번호10자리');
	*/

	// 재외국인 번호 체크
	function checkForeginNo(fgnno) {
	        var sum=0;
	        var odd=0;
	        buf = new Array(13);
	        for(i=0; i<13; i++) { buf[i]=parseInt(fgnno.charAt(i)); }
	        odd = buf[7]*10 + buf[8];
	        if(odd%2 != 0) { return false; }
	        if( (buf[11]!=6) && (buf[11]!=7) && (buf[11]!=8) && (buf[11]!=9) ) {
	                return false;
	        }
	        multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
	        for(i=0, sum=0; i<12; i++) { sum += (buf[i] *= multipliers[i]); }
	        sum = 11 - (sum%11);
	        if(sum >= 10) { sum -= 10; }
	        sum += 2;
	        if(sum >= 10) { sum -= 10; }
	        if(sum != buf[12]) { return false }
	        return true;
	}

	// 주민번호 체크
	function checkJumin(juminno) {
	        if(juminno=="" || juminno==null || juminno.length!=13) {
	//                alert("주민등록번호를 적어주세요.");
	                return false;
	        }
	        var jumin1 = juminno.substr(0,6);
	        var jumin2 = juminno.substr(6,7);
	        var yy           = jumin1.substr(0,2);        // 년도
	        var mm     = jumin1.substr(2,2);        // 월
	        var dd     = jumin1.substr(4,2);        // 일
	        var genda  = jumin2.substr(0,1);        // 성별
	        var msg, ss, cc;
	
	        // 숫자가 아닌 것을 입력한 경우
	        if (!isNumeric(jumin1)) {
	                alert("주민등록번호 앞자리를 숫자로 입력하세요.");
	                return false;
	        }
	        // 길이가 6이 아닌 경우
	        if (jumin1.length != 6) {
	                alert("주민등록번호 앞자리를 다시 입력하세요.");
	                return false;
	        }
	        // 첫번째 자료에서 연월일(YYMMDD) 형식 중 기본 구성 검사
	        if (yy < "00" || yy > "99" ||
	                mm < "01" || mm > "12" ||
	                dd < "01" || dd > "31") {
	                alert("주민등록번호 앞자리를 다시 입력하세요.");
	                return false;
	        }
	        // 숫자가 아닌 것을 입력한 경우
	        if (!isNumeric(jumin2)) {
	                alert("주민등록번호 뒷자리를 숫자로 입력하세요.");
	                return false;
	        }
	        // 길이가 7이 아닌 경우
	        if (jumin2.length != 7) {
	                alert("주민등록번호 뒷자리를 다시 입력하세요.");
	                return false;
	        }
	        // 성별부분이 1 ~ 4 가 아닌 경우
	        if (genda < "1" || genda > "4") {
	                alert("주민등록번호 뒷자리를 다시 입력하세요.");
	                return false;
	        }
	        // 연도 계산 - 1 또는 2: 1900년대, 3 또는 4: 2000년대
	        cc = (genda == "1" || genda == "2") ? "19" : "20";
	        // 첫번째 자료에서 연월일(YYMMDD) 형식 중 날짜 형식 검사
	        if (isYYYYMMDD(parseInt(cc+yy), parseInt(mm), parseInt(dd)) == false) {
	                alert("주민등록번호 앞자리를 다시 입력하세요.");
	                return false;
	        }
	        // Check Digit 검사
	        if (!isSSN(jumin1, jumin2)) {
	                alert("입력한 주민등록번호를 검토한 후, 다시 입력하세요.");
	                return false;
	        }
	        return true;
	}

	// 사업자등록번호 체크
	function checkBizNo(vencod) {
	        var sum = 0;
	        var getlist =new Array(10);
	        var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
	        for(var i=0; i<10; i++) { getlist[i] = vencod.substring(i, i+1); }
	        for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
	        sum = sum + parseInt((getlist[8]*5)/10);
	        sidliy = sum % 10;
	        sidchk = 0;
	        if(sidliy != 0) { sidchk = 10 - sidliy; }
	        else { sidchk = 0; }
	        if(sidchk != getlist[9]) { return false; }
	        return true;
	}


	function isYYYYMMDD(y, m, d) {
	        switch (m) {
	        case 2:        // 2월의 경우
	                if (d > 29) return false;
	                if (d == 29) {
	                        // 2월 29의 경우 당해가 윤년인지를 확인
	                        if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0))
	                                return false;
	                }
	                break;
	        case 4:        // 작은 달의 경우
	        case 6:
	        case 9:
	        case 11:
	                if (d == 31) return false;
	        }
	        // 큰 달의 경우
	        return true;
	}

	function isNumeric(s) {
	        for (i=0; i<s.length; i++) {
	                c = s.substr(i, 1);
	                if (c < "0" || c > "9") return false;
	        }
	        return true;
	}
	
	function isLeapYear(y) {
	        if (y < 100)
	        y = y + 1900;
	        if ( (y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0) ) {
	                return true;
	        } else {
	                return false;
	        }
	}
	
	function getNumberOfDate(yy, mm) {
	        month = new Array(29,31,28,31,30,31,30,31,31,30,31,30,31);
	        if (mm == 2 && isLeapYear(yy)) mm = 0;
	        return month[mm];
	}
	
	function isSSN(s1, s2) {
	        n = 2;
	        sum = 0;
	        for (i=0; i<s1.length; i++)
	                sum += parseInt(s1.substr(i, 1)) * n++;
	        for (i=0; i<s2.length-1; i++) {
	                sum += parseInt(s2.substr(i, 1)) * n++;
	                if (n == 10) n = 2;
	        }
	        c = 11 - sum % 11;
	        if (c == 11) c = 1;
	        if (c == 10) c = 0;
	        if (c != parseInt(s2.substr(6, 1))) return false;
	        else return true;
	}

	 



	/*****
   * kwCho 2008 9.29
   * 전화번호 자동 분리
   * Event Handler  onkeyup 이벤트에 적용
   * 
   * 
  
   */
  var phoneBind = function(ev, delim) {
	
	  var keynum =  ev.which || ev.keyCode; 

	  if((keynum > 47 && keynum < 58) || (keynum < 106 && keynum > 95)) { //숫자범위 또는 키패드에서의 숫자 
		  /*
		    key == 8  // 백스페이스 키
		    key == 37 // 왼쪽 화살표 키
		     key == 39 // 오른쪽 화살표 키
		     key == 46 // DEL 키
		     key == 13 // 엔터 키
		     key == 9  // Tab 키
		*/
		   
	  } else {
	 	return;	
	  }
	  
	  var element = this;
	  var p = element.value;
	  delim = delim || "-";
	  var num = p.replace( /\D/g, '' );

	  num.sub(/(02|0[3-9]{1}[0-9]{1})([0-9]+)/, function (match){
		  var p1 = match[1];
		  var p2 = match[2];
		  var p3 = "";
		  if (match[2].length > 3) {
				if (match[2].length < 8) {
					p2 = match[2].substring(0, 3);
					p3 = match[2].substring(3);
				} else {
					p2 = match[2].substring(0, 4);
					p3 = match[2].substring(4);
				}
		  }
		 var gnrP  = p1 + delim + p2;
		 gnrP +=  p3 ?  delim + p3 : "";
		  
		  element.value = gnrP;
	  });
  }
  
  /*****
   * kwCho 2008 9.29
   * 휴대폰 자동 분리
   * Event Handler  onkeyup 이벤트에 적용
   */
  var hPhoneBind = function(ev, delim) {
		
	  var keynum =  ev.which || ev.keyCode; 

	  if((keynum > 47 && keynum < 58) || (keynum < 106 && keynum > 95)) { //숫자범위 또는 키패드에서의 숫자 
		
	  } else {
	 	return;	
	  }
	  
	  var element = this;
	  var p = element.value;
	  delim = delim || "-";
	  var num = p.replace( /\D/g, '' );

	  num.sub(/(01[016789])([0-9]+)/, function (match){
		  var p1 = match[1];
		  var p2 = match[2];
		  var p3 = "";
		  if (match[2].length > 3) {
				if (match[2].length < 8) {
					p2 = match[2].substring(0, 3);
					p3 = match[2].substring(3);
				} else {
					p2 = match[2].substring(0, 4);
					p3 = match[2].substring(4);
				}
		  }
		 var gnrP  = p1 + delim + p2;
		 gnrP +=  p3 ?  delim + p3 : "";
		  
		  element.value = gnrP;
	  });
  }
  
  
  /*****
   * kwCho 2008 9.29
   * 사업자번호 자동 분리
   * Event Handler  onkeyup 이벤트에 적용
   */
  var coNoBind = function(ev, delim) {
		
	  var keynum =  ev.which || ev.keyCode; 

	  if((keynum > 47 && keynum < 58) || (keynum < 106 && keynum > 95)) { //숫자범위 또는 키패드에서의 숫자 
		
	  } else {
	 	return;	
	  }
	  
	  var element = this;
	  var p = element.value;
	  delim = delim || "-";
	  var num = p.replace( /\D/g, '' );

	  num.sub(/([0-9]{3})([0-9]+)/, function (match){
		  var p1 = match[1];
		  var p2 = match[2];
		  var p3 = "";
		  if (match[2].length > 2) {
			p2 = match[2].substring(0, 2);
			p3 = match[2].substring(2);
		  }
		 var gnrP  = p1 + delim + p2;
		 gnrP +=  p3 ?  delim + p3 : "";
		  
		  element.value = gnrP;
	  });
  }
  
  
  /*****
   * kwCho 2008 9.29
   * 주민번호자동분리
   * Event Handler  onkeyup 이벤트에 적용
   */
  var perNoBind = function(ev, delim) {
		
	  var keynum =  ev.which || ev.keyCode; 

	  if((keynum > 47 && keynum < 58) || (keynum < 106 && keynum > 95)) { //숫자범위 또는 키패드에서의 숫자 
		
	  } else {
	 	return;	
	  }
	  
	  var element = this;
	  var p = element.value;
	  delim = delim || "-";
	  var num = p.replace( /\D/g, '' );

	  num.sub(/([0-9]{6})([0-9]+)/, function (match){
		  var p1 = match[1];
		  var p2 = match[2];
		  var gnrP  = p1 + delim + p2;
		  
		  element.value = gnrP;
	  });
  }
  
  /*****
   * kwCho 2008 9.29
   * 날짜 자동 분리 - 숫자 8개로 구성해야함
   * Event Handler  onkeyup 이벤트에 적용
   */
  var dateBind = function(ev, delim) {
		
	  var keynum =  ev.which || ev.keyCode; 

	  if((keynum > 47 && keynum < 58) || (keynum > 95 && keynum < 106)) { //숫자범위 또는 키패드에서의 숫자 
		
	  } else {
	 	return;	
	  }
	  
	  var element = this;
	  var p = element.value;
	  delim = delim || "-";
	  var num = p.replace( /\D/g, '' );

	  num.sub(/([0-9]{4})([0-9]+)/, function (match){
		  var p1 = match[1];
		  var p2 = match[2];
		  var p3 = "";
		  if (match[2].length >= 2) {
			p2 = match[2].substring(0, 2);
			p3 = match[2].substring(2);
		  }
		  var gnrP  = p1 + delim + p2;
		  gnrP +=  p3 ?  delim + p3 : "";
		  element.value = gnrP;
	  });
  }
  
  /*****
   * kwCho 2008 9.29
   * 숫자만 허용
   * Event Handler  onkeyup 이벤트에 적용
   */
  var onlyNumberBind = function(ev, comma, point) {
	  var keynum =  ev.which || ev.keyCode; 

	  var element = this;
	  // keynum 109:-, 110 : 소수점
	  if (__moveKey.include(keynum) || keynum == 109 || (point && keynum == 110) ) {
		  // nothing to do...
	  } else {
		  element.value = comma ? element.value.numberFormat() : element.value.toNum();
	  }
  }
  
  function addComma(str) { // 
      return (str + '').numberFormat();
  }
  


 var AjaxSpinner = Class.create({
  		
  		initialize : function (submitBtn, spinnerImg) {
  			
  			if (submitBtn) {
  				this.submitBtn = (typeof submitBtn == "string") ? [submitBtn] : submitBtn;
  			} else {
  				this.submitBtn = [];
  			}
  			this.spinnerImg = spinnerImg || "spinner";
  			
  			
  			 //로딩시 스피너이지미 뛰우기
			Ajax.Responders.register({
				onCreate: function() { 
					this.create();
				}.bind(this),
				//요청 끝나면 그림 사라짐
				onComplete: function() { 
						this.complete();
				}.bind(this)
			});
	
  		},
  		create : function() {
  			this.submitBtn.each(function(elStr) {
  				if ($(elStr)) {
  					$(elStr).disabled = true;
  				}
  			});
  			
  			$(this.spinnerImg).show(); 
  		},
  		complete : function() {
  			this.submitBtn.each(function(elStr) {
  				if ($(elStr)) {
  					$(elStr).disabled = false;
  				}
  			});
  			$(this.spinnerImg).hide(); 
  		}
 	});

	/**
	* 영문과 숫자, 길이 체그 - 아이디 체크에 사용
	*/
	
	function checkEngNo(str, len) {
 		if (str.search(/^(\w[\w-]*\w$)/) == -1 || str.length < len){
    		return false;
    	}
    	return true;	
    }
	
	// IE와 FF에서 모두 작동하는 클립보드 복사
	// FF에서는 about:config 에 들어가 Signed.applets.codebase_principal_support 값을 true로 변경해야 함

	function clipCopy(meintext) {
	　 if (window.clipboardData) {
	　 　 window.clipboardData.setData("Text", meintext);
	　 } else if (window.netscape) {
	　 　 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
	　 　 var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
	　 　 if (!clip) return;
	　 　 var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
	　 　 if (!trans) return;
	　 　 trans.addDataFlavor('text/unicode');
	　 　 var str = new Object();
	　 　 var len = new Object();
	　 　 var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
	　 　 var copytext=meintext;
	　 　 str.data=copytext;
	　 　 trans.setTransferData("text/unicode",str,copytext.length*2);
	　 　 var clipid=Components.interfaces.nsIClipboard;
	　 　 if (!clip) return false;
	　 　 clip.setData(trans,null,clipid.kGlobalClipboard);
	　 }


	}

	// IE와 FF에서 모두 작동하는 클립보드 붙여넣기
	// FF에서는 about:config 에 들어가 Signed.applets.codebase_principal_support 값을 true로 변경해야 함

	 function clipPaste() {
	　 var chec=document.board_write;
	　 var clip_data;
	　 if (window.clipboardData) {
	　 　 clip_data = window.clipboardData.getData("Text"); // 클립보드 복사
	　 } else if (window.netscape) {
	　 　 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
	　 　 var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
	　 　 if (!clip) return;
	　 　 var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
	　 　 if (!trans) return;
	　 　 trans.addDataFlavor("text/unicode");
	　 　 clip.getData(trans, clip.kGlobalClipboard);
	　 　 var str = new Object();
	　 　 var strLength = new Object();
	　 　 trans.getTransferData("text/unicode", str, strLength);
	　 　 if(str) str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
	　 　 else return;
	　 　 if(str) clip_data = str.data.substring(0, strLength.value / 2);
	　 }
	　 return clip_data;
	}
	
	/**
	* 체크박스 체크 되었나?
	*/
	function checkboxChecked (cName) {

	 	var checked = false;
	 	$$("input[name='" + cName + "']").each(function(el, index) {
	 		if (el.checked) {
	 			checked	= true;
	 			return;
	 		}
	 	});
	 	return checked;
	};  
    	
	// flashWrite(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드)
	function flashWrite(url,w,h,id,bg,vars,win){

		// 플래시 코드 정의
		var flashStr=
		"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
		"<param name='allowScriptAccess' value='always' />"+
		"<param name='movie' value='"+url+"' />"+
		"<param name='FlashVars' value='"+vars+"' />"+
		"<param name='wmode' value='"+win+"' />"+
		"<param name='menu' value='false' />"+
		"<param name='quality' value='high' />"+
		"<param name='bgcolor' value='"+bg+"' />"+
		"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer' />"+
		"</object>";

		// 플래시 코드 출력
		document.write(flashStr);

	}
	
 var ResizingTextArea = Class.create();
  
  ResizingTextArea.prototype = {
      defaultRows: 1,
   
      initialize: function(field)
      {
          this.defaultRows = Math.max(field.rows, 1);
          this.resizeNeeded = this.resizeNeeded.bindAsEventListener(this);
          Event.observe(field, "click", this.resizeNeeded);
          Event.observe(field, "keyup", this.resizeNeeded);
      },
   
      resizeNeeded: function(event)
      {
          var t = Event.element(event);
          var lines = t.value.split('\n');
          var newRows = lines.length + 1;
          var oldRows = t.rows;
          for (var i = 0; i <lines.length; i++)
          {
              var line = lines[i];
              if (line.length>= t.cols) newRows += Math.floor(line.length / t.cols);
          }
    
          if (newRows> t.rows) t.rows = newRows;
          if (newRows <t.rows) t.rows = Math.max(this.defaultRows, newRows);
      }
 };

	
	/* 
	서브레프트메뉴 체인지
	*/
	function CHIMG(obj){
	   var str = obj.src;                
	   if(str.indexOf('on.gif') < 0){        
		ss = str.substr(0, str.indexOf('.gif'))        
		obj.src = ss + "on.gif";                          
	   }else{                                      
		ss = str.substr(0, str.indexOf('on.gif'))
		obj.src = ss + ".gif";
	   }
	  }

	/*
	 * 시간배열로 나타나는 GetObject()
	 * 파라미터 : objectId -> ELEMENT ID
	*/
	function GetObject(objectId) {
		if (document.getElementById && document.getElementById(objectId)) {
			return document.getElementById(objectId);
		} else if (document.getElementByName && document.getElementByName(objectId)) {
			return document.getElementByName(objectId);
		} else if (document.all && document.all(objectId)) {
			return document.all(objectId);
		} else if (document.layers && document.layers[objectId]) {
			return document.layers[objectId];
		} else {
			return false;
		}
	}


	/* 
	PNG 파일 투명도
	*/
	function setPng24(obj)	{ 
		obj.width=obj.height=1; obj.className=obj.className.replace(/\bpng24\b/i,''); 
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
		obj.src=''; return ''; 
		} 


	/* 
	탭메뉴
	
	*/
	var now_tab=1;
	function tab_menu(n){
		document.getElementById('tab'+now_tab).style.display = 'none';
		document.getElementById('tab'+n).style.display = 'block';
		now_tab = n;
	}
	


	/* 
	즐겨찾기 추가
	
	*/

	function favoris() {
	if ( navigator.appName != 'Microsoft Internet Explorer' )
	{
	window.sidebar.addPanel("하이랜드스포츠","http://www.hlsc.co.kr/",""); 
	}else { 
	window.external.AddFavorite("http://www.hlsc.co.kr/","하이랜드스포츠");
	} 
	}

	
	/* 
	팝업찾기버튼
	
	*/
	
	function show(object) {
	if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'visible';
	else if (document.all) document.all[object].style.visibility = 'visible';
	}
	function hide(object) {
	if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'hidden';
	else if (document.all) document.all[object].style.visibility = 'hidden';
	}

	
	/* 
	이미지새창띠우기
	
	*/
	
	function newWinImg(imgSrc) {
 		var iSrc = encodeURI(imgSrc); 
 		var img1= new Image(); 
 		
	  	img1.src = iSrc;
	  	var W=img1.width; 
		var H=img1.height; 
		var O="resizable=yes,scrollbars=yes,width="+W+",height="+H; 
		var imgWin=window.open("","",O); 
		imgWin.document.write("<html><head><title>이미지 미리보기</title></head>");
		imgWin.document.write("<body topmargin=0 leftmargin=0>");
		imgWin.document.write("<img src="+iSrc+" onclick='self.close()' style=cursor:hand>");
		imgWin.document.close();
	  
	}
	
	
	/*
	imgResize 함수 사용안함
	*/
	function imgResize(img){ 
	  img1= new Image(); 
	  img1.src=(img); 
	  imgControll(img); 
	} 

	function imgControll(img){ 
	  if((img1.width!=0)&&(img1.height!=0)){ 
		viewImage(img); 
	  } 
	  else{ 
		controller="imgControll('"+img+"')"; 
		intervalID=setTimeout(controller,20); 
	  } 
	} 

	function viewImage(img){ 
		W=img1.width; 
		H=img1.height; 
		O="width="+W+",height="+H; 
		imgWin=window.open("","",O); 
		imgWin.document.write("<html><head><title>이미지 미리보기</title></head>");
		imgWin.document.write("<body topmargin=0 leftmargin=0>");
		imgWin.document.write("<img src="+img+" onclick='self.close()' style=cursor:hand>");
		imgWin.document.close();
	} 
	
	


	/* 
	풋터 레이어 스크립트
	
	*/

	function showLayer(tgtEl)    { document.getElementById(tgtEl).style.display = "block"; }
	function hideLayer(tgtEl)    { document.getElementById(tgtEl).style.display = "none"; }

	

	/* 
	베스트FAQ 스크립트
	
	*/
	function showanswer(submenu){
	  if (submenu.style.display=="none") {
		submenu.style.display="";
	  } else if (submenu.style.display=="") {
	submenu.style.display="none";
	  }
	}


	/* 
	슬라이드 장바구니 툴팁스크립트

	*/	
	var openingLayer=0;
	var t_height,t_width;
	function openLayer(layerName){//레이어 초기 설정

		if (!openingLayer){
			sv = document.getElementById(layerName).style;
			t_height = parseInt(sv.height);
			t_width = parseInt(sv.width);
			sv.height=10;
			sv.width=10;
			openingLayer=1;
			sv.display = 'inline';
			movingLayer(layerName);
		}

	}

	function movingLayer(layerName){//레이어 움직임 설정
		var steps=2.5; //속도설정 값이 커질 수록 느려짐 default 2.5

		sv = document.getElementById(layerName).style;

		tmpx = parseInt(sv.height);
		tmpy = parseInt(sv.width);
		if (t_height - tmpx > 1){
			sv.display = 'inline';
			sv.height = tmpx+(t_height-tmpx)/steps+1;
			sv.width = tmpy+(t_width-tmpy)/steps+1;
			window.setTimeout("movingLayer('"+layerName+"')",5);
		} else {
			sv.height = t_height;
			sv.width = t_width;
			openingLayer=0;
		}
	}

	/* 
	상품레이어
	
	*/

	function layerView(idName)	{
		Obj = document.getElementById(idName);
		Obj.style.display="block";
	}

	function layerHidden(idName)	{
		Obj = document.getElementById(idName);
		Obj.style.display="none";
	}

	function layerView2(idName,T,L)	{
		Obj = document.getElementById(idName);
		Obj.style.display= "block";
		Obj.style.top= T + "px";
		Obj.style.left= L + "px";
	}


	/* 
	상품 카테고리 스크립트
	
	*/

	
	/* 
	상품이미지 체인지
	
	*/
	function changeImage(img_url, width, height){
	document.big_img.src = img_url;
	document.big_img.width = width;
	document.big_img.height = height;
    	return;
	}


	/* 
	상품상세정보 이미지줌
	
	*/
	function openImageWinCenter(imageRef){
        var x,y,w,h,loadingMsg;
        //팝업될 창의 초기 크기
        w=300;h=300;
        //화면 한가운데로 팝업창 띄우기 위한 좌표 계산
        x=Math.floor( (screen.availWidth-(w+12))/2 );y=Math.floor( (screen.availHeight-(h+30))/2 );

        //이지미가 로딩중에 내보낼 메시지
        loadingMsg="<div id='_img_login_msg' style='color:#fff;'><strong>이미지 로딩중</strong></div>";

        with( window.open("","",'height='+h+',width='+w+',top='+y+',left='+x+',scrollbars=no,resizable=no') )
        {
                document.write(
                "<body topmargin=0 rightmargin=0 bottommargin=0 leftmargin=0>",
                loadingMsg,
                "<img src=\""+imageRef+"\" hspace=0 vspace=0 border=0 onmousedown=\"window.close();\" onload=\"document.title=this.src;document.getElementById('_img_login_msg').display='none';window.resizeTo(this.width+12,this.height+30);window.moveTo(Math.floor( (screen.availWidth-(this.width+12))/2),Math.floor( (screen.availHeight-(this.height+30))/2 ));\">",
                "</body>");
                focus();
        }
	}

	/* 
	FAQ 슬라이드부분
	
	*/
	function slide(Id, interval, to)
	{
		var obj = document.getElementById(Id);
		var H, step = 30; // 속도설정. 숫자가 클수록 빠름

		if (obj == null) return;
		if (to == undefined) { // user clicking
			if (obj._slideStart == true) return;
			if (obj._expand == true) {
				to = 0;
				obj.style.overflow = "hidden";
			} else {
				slide.addId(Id);
				for(var i=0; i < slide.objects.length; i++) {
					if (slide.objects[i].id != Id && slide.objects[i]._expand == true) {
						slide(slide.objects[i].id);
					}
				}

				obj.style.height = "";
				obj.style.overflow = "";
				obj.style.display = "block";
				to = obj.offsetHeight;
				obj.style.overflow = "hidden";
				obj.style.height = "3px";
			}
			obj._slideStart = true;
		}
		
		step            = ((to > 0) ? 1:-1) * step;
		interval        = ((interval==undefined)?1:interval);
		obj.style.height = (H=((H=(isNaN(H=parseInt(obj.style.height))?0:H))+step<0)?0:H+step)+"px";
		
		if (H <= 0) {
			obj.style.display = "none";
			obj.style.overflow = "hidden";
			obj._expand = false;
			obj._slideStart = false;
		} else if (to > 0 && H >= to) {
			obj.style.display = "block";
			obj.style.overflow = "visible";
			obj.style.height = H + "px";
			obj._expand = true;
			obj._slideStart = false;
		} else {
			setTimeout("slide('"+Id+"' , "+interval+", "+to+");", interval);
		}
	}
	slide.objects = new Array();
	slide.addId = function(Id)
	{
		for (var i=0; i < slide.objects.length; i++) {
			if (slide.objects[i].id == Id) return true;
		}
		slide.objects[slide.objects.length] = document.getElementById(Id);
	}


	/* 
	FAQ 자주하는 질문 베스트5
	
	*/
	function layer_toggle(obj) {
        if (obj.style.display == 'none') obj.style.display = 'block';
        else if (obj.style.display == 'block') obj.style.display = 'none';
	}


	/* 

	브랜드 슬라이드
	
	*/
	var x = 0;
	var dest = 0;
	var distance = 0;
	var step = 0;
	var destination = 0;

	function scrollit(destination) {
		step = 10;
		dest = destination;
		if (x<dest) {
			while (x<dest) {
				step += (step / 2000);
				x += step;
		this.frames.iframe_scroll.scroll(x,0);
		} 
		this.frames.iframe_scroll.scroll(dest,0);
			x = dest;
	}

		if (x > dest) {
			while (x>dest) {
				step += (step / 2000);
		if(x >= (0+step)) {
			x -= step; 
			this.frames.iframe_scroll.scroll(x,0);
			}
		else { break; }
		} 
		if(dest >= 0) { this.frames.iframe_scroll.scroll(dest,0); }
			x = dest;
		} 
		if (x<1) {x=1}
		if (x>2850) {x=1900} 
	}

	
	/* 
	목록열기/닫기
	
	*/
    function ListClose(Prt, Chk){
   
        if('List' == Prt){ //게시물리스트
          var ListChk = 'pList';
          var btClose = 'btnClose';
          var btOpen = 'btnOpen';
          var Vlistchk = 'vList'; //해당글타이틀
        }else if('Reply' == Prt){ //덧글리스트
          var ListChk = 'RepList';
          var btClose = 'RebtnClose';
          var btOpen = 'RebtnOpen';          
        }
                  
          if('show' == Chk){ //목록열기
						if('List' == Prt){    
							document.getElementById(Vlistchk).style.display = "none";      	
						}          	
              document.getElementById(btOpen).style.display = "none";
              document.getElementById(btClose).style.display = "";
              document.getElementById(ListChk).style.display = "";
          } else if('hide' == Chk){ //목록닫기
						if('List' == Prt){    
							document.getElementById(Vlistchk).style.display = "";      	
						}           	
              document.getElementById(btOpen).style.display = "";
              document.getElementById(btClose).style.display = "none";
              document.getElementById(ListChk).style.display = "none";
          }

    }	


	
	/* 
	팝업메인
	
	*/
	function informationbar(){
    this.displayfreq="always"
    this.content='<div style="position:absolute; z-index:998"><a href="javascript:informationbar.close()"><img src="/images/common/slb_close.gif" style="float:right; border:0; margin-top:5px; margin-right:155px" /></a></div>'
	}

	informationbar.prototype.setContent=function(data){
		this.content=this.content+data
		document.write('<div id="informationbar"  style="position:absolute; z-index:999; top:-500px;">'+this.content+'</div>')
	}

	informationbar.prototype.animatetoview=function(){
		var barinstance=this
		if (parseInt(this.barref.style.top)<0){
			this.barref.style.top=parseInt(this.barref.style.top)+5+"px"
			setTimeout(function(){barinstance.animatetoview()}, 0) /* 0이 시간조정 십단위조정 */
		}
		else{
			if (document.all && !window.XMLHttpRequest)
			this.barref.style.setExpression("top", 'document.compatMode=="CSS1Compat"? document.documentElement.scrollTop+"px" : body.scrollTop+"px"')
		else
			this.barref.style.top=0
		}
	}

	informationbar.close=function(){
		document.getElementById("informationbar").style.display="none"
		if (this.displayfreq=="session")
			document.cookie="infobarshown=1;path=/";

		setCookie("noDisplay", "Y", 2);
	}

	informationbar.prototype.setfrequency=function(type){
		this.displayfreq=type
	}

	informationbar.prototype.initialize=function(){
		if (this.displayfreq=="session" && document.cookie.indexOf("infobarshown")==-1 || this.displayfreq=="always"){
			this.barref=document.getElementById("informationbar")
			this.barheight=parseInt(this.barref.offsetHeight)
			this.barref.style.top=this.barheight*(-1)+"px"
			this.animatetoview()
		}
	}

	window.onunload=function(){
		this.barref=null
	}

	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 "";
	} 




	/* 
	Textarea Resizer 스크립트
	
	*/

	// Constructor
	function textareaResizer(textarea) {
		if (textareaResizer.htmlstyle == null)
			textareaResizer.htmlstyle = document.getElementsByTagName('html')[0].style;
		
		var ua = navigator.userAgent.toLowerCase(), name;
		switch (true) {
			case ua.indexOf('konqueror') >= 0:
			case ua.indexOf('opera') >= 0:
			case ua.charAt(ua.indexOf('msie') + 5) == 5: // IE5
			case ua.charAt(ua.indexOf('safari') - 4) >= 3: // Safari 3
				return;
				break;
		};
		
		var index = textareaResizer.instances.length;
		textareaResizer.instances[textareaResizer.instances.length] = this;
		
		var handle = document.createElement('span');
		handle.className = 'textarea-handle';
		handle.onmousedown = function(e) { textareaResizer.instances[index].listen(e); };
		handle.onmouseover = function() { this.style.cursor = 'n-resize'; };
		handle.onmouseout = function() { this.style.cursor = 'auto'; };
		handle = textarea.parentNode.insertBefore(handle, textarea.nextSibling);
		handle.middle = Math.ceil(textareaResizer.findHeight(handle) / 2);
		
		this.handle = handle;
		this.textarea = textarea;
		this.index = index;
		this.minHeight = 100;
	};

	// Static properties
	textareaResizer.isResizing = false;
	textareaResizer.instances = new Array;
	textareaResizer.htmlstyle = null;

	// Static methods
	textareaResizer.findPosY = function(obj)
	{
		var curtop = 0;
		if (obj.offsetParent)
			while (obj.offsetParent) {
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	};
	textareaResizer.findHeight = function(element, recalc) {
		if (element.height && recalc != true)
			return element.height;
		else {
			if (element.style.height)
				element.height = parseInt(element.style.height);
			else {
				element.style.height = element.clientHeight + 'px';
				element.height = parseInt(element.style.height);
			};
			return element.height;
		}
	};
	textareaResizer.pageY = function(e) {
		if (!e.pageY)
			return e.clientY + window.document.documentElement.scrollTop;
		else
			return e.pageY;
	};

	/*
	textareaResizer.addToAll = function() {
		for (var i = 0, textarea; textarea = document.getElementsByTagName('textarea')[i]; i++)
			new textareaResizer(textarea);
		textarea = null;
	};
	*/
	// 하나만 적용하기위해 아래와 같이 수정
	textareaResizer.addToAll = function sgTextarea(ttid) {
		new textareaResizer(document.getElementById(ttid));
		textarea = null;
	};

	// Methods
	textareaResizer.prototype.listen = function(e) {
		var handle = this.handle, index = this.index;
		
		textareaResizer.htmlstyle.cursor = 'n-resize';
		textareaResizer.isResizing = true;
		handle.onmousedown = null;
		handle.onmouseup = function(e) { textareaResizer.instances[index].stopListening(e); };
		window.document.onmouseup = function(e) { textareaResizer.instances[index].stopListening(e); };
		window.document.onmousemove = function(e) { textareaResizer.instances[index].resize(e); };
	};
	textareaResizer.prototype.resize = function(e) {
		if (!e) var e = window.event;
		e.cancelBubble = true;
		
		var selection = document.selection;
		if (selection)
			selection.clear();
		
		if (textareaResizer.isResizing) {
			var textarea = this.textarea, handle = this.handle, minHeight = this.minHeight;
			
			/* This next statement is:
				* Textarea height +
				* Desired change in height +
				* Half the size of the handle (so the cursor stays in the middle of it) */
			var newHeight = textareaResizer.findHeight(textarea, true) + textareaResizer.pageY(e) - textareaResizer.findPosY(handle) - handle.middle;
			if (newHeight < minHeight)
				newHeight = minHeight;
			
			textarea.style.height = newHeight + 'px';
		};
	};
	textareaResizer.prototype.stopListening = function(e) {
		var handle = this.handle, index = this.index;
		
		textareaResizer.htmlstyle.cursor = 'auto';
		textareaResizer.isResizing = false;
		window.document.onmousemove = null;
		window.document.onmouseup = null;
		handle.onmouseup = null;
		handle.onmousedown = function(e) { textareaResizer.instances[index].listen(e); };
	};

	/**
	 * 이전달 다음달
	 * @param dateStr String "Y-m-d" 포멧
	 * @param step Int 이동월 (1, -1) getCalMonth('2009-05-01', -1) 이면  "2009-04-01" 리턴
	 * @return String "Y-m-d" 포멧
	 */
	function getCalMonth(dateStr, step) {
		var arrYMD = dateStr.split("-");
		var date = new Date(arrYMD[0], arrYMD[1], arrYMD[2]);
		date.setMonth(date.getMonth() + step);
		
		var year = date.getFullYear();
		var month = date.getMonth() < 10 ? "0" + date.getMonth() : date.getMonth();
		var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
		return year + "-" + month + "-" + day;
	}

	/* 
	포토갤러리 스크립트
	
	*/

	//<![CDATA[
	function MainGiftArea() {
	this.giftCurrIdx = 1;
	this.giftSetCount = parseInt('3');
	this.timerId = null;
	}
	MainGiftArea.prototype = {
	init: //{{{
	function () {
	if (this.giftSetCount > 1) this.timerId = window.setInterval('mainGiftArea.rollContent(\'fwd\');', 3000);
	}
	, //}}}
	rollContent: //{{{
	function (direction) {
	document.getElementById('giftThumb' + this.giftCurrIdx).style.display = "none";
	this.giftCurrIdx = (direction == 'fwd' ? this.giftCurrIdx + 1 : this.giftCurrIdx - 1);
	if (this.giftCurrIdx > this.giftSetCount) this.giftCurrIdx = 1;
	else if (this.giftCurrIdx < 1) this.giftCurrIdx = this.giftSetCount;
	document.getElementById('giftThumb' + this.giftCurrIdx).style.display = "block";
	}
	, //}}}
	setActionStatus: //{{{
	function (flag) {
	if (flag) {
	this.timerId = window.setInterval('mainGiftArea.rollContent(\'fwd\');', 3000);
	}
	else {
	if (!this.timerId) return;
	clearInterval(this.timerId);
	this.timerId = null;
	}


	}
	//}}}
	}
	;

// 에러나서 주석처리 3.11 kwCho
//	mainGiftArea = new MainGiftArea();
//	mainGiftArea.init();
	//]]>


	/* 
	하단 셀렉트메뉴 관련 스크립트
	
	*/

	// ExtendedSelectManager의 instance. Global객체.
	var SelectEXT;
	/************************* ExtendedSelectManager *************************/
	/**
	 * 기본적으로 select객체와 거의 동일하게 동작한다.
	 * DOC에서의 select의 객체의 주요 속성에 대한 retrive는 잘 지원하지만 set은 지원 되지 않는다.
	 * setValue(), setSelectedIndex()를 참고할 것.
	 */

	function ExtendedSelectManager() {
		this.isIE = window.navigator.userAgent.indexOf("MSIE") > 0;
		this.isNS = window.navigator.appName.indexOf("Netscape") == 0;
		this.browserVersion = parseFloat(window.navigator.appVersion);
		this.currentSObj == null;	// 현재 주목하고 있는 select객체.
		this.closeTimeOut = 1000;	// 마우스가 select에서 벗어났을때 펼처진 리스트를 숨기기까지의 시간. 밀리초.
		this.selectes = new Array();	// select객체를 담고 있는 리스트. key: select객체의 id, value: select객체.
		this.cursorName = this.isIE && this.browserVersion < 6 ? "hand" : "pointer";
		this.fontSize = 11;	// 글자 기본 크기.
		this.lineHeight = 14;	// 글자 기본 크기.
		this.unitSize = 17;	// 기본 크기. 단위 px. ex) option의 높이.
		this.defaultLineCount = 8;	// 펼처질 리스트에 보여질 option의 기본 개수.
		this.defaultWidth = 100;	// 펼처질 리스트의 기본 너비. 단위 px.
	//	this.defaultBGColor = "#F5F2EB";	 기본 배경색.
		this.defaultBGColor = "#F0F0F0";	// 기본 배경색 2005-09-교체
	//	this.defaultFontColor = "#FFFFFF";
		this.defaultFontColor = "#888888";
	//	this.defaultArrowColor = "#C5BDA6"; // 기본 배경색 2005-09-교체
	//	this.arrowImage = "/images/btn_down.gif"; 


	//SS_ENV.CR.ReverseBackground = '#F5F2EB';
	//SS_ENV.CR.ReverseText = '#969696';
	//SS_ENV.CR.Border = '#BABABA';
	//SS_ENV.CR.BorderActive = '#BDBEBE';
	//SS_ENV.ImgPrefix = 'http://ir.imbc.com/2006/images/';
	//SS_ENV.DefaultHeight = '17px';
	//SS_ENV.ButtonWidth = '16px';



		this.targets = new Array();
		this.appendTarget = function (sObjId) {
			this.targets[this.targets.length] = sObjId;
		}
		this.changeAll = function (sObjId) {
			if(this.targets.length > 0) {
				for(var i = 0; i < this.targets.length; i++)
					this.change(this.targets[i]);
			}
		}
		/**
		 * 노멀한 select를 ExtendedSelect로 바꾸는	.
		 * @public
		 * @param sObjId select객체의 id.
		 */
		this.change = function (sObjId) {
			if(true) {//this.isIE) {
				var sObj = document.getElementById(sObjId);
				if(sObj) {
					var extSelObj = new ExtendedSelect(sObj);
					this.selectes[sObjId] = extSelObj;
					sObj.parentNode.replaceChild(extSelObj.create(), sObj);
				}
			} else {
			}
		}
		/**
		 * ExtendedSelect의 값을 변경하는 메소드.
		 * @public
		 * @param sObjId select객체의 id.
		 * @param value 변경하고자 하는 값.
		 */
		this.setValue = function (sObjId, value) {
			if(this.isIE && this.selectes[sObjId]) {
				this.selectes[sObjId].setValue(value);
			} else {
				var sObj = document.getElementById(sObjId);
				if(sObj) sObj.value = value;
			}
		}
		/**
		 * ExtendedSelect의 selectedIndex를 변경하는 메소드.
		 * @public
		 * @param sObjId select객체의 id.
		 * @param index 변경하고자 하는 index.
		 */
		this.setSelectedIndex = function (sObjId, index) {
			if(this.isIE && this.selectes[sObjId]) {
				this.selectes[sObjId].setSelectedIndex(index);
			} else {
				var sObj = document.getElementById(sObjId);
				if(sObj) sObj.selectedIndex = index;
			}
		}
		/**
		 * ExtendedSelect에 설정된 현재 값을 가져오는 메소드.
		 * @public
		 * @param sObjId select객체의 id.
		 */
		this.getValue = function (sObjId) {
			if(this.isIE && this.selectes[sObjId]) {
				return this.selectes[sObjId].getValue();
			} else {
				var sObj = document.getElementById(sObjId);
				if(sObj) return sObj.value;
			}
		}
		/**
		 * 현재 주목하고 있는 ExtendedSelect를 기억해 두기 위한 메소드.
		 * @private
		 * @param sObj 현재 주목하고 있는 ExtendedSelect객체.
		 */
		this.setShowed = function (sObj) {
			if(this.currentSObj && this.currentSObj != sObj) {
				window.clearTimeout(this.currentSObj.closeTimer);
				this.currentSObj.close();
			}
			this.currentSObj = sObj;
		}
		/**
		 * 현재 주목하고 있는 ExtendedSelect객체의 펼처진 리스트를 숨기는 메소드.
		 * @private
		 */
		this.close = function () {
			if(SelectEXT.currentSObj != null)
				SelectEXT.currentSObj.close();
		}
	// style 관련 메소드들.
		// 제목영역의 style.
		this.applyTitleStyle = function (title, sObj) {
			title.style.color = sObj.fontColor;
			title.style.fontSize = SelectEXT.fontSize + "px";
			title.style.textIndent = "3px";
			title.style.paddingTop = "2px";
			title.style.height = SelectEXT.unitSize + "px";
			title.style.lineHeight = SelectEXT.lineHeight + "px";
			title.style.overflow = "hidden";
			title.noWrap = true;


	//SS_ENV.CR.Border = '#BABABA';
	//SS_ENV.CR.BorderActive = '#BDBEBE';
	//SS_ENV.ImgPrefix = '/images/';
	//SS_ENV.DefaultHeight = '17px';
	//SS_ENV.ButtonWidth = '16px';


	//		title.style.borderColor = "#BDBEBE";
	//		title.style.borderWidth  = "1px";	// 이 값은 변경 하지 말것. //
	//		title.style.borderStyle = "solid";

		}
		// 리스트의 style.
		this.applyListStyle = function (listObj, sObj) {
			listObj.style.fontSize = SelectEXT.fontSize + "px";
			listObj.style.lineHeight = SelectEXT.lineHeight + "px";
			if(SelectEXT.isIE) {
				listObj.style.overflowX = "hidden";
				listObj.style.overflowY = "auto";
			} else {
				listObj.style.overflow = "auto";
			}

			listObj.style.zIndex = 1;
			listObj.style.borderColor = "#F0F0F0";
			listObj.style.borderWidth  = "0px";	// 이 값은 변경 하지 말것. //
			listObj.style.borderStyle = "solid";
			listObj.style.color = SelectEXT.defaultFontColor;
			if (true) {//this.isIE && this.browserVersion >= 5.5) {
				listObj.style.scrollbarFaceColor = sObj.arrowColor;
				listObj.style.scrollbarHighlightColor = "#F0F0F0";
				listObj.style.scrollbarShadowColor = "#F0F0F0";
				listObj.style.scrollbar3dLightColor = sObj.bgColor;
				listObj.style.scrollbarArrowColor = sObj.fontColor;
				listObj.style.scrollbarTrackColor = sObj.bgColor;
				listObj.style.scrollbarDarkShadowColor = sObj.bgColor;
			}
		}
		// optGroup의 style.
		this.applyOptGroupStyle = function (optGroup, sObj) {
			optGroup.style.color = sObj.fontColor;
			optGroup.style.textIndent = "3px";
			optGroup.style.paddingTop = "2px";
			optGroup.style.height = SelectEXT.unitSize + "px";
			optGroup.style.lineHeight = SelectEXT.lineHeight + "px";
			optGroup.style.fontSize = SelectEXT.fontSize + "px";
			optGroup.style.fontStyle = "italic";
			optGroup.style.fontStyle = "italic";
			optGroup.style.fontWeight = "bold";
			optGroup.noWrap = true;
		}
		// option의 style.
		this.applyOptionStyle = function (option, sObj) {
			option.style.color = sObj.fontColor;
			option.style.cursor = SelectEXT.cursorName;
			option.style.fontSize = SelectEXT.fontSize + "px";
			option.style.textIndent = "3px";
			option.style.paddingTop = "2px";
			option.style.height = SelectEXT.unitSize + "px";
			option.style.lineHeight = SelectEXT.lineHeight + "px";
			option.noWrap = true;
		}
	}
	SelectEXT = new ExtendedSelectManager();

	/************************* ExtendedSelect *************************/
	/**
	 * id: document.getElementById()로 가져올수 있는 select객체의 id. unique해야 함.
	 * name: form으로 넘거갈때에 사용되는 select의 이름. (내부적으로 hidden으로 넘겨줌.)
	 * direction: 리스트가 펼처질 방향. "up", "down" default는 "down".
	 * width: 제목영역의 가로길이. default는 SelectEXT.defaultWidth
	 * listWidth: 리스트영역의 가로길이. default는 제목영역의 가로길이.
	 * lineCount: 리스트가 펼쳐질때 보여질 option의 개수. 높이를 결정함. default는 8.
	 * arrowImage: 제목영역의 화살표 이미지 URL. 설정되어 있지 않을때에는 ▼로 생성함.
	 * style {
	 * 	- width: 제목영역의 가로길이. 위의 width값을 덮어씌움.
	 * 	- background-color: select의 배경색. default는 SelectEXT.defaultBGColor
	 * }
	 */
	function ExtendedSelect(sObj) {
		this.id = sObj.id;	// id
		this.name = sObj.name;
		this.value;			// ExtendedSelect에 설정된 값.
		this.text;			// ExtendedSelect에 설정된 값에 해당하는 텍스트.
		this.direction = sObj.getAttribute("direction");	// 리스트가 펼쳐질 방향. up, down 을 지원. 기본값은 down.
		this.divAll = document.createElement("DIV");	// 전체 구조를 가지는 DIV.
		this.titleObj;	// select에 기본으로 보여지는 텍스트 노드.
		this.hiddenObj;	// form을 이용하여 데이타가 넘어갈때 필요한 input(hidden) 객체.
		this.listObj;	// select의 list부분을 구성하는 div 노드.

		this.bgColor = sObj.getAttribute("bgColor") ? sObj.getAttribute("bgColor") : SelectEXT.defaultBGColor;
		if(sObj.style.backgroundColor) this.bgColor = sObj.style.backgroundColor;
		this.fontColor = sObj.getAttribute("fontColor") ? sObj.getAttribute("fontColor") : SelectEXT.defaultFontColor;
		if(sObj.style.color) this.fontColor = sObj.style.color;
		this.arrowColor = sObj.getAttribute("arrowColor") ? sObj.getAttribute("arrowColor") : SelectEXT.defaultArrowColor;

		this.width = sObj.getAttribute("width") ? parseInt(sObj.getAttribute("width"), 10) : SelectEXT.defaultWidth;
		if(parseInt(sObj.style.width, 10) > 0) this.width = parseInt(sObj.style.width, 10);

		this.listWidth = sObj.getAttribute("listWidth") ? parseInt(sObj.getAttribute("listWidth"), 10) : this.width;

		if(sObj.getAttribute("lineCount"))
			this.height = parseInt(sObj.getAttribute("lineCount"), 10) * SelectEXT.unitSize + 2;
		else if(sObj.options.length < SelectEXT.defaultLineCount)
			this.height = sObj.options.length * SelectEXT.unitSize + 2;
		else
			this.height = SelectEXT.defaultLineCount * SelectEXT.unitSize + 2;

		this.arrowImage = sObj.getAttribute("arrowImage");

		this.children = new Array();	// option이나 optGroup을 가지는 리스트.
		this.options = new Array();	// option만을 가지는 리스트.
		this.selectedIndex = -1;	// 현재 선택된 option의 번호.
		this.onChange = sObj.onchange;	// select의 onChange 이벤트 핸들러를 가져옴.

		/**
		 * DOM을 이용하여 보여주기 위한 객체들을 생성하는 메소드.
		 */
		this.create = function () {
			// option 또는 optGroup이 들어갈 div.
			this.listObj = document.createElement("DIV");
			this.listObj.selObject = this;
			this.listObj.onmouseover = this.onMouseOver;
			this.listObj.onmouseout = this.onMouseOut;
			this.listObj.style.background = this.bgColor;
			this.listObj.style.visibility = "hidden";
			this.listObj.style.position = "absolute";
			this.listObj.style.width = (this.width + 2) + "px";
			this.listObj.style.height = this.height + "px";
			this.listObj.style.left = "0px";
			this.listObj.style.top = "-" + this.height +"px";
			if(this.direction)
			switch(this.direction) {
				case "down":
					this.listObj.style.top = (this.height) + "px";
					break;
				case "up":
					break;
				default:
					break;
			}
			for(var i = 0; i < this.children.length; i++) // 하위의 option 또는 optGroup을 만들어서 붙임.
				this.listObj.appendChild(this.children[i].create());
			SelectEXT.applyListStyle(this.listObj, this);

			var tableObj = document.createElement("TABLE");
			tableObj.cellSpacing = 0;
			tableObj.cellPadding = 0;
			tableObj.border = 0;
			tableObj.borderStyle = "solid";
			tableObj.width = this.width + "px";
			tableObj.style.height = (SelectEXT.unitSize + 2) + "px";
			tableObj.bgColor = "#F0F0F0";
			
			var tr = tableObj.insertRow(0);
			tr.selObject = this;
			tr.style.cursor = SelectEXT.cursorName;

			// 제목 영역이 들어갈 div.
			var div = document.createElement("DIV");
			div.selObject = this;
			div.style.width = (this.width - SelectEXT.unitSize + 2) + "px";
			div.style.height = SelectEXT.unitSize + "px";
			div.style.background = this.bgColor;
			this.titleObj = document.createTextNode("선택하세요");
			div.appendChild(this.titleObj);
			var td = tr.insertCell(0);
			td.align = "center";
			td.vAlign = "middle";
			td.style.width = (this.width - SelectEXT.unitSize + 2) + "px";
			td.style.color = this.listObj.style.color;
			SelectEXT.applyTitleStyle(div, this);
			td.appendChild(div);
			// 아래방향 화살표 이미지.
			var arrow;
			if(this.arrowImage) {
				arrow = new Image();
				arrow.src = this.arrowImage;
				arrow.border = 0;
				arrow.width = SelectEXT.unitSize;
				arrow.height = SelectEXT.unitSize;

			} else {
				arrow = document.createElement("DIV");
				arrow.style.fontSize = SelectEXT.fontSize + "px";
				arrow.style.paddingTop = "2px";
				arrow.style.background = this.listObj.style.scrollbarFaceColor;
				arrow.style.color = this.listObj.style.scrollbarArrowColor;
				arrow.style.width = SelectEXT.unitSize + "px";
				arrow.style.height = SelectEXT.unitSize + "px";
				arrow.appendChild(document.createTextNode("▼"));
			}
			arrow.selObject = this;
			td = tr.insertCell(1);
			td.align = "center";
			td.vAlign = "middle";
	//		title.style.borderColor = "#BDBEBE";
	//		title.style.borderWidth  = "1px";	// 이 값은 변경 하지 말것. //
	//		title.style.borderStyle = "solid";



	//		td.width = (SelectEXT.unitSize + 2) + "px";
	//		td.height = (SelectEXT.unitSize + 2) + "px";
	//		td.style.backgroundColor = this.arrowColor;
			td.appendChild(arrow);

			tr.onclick = this.onClick;
			tr.onmouseover = this.onMouseOver;
			tr.onmouseout = this.onMouseOut;

			// 생성하면서 셋팅할 값과 보여줄 텍스트를 계산.
			if(this.selectedIndex == -1) {
				this.selectedIndex = 0;
			}
			if(this.options[this.selectedIndex]) {
				this.value = this.options[this.selectedIndex].value;
				this.text = this.options[this.selectedIndex].text;
			}
			this.titleObj.nodeValue = this.text;
			this.titleObj.parentNode.title = this.text;
			if(SelectEXT.isIE) {
				this.hiddenObj = document.createElement("<input name='"+this.name+"'>");	
				this.hiddenObj.selObject = this;
				this.hiddenObj.onpropertychange = this.onValueChange;
			} else {
				this.hiddenObj = document.createElement("INPUT");	
				this.hiddenObj.name = this.name;
			}
			this.hiddenObj.type = "hidden";
			this.hiddenObj.value = this.value;
			this.hiddenObj.text = this.text;
			this.hiddenObj.selectedIndex = this.selectedIndex;
			this.hiddenObj.options = this.options;

			this.divAll.id = this.id;
			this.divAll.style.display = "inline";
			this.divAll.style.position = "relative";
			this.divAll.style.backgroundColor = this.bgColor;
			this.divAll.appendChild(tableObj);
			this.divAll.appendChild(this.listObj);
			this.divAll.appendChild(this.hiddenObj);

			// 생성된 table을 return.
			return this.divAll;
		}
		this.onClick = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj && obj.selObject) obj.selObject.onClickProc();
		}
		this.onClickProc = function () {
			this.toggleShow();
		}
		this.onMouseOver = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj && obj.selObject) obj.selObject.onMouseOverProc();
		}
		this.onMouseOverProc = function () {
			this.stopClose();
		}
		this.onMouseOut = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj && obj.selObject) obj.selObject.onMouseOutProc();
		}
		this.onMouseOutProc = function () {
			this.startClose();
		}
		this.onValueChange = function () {	// IE only...
			var e = window.event;
			var obj = e.srcElement;
			if(obj && obj.selObject) {
				var sObj = obj.selObject;
				switch(e.propertyName) {
					case "value":
						if(sObj.value != obj.value) sObj.setValue(obj.value);
						break;
					case "text":
						if(sObj.text != obj.text) sObj.setText(obj.text);
						break;
					case "selectedIndex":
						if(sObj.selectedIndex != obj.selectedIndex) sObj.setSelectedIndex(obj.selectedIndex);
						break;
					case "style.display":
						if(sObj.divAll.style.display != obj.style.display) sObj.divAll.style.display = obj.style.display;
						break;
					case "style.visibility":
						if(sObj.divAll.style.visibility != obj.style.visibility) sObj.divAll.style.visibility = obj.style.visibility;
						break;
				}
			}
		}
		/**
		 * 이 ExtendedSelect를 벗어나는 경우 펼쳐저 있던 리스트를 숨기기 위한 timer를 작동시키는 메소드.
		 */
		this.startClose = function () {
			this.stopClose();
			if(this.listObj.style.visibility == "visible")
				this.closeTimer = window.setTimeout(SelectEXT.close, SelectEXT.closeTimeOut);
		}
		/**
		 * 일정 시간 이내(SelectEXT.closeTimeOut)에 다시 들어왔을때 timer를 멈추게 하는 메소드.
		 */
		this.stopClose = function () {
			if(this.closeTimer != null) {
				window.clearTimeout(this.closeTimer);
				this.closeTimer = null;
			}
		}
		/**
		 * 펼쳐진 리스트를 숨기는 메소드.
		 */
		this.close = function () {
			this.listObj.style.visibility = "hidden";
		}
		/**
		 * 리스트를 펼치는 메소드.
		 */
		this.show = function () {
			this.listObj.style.visibility = "visible";
			if(this.selectedIndex >= 0 && this.selectedIndex < this.options.length) {
				this.options[this.selectedIndex].onMouseOverProc();
				if(SelectEXT.isIE) this.options[this.selectedIndex].divObj.focus();
			}
			// 이 ExtendedSelect가 주목받고 있다는 것을 기억해둠.
			SelectEXT.setShowed(this);
		}
		/**
		 * ExtendedSelect를 클릭하는 경우 펼침/숨김을 하기 위한 메소드.
		 */
		this.toggleShow = function () {
			if(this.listObj.style.visibility == "visible") this.close();
			else this.show();
		}
		/**
		 * 값을 설정하는 메소드.
		 */
		this.setValue = function (value) {
			var opt = null;
			if(this.selectedIndex >= 0 && this.selectedIndex < this.options.length)
				this.options[this.selectedIndex].onMouseOutProc();
			var founded = false;
			for(var i = 0; i < this.options.length; i++) {
				opt = this.options[i];
				if(opt.value == value) {
					opt.selected = true;
					this.selectedIndex = i;
					founded = true;
				} else {
					opt.selected = false;
				}
			}
			if(!founded) this.selectedIndex = -1;
			this.refresh();
		}
		this.setText = function (text) {
			var opt = null;
			if(this.selectedIndex >= 0 && this.selectedIndex < this.options.length)
				this.options[this.selectedIndex].onMouseOutProc();
			var founded = false;
			for(var i = 0; i < this.options.length; i++) {
				opt = this.options[i];
				if(opt.text == text) {
					opt.selected = true;
					this.selectedIndex = i;
					founded = true;
				} else {
					opt.selected = false;
				}
			}
			if(!founded) this.selectedIndex = -1;
			this.refresh();
		}
		this.setSelectedIndex = function (index) {
			if(index >= 0 && index < this.options.length)
				this.selectedIndex = index;
			else if(index == -1)
				this.selectedIndex = -1;
			this.refresh();
		}
		/**
		 * 제목 영역을 다시 뿌려주는 메소드.
		 */
		this.refresh = function () {
			if(this.selectedIndex >= 0 && this.selectedIndex < this.options.length) {
				if(this.value != this.options[this.selectedIndex].value) {
					this.value = this.options[this.selectedIndex].value;
					this.hiddenObj.value = this.value;
					this.hiddenObj.selectedIndex = this.selectedIndex;
					this.text = this.options[this.selectedIndex].text;
					this.titleObj.nodeValue = this.text;
					this.titleObj.parentNode.title = this.text;
					this.hiddenObj.text = this.text;
					// 값이 변경된 경우이므로 select에 설정되어있는 onChange이벤트 핸들러를 호출한다.
					if(this.onChange) this.onChange();
				}
			} else if(this.selectedIndex == -1){
				this.value = "";
				this.hiddenObj.value = this.value;
				this.hiddenObj.selectedIndex = this.selectedIndex;
				this.text = "";
				this.titleObj.nodeValue = "　";
				this.titleObj.parentNode.title = this.text;
				this.hiddenObj.text = this.text;
				if(this.onChange) this.onChange();
			}
		}

		// 초기화 작업.
		var nodeList = sObj.childNodes;
		if(nodeList && nodeList.length > 0) {
			for(var i = 0; i < nodeList.length; i++) {
				if(nodeList[i].tagName) {
					if(nodeList[i].tagName.toLowerCase() == "optgroup") {
						var optGroup = new ExtendedOptGroup(this);
						optGroup.init(this, nodeList[i]);
						this.children[this.children.length] = optGroup;
					} else if(nodeList[i].tagName.toLowerCase() == "option") {
						var opt = new ExtendedOption(this);
						opt.init(nodeList[i], "");
						this.children[this.children.length] = opt;
					}
				}
			}
		}
	}

	/************************* ExtendedOptGroup *************************/
	function ExtendedOptGroup(sObj) {
		this.sObj = sObj;	// 부모가 되는 ExtendedSelect 객체.
		this.label;	// optGroup의 label.
		this.divObj;	// optGroup과 그 하위에 포함되는 option이 들어갈 div.
		this.options = new Array();	// option 리스트.
		/**
		 * 초기화 메소드.
		 */
		this.init = function(sObj, optGroup) {
			this.label = optGroup.label;
			var nodeList = optGroup.childNodes;
			if(nodeList && nodeList.length > 0) {
				for(var i = 0; i < nodeList.length; i++) {
					if(nodeList[i].tagName && nodeList[i].tagName.toLowerCase() == "option") {
						var opt = new ExtendedOption(this.sObj);
						opt.init(nodeList[i], "　");	 // optGroup 밑으로 들어가는 option이므로 들여쓰기를 함.
						this.options[this.options.length] = opt;
					}
				}
			}
		}
		/**
		 * 화면에 뿌려질 객체를 만드는 메소드.
		 */
		this.create = function () {
			this.divObj = document.createElement("DIV");
			this.divObj.selObject = this;
			this.divObj.onmouseover = this.onMouseOver;
			this.divObj.onmouseout = this.onMouseOut;
			var div = document.createElement("DIV");
			div.title = this.label;
			div.selObject = this;
			div.onmouseover = this.onMouseOver;
			div.onmouseout = this.onMouseOut;
			div.appendChild(document.createTextNode(this.label));
			SelectEXT.applyOptGroupStyle(div, this.sObj);
			this.divObj.appendChild(div);
			for(var i = 0; i < this.options.length; i++) {
				this.divObj.appendChild(this.options[i].create());
			}
			return this.divObj;
		}
		this.onMouseOver = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj && obj.selObject) obj.selObject.onMouseOverProc();
		}
		this.onMouseOverProc = function () {
			this.sObj.stopClose();
		}
		this.onMouseOut = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj && obj.selObject) obj.selObject.onMouseOutProc();
		}
		this.onMouseOutProc = function () {
			this.sObj.startClose();
		}
	}

	/************************* ExtendedOption *************************/
	function ExtendedOption(sObj) {
		this.sObj = sObj;	// 부모가 되는 ExtendedSelect 객체.
		this.value;	// option의 값.
		this.text;	// option의 텍스트.
		this.selected;	// 이 option이 선택되었는가?
		this.indent;	// 화면에 뿌려질때 들어쓰기 값.
		this.divObj;	// 화면에 뿌려지는 div.
		this.index;	// 이 option의 순서.
		/**
		 * 초기화 메소드.
		 */
		this.init = function (opt, indent) {
			this.value = opt.value;
			this.text = opt.text;
			this.selected = opt.selected;
			this.indent = indent;
			this.index = this.sObj.options.length;
			this.sObj.options[this.index] = this;
			if(this.selected) {
				this.sObj.selectedIndex = this.index;
			}
		}
		/**
		 * 화면에 뿌려질 객체를 만드는 메소드.
		 */
		this.create = function () {
			this.divObj = document.createElement("DIV");
			this.divObj.optObject = this;
			this.divObj.onclick = this.onClick;
			this.divObj.onmouseover = this.onMouseOver;
			this.divObj.onmouseout = this.onMouseOut;
			this.divObj.appendChild(document.createTextNode(this.indent + this.text));
			this.divObj.title = this.text;
			SelectEXT.applyOptionStyle(this.divObj, this.sObj);
			return this.divObj;
		}
		this.onClick = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj) obj.optObject.onClickProc();
		}
		this.onClickProc = function () {
			if(this.sObj.options[this.sObj.selectedIndex])
				this.sObj.options[this.sObj.selectedIndex].onMouseOutProc();
			this.sObj.selectedIndex = this.index;
			this.sObj.refresh();
			this.sObj.close();
		}
		this.onMouseOver = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj) obj.optObject.onMouseOverProc();
		}
		this.onMouseOverProc = function () {
			this.divObj.style.background = this.sObj.fontColor;
			this.divObj.style.color = this.sObj.bgColor;
			this.sObj.stopClose();
		}
		this.onMouseOut = function (e) {
			var obj = e ? e.target : window.event.srcElement;
			if(obj) obj.optObject.onMouseOutProc();
		}
		this.onMouseOutProc = function () {
			this.divObj.style.background = this.sObj.bgColor;
			this.divObj.style.color = this.sObj.fontColor;
			this.sObj.startClose();
		}
	}
	
	// 브랜드 소개에서 제품 상세로 이동
	function goItemViewFromSLB(itemID, wcID, wciID, bdID) {
		bdID = bdID || "";
		if (bdID) {
			parent.location.href = "/front/shop/sub_brand_list.php?bd_id=" + bdID;
		} else {
			parent.location.href = "/front/shop/detail_view.php?item_id=" + itemID + "&wci_id=" + wciID + "&wc_id=" + wcID + "&bd_id=" + bdID;
		}
		
		parent.SLB();
	}



	
	// 특약점 보기
	function showSpShop(spBrandID, spShopDivCD, mcID, divCDArea) {
		spBrandID = spBrandID || "";
		spShopDivCD = spShopDivCD || "";
		mcID = mcID || "";
		divCDArea = divCDArea || "";
		SLB('/front/shop/store_map.php?mc_id=' + mcID + '&div_cd_area=' + divCDArea + '&sp_brand_id=' + spBrandID +  '&sp_shop_div_cd=' + spShopDivCD,'iframe', 900, 700, true, true);
	}
	
