/*************************************************************************
  This code is from Dynamic Web Coding at dyn-web.com
  Copyright 2003-5 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready) return;
  Tooltip.show(e, msg);
}

function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.hide();
}
	
// variables for tooltip content 
var yourComputer = '<b>Your Computer</b>Compatible with both Macs and PCs, TotoExpress allows you to easily send and receieve large files online from your clients.  You can access your account 24/7 from any computer with Internet Access.  It couldn\'t be any easier.'
var upload = '<b>Uploading</b>TotoExpress ensures the integrity of all file uploads and also provides the ability to resume any file transfers that are interrupted (saving you time and bandwidth usage).'
var servers = '<b>Servers</b>Your files are stored on our secure servers located in a state-of-the-art datacenter. Our system performs real-time duplication of your files to redundant servers and provides daily backups for additional protection. Relax, your data is safe with TotoExpress.'
var download = '<b>Downloads</b>Our network infrastructure has been designed to ensure you and your clients receive the absolute fastest uploads and downloads possible.'
var clientComputer = '<b>Clients\' Computer</b>TotoExpress will automatically notify your clients of new files posted to your account via e-mail and provides them with an easy-to-use interface for quickly downloading the files they are looking for.'
var diskspace = '<b>Diskspace</b>Diskspace refers to the amount of harddrive space that your account consumes on the TotoExpress servers.  Additional Diskspace may be purchased if required.'
var bandwitdh = '<b>Bandwidth</b>Bandwidth refers to the total amount of data that is transferred to and from your TotoExpress Account.'

function openTerms() {
	window.open("/terms.html", "terms", "width=770,height=550,resizable=no,directories=no,location=no,menubar=no,scrollbars=yes,status=no");
}

function openDemoTerms() {
	window.open("/demoTerms.html", "terms", "width=770,height=550,resizable=no,directories=no,location=no,menubar=no,scrollbars=yes,status=no");
}

function PopupPic(sPicURL) {
     window.open( "bigImage.php?"+sPicURL, "", "width=300,height=400,resizable=no,directories=no,location=no,menubar=no,scrollbars=no,status=no");
   }

/* Free Trial Page JS */

function hideFormButtons()
{	
	var formButtonArea;
	var formPleaseWaitArea;
	if (formButtonArea = document.getElementById('formSubmitButtons'))	
	{
		formButtonArea.style.display='none';
	}
	if (formPleaseWaitArea = document.getElementById('formPleaseWaitArea'))	
	{
		formPleaseWaitArea.style.display='block';
	}
	
}
function showFormButtons()
{
	var formButtonArea;
	var formPleaseWaitArea;
	if (formButtonArea = document.getElementById('formSubmitButtons'))
	{
		formButtonArea.style.display='block';
	}
	if (formPleaseWaitArea = document.getElementById('formPleaseWaitArea'))
	{
		formPleaseWaitArea.style.display='none';
	}
		
}
function checkIfEmailUsed(nameToCheck)
{
	if (!nameToCheck)
	{
		alert('You must enter an Email Address');
		return false;
	}
	else if (document.getElementById('agreement').checked == false)
	{
		alert('You must agree to the terms of service before continuing');
		return false;
	}
	hideFormButtons();
	var xmlhttp=false;
	var checkResponse = 0;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  xmlhttp = new XMLHttpRequest();
	}
	
	if (xmlhttp)
	{
		xmlhttp.open("GET","/checkDemoEmail.php?email="+encodeURIComponent(nameToCheck),true);
        xmlhttp.onreadystatechange = function()
        {
			if (xmlhttp.readyState == 4)
	        {			
	        	checkResponse = new String(xmlhttp.responseText);	
				if (checkResponse.match(/^2/))
				{
					document.subscribe.submit();
				}
				else if (checkResponse.match(/^3/))
				{
					alert("Sorry, that e-mail address is either invalid or has previously been used for another trial account.  Please enter another address.");
					showFormButtons();
				}
				else
				{
					alert("Sorry, an error was encountered.  Please try again.");
					showFormButtons();
				} 
	        }
        }
		xmlhttp.send(null);
	}
	return false;
}


function ieTables() {
	if (!document.getElementsByTagName) return;
	var rows = document.getElementsByTagName("tr");
	
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
	
		row.onmouseover = function() { this.className = 'over' };
		row.onmouseout = function() { this.className = '' };
	}
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		anchor.onfocus = function() { this.blur(); }
		if (anchor.getAttribute("href") &&
			anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}