// JavaScript Document
// JavaScript Document
function check(randomtextval)
{
var randomtextvalue = randomtextval;
var fname = document.entry.fname;
var lname=document.entry.lname;
var age = document.entry.age;
var address = document.entry.address;
var city = document.entry.city;
var state = document.entry.state;
var zip = document.entry.zip;
var phone = document.entry.phone;
var email=document.entry.email;
var Genre=document.entry.Genre;
var Pitch=document.entry.Pitch;
var StoryIdea = document.entry.StoryIdea;	
var AgreeToRules=document.entry.AgreeToRules;
var numericExpression = /^[0-9]+$/;

if (fname.value==null || fname.value=="") 
{
alert("Please Enter your First Name!.");
fname.focus();
return false
} 
else if (lname.value==null || lname.value=="") 
{
alert("Please Enter your Last Name!.");
lname.focus();
return false
} 
else if ( age.selectedIndex == 0) 
{
alert("Please Enter your Age!.");
fname.focus();
return false
} 

else if ( address.value==null || address.value=="") 
{
alert("Please Enter your Address!.");
fname.focus();
return false
} 
else if ( city.value==null || city.value=="") 
{
alert("Please Enter your City!.");
fname.focus();
return false
} 
else if ( state.value==null || state.value=="") 
{
alert("Please Enter your State!.");
fname.focus();
return false
} 
else if ( zip.value==null || zip.value=="" ||(!zip.value.match(numericExpression))) 
{
alert("Please Enter The ZipCode!.");
fname.focus();
return false
} 
else if ( phone.value==null || phone.value=="" ) 
{
alert("Please Enter your  Phone Number!.");
phone.focus();
return false
} 
else if(phone.value<10 ||(!phone.value.match(numericExpression))) 
{
alert("Phone Number must be atleast 10 Characters and Numbers only!");
phone.focus();
return false
}

else if ((email.value == null) || (email.value.indexOf("@") == -1) || (email.value.indexOf(".") == -1)) 
{
alert("Please Enter your valid email address.");
email.focus();
return false
}
else if (Genre.value=="")
//else if((document.entry.Genre.checked))
{
alert("Please select a Genre!.");
return false
}

else if( Pitch.value==null || Pitch.value=="") 
{
alert("Please Enter The Pitch.");
Pitch.focus();
return false
} 
else if( StoryIdea.value==null || StoryIdea.value=="") 
{
alert("Please Enter The StoryIdea.");
StoryIdea.focus();
return false
} 

if(randomtext.value=="" || randomtext.value==null)
	{
	alert("Please enter the text shown in the image");
	randomtext.focus();
	return false
	}
if(randomtext.value!=randomtextvalue)
	{
	alert("The text you entered does not match with the text in the image")
		randomtext.focus();
		 return false;
	}
	else if (!document.entry.AgreeToRules.checked)
{
alert("You should agree to the rules of this contest!.");
AgreeToRules.focus();
return false
}	

/*else if( AgreeToRules.value==null || AgreeToRules.value=="") 
{
alert("You should agree to the rules of this contest!.");
AgreeToRules.focus();
return false
} */
/*else {
document.entry.submit();
}*/

else {
			document.entry.submit();
			return true
			}

}


