// JavaScript Document
function sendme(){
	var eform = document.SendToFriend;
	var ctr = 0;
	
	
	if(eform.txtFriendEmail.value == ""){
		eform.txtFriendEmail.focus();
		ctr = 1;	
	}
	if(eform.txtEmail.value == ""){
		eform.txtEmail.focus();
		ctr = 1;
	}
	if(eform.txtName.value == ""){
		eform.txtName.focus();
		ctr = 1;
	}
	
	
	// Checking if email address is valid
		if (document.SendToFriend.txtEmail.value!="") {
			text=document.SendToFriend.txtEmail.value
			// Check For Bad Chars
			badchar = " ()<>\/[]{}+-*|;,'"
			for (i=0;i<text.length;i++) {
				for (j=0;j<badchar.length;j++) {
					if (text.charAt(i) == badchar.charAt(j)) {
						alert("Please enter a valid e-mail address.")				
		//				alert("Your Email Address May Has Some Bad Character or there is some space between letters")
						return false
					}
				}
			}
			// There Should Be a dot (.) Symbol
			if (text.indexOf(".") == -1) {
				alert("Please enter a valid e-mail address.")				
		//		alert("Your Email Address Doesnot have any dot(.) symbol")
				return false
			}
			// There Should Be an @ Symbol
			if (text.indexOf("@") == -1) {
				alert("Please enter a valid e-mail address.")				
		//		alert("Your Email Address Doesnot have any @ symbol")
				return false
			}
			else {
			// Only one @ symbol should be found
				symbolfound = 0
				for (i=0;i<text.length;i++) {
					if (text.charAt(i) == "@") {
						symbolfound++
					}
					else {
						continue
					}
				}
				if (symbolfound != 1) {
					alert("Please enter a valid e-mail address.")		
		//			alert("Ooops  Your Email Address Has More Than One @ Symbol")
					return false
				}
			}
			// Check For Syntax Errors Such as .@  or   @.  or  ..
			if (text.indexOf("@.") != -1 || text.indexOf(".@") != -1 || text.indexOf("..") != -1) {
				alert("Please enter a valid e-mail address.")		
		//		alert("Sorry Your Email Address has two symbol side by side and it is wrong")
				return false
			}
			// The first character shouldn't be @ or .
			if (text.charAt(0) == "@" || text.charAt(0) == ".") {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Your first character seem to be . or @ and it is wrong")
				return false
			}
			// The last character shouldn't be @ or .
			if (text.charAt(text.length-1) == "@" || text.charAt(text.length-1) == ".") {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Your last character seem to be . or @ and it is wrong")
		
				return false
			}
			// The @ Symbol should be found before .
			foundchar1 = text.indexOf("@")
			foundchar2 = text.indexOf(".")
			if (foundchar1 > foundchar2) {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Sorry The @ Symbol should be found before dot(.)symbol but it isnt in yours")
				return false
			}
		}
		
		// Checking if email address is valid
		if (document.SendToFriend.txtFriendEmail.value!="") {
			text=document.SendToFriend.txtFriendEmail.value
			// Check For Bad Chars
			badchar = " ()<>\/[]{}+-*|;,'"
			for (i=0;i<text.length;i++) {
				for (j=0;j<badchar.length;j++) {
					if (text.charAt(i) == badchar.charAt(j)) {
						alert("Please enter a valid e-mail address.")				
		//				alert("Your Email Address May Has Some Bad Character or there is some space between letters")
						return false
					}
				}
			}
			// There Should Be a dot (.) Symbol
			if (text.indexOf(".") == -1) {
				alert("Please enter a valid e-mail address.")				
		//		alert("Your Email Address Doesnot have any dot(.) symbol")
				return false
			}
			// There Should Be an @ Symbol
			if (text.indexOf("@") == -1) {
				alert("Please enter a valid e-mail address.")				
		//		alert("Your Email Address Doesnot have any @ symbol")
				return false
			}
			else {
			// Only one @ symbol should be found
				symbolfound = 0
				for (i=0;i<text.length;i++) {
					if (text.charAt(i) == "@") {
						symbolfound++
					}
					else {
						continue
					}
				}
				if (symbolfound != 1) {
					alert("Please enter a valid e-mail address.")		
		//			alert("Ooops  Your Email Address Has More Than One @ Symbol")
					return false
				}
			}
			// Check For Syntax Errors Such as .@  or   @.  or  ..
			if (text.indexOf("@.") != -1 || text.indexOf(".@") != -1 || text.indexOf("..") != -1) {
				alert("Please enter a valid e-mail address.")		
		//		alert("Sorry Your Email Address has two symbol side by side and it is wrong")
				return false
			}
			// The first character shouldn't be @ or .
			if (text.charAt(0) == "@" || text.charAt(0) == ".") {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Your first character seem to be . or @ and it is wrong")
				return false
			}
			// The last character shouldn't be @ or .
			if (text.charAt(text.length-1) == "@" || text.charAt(text.length-1) == ".") {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Your last character seem to be . or @ and it is wrong")
		
				return false
			}
			// The @ Symbol should be found before .
			foundchar1 = text.indexOf("@")
			foundchar2 = text.indexOf(".")
			if (foundchar1 > foundchar2) {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Sorry The @ Symbol should be found before dot(.)symbol but it isnt in yours")
				return false
			}
		}
		
	if(ctr == 0){
		imgget = document.getElementById("hidget").value;
		eform.action="refer_page.php?game="+imgget;
		eform.submit();
	}	
	else
		alert("Please Complete The Required Details");
	
}

