//DROP DOWN FAQ
<!--
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+'');
}
// -->

	loadtime="0"
	loading=true
	s="s"
	{	
		refresh()
	}

	function refresh()
		{
			setTimeout("count()",250)
		}
		
	function count()
		{
			if (loading)
				{
					loadtime=loadtime+++0.25;refresh()
				}
		}

	function done()
		{

			if (loadtime==1)
				{
					s=""
				}
			alert("It took "+loadtime+" second"+s+" to load the page");loading=false
		}

// DIV HIDE AND SHOW

var state = 'none';

function showhide(layer_ref)
	{
		if (state == 'block')
			{state = 'none';}
		else
			{state = 'block';}

		if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	
	if (document.layers)
		{ //IS NETSCAPE 4 or below
			document.layers[layer_ref].display = state;
		}

	if (document.getElementById &&!document.all)
		{hza = document.getElementById(layer_ref);
			hza.style.display = state;
		}
	}
// DIV END -->


//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 HEADING NOT EMPTY
		if (allElements[i].type=="text" && allElements[i].name == "sp_heading")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 )
			{
				errors += "-> Your Specials Heading is a mandatory field, please enter your Specials Heading\n";
			}			
		}	

		//CHECK HEADING NOT EMPTY
		if (allElements[i].name == "sp_description")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 )
			{
				errors += "-> Your Specials Description is a mandatory field, please enter your Specials Description\n";
			}	
		}
		
		//CHECK PRICE IS NOT NULL OR IS NUMERIC
		//else if (allElements[i].type=="text" && allElements[i].name == "sp_price") 
		//{
		//	var oSwitchCou = allElements[i].value;	
		//	if (oSwitchCou.length <= 0)
		//	{
		//		errors += "-> Your Specials Price is a mandatory field, please enter your Specials Price\n";
		//	}		
		//	else if (isNaN(oSwitchCou))
		//	{
		//		errors += "-> Your Specials Price is a numeric field, please enter your Specials Price\n";
		//	}			
		//}
		
		//CHECK PRICE IS NOT NULL OR IS NUMERIC
		//else if (allElements[i].type=="text" && allElements[i].name == "sp_cents") 
		//{
		//	var oSwitchCou = allElements[i].value;	
		//	if (oSwitchCou.length <= 0)
		//	{
		//		errors += "-> Your Specials Price Cents is a mandatory field, please enter your Specials Price Cents\n";
		//	}		
		//	else if (isNaN(oSwitchCou))
		//	{
		//		errors += "-> Your Specials Price Cents is a numeric field, please enter your Specials Price Cents\n";
		//	}			
		//}
		
		//CHECK DROPDOWN TITLE LIST
		//else if (allElements[i].name == "brandlogo")
		//	{
		//		var otitle = allElements[i].value.checked;
		//			if  (otitle.checked == 'checked')
		//				{		
		//					if (allElements[i].name == "brand")
		//					{
		//						var otitle = allElements[i].value;
		//						if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
		//						{
		//							errors += "-> A brand logo is a Mandatory field, please select your Title\n";
		//						}
		//					}
		//				}
		//		}

		
		//CHECK FIRSTNAME NOT EMPTY
		if (allElements[i].name == "fullname")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your full name is a mandatory field, please enter your first / full name\n"; document.form1.fullname.focus();}	
		}
		
		//CHECK LASTNAME NOT EMPTY
		if (allElements[i].name == "lastname")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your Last name is a mandatory field, please enter\n";}	
		}		
		
		//CHECK CONTACT DIAL CODE NUMBER NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "contact-area1")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> International code is a mandatory field, please enter code\n";}
		}
		
		//CHECK CONTACT DIAL CODE NUMBER NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "contact-area2")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Local dialing code is a mandatory field, please enter code\n";}			
		}		
		
		//CHECK CONTACT NUMBER1 NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "contact-number")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Contact number is a mandatory field, please enter number\n";}			
		}
		
		//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.co.za'";
				}
				else if ( (ndxAt < 0) ) //check for an '@' sign
				{
					errors += "->Your email lacks an '@'\n\tThe format is 'you@domain.co.za'";
				}
				else if (ndxDot2 - 3 <= ndxAt)
				{
					errors += "->You may be missing Your email's domain name\n\tThe format is 'you@domain.co.za'";
				}
			}	
		}
		
		//CHECK DROPDOWN TITLE LIST

		else if (allElements[i].name == "quantity")
		{
			var otitle = allElements[i].value;
			if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
			{
				errors += "-> A quantity is a Mandatory field, please select your quantity\n";
			}
		}
		
		//CHECK POSTAL OR PHYSICAL NOT EMPTY
		else if (allElements[i].type=="textarea" && allElements[i].name == "postaladdress")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 ){errors += "-> Postal address is a mandatory field, please enter your comment\n";}			
		}
		
		
		//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";}			
		}
		
		//CHECK EMAILCODE NOT EMPTY
		if (allElements[i].name == "code")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Please enter the image verification code\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 