//ÀÚÁÖ»ç¿ëÇÏ´Â ½ºÅ©¸³Æ®

//ÀÌ¹ÌÁö¿øº» Å©±â º¸±â
function show_pic(pic, pname,width,height) {
  window.open('/includes/shop_gallery.asp?pic='+pic+'&pname='+pname, '', ('scrollbars=no, resizable=no, top=80,left=80,width='+width+',height='+height+',resizable=yes'));
}

function IsEmpty(data) {  //½ºÆäÀÌ½º¹Ùµµ °ø¹éÀ¸·Î Ã³¸®
  for (var i=0;i<data.length;i++) { if (data.substring(i,i+1) != " ") return false;  }   
  return true; 
}

//°Ë»ö¾î ÀÔ·Â½Ã¿¡ Æ¯¼ö¹®ÀÚ Ã¼Å©¿ë ÇÔ¼ö
function checkxword(str){
	var xword = '!@#$%^&*()';
	for(i=0 ; i < str.length ;i++){
		for(z=0 ; z < xword.length ; z++){
			if( str.charAt(i)== xword.charAt(z)){
				return true;
			}
		}
	}
	return false;
}

//¾÷·Îµå½Ã ÀÌ¹ÌÁö ¹Ù·Îº¸±â
function up_show_pic(img,names) {
document.images["pic"+img].style.display = "none";
document.images["pic"+img].style.display = "";
document.images["pic"+img].src = frm.elements[names].value; }

function up_show_pic2(img,names,formName) {
document.images["pic"+img].style.display = "none";
document.images["pic"+img].style.display = "";
document.images["pic"+img].src = formName.elements[names].value; }

//¾÷·ÎµåµÈ ÀÌ¹ÌÁö ¼öÁ¤½Ã onload
function fshow_pic(num,files) {
    document.images["pic"+num].style.display = "none";
    document.images["pic"+num].style.display = "";
    document.images["pic"+num].src = files; }


//»õÃ¢¶Ù¿ö¼­ submit
function OpenPost (url, wname, top, left, width, height,fromName) {
  var winopts = "scrollbars=yes,resizable=yes,top="+top+",left="+left+",width="+width+",height="+height;
  var aa = window.open("", wname, winopts);
  eval("document."+fromName).action = url;
  eval("document."+fromName).target = wname;
  eval("document."+fromName).submit(); 
  aa.focus();

}

