﻿// 팝업
function open_popup(url, wid, hei, scroll, winName)
{
	var url = url;
	var posi = "width="+ wid +",height="+hei+",toolbar=no,location=no,status=no,menubar=no,top=10,left=50,scrollbars=" + scroll +",resizable=no" ;
	if (winName == "")
	{
		winName = popup;
	}
	window.open(url,winName,posi);
}

function popsn(url,trgt,w,h) { 
    window.open(url,trgt,'width='+w+',height='+h+',scrollbars=yes,resizable=no,copyhistory=no,toolbar=no,status=no,left=0,top=0'); 
}

//이미지 url 알아오기 
function findImgUrl(str)
{
	var oldImgUrl = document.images[str].src;
	var findText = "/";
	var findTextNum = oldImgUrl.lastIndexOf(findText) + 1;
	return(oldImgUrl.substring(0,findTextNum));
}

//이미지 오버
function imgOver(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "on.gif";
}

//이미지 아웃
function imgOut(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "off.gif";
}

//링크 주변 점선 없애기
var myAnchors=document.all.tags("A"); 
function allblur() {
	for (i=0;i<myAnchors.length;i++) { 
		myAnchors[i].onfocus=new Function("myAnchors["+i+"].blur()");
	} 
}



// 플래시 object
function dispswf(swf,w,h,bg,id,tit){
 document.write('<object id="'+id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+w+'" height="'+h+'" align="middle" title="'+tit+'">');
 document.write('<param name="allowScriptAccess" value="sameDomain" />');
 document.write('<param name="movie" value="'+swf+'" />');
 document.write('<param name="quality" value="high" />');
 if(bg == ""){
  document.write('<param name="wmode" value="transparent" />');
  document.write('<embed name="'+id+'" src="'+swf+'" quality="high" wmode="transparent" width="'+w+'" height="'+h+'"  align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  
 }else{
  document.write('<param name="bgcolor" value="'+bg+'" />');
  document.write('<embed name="'+id+'" src="'+swf+'" quality="high" bgcolor="'+bg+'" width="'+w+'" height="'+h+'"  align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
 }
 document.write('</object>');
}



////tap 관련/////
function toggleLayers(showIds, hideIds)
{
    for(var i in hideIds)
        document.getElementById(hideIds[i]).style.display = 'none';
    for(var i in showIds)
        document.getElementById(showIds[i]).style.display = 'block';
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
////tap 관련/////


//탭
function imgOver(imgName) {
	imgName.src = imgName.src.replace(/(_on.gif|.gif)$/i, "_on.gif");
	imgName.src = imgName.src.replace(/(_on.jpg|.jpg)$/i, "_on.jpg");
}
function imgOut(imgName) {
	imgName.src = imgName.src.replace(/(_on.gif|.gif)$/i, ".gif");
	imgName.src = imgName.src.replace(/(_on.jpg|.jpg)$/i, ".jpg");
}

function tabOver(tabName){	
	tabName = tabName.className = "on";
}
function tabOut(tabName){
	tabName = tabName.className = "";
}

function layer_events()
{
  if (document.layers) {
    document.layers['gnb_area'].captureEvents(Event.MOUSEOVER|Event.MOUSEOUT|Event.MOUSEUP);
    document.layers['gnb_area'].onmouseout = new Function("this.style.height='115'");
    document.layers['gnb_area'].onmouseover = new Function("this.style.height='260'");
  }
}

function display_open(n) {
	div_name = document.getElementById(n);

	if(div_name.style.display == "block"){
		div_name.style.display ="none";
	}else{
		div_name.style.display ="block";
	}
}



var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 900 //set x offset of bar in pixels
var startY = 150 //set y offset of bar in pixels

function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search)
        if (offset != -1) {
            offset += search.length
            end = document.cookie.indexOf(";", offset);
            if (end == -1) end = document.cookie.length;
            returnvalue=unescape(document.cookie.substring(offset, end))
        }
    }
    return returnvalue;
}

var verticalpos="fromtop"

function closebar(){
    if (persistclose)
    document.cookie="remainclosed=1"
    document.getElementById("topbar").style.visibility="hidden"
}

function staticbar(){

    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d = document;
    function ml(id){
        var el=d.getElementById(id);
        if (!persistclose || persistclose && get_cookie("remainclosed")=="")
        el.style.visibility="visible"
        if(d.layers)el.style=el;
        el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
        el.x = startX;
        if (verticalpos=="fromtop")
        el.y = startY;
        else{
            el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
            el.y -= startY;
        }
        return el;
    }
    window.stayTopLeft=function(){
        if (verticalpos=="fromtop"){
            var pY = ns ? pageYOffset : iecompattest().scrollTop;
            ftlObj.y += (pY + startY - ftlObj.y)/8;
        }
        else{
            var pY = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
            ftlObj.y += (pY - startY - ftlObj.y)/8;
        }
        ftlObj.sP(ftlObj.x, ftlObj.y);
        setTimeout("stayTopLeft()", 0);    /*Scoll Time*/
    }
    ftlObj = ml("topbar");
    stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar

