// »óÇ°°Ë»ö ½ºÅ©¸³Æ®
function checkSearch()
{
	var str = frmSearch.SearchName.value + '';
	
	if(str.indexOf("%") > -1 || str.indexOf("'") > -1)
	{ 
		alert("%³ª '(ÀÛÀºµû¿ÈÇ¥)´Â »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.\n\n´Ù¸¥ °Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä"); 
		frmSearch.SearchName.value = ''; 
		frmSearch.SearchName.focus(); 
		return false;
	}
	if(str.length < 1)
	{ 
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä'); 
		frmSearch.SearchName.focus(); 
		return false;
	}    		

	return true;
}

function goSearch()
{
	if(checkSearch()){
		document.frmSearch.submit();
	}    			    
}

// °øÁö»çÇ× ½ºÅ©¸³Æ®
function openNoticePop(aNoticeID) {
	var nLeftPos = 105;
	var nTopPos  = 95;
	
	window.open("/notice_detail.asp?notice_id=" + aNoticeID,"NoticePop","width=468 height=500,toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=no");
}

// ¿ìÆí¹øÈ£ Ã£±â ½ºÅ©¸³Æ®
function openZipPop(aFormName,aZipInput1,aZipInput2,aAddressInput1,aAddressInput2) 
{
	window.open("/zip.asp?form_name="+aFormName+"&zip_input_1="+aZipInput1+"&zip_input_2="+aZipInput2+"&addr_input_1="+aAddressInput1+"&addr_input_2="+aAddressInput2,"ZipPop","width=450 height=450,toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
}

// ³¯Â¥ °ËÁõ ½ºÅ©¸³Æ®
function gn_ArrayOfDay(l_sLeapYear)
{
   this[0]=0;  // <- ¾Æ¹«·± ÀÇ¹Ì°¡ ¾ø´Â °ÍÀÓ. ¹«½ÃÇØµµ ÁÁÀ½.
   this[1]=31;
   this[2]=28;
   if (l_sLeapYear) // À±´ÞÀÌ ¾Æ´Ï¸é...
       this[2]=29;
   this[3]=31;
   this[4]=30;
   this[5]=31;
   this[6]=30;
   this[7]=31;
   this[8]=31;
   this[9]=30;
   this[10]=31;
   this[11]=30;
   this[12]=31;
}

function gv_date_check(l_sDate) // "19991231" ÀÌ·± Çü½Ä`À¸·Î ¹Ýµå½Ã ³Ñ°ÜÁÙ°Í
{                             // "1999/12/31" ÀÌ·± Çü½ÄÀº Àý´ë ¾ÈµÊ   
   if (l_sDate == "") return false;

   if (l_sDate.length != 8) // Ã³À½¿£ ÀÚ¸®¼öºÎÅÍ Check ÇÑ´Ù.
   {           
      return false;
   }

   /*************************************************
    * text Box ÀÇ ÀÔ·ÂµÈ ÀÚ·á Check
    *************************************************/         
   var l_iYear  = parseInt(l_sDate.substring(0,4), 10);      
   var l_iMonth = parseInt(l_sDate.substring(4,6), 10);
   var l_iDay   = parseInt(l_sDate.substring(6,8), 10);    
   
   
   /******************************************************************
    * À±´Þ Check!
    ******************************************************************/
   var l_sLeapYear = (((l_iYear%4 == 0) && (l_iYear%100 != 0)) || (l_iYear%400 == 0));
   var monthDays  = new gn_ArrayOfDay(l_sLeapYear);

   if (l_iYear < 1900)
   {
     	return false;
   }
   else if (l_iMonth > 12) // ´Þ¼ö°¡ 12¿ù º¸´Ù Å©¸é...
   {            
      	return false;
   }
   else if((parseInt(l_iDay) < 1) || (l_iDay > monthDays[l_iMonth])) // ±× ´ÞÀÇ ¸¶Áö¸· ³¯ º¸´Ù Å©´Ù¸é...
   {  
      	return false;
   }
   
   return true;
}

function na_restore_img_src(name, nsdoc)
{
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  } 
}
// Ä³½ÃÄ³½Ã 2005³â 9¿ù ¸®´º¾ó
function na_preload_img()
{ 
  var img_list = na_preload_img.arguments;
  if (document.preloadlist == null) 
    document.preloadlist = new Array();
  var top = document.preloadlist.length;
  for (var i=0; i < img_list.length; i++) {
    document.preloadlist[top+i]     = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
  } 
}

