

/* Standard New Window */
function newWin(url,win,xv,yv) {
  var iwidth;
  var iheight;
  var str1;

  iwidth = (screen.width-xv)/2;
  iheight = (screen.height-yv)/2;

  str1 = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width="+xv+",height="+yv+",top="+iheight+",left="+iwidth;

  var popup = window.open(url, win, str1);

//  if( navigator.appName.substring(0,8) == "Netscape" ) {
//    popup.location = url;
//  }
}

/* Standard New Window */
function newWinRS(url,win,xv,yv,scroll,resize) {
  var iwidth;
  var iheight;
  var str1;

  iwidth = (screen.width-xv)/2;
  iheight = (screen.height-yv)/2;

  str1 = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars="+scroll+",resizable="+resize+",width="+xv+",height="+yv+",top="+iheight+",left="+iwidth;

  var popup = window.open(url, win, str1);

//  if( navigator.appName.substring(0,8) == "Netscape" ) {
//    popup.location = url;
//  }
}


/* Remake New Window ( scroll option ) */
function newWinEx(url,win,xv,yv,scroll) {
  
  var iwidth;
  var iheight;
  var str1;
  
  if(win == "viewmember") {
    iwidth = 0;
    iheight = 0;
  }
  else {
    iwidth = (screen.width-xv)/2;
    iheight = (screen.height-yv)/2;
  }
  str1 = "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars="+scroll+",resizable=0,width="+xv+",height="+yv+",top="+iheight+",left="+iwidth;

  var popup = window.open(url, win, str1);

//  if( navigator.appName.substring(0,8) == "Netscape" ) {
//    popup.location = url;
//  }
}


/* Trim the string */
function alltrim(str) {
  var i;
  var ch;
  var retStr = '';
  var retStr1 = '';
  if (str.length == 0) return str;
  for(i=0;i<str.length;i++) {
    ch = str.charAt(i);
    if(ch == ' ' || ch == '\r' || ch == '\n') continue;
    retStr += ch;
  }
  return retStr;
}


/* All Checkbox reset of dest form */
function resetCheckbox(f) {
  if(f.elements) {
    for(i=0;i<f.elements.length;i++) {
      var e = f.elements[i];
      if (e.type == "checkbox") {
        e.checked = true;
      }
    }
  }
  return false;
}


/* All Checkbox mark of dest form */
function clearCheckbox(f) {
  if(f.elements) {
    for(i=0;i<f.elements.length;i++) {
      var e = f.elements[i];
      if (e.type == "checkbox") {
        e.checked = false;
      }
    }
  }
  return false;
}


function modalNewWin(url, name, width, height) {  // 모달 창
  var winObj = new Object();
  winObj.win = window;

  //winurl = "/mNewWin.htm?turl=" + url;
  winurl = url;
  var sFeatures = "dialogHeight: " + height + "px;dialogWidth: " + width + "px;status:0;dialogHide:1;help: No;scroll:No;resizable:No";
  window.showModalDialog(winurl, winObj, sFeatures)
}

function over(t)
{
  var lnk = t.src;

  r = /\.gif$/g;
  t.src = lnk.replace(r, '_up.gif');
}

function out(t)
{
  var lnk = t.src;

  r = /_up\.gif$/g;
  t.src = lnk.replace(r, '.gif');
}

 
function getCookie(name) { 
  var Found = false 
  var start, end 
  var i = 0 

  while(i <= document.cookie.length) { 
    start = i 
    end = start + name.length 
    if(document.cookie.substring(start, end) == name) { 
      Found = true 
      break 
    } 
    i++ 
  } 

  if(Found == true) { 
    start = end + 1 
    end = document.cookie.indexOf(";", start) 
    if(end < start) 
      end = document.cookie.length 
    return document.cookie.substring(start, end) 
  } 
  return "" 
} 

function setCookie( name, value, expiredays ) 
{
  var today = new Date();
  today.setDate( today.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}


  function onmsg()
  {
    var f, w, h, lsize;

    f = document.getElementById('msglayer');

    lsize = f.style.width;

    w = document.body.clientWidth + document.body.scrollLeft - (parseInt(lsize) + 10);

    f.style.left = w;

    showmsg();
  }

  function showmsg()
  {
    var len = '';
    var newlen = '';
    var timerId, f, ff, s;

    f = document.getElementById('msglayer');

    len = f.style.height;

    s = parseInt(len);
    s = s + 5;
      
    newlen = s + 'px';

    f.style.height = newlen;

    h = document.body.clientHeight + document.body.scrollTop - (10 + s);
    f.style.top = h;

    timerId = setTimeout("showmsg()", 30);

    if (f.style.height == '100px')
    {
      clearTimeout(timerId);
      setTimeout("closemsg()", 5000)
      posmsg();
    }
  }

  function posmsg()
  {
    f = document.getElementById('msglayer');

    lsize = f.style.width;
    hsize = f.style.height;

    w = document.body.clientWidth + document.body.scrollLeft - (parseInt(lsize) + 10);
    h = document.body.clientHeight + document.body.scrollTop - (parseInt(hsize) + 10);

    f.style.left = w;
    f.style.top = h;

    setTimeout("posmsg()", 20);
  }

  function closemsg()
  {
    var len = '';
    var newlen = '';
    var timerId, f, s;

    f = document.getElementById('msglayer');

    len = f.style.height;

    s = parseInt(len);
    s = s - 5;
      
    newlen = s + 'px';

    f.style.height = newlen;

    h = document.body.clientHeight + document.body.scrollTop - (10 + s);
    f.style.top = h;

    timerId = setTimeout("closemsg()", 30);

    if (f.style.height == '0px')
    {
      clearTimeout(timerId);
      f.style.display = 'none';
    }
  }

  function setadmbtn()
  {
    f = document.getElementById('admbtn');
    lsize = f.width;

    w = document.body.clientWidth + document.body.scrollLeft - (parseInt(lsize) + 10);
    h = document.body.clientHeight + document.body.scrollTop - 90;

//    f.style.left = 10;
    f.style.left = w;
    f.style.top = h;

    setTimeout("setadmbtn()", 20);
  }

