/* all script functions of this site defined in this file */

function validate_pages()
{

var msg="";

if(document.pages_frm.title.value.length == 0)
	msg+="Enter Title\n";

if(msg.length > 0)
{

	alert(msg);
	return false;

}
else
{
	return true;
}
}

function confirm_on_del(val)
{

	if(val.length==0)
	val = "Are you sure?";
	
		if(confirm(val))
			return true;
		else
			return false;
}

function alert_delete(val1,val2,val3)
{

if(confirm_on_del(''))
{
str=val2+"&id="+val1+"&type="+val3;
//alert(str);
window.location.href=str;

}

}


function validate_request_form(obj)
{
	var msg="";
	
	if(obj.name.value.length==0)
		msg+="Enter Name\n";
		
	if(obj.company.value.length==0)
		msg+="Enter Company\n";

	if(obj.email.value.length==0)
		msg+="Enter Email\n";
	 else if(!chk_email(obj.email))
	{
		msg+="Enter valid Email\n";
	}					

	if(obj.phone.value.length==0)
		msg+="Enter Phone\n";

	var emp_type_cnt=0;
	var contact_method_cnt=0;
	
	for(i=0;i<obj.length;i++)
	{
			if(obj.elements[i].name=="emp_type[]")
			{
					if(obj.elements[i].checked)
						emp_type_cnt++;
			}
			
			if(obj.elements[i].name=="contact_method[]")
			{
					if(obj.elements[i].checked)
						contact_method_cnt++;
			}
			
			
			
			
			
	}
		
	if(emp_type_cnt==0)
		msg+="Select Type of Employment\n";
		

	if(obj.job_title.value.length==0)
		msg+="Enter Job Title/Position\n";

	if(obj.experience.value.length==0)
		msg+="Enter Mandatory Requirements, Education or Experience\n";

	if(contact_method_cnt==0)
		msg+="Select Contact Method\n";



if(msg.length > 0)
{
	alert(msg);
	return false;
}

return true;
}

function chk_email(fldname)
{

	var str=fldname.value;
	
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str))
		testresults=true
	else{
//		alert("Please input a valid email address!")
		testresults=false
	}
	return (testresults)

}