function na_change_img_src(name, nsdoc, rpath, preload)
{ 
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  } 
}

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
// Ä³½ÃÄ³½Ã 2005³â 9¿ù ¸®´º¾ó

// »óÇ° È®´ë ÀÌ¹ÌÁö º¸±â ½ºÅ©¸³Æ® ½ÃÀÛ
function enlarg_img(sProductID)
{
	url="/image.asp?product="+sProductID;
	leftpos="10";
	toppos="10";
	width="770";
	height="570";
	toolbar_str = 'no';
	menubar_str = 'no';
	statusbar_str = 'no';
	scrollbar_str = 'yes';
	resizable_str = 'yes';
	window.open(url, 'imgwin', 'left='+leftpos+',top='+toppos+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
// »óÇ° È®´ë ÀÌ¹ÌÁö º¸±â ½ºÅ©¸³Æ® ³¡

function MakeFlashString(source,id,width,height,wmode, otherParam)
{	
	return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0\" width="+width+" height="+height+" id="+id+"><param name=wmode value="+wmode+" /><param name=movie value="+source+" /><param name=\"allowScriptAccess\" value=\"always\"><param name=quality value=high />"+otherParam+"<embed src="+source+" quality=high wmode="+wmode+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+width+" height="+height+" allowScriptAccess=\"always\"></embed></object>";
}

function MakeObjectString(classid, codebase, name, id, width,height, param)
{
	return "<object classid="+classid+" codebase="+codebase+" name="+name+" width="+width+" height="+height+" id="+id+"><param name=wmode value="+wmode+" />"+param+"</object>";
}

function SetInnerHTML(target, code)
{ 
	target.innerHTML = code; 
}

function DocumentWrite(src)
{
	document.write(src);
}

function chkValue(obj,len, msg) {
	if (obj.value.length < len) {
		alert(msg + "À»(¸¦) ÀÔ·ÂÇÏ¼¼¿ä.");
		obj.focus();
		return false;
	}
	return true;
}

function chkNumber(obj) {
	var val = obj.value;
	var ret;
	
	for (var i=0;i < val.length;i++) {
		ret = val.charCodeAt(i);
		if ((ret < 48) || (ret > 57)) {
			alert("¼ýÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			obj.value = "";
			obj.focus();
			return false;
		} // if ¹®
	}

	return true;
}

function showPrivacyPolicy() {
	na_open_window('privacy', '/shop_privacy_policy.html', 100, 50, 700, 700, false, false, true, true, false);
}

function showServicePolicy() {
	na_open_window('service', '/shop_service_policy.html', 100, 50, 700, 700, false, false, true, true, false);
}

function goHome() {
	location.href = 'http://' + location.host;
}

function verticalWheel_event(id, Height, nSec,wdth_height){
	if(window.xwzWheelMarq == null) window.xwzWheelMarq = new Array(0);
	xwzWheelMarq[id]  = {
		install : function(id, Height, nSec){
			this.id = id;
			this.div = document.getElementById('ID_DIV_' + id);
			this.table = document.getElementById('ID_TABLE_' + id);
			if(this.div == null) return;
			this.wdth_height = (wdth_height == null) ? "width:215px;height:187px;" : wdth_height;

			this.div.style.cssText = "position:relative;cursor:pointer;"+this.wdth_height+"overflow:hidden;clip:rect(0 auto "+this.height+" 0);left:0;top:0;";
			this.div.parentNode.style.position='relative'
			this.div.parentNode.onmouseover=function(){xwzWheelMarq[id].nPause=true;}
			this.div.parentNode.onmouseout= function(){xwzWheelMarq[id].nPause=false;}	

			this.index =0;
			this.height = Height;
			this.items = new Array(0);
			this.tmID = null;
			this.nPause = false;
			this.nSec = nSec;
			var rows =this.table.tBodies[0].rows;
			for(var i = 0; i < rows.length; i++){
				this.items[i] = document.createElement("DIV");
				this.items[i].innerHTML=rows[i].innerHTML;
				this.items[i].style.padding="3";
				this.items[i].style.height=this.height;
				this.items[i].style.position="absolute";
				this.items[i].style.top = this.height * i;
				this.div.appendChild(this.items[i]);

//				rows[i].cells[0].style.cssText="padding-left:5px;border-bottom:#CACACA 1px dotted;";
				rows[i].onmouseover=function(){this.style.backgroundColor="#FDF1F0";}
				rows[i].onmouseout=function(){this.style.backgroundColor="";}
//				if(i >= rows.length -1){rows[i].cells[0].style.border="";}
			}
		},
		doClick : function(n){
			if(!n)
			{
				var nSleep = 10;
				this.nPause=false;
				this.tmID = setTimeout("xwzWheelMarq['" + this.id + "'].doWheel()", nSleep);
				return;
			}
			
			this.index = this.index+n;
			var nIndex = this.index+1 >=  this.items.length ? 0 :  this.index+1;
			if(this.index< 0 ) this.index	= this.items.length-1;
			if(this.index > this.items.length-1) this.index=0;
			var itmN = this.items[this.index];
	
			clearTimeout(this.tmID); this.tmID = null;
	
			if(parseInt(itmN.style.top) < (this.height/2)*-1){
					itmN.style.top = this.height*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
			}
			for(var i = 0; i < this.items.length; i++){
				this.items[i].style.top =  this.height * (  (this.items.length -  this.index + i ) % this.items.length );
			}


	
			
		},
		doWheel : function(){
			var itmN = this.items[this.index];
			var nSleep= 20;
			var nIndex= this.index+1 >=  this.items.length ? 0 :  this.index+1;
			clearTimeout(this.tmID); this.tmID = null;


			if(this.nPause != true){
				for(var i = 0; i < this.items.length; i++){
					this.items[i].style.top = parseInt(this.items[i].style.top)-1;
				}
				if(parseInt(itmN.style.top) <= this.height*-1){
					itmN.style.top = this.height*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
					nSleep= this.nSec;
				}
			}else{
				if(parseInt(itmN.style.top) < (this.height/2)*-1){
					itmN.style.top = this.height*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
				}

				for(var i = 0; i < this.items.length; i++){
					this.items[i].style.top =  this.height * (  (this.items.length -  this.index + i ) % this.items.length );
				}
				nSleep = 10;
			}
	
			this.tmID = setTimeout("xwzWheelMarq['" + this.id + "'].doWheel()", nSleep);
		}
	}


	xwzWheelMarq[id].install(id, Height, nSec);
	xwzWheelMarq[id].tmID = setTimeout("xwzWheelMarq['" +id + "'].doWheel()", nSec);
}
function horizontalWheel(id, width, nSec,wdth_height){
	if(window.xwzWheelHoriz == null) window.xwzWheelHoriz = new Array(0);
	xwzWheelHoriz[id]  = {
		install : function(id, width, nSec){
			this.id = id;
			this.div = document.getElementById('ID_DIV_' + id);
			this.table = document.getElementById('ID_TABLE_' + id);
			if(this.div == null) return;
			this.wdth_height = (wdth_height == null) ? "width:690px;height:150px;" : wdth_height;

			this.div.style.cssText = "position:relative;cursor:pointer;"+this.wdth_height+"overflow:hidden;clip:rect(0 auto "+this.width+" 0);left:2;top:0;";
			this.div.parentNode.style.position='relative'
			//this.div.parentNode.onmouseover=function(){xwzWheelHoriz[id].nPause=true;}
			//this.div.parentNode.onmouseout= function(){xwzWheelHoriz[id].nPause=false;}	
			this.div.onmouseover=function(){xwzWheelHoriz[id].nPause=true;}
			this.div.onmouseout= function(){xwzWheelHoriz[id].nPause=false;}

			this.index =0;
			this.width = width;
			this.items = new Array(0);
			this.tmID = null;
			this.nPause = false;
			this.nSec = nSec;
			var cols =this.table.tBodies[0].rows[0].cells;
			for(var i = 0; i < cols.length; i++){
				this.items[i] = document.createElement("DIV");
				this.items[i].innerHTML=cols[i].innerHTML;
				this.items[i].style.padding="3";
				this.items[i].style.width=cols[i].width ;
				this.items[i].style.position="absolute";
				this.items[i].style.left = cols[i].width * i; //18 + cols[i].width * i;
				this.div.appendChild(this.items[i]);

//				rows[i].cells[0].style.cssText="padding-left:5px;border-bottom:#CACACA 1px dotted;";
				cols[i].onmouseover=function(){this.style.backgroundColor="#FDF1F0";}
				cols[i].onmouseout=function(){this.style.backgroundColor="";}
//				if(i >= rows.length -1){rows[i].cells[0].style.border="";}
			}
		},
		doClick : function(n){
			if(!n)
			{
				var nSleep = 10;
				this.nPause=false;
				this.tmID = setTimeout("xwzWheelHoriz['" + this.id + "'].doWheel()", nSleep);
				return;
			}
			
			this.index = this.index+n;
			var nIndex = this.index+1 >=  this.items.length ? 0 :  this.index+1;
			if(this.index< 0 ) this.index	= this.items.length-1;
			if(this.index > this.items.length-1) this.index=0;
			var itmN = this.items[this.index];
	
			clearTimeout(this.tmID); this.tmID = null;
	
			if(parseInt(itmN.style.left) < (this.width/2)*-1){
					itmN.style.left = this.width*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
			}
			for(var i = 0; i < this.items.length; i++){
				this.items[i].style.left =  this.width * (  (this.items.length -  this.index + i ) % this.items.length );
			}


	
			
		},
		doWheel : function(){
			var itmN = this.items[this.index];
			var nSleep= 20;
			var nIndex= this.index+1 >=  this.items.length ? 0 :  this.index+1;
			clearTimeout(this.tmID); this.tmID = null;


			if(this.nPause != true){
				for(var i = 0; i < this.items.length; i++){
					this.items[i].style.left = parseInt(this.items[i].style.left)-1;
				}
				if(parseInt(itmN.style.left) <= this.width*-1){
					itmN.style.left = this.width*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
					nSleep= this.nSec;
				}
			}else{
				if(parseInt(itmN.style.left) < (this.width/2)*-1){
					itmN.style.left = this.width*(this.items.length-1);
					this.index = this.index+1 >=  this.items.length ? 0 :  this.index+1;
				}

				for(var i = 0; i < this.items.length; i++){
					this.items[i].style.left =  this.width * (  (this.items.length -  this.index + i ) % this.items.length );
				}
				nSleep = 10;
			}
	
			this.tmID = setTimeout("xwzWheelHoriz['" + this.id + "'].doWheel()", nSleep);
		}
	}


	xwzWheelHoriz[id].install(id, width, nSec);
	xwzWheelHoriz[id].tmID = setTimeout("xwzWheelHoriz['" +id + "'].doWheel()", nSec);
}


