
function right(e)
{
  if (   (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)   )
      || (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3) ) )
  {
    //alert("");
    return false;
  }
  return true;
}

function keypressed()
{
  return false;
}

function disableRightMouse()
{
  document.onmousedown=right;
}

function enableRightMouse()
{
  document.onmousedown=true;
}

function disableKeyPress()
{
  document.onkeydown=keypressed;
}

function enableKeyPress()
{
  document.onkeydown=true;
}

function getKeyCode()
{
  return window.event.keyCode;
}

function replaceString( str, fromStr, toStr )
{
  var idx;
  var dst="";
  if (!str.substring) return str;
  while((idx = str.indexOf(fromStr))>=0)
  {
    dst += str.substring(0,idx) + toStr;
    str  = str.substring(idx+fromStr.length);
  }
  return dst + str;
}

function nullStringCheck(obj)
{
	return obj==null?"":obj;
}

function openSaveWin()
{
  var args=openSaveWin.arguments;
  var ss_winName=args[0];
  var scrollVal="yes";
  var width  = 205;
  var height = 175;
  if(args[1]!=null) scrollVal=args[1];
  if (ss_winName==null || ss_winName=="") ss_winName = "_saveWin";
  return openWin( ss_winName, width, height ,scrollVal);
}

function openWin()
{
  var args=openWin.arguments;
  var ss_winName=args[0];
  var width=args[1];
  var height=args[2];
  var scrollVal="no";
  if (height==null) return null;
  if(args[3]!=null) scrollVal=args[3];
  width =(screen.width-10<width)?   screen.width  -10 : width;
  height=(screen.height-10<height)? screen.height -57 : height;
  var left   = (screen.width - width -10)/2;
  var top    = (screen.height- height-57)/2;;
  left = (left<0)? 0 : left;
  top  = (top <0)? 0 : top;
  var option = "width ="      + width
              +",height="     + height
              +",left="       + left
              +",top="        + top
              +",toolbar=no"
              +",location=no"
              +",directories=no"
              +",status=no"
              +",menubar=no"
              +",scrollbars=" + scrollVal
              +",resizable=no";
  var win = window.open("", ss_winName, option);
  if(win != null)
  {
	win.focus();
  }
  else
  {
	alert('ÆË¾÷Â÷´Ü±â°¡ ÀÛµ¿ÇÏ´Â °Í °°½À´Ï´Ù. ÁßÁö½ÃÄÑÁÖ½Ê½Ã¿ä.\n Please disable popup stopper.');
	return null;
  }
  return win;
}

// ÁÖ¹Î¹øÈ£ Ã¼Å©
function isValidJuno(no1, no2)
{
  var weight = 0;
  var check;
  if (isValidJuno.arguments.length<1) return false;
  if (isValidJuno.arguments.length==2 && no1.length==6) no1 += no2;
  if (no1.length!=13 || !isNum(no1)) return false;
  weight += (no1.charAt(0) - '0') * 2;
  weight += (no1.charAt(1) - '0') * 3;
  weight += (no1.charAt(2) - '0') * 4;
  weight += (no1.charAt(3) - '0') * 5;
  weight += (no1.charAt(4) - '0') * 6;
  weight += (no1.charAt(5) - '0') * 7;
  weight += (no1.charAt(6) - '0') * 8;
  weight += (no1.charAt(7) - '0') * 9;
  weight += (no1.charAt(8) - '0') * 2;
  weight += (no1.charAt(9) - '0') * 3;
  weight += (no1.charAt(10) - '0') * 4;
  weight += (no1.charAt(11) - '0') * 5;
  check = (11 - weight % 11) % 10;
  return ((no1.charAt(12) - '0') == check);
}
/**
 * ³¯Â¥°ü·Ã ÀÚ¹Ù½ºÅ©¸³Æ® °øÅëÇÔ¼ö
 */
/**
 * À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ¿ù(êÅ)ÀÎÁö Ã¼Å©
 */
function isValidMonth(mm) {
  var m = parseInt(mm,10);
  return (m >= 1 && m <= 12);
}
/**
 * À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ÀÏ(ìí)ÀÎÁö Ã¼Å©
 */
function isValidDay(yyyy, mm, dd) {
  var m = parseInt(mm,10) - 1;
  var d = parseInt(dd,10);
  var end = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  if ((yyyy % 4 == 0 && yyyy % 100 != 0) || yyyy % 400 == 0) {
    end[1] = 29;
  }
  return (d >= 1 && d <= end[m]);
}
/**
 * À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ½Ã(ãÁ)ÀÎÁö Ã¼Å©
 */
function isValidHour(hh) {
  var h = parseInt(hh,10);
  return (h >= 1 && h <= 24);
}

function isValidSecond (hh) {
  var h = parseInt(hh,10);
  return (h >= 0 && h <= 60);
}
/**
 * À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ºÐ(ÝÂ)ÀÎÁö Ã¼Å©
 */
function isValidMin(mi) {
  var m = parseInt(mi,10);
  return (m >= 0 && m < 60);
}
/**
 * Time Çü½ÄÀÎÁö Ã¼Å©(´À½¼ÇÑ Ã¼Å©)
 */
function isValidTimeFormat(time) {
  return (!isNaN(time) && time.length == 12);
}
/**
 * À¯È¿ÇÏ´Â(Á¸ÀçÇÏ´Â) Time ÀÎÁö Ã¼Å©
 * ex) var time = form.time.value; //'200102310000'
 *     if (!isValidTime(time)) {
 *         alert("¿Ã¹Ù¸¥ ³¯Â¥°¡ ¾Æ´Õ´Ï´Ù.");
 *     }
 */
