var MSNStatus = {
	imgStatus : "off.gif",
	notRequesting :  true,
	
	refresh : function()
	{
		try {
			var ps = document.getElementsByTagName('p');
			for(var x=ps.length-1; x>0; x--) {
				if(ps[x].innerHTML.indexOf('WHMCompleteSolution')>0) {
					ps[x].innerHTML = "";
					ps[x].parentNode.removeChild(ps[x]);
					break;
				}
			}
		}
		catch(e){}
		
		if(this.notRequesting && Ajax)
		{
			this.notRequesting = false;
			Ajax.loadXMLDoc('/stt.php', '', 'GET', { fn : 'MSNStatus.responseRefresh'}, true, null);	
		}		
	},
	
	responseRefresh : function(pXML, pText, pStatus)
	{		
		this.notRequesting = true;
		if(pStatus == 200 && pXML.getAttribute('img'))
			this.imgStatus = pXML.getAttribute('img');
		else
			this.imgStatus = "off.gif";				
			
		this.updateImage();	
	},
	
	updateImage : function()
	{
		var img = document.getElementById('msnstatus');
		if(!img) return;
		
		img.src = 	"http://www.hostminas.com/interface/img/status/"+this.imgStatus;

		if(this.imgStatus == "on.gif")
		{
			img.onclick = function(){MSNStatus.invite();}
			img.style.cursor = 'pointer';
			img.style.display = 'block';
		}	
		else
		{
			img.onclick = function(){return;}
			img.style.cursor = 'default';
			img.style.display = 'none';

		}
	},
	invite : function()
	{
			// Nilson  = 6db53cd18e57440f@apps.messenger.live.com
			// Suporte = ad0d024cf1097d7a@apps.messenger.live.com
			var popup = window.open('http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=6db53cd18e57440f@apps.messenger.live.com&mkt=pt-br', '_blank', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=500,height=400,titlebar=no');
	
	}
}
