var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function openflash(width,height,src,id,str,wmode,ver){ 
   var html = '';
	var ver = (ver) ? ver : 8;
	if(isIE && isWin && !isOpera){
		var html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+',0,0,0" width="'+width+'" height="'+height+'" ';
		if(id) html += 'id="'+id+'" name="'+id+'" ';
		html += 'align="middle">';
		html += '<param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" />';
		html += '<param name="movie" value="'+src+'" /><param name="quality" value="high" />';
		if(str) html += '<param name="FlashVars" value="'+str+'" />';
		if(!wmode) html += '<param name="wmode" value="transparent" />';
		html += '</object>';
	} else {
		html += '<embed src="'+src+'" quality="high" ';
		if(str) html += 'FlashVars="'+str+'" ';
		if(id) html += 'name="'+id+'" ';
		if(!wmode) html += 'wmode="transparent" ';
		html += 'width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
  }
  return html;
} 

function writeflash(src){ 
    document.write(src); 
}

function writeFlashMovie(){	
	document.write(openflash(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]));
}

function fo(){
	window.focus();
}

function closediv(DIV){
	document.getElementById(DIV).style.display='none';
}

function closeFlashWindow1(ID,TIME){
	closeWin(ID,TIME);
}

function getCookie(name)
	{
        var nameOfCookie = name + "=";
        var x = 0;
        while ( x <= document.cookie.length )
			{
				var y = (x+nameOfCookie.length);
				if( document.cookie.substring( x, y ) == nameOfCookie )
					{
						if((endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
							endOfCookie = document.cookie.length;
						return unescape( document.cookie.substring( y, endOfCookie ) );
					}
				x = document.cookie.indexOf( " ", x ) + 1;
				if( x == 0 )
					break;
			}
        return "";
    }


function pop(CID)
	{
        if(getCookie( CID ) != "done" )//ÄíÅ° ³×ÀÓ È®ÀÎ
			{
			    document.getElementById(CID).style.display = 'block';
		    }
	}

//ÄíÅ° ÃÊ ´ÜÀ§ÀüÈ¯
function setCookieTime(name, value, mSecond) {
		var today  = new Date();
		var expire = new Date(today.getTime() + mSecond);
		window.document.cookie = name + "=" + escape(value) + ((expire) ? ";path=/; expires=" + expire.toGMTString() : "");
	}

function setCookie(name, value, min)
	{
		setCookieTime(name, value, min*1000*60); /*ÇöÀç *1000 À¸·Î ¼ýÀÚ 1Àº 1ÃÊ¸¦ ÀÇ¹ÌÇÔ Kim jaemo*/ 
	}

function closeWin(CID,MIN)
	{
		setCookie( CID, "done" , MIN); //ÄíÅ°³×ÀÓ¼ÂÆÃ 
		document.getElementById(CID).style.display = 'none' ;
	}
	
function closeToday(cid){
	var today  = new Date();
	var expire = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 24, 00);
	window.document.cookie = cid + "=1" + ((expire) ? ";path=/; expires=" + expire.toGMTString() : "");
	document.getElementById(cid).style.display = 'none' ;
}

function closeWin2(CID,MIN)
	{
		setCookie( CID, "done" , MIN); //ÄíÅ°³×ÀÓ¼ÂÆÃ 
	}

function Position_change (div,left, top,otherdiv){
	if (screen.width==800 ) { float_left1 = left; }
	else if (screen.width==1024 ) { float_left1 = left; }
	else if (screen.width==1152 ) { float_left1 = left+64; }
	else if (screen.width==1280 ) { float_left1 = left+128; }
	else if (screen.width==1360 ) { float_left1 = left+168; }
	else if (screen.width==1400 ) { float_left1 = left+188; }
	else if (screen.width==1600 ) { float_left1 = left+288; }
	else if (screen.width==1680 ) { float_left1 = left+328; }
	else if (screen.width==1920 ) { float_left1 = left+448; }
	else if (screen.width==2048 ) { float_left1 = left+512; }

document.getElementById( div ).style.left = float_left1;

			if(otherdiv!="" ){
				if(document.getElementById(otherdiv)!=null){
					if(getCookie( otherdiv ) != "done" ){      // ÄíÅ°°¡ ¾ø´Ù ->Å¾¹è³Ê°¡ º¸ÀÎ´Ù. ->³ôÀÌ¸¦ ´õÇÑ´Ù.
						var plustop = document.getElementById( otherdiv ).clientHeight ;
						document.getElementById( div ).style.top = top+plustop;
					}
				}
			}
}

function Position_test (div,left, top,otherdiv)
	{
	var sizes = getPageSize ();
	alert(sizes[0]+' '+sizes[1]+' '+sizes[2]+' '+sizes[3]);
	document.getElementById( div ).style.left = -83;
	if (sizes[0]<1003)
	{	document.getElementById( div ).style.left = -93;
	}
	if(getCookie( otherdiv ) != "done" )      // ÄíÅ°°¡ ¾ø´Ù ->Å¾¹è³Ê°¡ º¸ÀÎ´Ù. ->³ôÀÌ¸¦ ´õÇÑ´Ù.
		{
	var plustop = document.getElementById( otherdiv ).clientHeight ;
	document.getElementById( div ).style.top = top+plustop;
		}
	}

if(typeof jkMouseTracking == 'undefined') jkMouseTracking = function(){}

/******************************************************************************
 * ±¤°í Æ®·¹ÇÈ Ã¼Å©
 ******************************************************************************/
function ad_view(){
	var adStatistics = new Image();
	var url = "http://common.jknews.co.kr/ad"+arguments[0]+"/view.php";
	url=url+"?ad_id="+arguments[1]+"&n_url="+document.location.href+"&s_url="+document.referrer;
	adStatistics.src = url; 
}

function ad_click(){
	var adStatistics = new Image();
	var url = "http://common.jknews.co.kr/ad"+arguments[0]+"/click.php";
	url=url+"?ad_id="+arguments[1]+"&n_url="+document.location.href+"&s_url="+document.referrer;
	adStatistics.src = url; 
}

function ad_event_click(){
	var adStatistics = new Image();
	var url = "http://event.jknews.co.kr/click/click.php";
	url=url+"?ad_id="+arguments[0];
	adStatistics.src = url; 
}

/*****************************************************
 * °øÅë ½ºÅ©¸³Æ® * 
 *****************************************************/
var favoriteurl="http://www.jknews.co.kr/";
var favoritetitle="Àç°æ´º½º - Financial and Economic News";
function addfavorites(){
	if (document.all)window.external.AddFavorite(favoriteurl,favoritetitle);
}

function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,''); 
	obj.style.filter =
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='about:blank;';
	return '';
}