//ÁÖ¹Î¹øÈ£,»ý³â¿ùÀÏ Ã¼Å©
function CheckJuminNo(form) {
	var form = eval("document."+form);
    var strresidentno1 = form.jumin1.value;
    var strresidentno2 = form.jumin2.value;

   if(strresidentno1.length < 6) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      form.jumin1.value = "";      
      form.jumin1.focus();
      return; }

    if(strresidentno2.length < 7 ) {
       alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
       form.jumin2.value = "";   
       form.jumin2.focus();
       return; } 

    var strresidentno = form.jumin1.value + form.jumin2.value;
    var strA, strB, strC, strD, strE, strF, strG, strH, strI, strJ, strK, strL, strM, strN, strO;
    var nCalA, nCalB, nCalC; 

    strA = strresidentno.substr(0, 1);
    strB = strresidentno.substr(1, 1);
    strC = strresidentno.substr(2, 1);
    strD = strresidentno.substr(3, 1);
    strE = strresidentno.substr(4, 1);
    strF = strresidentno.substr(5, 1);
    strG = strresidentno.substr(6, 1);
    strH = strresidentno.substr(7, 1);
    strI = strresidentno.substr(8, 1);
    strJ = strresidentno.substr(9, 1); 
    strK = strresidentno.substr(10, 1);
    strL = strresidentno.substr(11, 1);
    strM = strresidentno.substr(12, 1);            

    strO = strA*2 + strB*3 + strC*4 + strD*5 + strE*6 + strF*7 + strG*8 + strH*9 + strI*2 + strJ*3 + strK*4 + strL*5;

    nCalA = eval(strO);
    nCalB = nCalA % 11;
    nCalC = 11 - nCalB;
    nCalC = nCalC % 10; 

    strv = '19';
    strw = strresidentno.substr(0, 2);
    strx = strresidentno.substr(2, 2);
    stry = strresidentno.substr(4, 2);      	

    strz = strv + strw;

    if((strz % 4 == 0) && (strz % 100 != 0) || (strz % 400 == 0)) { yunyear = 29; }
    else yunyear = 28; 

    if((strx <= 0) || (strx > 12)) {
	alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
        form.jumin1.value = "";   
        form.jumin1.focus();
        return; }
    if((strx == 1 || strx == 3 || strx == 5 || strx == 7 || strx == 8 || strx == 10 || strx == 12) && (stry > 31 || stry <= 0)) {
	alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
        form.jumin1.value = "";   
        form.jumin1.focus();
        return; }
    if((strx == 4 || strx == 6 || strx == 9 || strx == 11) && (stry > 30 || stry <= 0)) {
	alert("»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù.");
        form.jumin1.value = "";   
        form.jumin1.focus();
        return; }
    if(strx == 2 && (stry > yunyear || stry <= 0)) {
	alert(strz + "»ý³â¿ùÀÏÀÌ ¸ÂÁö ¾Ê½À´Ï´Ù." + yunyear);
        form.jumin1.value = "";   
        form.jumin1.focus();
        return;  }
    if(!((strG == 1) || (strG == 2) || (strG == 3) || (strG ==4))) {
	alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®ÀÇ ½ÃÀÛÀº 1 ~ 4 ÀÌ¿©¾ß ÇÕ´Ï´Ù.");
        form.jumin2.value = "";   
        form.jumin2.focus();
        return;  }
    if(nCalC != strM) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ±ÔÄ¢¿¡ ¾î±ß³³´Ï´Ù.");
        form.jumin1.value = "";   
        form.jumin2.value = "";   
        return; }
    
   return true;  }


//ÁÖ¹Î¹øÈ£ Ã¼Å©
function CheckJuminNo2(form,jumin1,jumin2) {
	var form = eval("document."+form);
    var strresidentno1 = jumin1;
    var strresidentno2 = jumin2;

   if(strresidentno1.length < 6) {
      alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
      jumin1 = "";
      return; }

    if(strresidentno2.length < 7 ) {
       alert ("ÁÖ¹Îµî·Ï¹øÈ£ ±æÀÌ°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.!!");
       jumin2 = "";
       return; } 

    var strresidentno = jumin1  + jumin2;
    var strA, strB, strC, strD, strE, strF, strG, strH, strI, strJ, strK, strL, strM, strN, strO;
    var nCalA, nCalB, nCalC; 

    strA = strresidentno.substr(0, 1);
    strB = strresidentno.substr(1, 1);
    strC = strresidentno.substr(2, 1);
    strD = strresidentno.substr(3, 1);
    strE = strresidentno.substr(4, 1);
    strF = strresidentno.substr(5, 1);
    strG = strresidentno.substr(6, 1);
    strH = strresidentno.substr(7, 1);
    strI = strresidentno.substr(8, 1);
    strJ = strresidentno.substr(9, 1); 
    strK = strresidentno.substr(10, 1);
    strL = strresidentno.substr(11, 1);
    strM = strresidentno.substr(12, 1);            

    strO = strA*2 + strB*3 + strC*4 + strD*5 + strE*6 + strF*7 + strG*8 + strH*9 + strI*2 + strJ*3 + strK*4 + strL*5;

    nCalA = eval(strO);
    nCalB = nCalA % 11;
    nCalC = 11 - nCalB;
    nCalC = nCalC % 10; 

    strv = '19';
    strw = strresidentno.substr(0, 2);
    strx = strresidentno.substr(2, 2);
    stry = strresidentno.substr(4, 2);      	

    strz = strv + strw;

    if((strz % 4 == 0) && (strz % 100 != 0) || (strz % 400 == 0)) { yunyear = 29; }
    else yunyear = 28; 
   
    if(!((strG == 1) || (strG == 2) || (strG == 3) || (strG ==4))) {
	alert("ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®ÀÇ ½ÃÀÛÀº 1 ~ 4 ÀÌ¿©¾ß ÇÕ´Ï´Ù.");
        jumin2 = "";
        return;  }
    if(nCalC != strM) {
        alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ±ÔÄ¢¿¡ ¾î±ß³³´Ï´Ù.");
		jumin1 = "";
        jumin2 = "";
        return; }
    
   return true;  }

