function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function setupXmlHttp(url)
{
	xmlHttp=GetXmlHttpObject();
	url = url.replace(location.protocol+"//"+location.host+"/",'');
	url = location.protocol+"//"+location.host+"/"+url;
	return url;
}


function sendXmlHttp(url)
{
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//url is the url called for the dynamic html
//id is the id in which the html will be placed
function getHTML(url)
{
	url = setupXmlHttp(url);
	setXmlOnReady(url, onHTMLResponse);
	sendXmlHttp(url);
}

function setXmlOnReady(url, onResponse)
{
	xmlHttp.onreadystatechange=function()
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			onHTMLResponse(xmlHttp.responseText);
		} 
	};
}

//url is the url called for the dynamic html
//id is the id in which the html will be placed
function send_screen(url)
{
	url = setupXmlHttp(url+"screen/"+screen.width+"/"+screen.height);
	sendXmlHttp(url);
	return false;
}

function send_mobscreen(url)
{
	url = setupXmlHttp(url+"screen/"+screen.height+"/"+screen.height);
	sendXmlHttp(url);
	return false;
}

var aHAtt = 'aH';
var aWAtt = 'aW';

//stores the actual height as a property
function actualHeight(item, output)
{
	//defined actual height of before resize
	if(item.attr(aHAtt) == undefined)
	{
		item.attr(aHAtt, item.height());
	}
		
	//set default actual height
	item.height(item.attr(aHAtt)*1);
	
	return item.attr(aHAtt)*1;
}

//stores the actual width as a property
function actualWidth(item)
{
	//defined actual height of before resize
	if(item.attr(aWAtt) == undefined)
	{
		item.attr(aWAtt, item.width());
	}
		
	//set default actual height
	item.width(item.attr(aWAtt)*1);
	
	return item.attr(aWAtt)*1;
}

var showdebug = false;
function debug(str)
{
	if(showdebug)
	{
		document.title = str;
	}
}
