//IMAGE SWAP CODE
	<!-- Begin
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v3.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	// End -->
//IMAGE SWAP CODE

	// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
	<!-- Begin
		function mailsome1()
			{
				who=prompt("Enter recipient's email address: ","email@domainname.co.za");
				what=prompt("Enter the subject: ","Try out SA Biking Academy [+27 11 793-4255]");
				if (confirm("Are you sure you want to mail "+who+" with the subject of "+what+"?")==true)
					{
					parent.location.href='mailto:'+who+'?subject='+what+'';
					}
			}
	// End -->


//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 -->

// REQUEST AND QUOTE FROM DIV UNHIDE IN THE REQUEST A QUOTE PAGE
	<!-- Begin
	function DisDiv()
		{
			if(document.form1.May.checked == true)
			{document.getElementById("May").style.display ="block";}
			else
			{document.getElementById("May").style.display ="none";}
		}
		
	function DisDiv2()
		{
			if(document.form1.June.checked == true)
			{document.getElementById("June").style.display ="block";}
			else
			{document.getElementById("June").style.display ="none";}
		}
	
	function DisDiv3()
		{
			if(document.form1.July.checked == true)
			{document.getElementById("July").style.display ="block";}
			else
			{document.getElementById("July").style.display ="none";}
		}
		
	function DisDiv3()
		{
			if(document.form1.August.checked == true)
			{document.getElementById("August").style.display ="block";}
			else
			{document.getElementById("August").style.display ="none";}
		}
		
	function DisDiv3()
		{
			if(document.form1.September.checked == true)
			{document.getElementById("September").style.display ="block";}
			else
			{document.getElementById("September").style.display ="none";}
		}
		
	function DisDiv3()
		{
			if(document.form1.October.checked == true)
			{document.getElementById("October").style.display ="block";}
			else
			{document.getElementById("October").style.display ="none";}
		}
		
	function DisDiv5()
		{
			if(document.form1.November.checked == true)
			{document.getElementById("November").style.display ="block";}
			else
			{document.getElementById("November").style.display ="none";}
		}
		
	function DisDiv5()
		{
			if(document.form1.December.checked == true)
			{document.getElementById("December").style.display ="block";}
			else
			{document.getElementById("December").style.display ="none";}
		}
	// End -->
// REQUEST AND QUOTE FROM DIV UNHIDE IN THE REQUEST A QUOTE PAGE



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].name == "name")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your Full Name is a mandatory field, please enter\n";}	
		}
		
		//CHECK EMAIL ADDRESS NOT EMPTY AND VALID
		if (allElements[i].type == "text" && allElements[i].name == "email" || allElements[i].name == "contact_recipient")
		{
			var oEmail = allElements[i].value;
			var chkDot = true;
			var result = false;
			var ndxAt = ndxDot =  0;
			var ndxAt = ndxDot =  0;

			if (oEmail.length <= 0 )
			{
				errors += "-> Email is a mandatory field, please enter email\n";
			}
			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 += "-> Email lacks '.' \tThe format is 'you@domain.com'\n";
				}
				else if ( (ndxAt < 0) ) //check for an '@' sign
				{
					errors += "-> Email lacks an '@'\tThe format is 'you@domain.com'\n";
				}
				else if (ndxDot2 - 3 <= ndxAt)
				{
					errors += "-> May be missing an email's domain name\tThe format is 'you@domain.com'\n";
				}
			}	
		}
		
		//CONTACTFORM SAVE
		if (allElements[i].type=="text" && allElements[i].name == "number") 
		{
			var oSwitchCou = allElements[i].value;	
			if (oSwitchCou.length <= 0)
			{
				errors += "-> Your phone is a mandatory field, please enter\n";
			}		
			else if (isNaN(oSwitchCou))
			{
				errors += "-> Your phone is a numeric field, please enter numbers only\n";
			}			
		}
			
		//CHECK CONTACT DIAL CODE NUMBER NOT EMPTY
		if (allElements[i].type=="text" && allElements[i].name == "dialcode")
		{var oFullName = allElements[i].value; if ( oFullName.length <= 0 ){errors += "-> Dialing code is a mandatory field, please enter code\n";}}
		
		//CHECK HEADING NOT EMPTY
		if (allElements[i].name == "message")
		{
			var ocomments = allElements[i].value;
			if ( ocomments.length <= 0 ) {errors += "-> Your message is a mandatory field, please enter\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(errors)
	{
		alert("The following fields are mandatory:\n" + errors);
		errors = "";
		returnVal = false;
	}
	else
	{
		returnVal = true;
	}
	return returnVal; 
}
