document.write("\
<a href=\"javascript:YnaStart()\"><img src=http://img.yonhapnews.co.kr/basic/svc/06_image/msn_send_icon.jpg border=0  align=absmiddle></a>\
");

function getDzCookie(name)
{
	var cookies = document.cookie;
	var value  = "";
	if(cookies.indexOf(name) != -1) {
		var start = cookies.indexOf(name) + name.length + 1;
		var end   = cookies.indexOf(";",start);

		if(end == -1) {
			end = cookies.length;
		}

		value = cookies.substring(start,end);
		value = unescape(value);
	}

	return value;
}

var winobj;
var winModalWindow;
var AppID = "99995717";

function YnaStart() {   
	//checkCookie
//	CheckCookie();

	// Test #1: Launch with no email variable value causing the user to have to select another user to interact with.
	CheckMessenger();

	//setCookie
	SetCookieArticle();

	LaunchApp(AppID, "");

//	(new Image).src = "http://218.145.28.148/php/In_Newht.php?sitecode=1&catcode=sec_00006&artcode=sec_sec_00006&ref=www.chosun.com&cur=www.chosun.com";
}

function LaunchApp(AppID, emailID) {   
	if (winobj != null) {   
		winobj.LaunchApp(AppID, emailID);
	}
}

function CheckMessenger() {   
	eval ('try {winobj = new ActiveXObject("MSNMessenger.P4QuickLaunch"); } catch (e) {winobj = null;}');
	var strErrorPage = "http://news.chosun.com/svc/content_view/notice.html"


	/*if ([Browser is not IE]) {
		ShowWindow(strErrorPage, 410, 130);
	}
	else if (obj == null) {
		ShowWindow(strErrorPage, 410, 225);
	}

	ShowWindow(strErrorPage, 410, 225);
	*/
}

/*function CheckCookie() {   
	var cookieName = "checkCookie";

	document.cookie = cookieName + "=1;path=/"+((location.host.toLowerCase().indexOf("yonhapnews.co.kr")>=0)?";domain=yonhapnews.co.kr":"");
	var value = getDzCookie(cookieName);

	if (value == null || value == "") {
		//if (isVista())
		//	alert ("¸Þ½ÅÀúº¸³»±â ±â´ÉÀº À¥ ºê¶ó¿ìÀú¿¡¼­ 'ÄíÅ°Çã¿ë' ÈÄ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
		alert ("ÄíÅ°¼³Á¤ÀÌ ¾ÈµÇ¾î ÀÖ´Â °æ¿ì ´Ù¸¥±â»ç°¡ Àü¼ÛµÉ ¼ö ÀÖ½À´Ï´Ù. \n\nÀÎÅÍ³Ý¿É¼Ç¿¡¼­ ÄíÅ°Çã¿ëÀ» È®ÀÎÇØ ÁÖ¼¼¿ä.");
	}
	
	document.cookie = cookieName + "=;path=/;expires=Fri, 31 Dec 1900 23:59:59 GMT"+((location.host.toLowerCase().indexOf("yonhapnews.co.kr")>=0)?";domain=yonhapnews.co.kr":"");
}
*/
function IgnoreEvents(e) {
	return false;
}

//Display error message if the MSN Messenger client 6.2 is not installed or the browser is not Internet Explorer
function ShowWindow(strError, width, height) {
	if (window.showModalDialog) {

		window.showModalDialog(strError,null, "dialogWidth="+width+"px;dialogHeight="+height+"px;help=no;dialogLeft=160");
	}
	else {
		var ah = screen.availHeight;

		var y = (ah - height) / 2;

		window.top.captureEvents (Event.CLICK|Event.FOCUS)
		window.top.onfocus=HandleFocus
		winModalWindow = window.open (strError,"ModalChild", "dependent=yes,width="+width+",height="+height+",top="+y+",left=160,screenX=160,screenY="+y)
		winModalWindow.focus()
	}
}

function HandleFocus() {
	if (winModalWindow) {
		if (!winModalWindow.closed) {
			winModalWindow.focus()
		}
		else {
			window.top.releaseEvents (Event.CLICK|Event.FOCUS)
		}
	}
	return false
}

function SetCookieArticle(){

	var sValue = location.href;

	var sExpires = new Date();
	sExpires.setDate(sExpires.getDate()+1);
	sExpires.setHours(0,0,0,0);

	document.cookie="cid="+escape(sValue)+";expires="+(sExpires.toGMTString())+";path=/"+((location.host.toLowerCase().indexOf("yonhapnews.co.kr")>=0)?";domain=yonhapnews.co.kr":"");
}

//ºñ½ºÅ¸ Ã¼Å© ÀÚ¹Ù½ºÅ©¸³Æ® ºñ½ºÅ¸ÀÎ°æ¿ì true ¸®ÅÏ 
function isVista() { 
	var re = new RegExp("Windows NT ([0-9]).([0-9])" ,"g"); 
	var m = re.exec(navigator.userAgent); 
	return (m[1] >= 6); 
} 

//¸Þ½ÅÀúº¸³»±â ¹öÆ° ·Ñ¿À¹ö, ·Ñ¾Æ¿ô

var TimeOut         = 300;
var currentLayer    = null;
var currentitem     = null;

var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

// Open Hidden Layer
function mopen(n)
{
    var l  = document.getElementById("msn_event");
    var mm = document.getElementById("contentButtonArea");
    
    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; 


