//////////////////////////////////////////////////////
//
//  * Áß¾Ó¿¡ ¸ð´Þ¹Ú½º ¶ç¿ì±â
//
////////////////////////////////////////////////////////


function OpenModal(sURL,sMsg,sWidth,sHeight,sTop,sLeft,sResize)
{
 var sFeatures = new Array();
 
 sFeatures[0] = (sWidth > 0)? "dialogWidth:"+sWidth+"px":"dialgWidth:300px";
 sFeatures[1] = (sHeight > 0)? "dialogHeight:"+sHeight+"px":"dialogHeight:300px";
 sFeatures[2] = (sTop > 0)? "dialogTop:"+sTop+"px":"";
 sFeatures[3] = (sLeft > 0)? "dialogLeft:"+sLeft+"px":"";
 sFeatures[4] = (sTop ="")? "center:Yes":"";
 sFeatures[5] = (sResize)? "resizeable:"+sResize:"resizeable:No";
 sFeatures[6] = "help:No";
 sFeatures[7] = "status:No";
  sFeatures[7] = "scroll:"+sResize+"";
 
 sFeatures = sFeatures.join(";");
 
 window.showModalDialog(sURL,sMsg,sFeatures);
}

function OpenModalNew(sURL,sMsg,sWidth,sHeight,sTop,sLeft,sResize)
{
	 var sFeatures = new Array();
	 
	 sFeatures[0] = (sWidth > 0)? "dialogWidth:"+sWidth+"px":"dialgWidth:300px";
	 sFeatures[1] = (sHeight > 0)? "dialogHeight:"+sHeight+"px":"dialogHeight:300px";
	 sFeatures[2] = (sTop > 0)? "dialogTop:"+sTop+"px":"";
	 sFeatures[3] = (sLeft > 0)? "dialogLeft:"+sLeft+"px":"";
	 sFeatures[4] = (sTop ="")? "center:Yes":"";
	 sFeatures[5] = (sResize)? "resizeable:"+sResize:"resizeable:No";
	 sFeatures[6] = "help:No";
	 sFeatures[7] = "status:No";
	  sFeatures[7] = "scroll:"+sResize+"";
	 
	 sFeatures = sFeatures.join(";");
	 
	 var retVal = window.showModalDialog(sURL,sMsg,sFeatures);
	 
	 if (typeof retVal != "undefined" && retVal)    // retVal °ªÀÌ À¯È¿ÇÏ°í, true °ªÀÏ ¶§ ¸®·Îµå
	 {
      document.location.reload();
	 }


}


function OpenWindow(StrPage, StrName, w, h,scrolls)
{
	var win = null;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/3;
	settings = 'height='+h+',';
	settings += 'width='+w+',';	
	settings += 'top=80,';
	settings += 'left=120,';
	settings += 'scrollbars='+scrolls+',';
	settings += 'resizable=no,';
	settings += 'status=no';

	win = window.open(StrPage, StrName, settings);
	if (parseInt(navigator.appVersion)>=4) {
		win.window.focus();
	}
}



//////////////////////////////////////////////////////
//
//  * ÇÃ·¡½Ã Write
//
////////////////////////////////////////////////////////
// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå)
function flashWrite(url,w,h,id,bg,vars,win){

	// ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,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='swLiveConnect' value='true' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' swLiveConnect='true' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);

}


//////////////////////////////////////////////////////
//
//  * ¼ýÀÚ ÁÙÀÌ±â ( ½Ã¹Ä·¹ÀÌ¼Ç »ó¼¼¼³Á¤½Ã »ç¿ë )
//
////////////////////////////////////////////////////////
// minusValue(ÀÎÇ²¹Ú½º Ç® ³×ÀÓ)
function  minusValue(this_frm) {
  if(this_frm.value <= 1)
    {
        alert('Çã¿ëµÈ ¹üÀ§¿¡ ¾î±ß³³´Ï´Ù.');
    }
      else
    {
        this_frm.value = parseInt(this_frm.value)-1;
    }
}

//////////////////////////////////////////////////////
//
//  * ¼ýÀÚ ´ÃÀÌ±â ( ½Ã¹Ä·¹ÀÌ¼Ç »ó¼¼¼³Á¤½Ã »ç¿ë )
//
////////////////////////////////////////////////////////
// plusValue(ÀÎÇ²¹Ú½º Ç® ³×ÀÓ)
function  plusValue(this_frm) {
  if(this_frm.value>=100)
    {
        alert('Çã¿ëµÈ ¹üÀ§¿¡ ¾î±ß³³´Ï´Ù.');
    }
      else
    {
        this_frm.value = parseInt(this_frm.value)+1;
    }
}