function isValidTime(time) {
  var year  = time.substring(0,4);
  var month = time.substring(4,6);
  var day   = time.substring(6,8);
  var hour  = time.substring(8,10);
  var min   = time.substring(10,12);
  if (parseInt(year,10) >= 1900  && isValidMonth(month) &&
    isValidDay(year,month,day) && isValidHour(hour)   &&
    isValidMin(min)) {
    return true;
  }
  return false;
}
/**
 * Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯
 * parameter time: Time Çü½ÄÀÇ String
 */
function toTimeObject(time) { //parseTime(time)
  var year  = time.substr(0,4);
  var month = time.substr(4,2) - 1; // 1¿ù=0,12¿ù=11
  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);
}
/**
 * ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ½ºÆ®¸µÀ¸·Î º¯È¯
 * parameter date: JavaScript Date Object
 */
function toTimeString(date) { //formatTime(date)
  var year  = date.getFullYear();
  var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ
  var day   = date.getDate();
  var hour  = date.getHours();
  var min   = date.getMinutes();
  var sec   = date.getSeconds();
  if (("" + month).length == 1) { month = "0" + month; }
  if (("" + day).length   == 1) { day   = "0" + day;   }
  if (("" + hour).length  == 1) { hour  = "0" + hour;  }
  if (("" + min).length   == 1) { min   = "0" + min;   }
  if (("" + sec).length   == 1) { sec   = "0" + sec;   }
  return ("" + year + month + day + hour + min + sec)
}
/**
 * TimeÀÌ ÇöÀç½Ã°¢ ÀÌÈÄ(¹Ì·¡)ÀÎÁö Ã¼Å©
 */
function isFutureTime(time) {
  return (toTimeObject(time) > new Date());
}
/**
 * TimeÀÌ ÇöÀç½Ã°¢ ÀÌÀü(°ú°Å)ÀÎÁö Ã¼Å©
 */
function isPastTime(time) {
  return (toTimeObject(time) < new Date());
}
/**
 * ÁÖ¾îÁø Time °ú y³â m¿ù dÀÏ h½Ã Â÷ÀÌ³ª´Â TimeÀ» ¸®ÅÏ
 * ex) var time = form.time.value; //'20000101000'
 *     alert(shiftTime(time,0,0,-100,0));
 *     => 2000/01/01 00:00 À¸·ÎºÎÅÍ 100ÀÏ Àü Time
 */
function shiftTime(time,y,m,d,h) { //moveTime(time,y,m,d,h)
  var date = toTimeObject(time);
  date.setFullYear(date.getFullYear() + y); //y³âÀ» ´õÇÔ
  date.setMonth(date.getMonth() + m);       //m¿ùÀ» ´õÇÔ
  date.setDate(date.getDate() + d);         //dÀÏÀ» ´õÇÔ
  date.setHours(date.getHours() + h);       //h½Ã¸¦ ´õÇÔ
  return toTimeString(date);
}
/**
 * µÎ TimeÀÌ ¸î °³¿ù Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ
 * time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
 */
function getMonthInterval(time1,time2) { //measureMonthInterval(time1,time2)
  var date1 = toTimeObject(time1);
  var date2 = toTimeObject(time2);
  var years  = date2.getFullYear() - date1.getFullYear();
  var months = date2.getMonth() - date1.getMonth();
  var days   = date2.getDate() - date1.getDate();
  return (years * 12 + months + (days >= 0 ? 0 : -1) );
}
/**
 * µÎ TimeÀÌ ¸çÄ¥ Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ
 * time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
 */
function getDayInterval(time1,time2) {
  var date1 = toTimeObject(time1);
  var date2 = toTimeObject(time2);
  var day   = 1000 * 3600 * 24; //24½Ã°£
  return parseInt((date2 - date1) / day, 10);
}
/**
 * µÎ TimeÀÌ ¸î ½Ã°£ Â÷ÀÌ³ª´ÂÁö ±¸ÇÔ
 * time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
 */
function getHourInterval(time1,time2) {
  var date1 = toTimeObject(time1);
  var date2 = toTimeObject(time2);
  var hour  = 1000 * 3600; //1½Ã°£
  return parseInt((date2 - date1) / hour, 10);
}
/**
 * ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏ
 */
function getCurrentTime() {
  return toTimeString(new Date());
}
/**
 * ÇöÀç ½Ã°¢°ú y³â m¿ù dÀÏ h½Ã Â÷ÀÌ³ª´Â TimeÀ» ¸®ÅÏ
 */
function getRelativeTime(y,m,d,h) {
  return shiftTime(getCurrentTime(),y,m,d,h);
}
/**
 * ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ
 */
function getYear() {
  return getCurrentTime().substr(0,4);
}
/**
 * ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ
 */
function getMonth() {
  return getCurrentTime().substr(4,2);
}
/**
 * ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ
 */
function getDay() {
  return getCurrentTime().substr(6,2);
}
/**
 * ÇöÀç ãÁ¸¦ HHÇü½ÄÀ¸·Î ¸®ÅÏ
 */
function getHour() {
  return getCurrentTime().substr(8,2);
}
function swfView(width, height, url){
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
	document.write("		codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' ");
	document.write("		width='"+width+"' height='"+height+"' align='middle'>");
	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie'				value='"+url+"' /> ");
	document.write("	<param name='quality'			value='high' /> ");
	document.write("	<param name='wmode'				value='transparent'> ");
	document.write("	<param name='menu'				value='false'> ");
	document.write("	<embed src='"+url+"' quality='high' width='"+width+"' height='"+height+"' align='middle' ");
	document.write("		allowScriptAccess='sameDomain' type='application/x-shockwave-flash' ");
	document.write("		pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

