// JavaScript Document

	var img = "images/";
	var pcOn = "pc_on.jpg";
	var pcOff = "pc_off.jpg";
	var webOn = "web_on.jpg";
	var webOff = "web_off.jpg";
	var currentPage ="pc";
	
	function hover(id)
	{

		if(id.name == "pc")
		{
			id.src = img+pcOn;
		}
		if(id.name == "web")
		{
			id.src = img+webOn;
		}
	}
	
	function out(id)
	{
		var arrow = document.getElementById("leftArrow");
		if(id.name == "pc" && currentPage != "pc")
		{
			id.src = img+pcOff;
		}
		if(id.name == "web" && currentPage != "web")
		{
			id.src = img+webOff;
		}
	}

	function setCurrentPage(page)
	{
	currentPage = page;
	}



	function formValidation(thisform)
	{

		var file		= document.getElementById("file");
		var url 		= document.getElementById("url");
		var number 	= document.getElementById("number");
		var email 	= document.getElementById("email");
		var code 		= document.getElementById("user_code");
		var terms 	= document.getElementById("terms");
		
if(file)if (emptyvalidation(file,"You have not selected a file.")==false) {file.focus(); return false;};
if(url)if (emptyvalidation(url,"You have not entered a media URL.")==false) {url.focus(); return false;};




		if (digitvalidation(number,10,10,"You MUST enter 10 integer digits for your phone number.")==false) {number.focus(); return false;};
		if (emailcheck(email,"You have not enter a valid email address.")==false) {email.focus(); return false;};
		if (emptyvalidation(code,"Please enter the security code.")==false) {code.focus(); return false;};
		if (checkboxvalidation(terms,"You must agree to the terms and conditions and privacy policy.")==false) {terms.focus(); return false;};

	}

function checkboxvalidation(box,alertbox){	if (!box.checked) 
		{
		alert(alertbox);
		return false;}	else {return true;}}


function emptyvalidation(entered, alertbox){// Emptyfield Validation by Henrik Petersen / NetKontoret// Explained at www.echoecho.com/jsforms.htm// Please do not remove this line and the two lines above.with (entered){if (value==null || value==""){if (alertbox!="") {alert(alertbox);} return false;}else {return true;}}} 


//DIGIT VALIDATIONfunction digitvalidation(entered, min, max, alertbox, datatype) {	// Digit Validation by Henrik Petersen / NetKontoret	// Explained at www.echoecho.com/jsforms.htm	// Please do not remove this line and the two lines above.	with (entered) {		checkvalue=parseFloat(value);		if (datatype) {			smalldatatype=datatype.toLowerCase();			if (smalldatatype.charAt(0)=="i") {				checkvalue=parseInt(value); 				if (value.indexOf(".")!=-1) {					checkvalue=checkvalue+1				}			};		}		if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue) {			if (alertbox!="") {				alert(alertbox);			} 			return false;		}		else {return true;}	}} //END DIGIT VALIDATION


//EMAIL VALIDATIONfunction emailcheck(email,alertbox) {		var str = email.value		var at="@"		var dot="."		var lat=str.indexOf(at)		var lstr=str.length		var ldot=str.indexOf(dot)		if (str.indexOf(at)==-1){		   alert(alertbox)		   return false		}		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){		   alert(alertbox)		   return false		}		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){		    alert(alertbox)		    return false		}		 if (str.indexOf(at,(lat+1))!=-1){		    alert(alertbox)		    return false		 }		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){		    alert(alertbox)		    return false		 }		 if (str.indexOf(dot,(lat+2))==-1){		    alert(alertbox)		    return false		 }				 if (str.indexOf(" ")!=-1){		    alert(alertbox)		    return false		 } 		 return true						}// END EMAIL VALIDATION