//ÀüÀÚ¿ìÆí Ã¼Å©( ÆÐÅÏ°ú ÀÏÄ¡ÇÏÁö ¾ÊÀ¸¸é false¸¦ ¹ÝÈ¯ÇÑ´Ù.)
function emailcheck(str){
	re=/(\w+)@(\w+)\.(\w+)/
	return re.test(str)
}

//Æ¯¼ö ¹®ÀÚÃ¼Å©
function CheckunderChar(val){
	var rtnval = false;
	var symbol = "~`!@#$%^&*()-+=|\\[]{};:\'\"<>,.?/";

	for(i=0; i<val.length; i++){
		if(symbol.indexOf(val.substring(i, i+1))>-1){
			rtnval = true;
			break;
		}
	}

	return rtnval;
}
//ÇÑ±Û »ç¿ë±ÝÁö
function CheckSymbol(val){
	var rtnval = false;
	var symbol = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";

	for(i=0; i<val.length; i++){
		if(symbol.indexOf(val.substring(i, i+1))<0){
			rtnval = true;
			break;
		}
	}

	return rtnval;
}
//ÀÎ¼â
function printWin(){
	if(window.print){
		window.print();	
	}
	else{alert('³Ý½ºÄÉÀÌÇÁ4.0 ÀÌ³ª ÀÍ½ºÇÃ·Î·¯ 5.0ÀÌ»ó¿¡¼­¸¸ Áö¿øµË´Ï´Ù.');}
}

//ÁÖ¹Î¹øÈ£·Î ¼ºº°¾Ë¾Æ³»±â
function inputSex(){
	var temp;
	temp1=document.frm.jumin2.value.substring(0,1);
	if(temp1=="1"){
		document.frm.sex.value = "³²";
	}else if(temp1=="2"){
		document.frm.sex.value = "¿©";
	}else{
		alert('ÁÖ¹Î¹øÈ£ µÞÀÚ¸®ÀÇ Ã¹¹øÂ°´Â 1 ¶Ç´Â 2ÀÌ¿©¾ß ÇÕ´Ï´Ù.\n\nÁÖ¹Î¹øÈ£¸¦ ´Ù½ÃÀÔ·ÂÇÏ¼¼¿ä.');
		document.frm.jumin1.value="";
		document.frm.jumin2.value="";
		document.frm.sex.value = "";
	}

}

function emailInput(value){
	if(value!=""){
		document.frm.email3.value = value;
	}else{
		document.frm.email3.value = value;
	}
}
//ÁÖ¹Î¹øÈ£·Î ³ªÀÌÃßÃâ
function juminAge(){
	selectedYearindexValues4 = "19"+document.frm.jumin1.value.substring(0,2);
	//ÇöÀç³âµµ
	var nowDate=new Date();
	var Y = nowDate.getYear(); 
	x = Y - selectedYearindexValues4;
	document.frm.age.value=x;
}
function paymentKind_all(payKind){
	var frmname = document.frm;
	if(payKind=="1"){
		payinput.style.display="block";
		frmname.payInput_name.value = frmname.name.value;
	}else if(payKind=="2"){
		payinput.style.display="block";
		frmname.payInput_name.value="";
	}else if(payKind=="3"){
		payinput.style.display="none";
		frmname.payInput_name.value="";
	}
}



