//check distributor form
function disCheck()
{
    if(!document.form.CONTACT.value)
    {
        alert("Please enter a contact name.");
        return false;
    }
    
    if(!document.form.COMPANY.value)
    {
        alert("Please enter a company name.");
        return false;
    }
    
    if (!isValidEmail(document.form.EMAIL.value))
    {
		alert("You did not enter a valid email address."); 
		return false;
	}
}

//check registration form
function regCheck()
{
    if(!document.form.PersonForename.value)
    {
        alert("Please enter your forename.");
        return false;
    }
    if(!document.form.PersonSurname.value)
    {
        alert("Please enter your surname.");
        return false;
    }
    if(!document.form.AddressNumber.value)
    {
        alert("Please enter your house name / number");
        return false;
    }
    if(!document.form.AddressStreet.value)
    {
        alert("Please enter your street name");
        return false;
    }
    if(!document.form.AddressArea.value)
    {
        alert("Please enter an area name");
        return false;
    }
    if(!document.form.AddressTown.value)
    {
        alert("Please enter a town name");
        return false;
    }
    if(!document.form.AddressCounty.value)
    {
        alert("Please enter a county name");
        return false;
    }
    if(!document.form.AddressPostcode.value)
    {
        alert("Please enter a postcode");
        return false;
    }
    
    if (!isValidEmail(document.form.EmailAddress.value))
    {
		alert("You did not enter a valid email address."); 
		return false;
	}
    if(!document.form.TelephoneNumber.value)
    {
        alert("Please enter your telephone contact number");
        return false;
    }
    if(!document.form.FaxNumber.value)
    {
        alert("Please enter your fax number");
        return false;
    }
    
    if (!isValidEmail(document.form.CONT_EMAIL.value))
    {
		alert("You did not enter a valid email address."); 
		return false;
	}
}

//candidate form checking
function formCheck()
{			
		if (!document.form.NAME.value)
		{
			alert("You did not enter a name."); 
			return false;		
		}
		
		if (!document.form.PHONE.value && !document.form.MOBILE.value)
		{
			alert("You must enter at least one contact number."); 
			return false;		
		}
		
		if (!isValidEmail(document.form.EMAIL.value))
		{
			alert("You did not enter a valid email address."); 
			return false;
		}					
		
	return true;
}
function checkMail()
{				
		if (!isValidEmail(document.maillist.email_add.value))
		{
			alert("You must enter a valid email address."); 
			return false;
		}		
		
	return true;
}

//Checks for a valid email address
function isValidEmail(str)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return true;
	}else{
		return false;
	}
}

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth = 400;
defaultHeight = 400;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popimage(imageURL,imageTitle,imageCaption){
if(typeof(imageCaption)=="undefined") imageCaption = ''; 
if (isIE){imgWin=window.open('about:blank','',optIE);}
else{imgWin=window.open('about:blank','',optNN);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToimage(){');
writeln('if (isIE){');
writeln('window.resizeTo(100,100);');
//writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('width=400;');
writeln('height='+(imageCaption!='' ? '150' : '100')+'-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');
//writeln('if (isNN){');
writeln('else{');
writeln('window.innerWidth=document.images["George"].width;');
writeln('window.innerHeight=document.images["George"].height'+(imageCaption!='' ? ' + 50' : '')+';}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor="#ffffff" text="#000000" scroll="no" onload="reSizeToimage();doTitle();self.focus()">')
else writeln('</head><body bgcolor="#ffffff" text="#000000" scroll="no" onload="reSizeToimage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block">');
if(imageCaption!='') writeln('<div align="center" style="margin-top:10px;font-family:sans-serif;font-size:10pt;">' + imageCaption + '</div>');
writeln('</body></html>');
close();
}}