var keylist = "1234567890";
var temp = "";

function genRID(bool)
{
	bool = bool || false;
	temp = "";
	var plength = 9;
	var i;
	for(i=0; i<plength; i++){
		temp += keylist.charAt(Math.floor(Math.random()*keylist.length));
	}
	//return temp
	if(bool){
		return temp;
	}
	else{
		document.getElementById("actual").value = temp;
	}
}
/*window.onload = function(){
	genRID();
}*/

function printpdf()
{
	window.print("thanks.php");
}

function validateForm(obj)
{
	str = "";
	if(!validFiled(obj.fname.value)){
		str += ", first name";
	}
	if(!validFiled(obj.lname.value)){
		str += ", last name";
	}
	if(!validEmail(obj.email.value)){
		str += ", valid email";
	}
	
	if(str.length > 0){
		str = "Required field(s): " + str;
		document.getElementById('err').innerHTML = '<span style="color:#FF0000;">' + str.replace(/, +/, "") + '</span>';
		return false;
	}
	else{
		return true;
	}
}

function validEmail(inputvalue)
{
	var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    if(pattern.test(inputvalue)){
    	return true;
    }
    else{
    	return false;
    }
}

function validFiled(str1)
{
	patern = /[0-9a-z. ]+$/i;
	if(patern.test(str1)){
		return true;
	}
	else{
		return false;
	}
}