checkBrowserWidth();

attachEventListener(window, "resize", checkBrowserWidth, false);

document.body.onresize = checkBrowserWidth();

function checkBrowserWidth()
{
	var theWidth = getBrowserWidth();
	var theHeight = getBrowserHeight();
	/*
	alert(theHeight);
	*/
		if (theHeight > 770)
		{	
			var headID = document.getElementsByTagName("head")[0];         
			var cssNode = document.createElement('link');
			cssNode.type = 'text/css';
			cssNode.rel = 'stylesheet';
			cssNode.href = 'css/more1024.css';
			cssNode.media = 'screen';
			headID.appendChild(cssNode);
		}

		else
		{
			var headID = document.getElementsByTagName("head")[0];         
			var cssNode = document.createElement('link');
			cssNode.type = 'text/css';
			cssNode.rel = 'stylesheet';
			cssNode.href = 'css/less1024.css';
			cssNode.media = 'screen';
			headID.appendChild(cssNode);	
		}

		return true;
	};


function getBrowserWidth()
{
	if (window.innerWidth)
	{
		return window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth != 0)
	{
		return document.documentElement.clientWidth;
	}
	else if (document.body)
	{
		return document.body.clientWidth;
	}
	
	return 0;
};

function getBrowserHeight()
{
	if (window.innerHeight)
	{
		return window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight != 0)
	{
		return document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		return document.body.clientHeight;
	}
	
	return 0;
};