//////////////////////////////////////////////////////
//
//  * ÀÚµ¿À¸·Î ²Ä¸¶ Âï±â  ( onkeyup À¸·Î È°¼ºÈ­ )
//
////////////////////////////////////////////////////////
// number_comma(this)
function number_comma(form_value) {

   num = form_value.value.replace(/,/g, "")
   var num_str = num.toString()
   var result = ''

    for(var i=0; i<num_str.length; i++) {
          var tmp = num_str.length-(i+1)
          if(i%3==0 && i!=0) result = ',' + result
          result = num_str.charAt(tmp) + result
     }

      form_value.value  = result;

      return
 }

//////////////////////////////////////////////////////
//
//  * ´Þ·Â »õÃ¢ ¶ç¿ì±â ( ·¹ÀÌ¾î·Î Ç¥ÇöÇÏ¸é ¹üÀ§¸¦ ¹þ¾î³ª´Â ÆäÀÌÁö¸¦ À§ÇØ »ðÀÔ )
//
////////////////////////////////////////////////////////
// popUp_cal(Ã¢ Æø, Ã¢ ³ôÀÌ, Æû ÀÌ¸§, ·¹ÀÌºí ÀÌ¸§)
function popUp_cal(w, h, frm_name, field_name){
	
     x = (screen.availWidth - w) / 2;
     y = (screen.availHeight - h) / 2;
     window.open('/common/inc/PopCalendar.asp?frm_name='+frm_name+'&field_name='+field_name, 'pop_cal','width='+w+', height='+h+', left='+x+', top='+y);

}
//´Þ·Â »õÃ¢ ¶ç¿ö ºÎ¸ðÆäÀÌÁö ¼­ºê¹Ô
function popUp_cal2(w, h, frm_name, field_name){
	
     x = (screen.availWidth - w) / 2;
     y = (screen.availHeight - h) / 2;
     window.open('/common/inc/PopCalendar2.asp?frm_name='+frm_name+'&field_name='+field_name, 'pop_cal','width='+w+', height='+h+', left='+x+', top='+y);

}

//´Þ·Â »õÃ¢ ¶ç¿ö ºÎ¸ðÆäÀÌÁö ¼­ºê¹Ô
function popUp_cal3(w, h, frm_name, field_name,curdate){
	
     x = (screen.availWidth - w) / 2;
     y = (screen.availHeight - h) / 2;
     window.open('/common/inc/PopCalendar3.asp?frm_name='+frm_name+'&field_name='+field_name+'&curdate='+curdate, 'pop_cal','width='+w+', height='+h+', left='+x+', top='+y);

}

//´Þ·Â »õÃ¢ ¶ç¿ö ºÎ¸ðÆäÀÌÁö ¼­ºê¹Ô(ºÎÅ·)
function popUp_cal4(w, h, frm_name, field_name,curdate){
	
     x = (screen.availWidth - w) / 2;
     y = (screen.availHeight - h) / 2;
     window.open('/common/inc/PopCalendar4.asp?frm_name='+frm_name+'&field_name='+field_name+'&curdate='+curdate, 'pop_cal','width='+w+', height='+h+', left='+x+', top='+y);

}


/*---------------------------------------------------------------
  ±â´É		: ¿ìÆí¹øÈ£ µ¥ÀÌÅÍ
  INPUT		: FormName : Æû ÀÌ¸§ ,zip: ¿ìÆí¹øÈ£ - À» Á¦¿ÜÇÑ ÀüÃ¼ ¿ìÆí¹øÈ£ ÀÎÇ² ¹Ú½º¸í,zip01 : ¿ìÆí¹øÈ£ Ã¹¹øÂ° 3ÀÚ¸® ÀÎÇ² ¹Ú½º¸í,
            zip02 : ¿ìÆí¹øÈ£ ¸¶Áö¸· 3ÀÚ¸® ÀÎÇ² ¹Ú½º¸í ,addr1 : ÁÖ¼Ò Ã¹¹øÂ° ÀÎÇ² ¹Ú½º ¸í,addr2 : ÁÖ¼Ò µÎ¹øÂ° ÀÎÇ² ¹Ú½º ¸í
  RETURN	: zip : ¿ìÆí¹øÈ£ ÀüÃ¼ Ãâ·Â,zip01 : ¿ìÆí¹øÈ£ Ã³À½ 3ÀÚ¸® ,zip02 : ¿ìÆí¹øÈ£ ¸¶Áö¸· 3ÀÚ¸® ,addr1 : ÁÖ¼Ò Ã¹¹øÂ°,addr2 : ÁÖ¼Ò µÎ¹øÂ° ( ¹øÁö )
  AUTHOR	: ÁÖ¿µ»ó
----------------------------------------------------------------*/
function PopZipcode(FormName,zip,zip01,zip02,addr1,addr2) {
  window.open('/Common/Inc/ZipCode.asp?FormName='+FormName+'&zip='+zip+'&zip01='+zip01+'&zip02='+zip02+'&addr1='+addr1+'&addr2='+addr2,'zipcodepopup','width=435,height=300,scrollbars=yes');

}


/*---------------------------------------------------------------
  ±â´É		: ÆäÀÌÁö ÀüÃ¼È­¸éÀ¸·Î º¸±â
----------------------------------------------------------------*/

