/**
* Assign the view handler
*/

viewHandler = Home;

/**
* Creates a new object with methods used by the Home page
*
* @author				Matt Gifford
* @copyright			2008 Timeshifting Interactive Limited
*/
function Home()
	{
	// Step 1. Define Properties

	var _instance = this;



	// Step 2. Define Public Methods

	/**
	* Sets up the initial page state and event handlers
	*/
	this.init = function()
		{
		// Call generic page init method
		this.base.init.call(this);

		// Preload the reseller bg
		this.resellerBg = new Image();
		this.resellerBg.src = 'images/global-header-reseller-active-bg.png';

		// Add event handlers
		document.getElementById('screenshot1box').onmouseover = function() { this.parentNode.className = 'hover'; }
		document.getElementById('screenshot1box').onmouseout = function() { this.parentNode.className = ''; }
		document.getElementById('screenshot2box').onmouseover = function() { this.parentNode.className = 'hover'; }
		document.getElementById('screenshot2box').onmouseout = function() { this.parentNode.className = ''; }
		}


	/**
	* Displays the screenshot popup
	*
	* @param		id		The id of the popup to display
	*/
	this.openPopup = function(id)
		{
		this.closePopup();

		// Display the popup
		this.updateOverlay();
		document.getElementById('popup' + id).className = '';
		}


	/**
	* Hides the screenshot popup
	*/
	this.closePopup = function()
		{
		// Hide the popup and background
		document.getElementById('popupBackground').className = 'invisible';
		document.getElementById('popupBackground').style.height = '1px';
		document.getElementById('popup1').className = 'invisible';		
		document.getElementById('popup2').className = 'invisible';
		}


	/**
	* Updates the display of the background overlay
	*/
	this.updateOverlay = function()
		{
		var overlay = document.getElementById('popupBackground');
		overlay.style.position = 'absolute';
		overlay.style.left = '0px';
		overlay.style.top = '0px';
		overlay.style.background = '#000';
		overlay.style.opacity = 0.6;
		overlay.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=60)';
		overlay.style.width = document.body.offsetWidth + 'px';
		overlay.style.height = (document.body.offsetHeight+20 < document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight+20) + 'px';
		overlay.className = '';
		}
	}
