
	// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
	<!--
	function showAnswer(whatForm){
	if(document.forms[whatForm].question.value=="none"){
	document.forms[whatForm].answer.value="^ Please select a question above ^"
	}else{
	document.forms[whatForm].answer.value=document.forms[whatForm].question.value
	}}
	// -->

	
//POPUP WINDOW
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height, scroll, resize)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable='+resize+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
//POPUP WINDOW


//CONTACT FORM VALIDATION 
//alert ("went in to validation");
var validate;

function validate(obj)
{
	//define objects to validate
	var allElements = obj.elements;
	var coCount = 0;
	var errors = "";

	for( i=0 ; i<allElements.length; i++)
	{

		//CHECK FIRSTNAME NOT EMPTY
		if (allElements[i].name == "username")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your Username is a mandatory field, please enter\n"; document.form1.username.focus();}	
		}		
		
		//CHECK LASTNAME NOT EMPTY
		if (allElements[i].name == "password")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your Password is a mandatory field, please enter\n"; document.form1.password.focus();}	
		}		
	
		//CHECK FIRSTNAME NOT EMPTY
		if (allElements[i].name == "firstname")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your first name is a mandatory field, please enter\n"; document.form1.firstname.focus();}	
		}
		
		
		//CHECK LASTNAME NOT EMPTY
		if (allElements[i].name == "lastname")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your surname is a mandatory field, please enter\n"; document.form1.lastname.focus();}	
		}		
		
		//CHECK EMAIL ADDRESS NOT EMPTY AND VALID
		if (allElements[i].type == "text" && allElements[i].name == "email")
		{
			var oEmail = allElements[i].value;
			var chkDot = true;
			var result = false;
			var ndxAt = ndxDot =  0;
			var ndxAt = ndxDot =  0;

			if (oEmail.length <= 0 )
			{
				errors += "-> Your Email is a mandatory field, please enter your email\n"; document.form1.email.focus();
			}
			else //not empty start email address validation
			{
				ndxAt  = oEmail.indexOf("@");
				ndxDot = oEmail.indexOf(".");
				ndxDot2 = oEmail.lastIndexOf(".");
									
				var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
				
			        if (oEmail.match(illegalChars)) { 
			                errors += "Your email contains illegal characters\n";
			        }
				else if ( (ndxDot < 0) ) //check for a '.' sign
				{
					errors += "->Your email lacks '.'\n\tThe format is 'you@domain.com'";
				}
				else if ( (ndxAt < 0) ) //check for an '@' sign
				{
					errors += "->Your email lacks an '@'\n\tThe format is 'you@domain.com'";
				}
				else if (ndxDot2 - 3 <= ndxAt)
				{
					errors += "->You may be missing Your email's domain name\n\tThe format is 'you@domain.com'";
				}
			}	
		}
		
		//CHECK LASTNAME NOT EMPTY
		if (allElements[i].name == "companyname")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your company name is a mandatory field, please enter\n"; document.form1.companyname.focus();}	
		}		
		
		//CHECK CONTACT DIAL CODE NUMBER NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "itec")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> International code is a mandatory field, please enter\n"; document.form1.itec.focus();}
		}
		
		//CHECK CONTACT DIAL CODE NUMBER NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "ctec")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Local dialing code is a mandatory field, please enter\n"; document.form1.ctec.focus();}			
		}		
		
		//CHECK CONTACT NUMBER1 NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "ctel")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Contact number is a mandatory field, please enter\n"; document.form1.ctel.focus();}			
		}
		
		
		//CHECK CardNo NOT EMPTY
		if (allElements[i].name == "cardnumber")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Card Number is a mandatory field, please enter\n"; document.form1.cardnumber.focus();}			
		}
		
		//CHECK cardname NOT EMPTY
		if (allElements[i].name == "cardname")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Card Holder's Name is a mandatory field, please enter\n"; document.form1.cardname.focus();}			
		}
		
		//CHECK CVV NOT EMPTY
		if (allElements[i].name == "CVV")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> CVV Number is a mandatory field, please enter\n"; document.form1.CVV.focus();}			
		}
				
		//CHECK COMMMENTS NOT EMPTY
		else if (allElements[i].type=="textarea" && allElements[i].name == "comments")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Comments is a mandatory field, please enter your comment\n"; document.form1.comments.focus();}			
		}
		
		//CHECK EMAILCODE NOT EMPTY
		if (allElements[i].name == "code")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Please enter the AntiSpam code from them image\n"; document.form1.code.focus();}	
		}
		
	}
	if (coCount == 2) 
	{
			
		errors += "-> Please fill in the neccesary country and area code in the Contact Number\n";
	}
	
	if(errors)
	{
		alert("The following errors were found\n" + errors);
		errors = "";
		returnVal = false;
	}
	else
	{
		returnVal = true;
	}
	return returnVal; 
}
  //CONTACT FORM VALIDATION 