/* ¹öÆ° ÀÌ¹ÌÁö ·Ñ¾÷ */

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/*  ÆäÀÌµå ÀÎ ÅÂ±× */


var useBSNns;

if (useBSNns) {
     if (typeof(bsn) == "undefined")
          bsn = {}
       var _bsn = bsn;
} else {
      var _bsn = this;
}

_bsn.Crossfader = function (divs, fadetime, delay ) {    
     this.nAct = -1;
     this.aDivs = divs;
    
     for (var i=0;i<divs.length;i++) {
       document.getElementById(divs[i]).style.opacity = 0;
       document.getElementById(divs[i]).style.position = "absolute";
       document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
      document.getElementById(divs[i]).style.visibility = "hidden";
     }
    
     this.nDur = fadetime;
  this.nDelay = delay;
  this._newfade();
}

_bsn.Crossfader.prototype._newfade = function() {
  if (this.nID1)
    clearInterval(this.nID1);
       this.nOldAct = this.nAct;
    this.nAct++;

    if (!this.aDivs[this.nAct])    this.nAct = 0;

    if (this.nAct == this.nOldAct)
    return false;

  document.getElementById( this.aDivs[this.nAct] ).style.visibility = "visible";
  this.nInt = 50;
  this.nTime = 0;
  var p=this;
  this.nID2 = setInterval(function() { p._fade() }, this.nInt);
}

_bsn.Crossfader.prototype._fade = function() {
  this.nTime += this.nInt;
    var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 );
    var op = ieop / 100;
    document.getElementById( this.aDivs[this.nAct] ).style.opacity = op;
    document.getElementById( this.aDivs[this.nAct] ).style.filter = "alpha(opacity="+ieop+")";

  if (this.nOldAct > -1) {
    document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op;
          document.getElementById( this.aDivs[this.nOldAct] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
     }
    
     if (this.nTime == this.nDur) {
          clearInterval( this.nID2 );
        
  if (this.nOldAct > -1)
       document.getElementById( this.aDivs[this.nOldAct] ).style.visibility = "hidden";    
    var p=this;
    this.nID1 = setInterval(function() { p._newfade() }, this.nDelay);
  }
}

_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d) {
  return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}


/********** ÀÌ¹ÌÁö Å×ÀÌºíÅ×µÎ¸® ********************/

function roundTable(objID) {
   var obj = document.getElementById(objID);
   var Parent, objTmp, Table, TBody, TR, TD;
   var bdcolor, bgcolor, Space;
   var trIDX, tdIDX, MAX;
   var styleWidth, styleHeight;

   Parent = obj.parentNode;
   objTmp = document.createElement('SPAN');
   Parent.insertBefore(objTmp, obj);
   Parent.removeChild(obj);

   bdcolor = obj.getAttribute('rborder');
   bgcolor = obj.getAttribute('rbgcolor');
   radius = parseInt(obj.getAttribute('radius'));
   if (radius == null || radius < 1) radius = 1;
   else if (radius > 6) radius = 6;

   MAX = radius * 2 + 1;

   Table = document.createElement('TABLE');
   TBody = document.createElement('TBODY');

   Table.cellSpacing = 0;
   Table.cellPadding = 0;

   for (trIDX=0; trIDX < MAX; trIDX++) {
          TR = document.createElement('TR');
          Space = Math.abs(trIDX - parseInt(radius));
          for (tdIDX=0; tdIDX < MAX; tdIDX++) {
                 TD = document.createElement('TD');
                 
                 styleWidth = '1px'; styleHeight = '1px';
                 if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
                 else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
                 else if (radius > 2) {
                        if (Math.abs(tdIDX - radius) == 1) styleWidth = '1px';
                        if (Math.abs(trIDX - radius) == 1) styleHeight = '1px';
                 }

                 if (styleWidth != null) TD.style.width = styleWidth;
                 if (styleHeight != null) TD.style.height = styleHeight;

                 if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
                 else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
                 
                 if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
                 TR.appendChild(TD);
          }
          TBody.appendChild(TR);
   }
   Table.appendChild(TBody);
   Parent.insertBefore(Table, objTmp);
}

/**********  ÆË¾÷¶ç¿ì±â ********************/

function openPopup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/**********  ´ã´çÀÚÆË¾÷ ÆË¾÷¶ç¿ì±â ********************/

function contactpop(pop) {
		window.open('/medicompr/popup/mailPopup.asp?code=9&idx='+pop,'Mail_mailPopup','width=454,height=291');
}