function openPopUp(pageUrl)
{
	newwin = window.open(pageUrl,"terms","width=405,height=400,scrollbars=yes");
	newwin.focus();
}

function navOver(imgName)
{
	var theImage = document.getElementById(imgName);
	
	if(theImage.src.indexOf("_off.gif") != -1)
	{
		theImage.src = theImage.src.replace("_off.gif","_over.gif");
	}
	
	else
	{
		theImage.src = theImage.src.replace("_over.gif","_off.gif");
	}
}

function getWindowWidth() 
{
	var windowWidth = 0;
	
	if (typeof(window.innerWidth) == 'number') 
	{		
		windowWidth = window.innerWidth;				
		
		theDiv = document.getElementById("mainContainer");
		theWidth = theDiv.offsetLeft * 2 + theDiv.offsetWidth;

		if(window.innerWidth > theWidth)
		{
		  windowWidth = theWidth;
		}  
	}
	else 
	{
		if (document.documentElement && document.documentElement.clientWidth) 
		{		
			windowWidth = document.documentElement.clientWidth;
		}
		
		else 
		{
			if (document.body && document.body.clientWidth) 
			{
				windowWidth = document.body.clientWidth;
			}
		}
	}
	
	return windowWidth;
}


function displayMenu(menuId)
{
	document.getElementById(menuId).style.visibility = "visible";
}

function hideMenu(menuId)
{
	document.getElementById(menuId).style.visibility = "hidden";
}

function positionMenus()
{		
	// var browserHeight = (navigator.appName.indexOf("Microsoft")!=-1) ? document.body.clientHeight : window.innerHeight;
 	// var browserWidth = (navigator.appName.indexOf("Microsoft")!=-1) ? document.body.clientWidth : window.innerWidth;
	
	var windowWidth = getWindowWidth();
	navLeft = (windowWidth - 926) / 2;	
	
	if (navigator.appName.indexOf('Netscape') != -1)
	{
	// 	document.getElementById("module_difference").style.left = (navLeft + 278) + "px";
// 		document.getElementById("module_whatsInside").style.left = (navLeft + 279) + "px";		
		// document.getElementById("module_whatsImportant").style.left = (navLeft + 279) + "px";				
	}
	else
	{
		if(navigator.userAgent.indexOf('MSIE 6') != -1)		
		{
			document.getElementById("module_difference").style.left = (navLeft + 278) + "px";
			document.getElementById("module_whatsInside").style.left = (navLeft + 279) + "px";		
			document.getElementById("module_whatsImportant").style.left = (navLeft + 279) + "px";						
		}
		else
		{
			document.getElementById("module_difference").style.left = (navLeft + 276) + "px";
			document.getElementById("module_whatsInside").style.left = (navLeft + 277) + "px";
			document.getElementById("module_whatsImportant").style.left = (navLeft + 277) + "px";
		}
	}	
}

function validateForm(theForm)
{
	
	valid = true;
	message = "Please enter the following sections before proceeding:\n\n";
	
	if(theForm.elements["name"].value == "")
	{
		message += "Your name\n";
		valid = false;
	}

	if(theForm.elements["company"].value == "")
	{
		message += "Your company\n";
		valid = false
	}

	if(theForm.elements["number"].value == "")
	{
		message += "Your phone number\n";
		valid = false
	}
	
	if(theForm.elements["email"].value == "")
	{
		message += "Your email address\n";
		valid = false
	}	
		
	if(theForm.elements["email"].value != "")	
	{	
		var supEmail = theForm.elements["email"].value;
		var emLen = supEmail.length;
		var posAt = supEmail.indexOf('@')
		var posDot = supEmail.lastIndexOf('.')
		if((emLen < 7) || (posAt < 1) || (posDot <= (posAt + 1)) || (posDot >= (emLen - 1)))
		{
			message += "Valid email address\n";
			valid = false;
		}
	}	
	
	if(valid)
	{			
		return true;
	}
	else
	{		
		alert(message);
		return false;
	}		
}

function changeBorder(id)
{		
	document.getElementById(id).style.borderColor = "#000000";											
}
function resetBorder(id)
{		
	document.getElementById(id).style.borderColor = "#999999";									
}	

	