function sendinfo(){
	var eform = document.frminfo;
	var ctr = 0;

	if(eform.txtMessage.value == ""){
		eform.txtMessage.focus();
		ctr = 1;	
	}
	if(eform.txtSubject.value == ""){
		eform.txtSubject.focus();
		ctr = 1;	
	}
	if(eform.txtEmail.value == ""){
		eform.txtEmail.focus();
		ctr = 1;	
	}
	if(eform.txtEveningPhone.value == ""){
		eform.txtEveningPhone.focus();
		ctr = 1;	
	}
	if(eform.txtDayPhone.value == ""){
		eform.txtDayPhone.focus();
		ctr = 1;	
	}
	if(eform.txtLastName.value == ""){
		eform.txtLastName.focus();
		ctr = 1;	
	}
	if(eform.txtFirstName.value == ""){
		eform.txtFirstName.focus();
		ctr = 1;	
	}
	
		// Checking if email address is valid
		if (document.frminfo.txtEmail.value!="") {
			text=document.frminfo.txtEmail.value
			// Check For Bad Chars
			badchar = " ()<>\/[]{}+-*|;,'"
			for (i=0;i<text.length;i++) {
				for (j=0;j<badchar.length;j++) {
					if (text.charAt(i) == badchar.charAt(j)) {
						alert("Please enter a valid e-mail address.")				
		//				alert("Your Email Address May Has Some Bad Character or there is some space between letters")
						return false
					}
				}
			}
			// There Should Be a dot (.) Symbol
			if (text.indexOf(".") == -1) {
				alert("Please enter a valid e-mail address.")				
		//		alert("Your Email Address Doesnot have any dot(.) symbol")
				return false
			}
			// There Should Be an @ Symbol
			if (text.indexOf("@") == -1) {
				alert("Please enter a valid e-mail address.")				
		//		alert("Your Email Address Doesnot have any @ symbol")
				return false
			}
			else {
			// Only one @ symbol should be found
				symbolfound = 0
				for (i=0;i<text.length;i++) {
					if (text.charAt(i) == "@") {
						symbolfound++
					}
					else {
						continue
					}
				}
				if (symbolfound != 1) {
					alert("Please enter a valid e-mail address.")		
		//			alert("Ooops  Your Email Address Has More Than One @ Symbol")
					return false
				}
			}
			// Check For Syntax Errors Such as .@  or   @.  or  ..
			if (text.indexOf("@.") != -1 || text.indexOf(".@") != -1 || text.indexOf("..") != -1) {
				alert("Please enter a valid e-mail address.")		
		//		alert("Sorry Your Email Address has two symbol side by side and it is wrong")
				return false
			}
			// The first character shouldn't be @ or .
			if (text.charAt(0) == "@" || text.charAt(0) == ".") {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Your first character seem to be . or @ and it is wrong")
				return false
			}
			// The last character shouldn't be @ or .
			if (text.charAt(text.length-1) == "@" || text.charAt(text.length-1) == ".") {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Your last character seem to be . or @ and it is wrong")
		
				return false
			}
			// The @ Symbol should be found before .
			foundchar1 = text.indexOf("@")
			foundchar2 = text.indexOf(".")
			if (foundchar1 > foundchar2) {
				alert("Please enter a valid e-mail address.")		
		//		alert("E-mail: Sorry The @ Symbol should be found before dot(.)symbol but it isnt in yours")
				return false
			}
		}
	if(ctr == 0){
	
			imgget = document.getElementById("hidget").value;
			eform.action="info_rqst.php?game="+imgget;
			eform.submit();
	}	
	else
		alert("Please Complete The Required Details");
	
}



onKeyPress="return keyRestrict(event,'1234567890');"
function getKeyCode(e)
{
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}

function keyRestrict(e, validchars) { 
	var key='', keychar='';
	key = getKeyCode(e);
	if (key == null) return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	validchars = validchars.toLowerCase();
	if (validchars.indexOf(keychar) != -1)
		return true;
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
		return true;
	return false;
}
function PhoneFormat(me)
{
	if (me.value.length > 0) {
		var tValue = me.value.replace(new RegExp("-", "gi"), "");
		
		tValue = tValue.substring(0, 3) + '-' + tValue.substring(3, 6) + '-' + tValue.substring(6);
		me.value = tValue;
	}
}