// menu tiptool hidden
function openimg(url,win_width,win_height,win_scroll) {
var me_width;
var me_height;

me_width = (window.screen.width/2) - (win_width/2);
me_height = (window.screen.height/2) - (win_height/2);
me_height = me_height - 30;

var win2 = window.open(url,'win2','height='+win_height+',width='+win_width+',left='+me_width+',top='+me_height+',screenX='+me_width+',screenY='+me_height+',resizable=no,menubar=no,scrollbars='+win_scroll+','+',location=no,status=no');
win2.focus();
}

function ViewContent(kindid,id) {
	urlpage="view.asp?kindid="+kindid+"&id="+id;
	window.open(urlpage,"openwin","height=600,width=720,resizable=no,scrollbars=yes,mebubar=no");
}

function openwin(url,win_width,win_height,win_scroll,nm) {
var me_width;
var me_height;

me_width = (window.screen.width/2) - (win_width/2);
me_height = (window.screen.height/2) - (win_height/2);
me_height = me_height - 30;

var nm = window.open(url,nm,'height='+win_height+',width='+win_width+',left='+me_width+',top='+me_height+',screenX='+me_width+',screenY='+me_height+',resizable=no,menubar=no,scrollbars='+win_scroll+','+',location=no,status=no');
nm.focus();
}

// yes check
function delete_data(url){
  if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){location=url;}
}

// yes check
function delete_click(url){
  if(confirm('Å¬¸¯ »óÇ°¸ñ·ÏÀ» ºñ¿ì½Ã°Ú½À´Ï±î?')){location=url;}
}

function GoURL(url){
  location=url;
}


function delete_msg(url,str){
  if(confirm(str)){location=url;}
}

function check_login_form(){
  var theform = document.frm_login;

  if(theform.id.value.length<1){alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.id.focus();return false;}
  if(theform.pw.value.length<1){alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.pw.focus();return false;}
  return true;
}

function check_guest_form(){
  var theform = document.frm_guest;

  if(theform.id.value.length<1){alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.id.focus();return false;}
  if(theform.pw.value.length<1){alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.pw.focus();return false;}
  return true;
}

function check_ordernm_form(){
  var theform = document.frm_ordernm;

  if(theform.name.value.length<1){alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.");theform.name.focus();return false;}
  if(theform.order_nm.value.length<1){alert("ÁÖ¹®¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.order_nm.focus();return false;}
  return true;
}

function check_rule_form(){
  var theform = document.form_rule;

  if(!theform.rule_agree.checked){alert("¾à°ü¿¡ µ¿ÀÇÇØ¾ß È¸¿ø¿¡ °¡ÀÔÇÒ ¼ö ÀÖ½À´Ï´Ù.");theform.rule_agree.focus();return false;}
  return true;
}

function check_ed(){
  var theform = document.frm_ed;
  if(trim(theform.name.value)==""){alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");theform.name.focus();return false;}
  if(trim(theform.title.value)==""){alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");theform.title.focus();return false;}
  if(trim(theform.comment.value)==""){alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");theform.comment.focus();return false;}
}

function find_id_form(){
  var theform = document.frm_login;

  if(theform.id.value.length<1){alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.id.focus();return false;}
  if(theform.pw.value.length<1){alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");theform.pw.focus();return false;}
  return true;
}

function se_go(form){
  if(form.searchword.value == ""){alert('°Ë»ö ³»¿ëÀ» ³Ö¾î ÁÖ½Ê½Ã¿ä.');form.searchword.focus();return;}
  form.submit();
}

function trim(tmpStr) {
  var atChar;
  if (tmpStr.length > 0) atChar = tmpStr.charAt(0);
  while (isSpace(atChar)) {
    tmpStr = tmpStr.substring(1, tmpStr.length);
    atChar = tmpStr.charAt(0);
  }
  if (tmpStr.length > 0) atChar = tmpStr.charAt(tmpStr.length-1);
  while (isSpace(atChar)) {
    tmpStr = tmpStr.substring(0,( tmpStr.length-1));
    atChar = tmpStr.charAt(tmpStr.length-1);
  }
  return tmpStr;
}

function isSpace(inChar) {
  return (inChar == ' ' || inChar == '\t' || inChar == '\n');
}

function JS_viewObj(objhtml) { 
    document.write(objhtml); 
} 


function objwrite(src,w,h){
  var str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width="+w+" height="+h+">";

  str+= "<param name='movie' value='"+src+"'>";
  str+= "<param name='quality' value='high'>";
  str+= "<param name='wmode' value='transparent'>";
  str+= "<embed src='"+src+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+w+"' height='"+h+"'>";
  str+= "</embed>";
  str+= "</object>";

  if(src) document.write(str);
}

function setFavorites() {
	window.external.AddFavorite('http://www.nfootwear.com', '³ªÀÌÅ° ¾ØÇ²¿þ¾î');
}


function s_send() {
	if (s_form.gap.value=="") {
		if (s_form.searchword.value=="") {
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			s_form.searchword.focus();
			return;
		}
	}
	s_form.submit();
}







//SCROLL
//
// o File : nvscroll.js
// o Author : Kukjin Kang
// o Date : 2004. 7. 6
// o Cont. : scroll object
//

function NvScroll() {

this.version = "0.2";
this.name = "NvScroll";
this.item = new Array();
this.itemcount = 0;
this.currentspeed = 0;
this.scrollspeed = 50;
this.pausedelay = 1000;
this.pausemouseover = false;
this.stop = false;
this.type = 1;
this.height = 100;
this.width = 100;
this.stopHeight=0;
this.i=0;

this.add = function () {
var text = arguments[0];
this.item[this.itemcount] = text;
this.itemcount = this.itemcount + 1;
};

this.start = function () {
if ( this.itemcount == 1 ) {
this.add(this.item[0]);
}
this.display();
this.currentspeed = this.scrollspeed;
this.stop = true;
setTimeout(this.name+'.scroll()',this.currentspeed );
window.setTimeout(this.name+".stop = false", this.pausedelay);
};

this.display = function () {
document.write('<div id="'+this.name+'" style="height:'+this.height+'; width:'+this.width+'; position:relative; overflow:hidden; " OnMouseOver="'+this.name+'.onmouseover(); " OnMouseOut="'+this.name+'.onmouseout(); ">');
for(var i = 0; i < this.itemcount; i++) {
if ( this.type == 1) {
document.write('<div id="'+this.name+'item'+i+'"style="left:0px; width:'+this.width+'; position:absolute; top:'+(this.height*i)+'px; ">');
document.write(this.item[i]);
document.write('</div>');
} else if ( this.type == 2 ) {
document.write('<div id="'+this.name+'item'+i+'"style="left:'+(this.width*i)+'px; width:'+this.width+'; position:absolute; top:0px; ">');
document.write(this.item[i]);
document.write('</div>');
}
}
document.write('</div>');
};

this.scroll = function () {

if ( this.pause == true ) {
window.setTimeout(this.name+".scroll()",this.pausedelay);
this.pause = false;
} else {

this.currentspeed = this.scrollspeed;
if ( !this.stop ) {
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.name+'item'+i).style; 
if ( this.type == 1 ) {
obj.top = parseInt(obj.top) - 1;
if ( parseInt(obj.top) <= this.height * (-1) ) obj.top = this.height * (this.itemcount-1);
if ( parseInt(obj.top) == 0 ) this.currentspeed = this.pausedelay;
} else if ( this.type == 2 ) {

obj.left = parseInt(obj.left) - this.width;
/*
obj.left = parseInt(obj.left) - 1;  //ÀÌ°Å ½º¸é Èå¸£µíÀÌ Èê·¯ °£´Ù.

obj.left = this.width * (this.itemcount-1);
obj.left = parseInt(obj.left) - this.width; //ÀÌ°Å ¾²¸é Áï½Ã ¹Ù²ï´Ù.
width = parseInt(obj.left) * (-1);
obj.left = parseInt(obj.left) - width;
*/

if ( parseInt(obj.left) <= this.width * (-1) ) obj.left = this.width * (this.itemcount-1);
if ( parseInt(obj.left) == 0 ) this.currentspeed = this.pausedelay;
}
}
}

window.setTimeout(this.name+".scroll()",this.currentspeed);
}
};

this.onmouseover = function () {
if ( this.pausemouseover ) {
this.stop = true;
}
};

this.onmouseout = function () {
if ( this.pausemouseover ) {
this.stop = false;
}
};

this.next = function() {
this.stop = true;
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.name+'item'+i).style; 
if ( parseInt(obj.left) < 1 ) { 
width = this.width + parseInt(obj.left);
break;
}
}
/*
obj.left = parseInt(obj.left) - 1;  //ÀÌ°Å ½º¸é Èå¸£µíÀÌ Èê·¯ °£´Ù.

obj.left = this.width * (this.itemcount-1);
obj.left = parseInt(obj.left) - this.width; //ÀÌ°Å ¾²¸é Áï½Ã ¹Ù²ï´Ù.
width = parseInt(obj.left) * (-1);
obj.left = parseInt(obj.left) - width;
*/
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.name+'item'+i).style; 
if ( parseInt(obj.left) < 1 ) { 
obj.left = this.width * (this.itemcount-1);
} else {
obj.left = parseInt(obj.left) - width;
}
}
this.sleft = false;
this.pause = true;
}

this.prev = function() {
this.sleft = true;
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.name+'item'+i).style; 
if ( parseInt(obj.left) < 1 ) { 
width = parseInt(obj.left) * (-1);
break;
}
}
if ( width == 0 ) {
total_width= this.width * (this.itemcount-1);
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.name+'item'+i).style; 
if ( parseInt(obj.left) + 1 > total_width ) { 
obj.left = 0;
} else {
obj.left = parseInt(obj.left) + this.width;
}
}
} else {
for (i = 0; i < this.itemcount; i++) {
obj = document.getElementById(this.name+'item'+i).style; 
if ( parseInt(obj.left) < 1 ) { 
obj.left = 0;
} else {
obj.left = parseInt(obj.left) + width;
}
}
}
this.stop = false;
this.pause = true;
}


}