function fullscreen()
{
	try{ 
		//ºÎ¸ðÃ¢ÀÌ ÀÖÀ¸¸é
		window.opener.location.href; 
		 scrn.innerHTML = "<a href='"+window.opener.location.href+"' target='_blank'><img src='/images/index/top_m_allview_close.gif' border='0' onclick='javascript:winclose();'></a>";
		 

	}catch(e){ 
		scrn.innerHTML=  "<a href=\"javascript:setTimeout('winclose()', 2000);OpenWindow(\'"+location.href+"\',\'', \'toolbar=no,location=no,channelmode=0,fullscreen=1,screenY=1,scrollbars=yes,alwaysRaised=1\');\"><img src='/images/index/top_m_allview1.gif' border='0'></a>";

	} 
}


function winclose() {
    opener = self;
    self.close();

}








function trim(va){
	va=new String(va)
	temp1=0
	for(i=0;i<va.length;i++){
		temp2=va.charAt(i)
		if(temp2!=" "){temp1=i;break}
	}
	va=va.substring(temp1,va.length)
	temp1=0
	for(i=va.length-1;i>=0;i--){
		temp2=va.charAt(i)
		if(temp2!=" "){temp1=i+1;break}
	}
	va=va.substring(0,temp1)
	return va
}



function ValidNumChk(p_SelectEle)
{

     var i_KeyValue = event.keyCode;		
    if ((i_KeyValue < 48 || i_KeyValue > 57) && (i_KeyValue != 45) && (i_KeyValue != 46) && (i_KeyValue != 13))
    {
         alert ("¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.È®ÀÎ¹Ù¶ø´Ï´Ù.");
		 event.returnValue = false;
    }
}
	


/*---------------------------------------------------------------
  ±â´É		: ¾ÆÀÌÇÁ·¹ÀÓ³ôÀÌ ÀÚµ¿Á¶Àý
----------------------------------------------------------------*/


function resizeIframe(fr) {
	fr.setExpression('height',ifrm_left.document.body.scrollHeight);
	fr.setExpression('width',ifrm_left.document.body.scrollWidth);    
}


var resizeIframeGCM=function(iframe_id) {
	var h = document.body.offsetHeight + document.body.scrollHeight;
	try{
		parent.document.getElementById(iframe_id).style.height = h+"px";
	}catch(e){}
};

var resizeIframeBuy=function(iframe_id, _id) {
	var h = document.getElementById(_id).offsetHeight;
	try{parent.document.getElementById(iframe_id).style.height = h+"px";}catch(e){}
};



function getDayInterval ( time1 , time2 )
{
var date1 = toTimeObject ( time1 );
var date2 = toTimeObject ( time2 ); 
var day = 1000 * 3600 * 24; /*24½Ã°£*/ 
return parseInt((date2 - date1) / day, 10); 
}

function toTimeObject(time) {
var year = time.substr(0,4);
var month = time.substr(4,2) - 1;
var day = time.substr(6,2);
var hour = time.substr(8,2);
var min = time.substr(10,2);

return new Date(year,month,day,hour,min);
}


/**
  * ÄíÅ°°ª ÃßÃâ
  * @param cookieName ÄíÅ°¸í
  */
 function getCookie( cookieName )
 {
  var search = cookieName + "=";
  var cookie = document.cookie;

  // ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
  if( cookie.length > 0 )
  {
   // ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
   startIndex = cookie.indexOf( cookieName );

   // ¸¸¾à Á¸ÀçÇÑ´Ù¸é
   if( startIndex != -1 )
   {
    // °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
    startIndex += cookieName.length;

    // °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
    endIndex = cookie.indexOf( ";", startIndex );

    // ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
    if( endIndex == -1) endIndex = cookie.length;

    // ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
    return unescape( cookie.substring( startIndex + 1, endIndex ) );
   }
   else
   {
    // ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
    return false;
    alert('ÇØ´çÄí±â Á¸Àç¾ÈÇÔ');
   }
  }
  else
  {
   // ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
   return false;
   alert('ÄíÄ«ÀÚÃ¼¾øÀ½');
  }
 }

 

 /**
  * ÄíÅ° ¼³Á¤
  * @param cookieName ÄíÅ°¸í
  * @param cookieValue ÄíÅ°°ª
  * @param expireDay ÄíÅ° À¯È¿³¯Â¥
  */
function setCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}



 /**
  * ÄíÅ° »èÁ¦
  * @param cookieName »èÁ¦ÇÒ ÄíÅ°¸í
  */
 function deleteCookie( cookieName )
 {
  var expireDate = new Date();
  
  //¾îÁ¦ ³¯Â¥¸¦ ÄíÅ° ¼Ò¸ê ³¯Â¥·Î ¼³Á¤ÇÑ´Ù.
  expireDate.setDate( expireDate.getDate() - 1 );
  document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
 }