//#############Å×ÀÌºí Å©±âÁ¶Àý ½ÃÀÛ#########


var mousedown = false; //¸¶¿ì½º¸¦ ´©¸¥ »óÅÂ
var td = "";           //»çÀÌÁî º¯°æÇÒ td
var td_width;          //º¯°æÇÒ tdÀÇ width,
var x = 0;             //¸¶¿ì½º µå·¹±×Àü °¡·ÎÀ§Ä¡

function TCstartColResize(obj){
       mousedown = true;
       td = obj;
       td_width = td.width;
       x = event.clientX;
}
function TCColResize()
{
       if (mousedown){
              var distX = event.x - x; //ÀÌµ¿ÇÑ °£°Ý
              td.width = parseInt(td_width) + parseInt(distX);
       }
}
function TCstopColResize(){
       mousedown = false;
       td = '';
}

function cell_left(obj){//¸¶¿ì½º°¡ ¼¿ÀÇ ¿ÞÂÊÀÎÁö ÃøÁ¤
       if(event.offsetX < 5 && obj.cellIndex!=0)
              return true;
       else
              return false;
}
function cell_right(obj){//¸¶¿ì½º°¡ ¼¿ÀÇ ¿À¸¥ÂÊÀÎÁö ÃøÁ¤
       if(event.offsetX > obj.width-4)
              return true;
       else
              return false;
}

//¸®»çÀÌÁî½ÃÀÛ
document.onmousedown = function(){
try{
       var now_mousedown = window.event.srcElement;
       if(now_mousedown.className.toUpperCase()=="COLRESIZE"){
		  if( cell_left(now_mousedown) ){
				 now_mousedown = now_mousedown.parentNode.childNodes[now_mousedown.cellIndex-1];
		  }else if( !cell_right(now_mousedown) ){
				 return true;//¿À¸¥ÂÊµµ ¿ÞÂÊµµ ¾Æ´Ï¸é »çÀÌÁî Á¶Àý ¾ÈÇÔ
		  }
		  TCstartColResize(now_mousedown);
       }
}catch(e){ return true; }
}

//¸®»çÀÌÁî
document.onmousemove = function(){
try{
       var now_mousemove = window.event.srcElement;
       if(now_mousemove.className.toUpperCase()=="COLRESIZE" || td!=""){

              //¼¿ÀÇ °¡ÀåÀÚ¸®¸é ¸¶¿ì½º Ä¿¼­ º¯°æ
              if( cell_left(now_mousemove) || cell_right(now_mousemove) ){
                     now_mousemove.style.cursor = "col-resize";
              }else{
                     now_mousemove.style.cursor = "";
              }

              TCColResize(now_mousemove);
       }else{
              now_mousemove.style.cursor = "";
    }
}catch(e){ return true; }
}

//¸®»çÀÌÁîÁ¾·á
document.onmouseup = function(){
try{
       var now_mouseup = window.event.srcElement;
       //if(now_mouseup.className=="colResize"){
              TCstopColResize(now_mouseup);
       //}
}catch(e){ return true; }
}

//¸®»çÀÌÁî µµÁß ÅØ½ºÆ® ¼±ÅÃ ±ÝÁö
document.onselectstart = function(){
try{
    if(td != ""){
        return false;
    }
}catch(e){ return true; }
}


//############## Å©±âÁ¶Àý³¡ ##############



//##############ÀüÃ¼¼±ÅÃ,¼±ÅÃÇØÁ¦,¼±ÅÃ»èÁ¦##################
function All_Check() {
    var check_num = eval("frm.elements.length");
    for(var i=0; i<check_num; i++) { frm.elements[i].checked = true; }
   }
function All_NoCheck() {
    var check_num = eval("frm.elements.length");
    for(var i=0; i<check_num; i++) { frm.elements[i].checked = false; }
   }
