// JavaScript Document
var objMessengerActiveP4;
function CheckMessenger(){
	this.gid=function(i){return document.getElementById(i);};
	try
	{
		objMessengerActiveP4 = new ActiveXObject("MSNMessenger.P4QuickLaunch");
	}
	catch(e)
	{
		objMessengerActiveP4 = null;
		alert("You need Windows Live Messenger to use this feature");
		// Do other stuff. For eg: You can convey the message to the user that Windows Live Messenger is needed
	}
}

function DeleteComment(strUrlComment)
{
	var urlThis=strUrlComment;
	urlThis=urlThis.indexOf('#',0)<0?urlThis:urlThis.substr(0,urlThis.indexOf('#',0));
	urlThis=urlThis.indexOf('?',0)<0?urlThis:urlThis.substr(0,urlThis.indexOf('?',0));
	return urlThis;
}
function SetCookie(strCookieName,strCookieValue,strExpireDate)
{
	var strExpires;
	if(strExpireDate=="session"){
		strExpires="";
	}
	else{
		if(strExpireDate)
			strExpires=";expires="+strExpireDate;
		else
			strExpires=";expires="+(new Date( (new Date()).getTime() + 1000 * 60 * 60 * 24 )).toGMTString();//new Date(2021,10,4).toGMTString();
	}
	document.cookie=strCookieName+"="+escape(strCookieValue)+strExpires+";path=/";
}

function ReadCookie(strCookieName){
	var anyCookies=document.cookie;
	var pos=anyCookies.indexOf(strCookieName+"=");
	var value="";
	if(pos!=-1){
		var start=pos+strCookieName.length+1;
		var end=anyCookies.indexOf(";",start);
		if(end==-1){
			end=anyCookies.length;
		}
		value=anyCookies.substring(start,end);value=unescape(value);
	}
	return value;
}

/**
 *  To be used by StripitDownload.as for sharing strip-it
 **/
function IMThis(pID)
{
//	alert('IMThis ' + pID);
	SetCookie('UrlThis','http://discover.windowslive.com/th-th/messenger/messengeris10/#/gallery/?siid=' + pID);
	SetCookie('TitleThis',document.title);
	CheckMessenger();
	if( objMessengerActiveP4 != null) objMessengerActiveP4.LaunchApp('99996245', ''); // replace 7 with application ID
}