//top¹öÆ° ·Ñ¸µ
var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements()
{
var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

if ( bNetscape4plus ) { // ³×Ã÷ÄÉÀÌÇÁ ¿ë ¼³Á¤
yMenuFrom = document["divMenu"].top;
yMenuTo = top.pageYOffset + 20; // À§ÂÊ À§Ä¡
}
else if ( bExplorer4plus ) { // IE ¿ë ¼³Á¤
yMenuFrom = parseInt (divMenu.style.top, 10); //À§¿¡¼­ ³»·Á¿À´Â À§Ä¡
yMenuTo = document.body.scrollTop + 295; // À§ÂÊ À§Ä¡
}

timeoutNextCheck = 500;

if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
setTimeout ("CheckUIElements()", timeoutNextCheck);
return;
}


if ( yButtonFrom != yButtonTo ) {
yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
if ( yButtonTo < yButtonFrom )
yOffset = -yOffset;

if ( bNetscape4plus )
document["divLinkButton"].top += yOffset;
else if ( bExplorer4plus )
divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

timeoutNextCheck = 10;
}
if ( yMenuFrom != yMenuTo ) {
yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
if ( yMenuTo < yMenuFrom )
yOffset = -yOffset;

if ( bNetscape4plus )
document["divMenu"].top += yOffset;
else if ( bExplorer4plus )
divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;

timeoutNextCheck = 10;
}

setTimeout ("CheckUIElements()", timeoutNextCheck);
}
function OnLoad()
{
var y;

// ÇÁ·¹ÀÓ ¿¡¼­ ¹þ¾î³ª°Ô ÇÏ´Â ÇÔ¼öÀÔ´Ï´Ù. ÇÁ·¹ÀÓ¿¡ ³ÖÀ¸·Á¸é »èÁ¦ÇÏ¼¼¿ä
if ( top.frames.length )
// top.location.href = self.location.href;

// Æä¿¡Áö ·Îµù½Ã Æ÷Áö¼Ç
if ( bNetscape4plus ) {
document["divMenu"].top = top.pageYOffset + 100;
document["divMenu"].visibility = "visible";
}
else if ( bExplorer4plus ) {
divMenu.style.top = document.body.scrollTop + 100;
divMenu.style.visibility = "visible";
}

CheckUIElements();
return true;
}

//ÀÌ¹ÌÁö ·Ñ¿À¹ö È¿°ú
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function na_restore_img_src(name, nsdoc)
{
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  } 
}

function na_preload_img()
{ 
  var img_list = na_preload_img.arguments;
  if (document.preloadlist == null) 
    document.preloadlist = new Array();
  var top = document.preloadlist.length;
  for (var i=0; i < img_list.length; i++) {
    document.preloadlist[top+i]     = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
  } 
}

function na_change_img_src(name, nsdoc, rpath, preload)
{ 
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  } 
}

// ¸µÅ©Á¡¼±¾ø¾Ö±â ///////////////////////////////////////////////
function bluring() {
	if (event.srcElement.tagName == "A" || event.srcElement.tagName == "IMG")
		document.body.focus();
} 
document.onfocusin = bluring;

// iframe sizeÁ¶Àý¿ë ½ºÅ©¸³Æ® ------------
function reSize() {
        try{
        var objBody = innerFrame.document.body;
        var objFrame = document.all["innerFrame"];
        ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
        
        if (ifrmHeight > 300) {
                objFrame.style.height = ifrmHeight
        }else{
                objFrame.style.height = 300;
        }
        objFrame.style.width = '670'
        }catch(e){}
}
function init_iframe() {
        reSize();
        setTimeout('init_iframe()',100)
}
init_iframe();

//»õÃ¢ ¶ç¿ì±â
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//select
function go_url(url)
{
    if(url != '')   window.open(url,'_blank');
}

/***********************************
/ ÀÌ¹ÌÁö »çÀÌÁî¿¡ ¸Â°Ô »õÃ¢¶ç¿ì±â
/***********************************/
function OpenImage(s){
        //
        // º¯¼ö Á¤ÀÇ
        // 
        srcImg = new Image();
        clientWidth = screen.width;
        clientHeight = screen.height;
        srcImg.src = s;
  //
  // ¿­·Á´Â ÆÄÀÏÀ» ÀÌ¸§
  //
        var srcFileName = srcImg.src.substr(srcImg.src.lastIndexOf("/")+1, srcImg.src.length);
        //
        // »õÃ¢ ¶ç¿ì°í ÀÌ¹ÌÁö »ðÀÔ
        //
        win = window.open("","","width=15,height=15,scrollbars=no,resizable=no,left="+(clientWidth/2-15)+",top="+(clientHeight/2-15)+"");
        win.document.writeln("<html>");
        win.document.writeln("<head>");
        win.document.writeln("<title>"+document.title+" ["+srcFileName+"]</title>");
        win.document.writeln("</head>");
        win.document.writeln("<body style='margin:0px;'>");
        win.document.writeln("<table border='0' cellpadding='0' cellspacing='0' style='cursor:hand' onclick='self.close()'>");
        win.document.writeln(" <tr>");
        win.document.writeln("  <td align='center'><img src="+s+" name='winImg' style='cursor:hand' onclick='self.close()' alt='Å¬¸¯ÇÏ¸é »ç¶óÁý´Ï´Ù'></td>");
        win.document.writeln(" </tr>");
        win.document.writeln("</table>");
        win.document.writeln("</body>");
        win.document.writeln("</html>");

        srcImg = win.document.winImg;
        //
        // ÀÌ¹ÌÁö°¡ ¸ðµÎ ·ÎµùµÉ¶§±îÁö ±â´Ù¸²
        //
        while(true)
                if(srcImg.readyState == "complete")
                        break;
        
        //
        // »õÃ¢ÀÇ Å©±â ¼³Á¤
        //
        var winWidth = srcImg.width+10;
        var winHeight = srcImg.height+29;
        //
        // »õÃ¢ÀÌ ¶ç¿öÁú À§Ä¡ ¼³Á¤
        //
        var left = (clientWidth/2)-(srcImg.width/2);
        var top = (clientHeight/2)-(srcImg.height/2);
        //
        // ÀÌ¹ÌÁöÀÇ Å©±â overflow È®ÀÎÈÄ »õÃ¢ÀÇ Å©±â¿Í À§Ä¡ Àç¼³Á¤
        //
        if(clientWidth <= srcImg.width){
                winWidth = clientWidth;
                left = 0;
                win.document.body.scroll = "auto";
        }
        if(clientHeight <= srcImg.height){
                winHeight = clientHeight-30;
                top = 0;
                win.document.body.scroll = "auto";
        }
        //
        // ÀÌ¹ÌÁö·ÎµùÀÌ ³¡³µÀ½À¸·Î ÀÌ¹ÌÁöÀÇ Å©±â¸¦ »ç¿ëÇÒ¼ö ÀÖ´Ù.
        // ÇØ´ç ÀÌ¹ÌÁöÀÇ »çÀÌÁî¿¡ ¸Â°Ô À©µµ¿ì¸¦ Àç¼³Á¤ÇÑ´Ù.
        win.moveTo(left, top);
        win.resizeTo(winWidth, winHeight);
}