// JavaScript Document

//ÇÃ·¡½Ã print
//ActiveX ÇÃ·¡½Ã
function printFlash(src, w, h, id, vars) {
	var Flash_html = "";
	Flash_html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10.0.12.36" id="'+id+'" width="'+w+'" height="'+h+'">';
	Flash_html += '<param name="movie" value="'+src+'">';
	Flash_html += '<param name="quality" value="high">';
	Flash_html += '<param name="allowScriptAccess" value="always">';
	Flash_html += '<param name="wmode" value="transparent">';
	Flash_html += '<param name="FlashVars" value="'+vars+'">';
	Flash_html += '<param name="swliveconnect" value="true">';
	Flash_html += '<embed src="'+src+'" quality=high wmode="transparent" FlashVars="'+vars+'" width="'+w+'" height="'+h+'" swliveconnect="true" allowScriptAccess="always" id="'+id+'" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	Flash_html += '</object>';
	document.write(Flash_html);
}

function printFlash2(fid,src,wid,hei,wmd,fvs) {
    this.fPrint = '';
    this.Src = src;
    this.Width = wid;
    this.Height = hei;
    this.FlashVars = (fvs != undefined)? fvs :'';
    this.Wmod = (wmd != undefined)? wmd :'';
    fPrint = '<object id="' + fid + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10.0.12.36"';
    fPrint += ' width="'+Width+'"';
    fPrint += ' height="'+Height+'">';
    fPrint += '<param name="allowScriptAccess" value="always">';
	fPrint += '<param name="wmode" value="transparent">';
    fPrint += '<param name="movie" value="'+Src+'">';
    fPrint += '<param name="quality" value="high">';
    fPrint += (FlashVars != null) ? '<param name="FlashVars" value="'+FlashVars+'">' : '';
    fPrint += (Wmod != null) ? '<param name="wmode" value="'+Wmod+'">' : '';
    fPrint += '<embed';
    fPrint += fPrint + ' src="'+Src+'"';
    fPrint += (FlashVars != null) ? ' FlashVars="'+FlashVars+'"' : '';
    fPrint += (Wmod != null) ? ' wmode="'+Wmod+'"' : '';
    fPrint += ' quality="high"';
    fPrint += ' allowScriptAccess="always"';
    fPrint += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
    fPrint += ' type="application/x-shockwave-flash"';
    fPrint += ' width="'+Width+'"';
    fPrint += ' height="'+Height+'"';
    fPrint += '></embed>';
    fPrint += '</object>';
    
	document.write(fPrint);
}

// ÇÖÀÌ½´ º¸ÀÌ±â
function openHotIssue() {
		document.getElementById('mainHot').style.display = "block";
}
function openPop(id) {
	document.getElementById(id).style.display = "block";
}
// ·¹ÀÌ¾îÆË¾÷ 
function closePop(id){
	document.getElementById(id).style.display = "none";
}


// ÄíÅ°»ý¼º
function setCookie(name, value, expire, path) { 
    document.cookie = name + "=" + escape(value) + "; path=" + path + ( (expire) ? "; expires=" + expire.toGMTString() : "")
}

// ÄíÅ°Á¤º¸ °¡Á®¿À±â
function getCookie(uName) { 
    var flag = document.cookie.indexOf(uName+'='); 
    if (flag != -1) { 
	    flag += uName.length + 1 
	    end = document.cookie.indexOf(';', flag) 
	    if (end == -1) end = document.cookie.length 
	    return unescape(document.cookie.substring(flag, end)) 
    }
}


function closeLoginPop(id){
	document.getElementById(id).style.display = "none";
	setCookie('brloginbox', 'false', 0, '/') ;
}
function openLoginPop(id){
	document.getElementById(id).style.display = "block";
	setCookie('brloginbox', 'true', 0, '/') ;
}


//alert("js : " + getCookie('brloginbox')) ;
//var loginOpenBool = getCookie('brloginbox') ;





function openPopup(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);
  
}

/* scroll */
function getPosition(){
	var start, end, term;
	
	start = parseInt(document.getElementById('gotoTop').style.top, 10);
	end = document.documentElement.scrollTop + 1;
	term = 3;

	if ( start != end ) {
		var scale = Math.ceil( Math.abs( end - start ) / 20 );
		
		if ( end < start )	scale = -scale;
		document.getElementById('gotoTop').style.top = parseInt (document.getElementById('gotoTop').style.top, 10) + scale + "px";
		term = 1;
	}
	setTimeout ("getPosition()", term);
}
function moveTop() {
	document.getElementById('gotoTop').style.top = document.documentElement.scrollTop + "px";
	getPosition();
	return true;
}


function goTop(){
 scrollTo(0,0);
}


//·Î±×ÀÎ ¹Ú½º 
//·Î±×ÀÎ ¹Ú½º 

var TimeOut         = 300;
var currentLayer    = null;
var currentitem     = null;

var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

// Open Hidden Layer
function openLoginBox(n)
{
    var l  = document.getElementById("loginBox"+n);
    var mm = document.getElementById("loginBox"+n);
    
    if(l)
    {
        mcancelclosetime();
        l.style.visibility='visible';

        if(currentLayer && (currentLayerNum != n))
            currentLayer.style.visibility='hidden';

        currentLayer = l;
        currentitem = mm;
        currentLayerNum = n;            
    }
    else if(currentLayer)
    {
        currentLayer.style.visibility='hidden';
        currentLayerNum = 0;
        currentitem = null;
        currentLayer = null;
    }
}

// Turn On Close Timer
function mclosetime()
{
    closeTimer = window.setTimeout(mclose, TimeOut);
}

// Cancel Close Timer
function mcancelclosetime()
{
    if(closeTimer)
    {
        window.clearTimeout(closeTimer);
        closeTimer = null;
    }
}

// Close Showed Layer
function mclose()
{
    if(currentLayer && noClose!=1)
    {
        currentLayer.style.visibility='hidden';
        currentLayerNum = 0;
        currentLayer = null;
        currentitem = null;
    }
    else
    {
        noClose = 0;
    }

    currentLayer = null;
    currentitem = null;
}

// Close Layer Then Click-out
document.onclick = mclose; 