// field input check
function check_email(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 "ÀÌ¸ÞÀÏ ÁÖ¼Ò ¿À·ùÀÔ´Ï´Ù. ( @ ¿Í . À¸·Î ÀÌ·ç¾î Á®¾ß ÇÕ´Ï´Ù.)";
       if (!arr[1].match(user_pattern)) return "ÀÌ¸ÞÀÏ ÁÖ¼Ò ¿À·ùÀÔ´Ï´Ù.";

       var ip = arr[2].match(ip_pattern);
       if (ip) {
              for (var i=1; i<5; i++) if (ip[i] > 255) return " ÀÌ¸ÞÀÏ ÁÖ¼Ò ¿À·ùÀÔ´Ï´Ù.!";
       }
       else {
              if (!arr[2].match(domain_pattern)) return "ÀÌ¸ÞÀÏ ÁÖ¼Ò ¿À·ùÀÔ´Ï´Ù.";
              var domain = arr[2].match(new RegExp(atom,"g"));
              if (domain.length<2) return "ÀÌ¸ÞÀÏ ÁÖ¼Ò ¿À·ùÀÔ´Ï´Ù.";
              if (domain[domain.length-1].length<2 || domain[domain.length-1].length>3)
                     return "ÀÌ¸ÞÀÏ ÁÖ¼Ò ¿À·ùÀÔ´Ï´Ù.(µµ¸ÞÀÎ °ü·Ã)";
       }
       return false;
}

//max length next focus
function auto_focus(text1,text2,len){
  if(text1.value.length == len){
    text2.focus();
    return;
  }
}

