// JavaScript Document
var hash;
var currentPage;
var centralPromoSize;
var specsheetSize;

function pageLoaded(centralSize, specSize, miniPromosFiles1, miniPromoFiles2)
{
	centralPromoSize	= centralSize;
	specsheetSize			= specSize;
	initMiniPromosObjects(miniPromosFiles1, miniPromoFiles2);


  var fl = document.getElementById('SplashFlash'); 

	hash 		= window.location.hash;
	switch(hash)
	{
		case '#signup':
			openRegistration();
		break;
		
		case '#specs':
			openSpecs();
		break;
		
		case '#contact':
				openContact();
			break;	
	
		default:
			openPromo();
	}	
	setInterval(hashWatcher, 400);
}

function hashWatcher()
{
	if (window.location.hash != hash)
	{
		hash = window.location.hash;
	
		switch(hash)
		{
			case '#signup':
				openRegistration();
			break;
			
			case '#specs':
				openSpecs();
			break;
			
			case '#contact':
				openContact();
			break;
			
			default:
				openPromo();
		}
	}
}

function openRegistration()
{
	removeCurrentPage();
	var div			= document.getElementById('centerDiv'); 
	
	var newPage = currentPage = document.createElement('div');
		newPage.setAttribute('id', 'registrationPanel');
	div.appendChild(newPage);
	currentPage = swfobject.embedSWF("splash/Registration.swf", "registrationPanel", "900", "490", "9.0.45", "splash/scripts/expressInstall.swf", false, {wmode:'transparent'}, {id:'currentPage'});
	// HOLIDAY CHANGE - ADDED TRANSPARENT BG AND MADE IT #FFFFFF
	//currentPage = swfobject.embedSWF("splash/Registration.swf", "registrationPanel", "900", "490", "9.0.45", "splash/scripts/expressInstall.swf", false, {bgcolor: '#ffffff'}, {id:'currentPage'});
	window.location.hash = hash = '#signup';
}

function openContact()
{
	removeCurrentPage();
	var div			= document.getElementById('centerDiv'); 
	
	var newPage = currentPage = document.createElement('div');
		newPage.setAttribute('id', 'contactPanel');
	div.appendChild(newPage);
	currentPage = swfobject.embedSWF("splash/Contact.swf", "contactPanel", "900", "490", "9.0.45", "splash/scripts/expressInstall.swf", false, {wmode:'transparent'}, {id:'currentPage'});
	window.location.hash = hash = '#contact';
}

function openSpecs()
{
	removeCurrentPage();
	var div			= document.getElementById('centerDiv'); 
	var imgElement	= currentPage = document.createElement('img');
		imgElement.setAttribute('src', 'splash/images/specs.png');
		imgElement.setAttribute('id', 'currentPage');
		imgElement.style.width = specsheetSize[0]+'px';
		imgElement.style.height = specsheetSize[1]+'px';
	div.appendChild(imgElement);
	window.location.hash = hash = '#specs';
}

function openPromo()
{
	removeCurrentPage();
	var div			= document.getElementById('centerDiv'); 
	
	var imgElement	= currentPage = document.createElement('img');
		imgElement.setAttribute('src', 'splash/images/promo.png');
		imgElement.style.width = centralPromoSize[0]+'px';
		imgElement.style.height = centralPromoSize[1]+'px';
		imgElement.setAttribute('usemap', '#Map', 0);
		imgElement.setAttribute('id', 'currentPage');

	div.appendChild(imgElement);
	if(hash.substring(1))
	{
		if(hash.substring(1) != 'promo')
		{
			window.location.hash = hash = '#';
		}
	}
}

function removeCurrentPage()
{
	var currentPage = document.getElementById('currentPage');	
	if(currentPage)
	{
		var div	= document.getElementById('centerDiv');
			div.removeChild(currentPage);
	}
}