function del(munGu){
	if(munGu==""){
		var choice = confirm("Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?\n»èÁ¦ÇÏ½Ã¸é º¹±¸ÇÒ¼ö ¾ø½À´Ï´Ù!!");
	}else{
		var choice = confirm(munGu);
	}	
	if(choice == true) {		 
		action = frm.action;
		OpenPost(action,'_del_',10000,10000,0,0,'frm');		
	}
}
//##############ÀüÃ¼¼±ÅÃ,¼±ÅÃÇØÁ¦,¼±ÅÃ»èÁ¦³¡##################

//Ã£±â ±âº»½ºÅ©¸³Æ® 
function searchFrm(formName){	
	formName.submit();
}

//ÀÌ¹ÌÁö ºñÀ²´ë·Î »Ñ¸®±â
//¾²´Â¹ý <img src='ÀÌ¹ÌÁö °æ·Î' width='³ÑÁö ¾Ê´Â ¼±' onload='func_adjustimage(this,148,100)'>
function func_adjustimage(target_img,maxW,maxH)
   {
      var newX;
      var newY;
      var newHeight;
      var newWidth;
      var maxWidth = maxW;
      var maxHeight = maxH;
      var newImg = new Image();
      newImg.src = target_img.src;
      imgw = newImg.width;
      imgh = newImg.height;
      if (imgw > maxWidth || imgh > maxHeight)
      {
         if (imgw > imgh)
         {
            if (imgw > maxWidth)
               newWidth = maxWidth;
            else
               newWidth = imgw;
            newHeight = Math.round((imgh * newWidth) / imgw);
         }
         else
         {
            if (imgh > maxHeight)
               newHeight = maxHeight;
            else
               newHeight = imgh;
            newWidth = Math.round((imgw * newHeight) / imgh);
         }
      }
      else
      {
         newWidth = imgw;
         newHeight = imgh;
      }
       newX = maxWidth / 2 - newWidth / 2;
       newY = maxHeight / 2 - newHeight / 2;
       target_img.onload = null;
       target_img.src = newImg.src;
       target_img.width = newWidth;
       target_img.height = newHeight;
   }
/* ¾ÆÆ®ºñÁî¿¡¼­¸¸ ¾²ÀÌ´Â ½ºÅ©¸³Æ® */

//°ü¸®ÀÚ ¸ðµå¿¡¼­ »óÇ°ÀÔ·Â½Ã Æ÷ÀÎÆ® ±¸ºÐ¼±ÅÃ
function pointView(frmname){	
	if(frmname.pointChk[0].checked==true){
		prePoint.style.display = 'none';
	}else if(frmname.pointChk[1].checked==true){
		prePoint.style.display = 'block';
	}else if(frmname.pointChk[2].checked==true){
		prePoint.style.display = 'none';
	}
}

//ºê¶ó¿ìÁ® Á¤º¸ÃßÃâÇÏ±â
var s_u=navigator.userAgent,s_apn=navigator.appName,s_w=navigator.appVersion;
var s_apv,s_i,s_ie=s_w.indexOf('MSIE '),s_ns6=s_u.indexOf('Netscape6/');

if(s_w.indexOf('Opera')>=0 || s_u.indexOf('Opera')>=0)
    s_apn='Opera';

if(s_ie>0){
    s_apv=parseInt(s_i=s_w.substring(s_ie+5));
    if(s_apv>3)
        s_apv=parseFloat(s_i);
}
else if(s_ns6>0)
    s_apv=parseFloat(s_u.substring(s_ns6+10));
else
    s_apv=parseFloat(s_w);
var stref = document.referrer;
var re = /&/g;
var reff = stref.replace(re,"*");
var str_q = 'appname='+s_apn+'&appver='+s_apv+'&refer='+stref+'&sc_x='+screen.width+'&sc_y='+screen.height;
//alert(str_q)
//³¡


