/* OPEN A NEW ACCOUNT */

function validateAccount()

{

var checkbox_choices = 0;
for (counter = 0; counter < document.NewAccount.checkbox.length; counter++)
{
	if (document.NewAccount.checkbox[counter].checked)
	{ checkbox_choices = checkbox_choices + 1; }
}

var Name = document.NewAccount.name.value
var CompName = document.NewAccount.compname.value
var Address = document.NewAccount.address.value
var Email = document.NewAccount.email.value
var Phone = document.NewAccount.phone.value
var ContactMethod = document.NewAccount.contactmethod.value
var ContactTime = document.NewAccount.contacttime.value
var Spend = document.NewAccount.spend.value
var Checkbox = document.NewAccount.checkbox.value

//This section validates the user input
	
	if (Name == "")
	{ 
		alert("Please enter your full name.");
		document.NewAccount.name.focus();
		return false;
	}

	else if (CompName == "")
	{ 
		alert("Please enter your company's name.");
		document.NewAccount.compname.focus();
		return false;
	}
	
	else if (Address == "")
	{ 
		alert("Please enter your location.");
		document.NewAccount.address.focus();
		return false;
	}
	
	else if (Email.indexOf("@")==-1 || Email.indexOf(".")==-1 || Email.indexOf(" ")!=-1 || Email.length<6)
	{
		alert("Please enter a valid email address.");
		document.NewAccount.email.focus()
		return false;
	}
	
	else if (Phone == "")
	{ 
		alert("Please enter your phone number.");
		document.NewAccount.phone.focus();
		return false;
	}
	
	else if (ContactMethod == "Please Select")
	{ 
		alert("Please enter your preferred contact method.");
		document.NewAccount.contactmethod.focus();
		return false;
	}
	
	else if (ContactTime == "")
	{ 
		alert("Please enter your preferred contact time.");
		document.NewAccount.contacttime.focus();
		return false;
	}
	
	else if (Spend == "")
	{ 
		alert("Please enter your average spend.");
		document.NewAccount.spend.focus();
		return false;
	}
	
	else if (checkbox_choices == 0 )
	{
		alert("Please select your interests.")
		return (false);
	}
	
	else
	{
		return true;
	}
}



/* NEWSLETTER SIGNUP */

/* Clears the newsletter signup box on focus and repopulates with default values if left blank */

function init(){
var inp=document.getElementsByTagName('input');
for(var i=0;i<inp.length;i++){
if(inp[i].type=='text' && inp[i].className.indexOf('check') > -1){
//if(inp[i].type=='text'){
inp[i].setAttribute('rel',inp[i].defaultValue)
inp[i].onfocus=function(){
if(this.value==this.getAttribute('rel')){this.value='';}
else{return false;}}
inp[i].onblur=function(){
if(this.value==''){this.value=this.getAttribute('rel');}
else{return false;}}
inp[i].ondblclick=function(){this.value=this.getAttribute('rel')}
}}}
if(document.childNodes){window.onload=init}


var BrowserName = self.navigator.appName; 
var BrowserVer = parseInt(self.navigator.appVersion,10); 
var BrowserOK = false;
if(BrowserName == "Netscape") {
if (BrowserVer >= 3.0)  BrowserOK=true;
}
else if (BrowserName == "Microsoft Internet Explorer") {
        if (BrowserVer>=3.0) BrowserOK=true;

}

function validateNewsletter()
{
var Name = document.newsletter.name.value
var Email = document.newsletter.email.value

//This section validates the user input

	if (Name == "" || Name == " Name")
	{ 
		alert("Please enter your name.");
		document.newsletter.name.focus();
		return false;
	}
		
	else if (Email.indexOf("@")==-1 || Email.indexOf(".")==-1 || Email.indexOf(" ")!=-1 || Email.length<6)
	{
		alert("You have either failed to enter or typed an invalid email adress, please check and try again.");
		document.newsletter.email.focus()
		return false;
	}

	else
	{
		return true;
	}
}



function validateNewsletterLHOTW()
{
var Name = document.newsletterlhotw.name.value
var Email = document.newsletterlhotw.email.value

//This section validates the user input

	if (Name == "" || Name == " Name")
	{ 
		alert("Please enter your name.");
		document.newsletterlhotw.name.focus();
		return false;
	}
		
	else if (Email.indexOf("@")==-1 || Email.indexOf(".")==-1 || Email.indexOf(" ")!=-1 || Email.length<6)
	{
		alert("You have either failed to enter or typed an invalid email adress, please check and try again.");
		document.newsletterlhotw.email.focus()
		return false;
	}

	else
	{
		return true;
	}
}