//personal number check
function valid_reg_num (theForm){
  var chk =0
  var yy = theForm.per1.value.substring(0,2)
  var mm = theForm.per1.value.substring(2,4)
  var dd = theForm.per1.value.substring(4,6)
  var sex = theForm.per2.value.substring(0,1)

  if((theForm.per1.value.length != 6 )||(yy <25 || mm <1 || mm>12 ||dd<1)){
    theForm.per1.focus();
    return (false);
  }

  if((sex != 1 && sex !=2)|| (theForm.per2.value.length != 7)){
    theForm.per2.focus();
    return (false);
  }

  // personal number validation check
  for(var i = 0; i <=5 ; i++)	{chk = chk + ((i%8+2) * parseInt(theForm.per1.value.substring(i,i+1)))}
  for(var i = 6; i <=11 ; i++)	{chk = chk + ((i%8+2) * parseInt(theForm.per2.value.substring(i-6,i-5)))}

	chk = 11 - (chk %11)
	chk = chk % 10

  if(chk != theForm.per2.value.substring(6,7)){return (false);}
  return true;
}


var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}


function imgOver(obj) {
	if (obj.src.indexOf("_o.gif") < 0) {
		var overTmp = obj.src.replace(".gif", "_o.gif");
		var imgTmp = new Image();
		imgTmp.src = overTmp
		obj.src = imgTmp.src;
		//obj.style.cursor = "pointer";
	}
	if (obj.src.indexOf("_o.jpg") < 0) {
		var overTmp = obj.src.replace(".jpg", "_o.jpg");
		var imgTmp = new Image();
		imgTmp.src = overTmp
		obj.src = imgTmp.src;
		//obj.style.cursor = "pointer";
	}
	if (obj.src.indexOf("_o.png") < 0) {
		var overTmp = obj.src.replace(".png", "_o.png");
		var imgTmp = new Image();
		imgTmp.src = overTmp
		obj.src = imgTmp.src;
		//obj.style.cursor = "pointer";
	}
}


function imgOut(obj) {
	if (obj.src.indexOf("_o.gif") > -1) {
		var overTmp = obj.src.replace("_o.gif", ".gif");
		var imgTmp = new Image();
		imgTmp.src = overTmp
		obj.src = imgTmp.src;
	}
	if (obj.src.indexOf("_o.jpg") > -1) {
		var overTmp = obj.src.replace("_o.jpg", ".jpg");
		var imgTmp = new Image();
		imgTmp.src = overTmp
		obj.src = imgTmp.src;
	}
	if (obj.src.indexOf("_o.png") > -1) {
		var overTmp = obj.src.replace("_o.png", ".png");
		var imgTmp = new Image();
		imgTmp.src = overTmp
		obj.src = imgTmp.src;
	}
}


function drawFlash(fID, fURL, w, h, wmode, bgClr, lstate) {
	var tmpStr = "";

	tmpStr += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+w+"' height='"+h+"' id='"+ fID +"' align='middle'>";
	tmpStr += "<param name='allowScriptAccess' value='always' />";
	tmpStr += "<param name='movie' value='"+ fURL +"' />";
	tmpStr += "<param name='quality' value='high' />";
	tmpStr += "<param name='menu' value='false' />";

	if (lstate == 2) tmpStr += "<param name='loop' value='false' />"; 
	if (wmode == 1) tmpStr += "<param name='wmode' value='transparent' />";
	if (bgClr != null && bgClr != "undefined") tmpStr += "<param name='bgcolor' value='"+ bgClr +"' />";

	tmpStr += "<embed src='"+fURL+"' quality='high' ";

	if (lstate == 2) tmpStr += "loop='false' ";
	if (wmode == 1) tmpStr += "wmode='transparent' ";
	if (bgClr != null && bgClr != "undefined") tmpStr += "bgcolor='#ffffff' ";

	tmpStr += "width='"+ w +"' height='"+ h +"' name='"+ fID +"' menu='false' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' /></embed>";
	tmpStr += "</object>";

	document.write(tmpStr);
}