//select : select¿¡¼­ str°ªÀ» °¡Áø optionÀ» ¼±ÅÃµÇµµ·Ï ¼³Á¤
function setSelect(input,str) {
  
  for (i=0;i<input.options.length;i++) {
    if (input.options[i].value == str) input.options[i].selected=true;
  }
}

function tdaySetChk(tyear, tmon, tday ,formName) {

  if (formName.term[0].checked == true || formName.term[1].checked == true || formName.term[5].checked == true)  {

	  setSelect(formName.sday1, tyear);   //³âµµ¼³Á¤
	  setSelect(formName.sday2, tmon);    //¿ù¼³Á¤
	  setSelect(formName.sday3, tday);    //ÀÏ¼³Á¤

	  setSelect(formName.eday1, '');      //³âµµ¼³Á¤
	  setSelect(formName.eday2, '');      //¿ù¼³Á¤
	  setSelect(formName.eday3, '');      //ÀÏ¼³Á¤
  
  }

}


//ÀÌ¹øÁÖ, Áö³­ÁÖº°·Î select ¹Ù ¼³Á¤
function tweekSetChk(sday1, sday2, sday3, eday1, eday2, eday3 ,formName) {

  if (formName.term[2].checked == true || formName.term[3].checked == true)  {

      setSelect(formName.sday1, sday1);   //³âµµ¼³Á¤
      setSelect(formName.sday2, sday2);   //¿ù¼³Á¤
      setSelect(formName.sday3, sday3);   //ÀÏ¼³Á¤

      setSelect(formName.eday1, eday1);   //³âµµ¼³Á¤
      setSelect(formName.eday2, eday2);   //¿ù¼³Á¤
      setSelect(formName.eday3, eday3);   //ÀÏ¼³Á¤

  }

}



//¿ùº°·Î select ¹Ù ¼³Á¤
function tmonSetChk(sday1, sday2 ,formName) {

  if (formName.term[4].checked == true)  {

      setSelect(formName.sday1, sday1);   //³âµµ¼³Á¤
      setSelect(formName.sday2, sday2);   //¿ù¼³Á¤
      setSelect(formName.sday3, '');      //ÀÏ¼³Á¤

	  setSelect(formName.eday1, '');      //³âµµ¼³Á¤
	  setSelect(formName.eday2, '');      //¿ù¼³Á¤
	  setSelect(formName.eday3, '');      //ÀÏ¼³Á¤

  }
}
function menu(img_id,img_src,subm,sub_img_id,sub_img_src){
	eval(img_id + ".src='images/" + img_src + ".gif';");
	
	if (subm != ""){
		eval("document.all['" + subm + "'].style.display = '';");
	}
	
	if (sub_img_id != "" && sub_img_src != ""){
		eval(sub_img_id + ".src='images/" + sub_img_src + ".gif';");
	}
}
function imgSizeChk(imgSrc){
	  var newImg = new Image();
	  newImg.src = imgSrc;
      imgw = newImg.width;	 
      imgh = newImg.height;
	  imgw = imgw + 13;
	  imgh = imgh + 30;
 // ÀÍ½º ÇÃ·Î·¯ÀÌ¸é ¹öÀü 7ÀÏ °æ¿ì ÁÖ¼ÒÁÙ ¸¸Å­ ´ÃÀÓ
		 if( navigator.appName.indexOf("Microsoft") > -1 ){         // ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯ÀÎÁö È®ÀÎ
			if( navigator.appVersion.indexOf("MSIE 6") > -1){       // ÀÍ½ºÇÃ·Î·¯ÀÌ¸é ¹öÀü 6ÀÎÁö È®ÀÎ

			}else if(navigator.appVersion.indexOf("MSIE 7") > -1){  // ÀÍ½º ÇÃ·Î·¯ÀÌ¸é ¹öÀü 7ÀÎÁö È®ÀÎ
			  imgh = imgh + 0;
			}
		}else{                                                      // ÀÍ½ºÇÃ·Î·¯°¡ ¾Æ´Ò °æ¿ì

		}
	  window.resizeTo(imgw, imgh)
}
