function index(){
	window.location = "index.php";
}
function press(){
	window.location = "press.php";
}
function blog(){
	window.location = "blog.php";
}
function products(){
	window.location = "products.php";
}
function contact(){
	window.location = "contact.php";
}
function about(){
	window.location = "about.php";
}
function oscommerc(){
	window.location = "oscommerce.php";
}
function ttc(){
window.location = "tictactoe.php";
}
function gotopage(id){
window.location = id;
}
function contestone(){
window.location = "http://twitter.com/home/?status=RT+@chiarosoftware+Chiaro+Contest:+get+a+free+license+of+Chiaro+Tic+Tac+Toe+http://bit.ly/2RhksZ+Please+RT";
}
function sp(){
var num = Math.floor(Math.random()*9);
if(num == "0"){
		spamf = "143002";
	}
else if(num == "1"){
		spamf = "4532";
	}
else if(num == "2"){
		 spamf = "157";
	}
else if(num == "3"){
		 spamf = "13098";
	}
else if(num == "4"){
		 spamf = "00";
	}
else if(num == "5"){
		 spamf = "092182";
	}
else if(num == "6"){
		 spamf = "93123";
	}
else if(num == "7"){
		 spamf = "874332";
	}
else if(num == "8"){
		 spamf = "26486";
	}
else{
		 spamf = "1456";
}

document.getElementById('antispam').innerHTML = '<img src=captha' + num + '.png onClick="sp();"><br><font size=1>Click to reload image</font>';
}
function validate(){
	if(document.contact.name.value == ""){
		alert("Please fill out the field name");
		document.contact.name.focus();
		return false;
	}
	if(document.contact.email.value == ""){
		alert("Please fill out the field email");
		document.contact.email.focus();
		return false;
	}
		with (document.contact.email)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {
		alert("Please type a valid email");
		document.contact.email.focus();
		return false;
	}
  }
  	
	if(document.getElementById("subject").selectedIndex == ""){
		alert("Please choose a subject");
		return false;
	} 
	if(document.contact.mensage.value == ""){
		alert("Please fill out the field message");
		document.contact.mensage.focus();
		return false;
	}
	if(document.contact.mensage.value == ""){
		alert("Please fill out the field message");
		document.contact.mensage.focus();
		return false;
	}
	if(document.contact.spam.value != spamf){
		alert("The caracteres you entered in the spam verification didn't match the word verification. Please try again.");
		sp();
		return false;
	}
}
