function spScreen()
{
	this.height = screen.height;
	this.width = screen.width;
	this.aheight = screen.availHeight;
	this.awidth = screen.availWidth;

	this.Orientation = function()
	{	
	if ( this.width == this.height )
		{
			this.orientation = "square";
		}
		else if ( this.width > this.height )
			{
				this.orientation = "landscape";
			}
			else
			{
				this.orientation = "portrait";
			}
	}

	this.Display = function()
	{
		alert("Orientation " + this.orientation + " width " + this.width + " height " + this.height);
		alert("Available width " + this.awidth + " height " + this.aheight);
	}

	this.SetDisplay = function()
	{
		switch ( this.orientation )
		{
			case "landscape" : landscape.style.display = "inline";
						 portrait.style.display = "none";
						 square.style.display = "none";						
						 break;
			case "portrait" :  portrait.style.display = "inline";
						 landscape.style.display = "none";
						 square.style.display = "none";						
						 break;
			case "square" :    square.style.display = "inline";
						 portrait.style.display = "none";
						 landscape.style.display = "none";						
						 break;

		}

	}

	this.SetBrowser = function()
	{
		switch ( this.orientation )
		{
			case "landscape" : window.location.href = "landscape/index.htm";
					break;
			case "portrait" : window.location.href = "portrait/index.htm";
					break;

		}
	}

}

function spBrowser()
{
	var mobile = /mobile/i;
	var firefox = /firefox/i;
	var chrome = /chrome/i;

	this.browser = "";
	this.codeName = navigator.appCodeName;
	this.appName = navigator.appName;
	this.appVersion = navigator.appVersion;
	this.cookiesEnabled = navigator.cookieEnabled;
	this.platform = navigator.platform;
	this.userAgent = navigator.userAgent;

	this.browser = "Browser CodeName: " + this.codeName;
	this.browser+= " Browser Name: " + this.appName;
	this.browser+= " Browser Version: " + this.appVersion;
	this.browser+= " Cookies Enabled: " + this.cookiesEnabled;
	this.browser+= " Platform: " + this.platform;
	this.browser+= " User-agent: " + this.userAgent;

	this.GetType = function()
	{
		this.type = "notie";
		var strUserAgent = ( new String(this.userAgent)).toLowerCase();

		var pos = strUserAgent.search(mobile);

		if ( pos > 0 )
		{
			this.type = "mobile";
		}

		var pos = strUserAgent.search(firefox);

		if ( pos > 0 )
		{
			this.type = "firefox";
		}

		var pos = strUserAgent.search(chrome);

		if ( pos > 0 )
		{
			this.type = "chrome";
		}

		if ( this.appName == "Microsoft Internet Explorer" )
		{
			this.type = "ie";
		}
	}

	this.Display = function()
	{
		alert(this.browser);
		alert("Type " + this.type);
	}

	this.SetBrowser = function()
	{
		switch ( this.type )
		{
			case "mobile" : window.location.href = "mobile/index.htm";
					break;

		}
	}

}

