// JavaScript Document
function isProfileFormOk(frm1)
{

	if(frm1.name.value == '')
	{
		alert("Please enter Your Name.");
		frm1.name.focus();
		return false;
	}
	if(frm1.email.value == '')
	{
		alert("Please enter Your Email Address.");
		frm1.email.focus();
		return false;
	}
	
	if(Validate(frm1.email.value)==false)
	{
		alert("Invalid Email Address.");
		frm1.email.focus();
		return false;
	}
	if(frm1.phone.value == '')
	{
		alert("Please enter Your Phone Number.");
		frm1.phone.focus();
		return false;
	}
	if(frm1.center.value == '')
	{
		alert("Please select Center Of Choice.");
		//frm1.center.focus();
		return false;
	}
	
	else
		return true;
}
function Validate(email)
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = email;
   if(reg.test(address) == false) {
      //alert('Invalid Email Address');
      return false;
   }
   else
   {
      return true;
   }
}
function enquiry_check()
{
	var fname = window.document.enquiry.fname.value;
	var lname = window.document.enquiry.lname.value;
	var sex = window.document.enquiry.sex.value;
	var dob1 = window.document.enquiry.dob1.value;
	var dob2 = window.document.enquiry.dob2.value;
	var dob3 = window.document.enquiry.dob3.value;
	var mobile_no = window.document.enquiry.mobile_no.value;						
	var land_no = window.document.enquiry.land_no.value;
	var h_n = window.document.enquiry.h_n.value;
	var area = window.document.enquiry.area.value;
	var city = window.document.enquiry.city.value;						
	var state = window.document.enquiry.state.value;
	var pin = window.document.enquiry.pin.value;
	var course = window.document.enquiry.course.value;
	var c_center = window.document.enquiry.c_center.value;	
	var email = window.document.enquiry.email.value;
	//var question = window.document.enquiry.question.value;						
	
	var chk = 1;
	var str_alert = "";
	var s = 0;
		
 	var f = window.document.forms['enquiry'];
    for(var j = 0; j < f.elements.length; j++)
    {
        if(f.elements[j].type == 'radio')   
        {
			if(f.elements[j].checked == true)   
			{
				s = 1;
			}

        }
    }
	
	
	if(s == 0)
	{
		str_alert += 'Please select your gendar.\n';	
		chk = 0;	
	}
	
	if(fname != "")
	{
		var regex = new RegExp("^[a-zA-Z. ]+$");
		if(!regex.test(fname))
		{
			str_alert += 'Please insert only characters in first name field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the first name.\n';	
		chk = 0;
	}

	if(lname != "")
	{
		var regex = new RegExp("^[a-zA-Z. ]+$");
		if(!regex.test(lname))
		{
			str_alert += 'Please insert only characters in last name field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the last name.\n';	
		chk = 0;
	}

	


	if(mobile_no != "")
	{
		var regex = new RegExp("^[0-9- ]+$");
		if(!regex.test(mobile_no))
		{
			str_alert += 'Please insert only numbers in mobile number field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the mobile number field.\n';	
		chk = 0;
	}
	
	if(email != "")
	{
		var regex = new RegExp("^([_a-z0-9_-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$");
		if(!regex.test(email))
		{
			str_alert += 'Please insert proper email address in email field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the email.\n';	
		chk = 0;
	}

	if(area == "")
	{
		str_alert += 'Please fill the area filed.\n';	
		chk = 0;	
	}

	if(city == "")
	{
		str_alert += 'Please fill the city field.\n';	
		chk = 0;	
	}

	if(dob1 == "")
	{
		str_alert += 'Please select a date for your Date of Birth.\n';	
		chk = 0;	
	}
	if(dob2 == "")
	{
		str_alert += 'Please select a month for your Date of Birth.\n';	
		chk = 0;	
	}
	if(dob3 == "")
	{
		str_alert += 'Please select a year for your Date of Birth.\n';	
		chk = 0;	
	}
	/*if(state == "")
	{
		str_alert += 'Please fill the state field.\n';	
		chk = 0;	
	}

	if(pin == "")
	{
		str_alert += 'Please fill the pin field.\n';	
		chk = 0;	
	}*/

	if(course == "")
	{
		str_alert += 'Please select a course.\n';	
		chk = 0;	
	}

	if(c_center == "")
	{
		str_alert += 'Please select a center.\n';	
		chk = 0;	
	}


	if(chk == 1)
	{
		return true;
	}
	else
	{
		alert(str_alert);
		return false;
	}
}

function free_workshop_check()
{
	var fname = window.document.enquiry.fname.value;
	var lname = window.document.enquiry.lname.value;
	var sex = window.document.enquiry.sex.value;
	var dob1 = window.document.enquiry.dob1.value;
	var dob2 = window.document.enquiry.dob2.value;
	var dob3 = window.document.enquiry.dob3.value;
	var mobile_no = window.document.enquiry.mobile_no.value;						
	var land_no = window.document.enquiry.land_no.value;
	var h_n = window.document.enquiry.h_n.value;
	var area = window.document.enquiry.area.value;
	var city = window.document.enquiry.city.value;						
	var state = window.document.enquiry.state.value;
	var pin = window.document.enquiry.pin.value;
	var email = window.document.enquiry.email.value;
	var course = window.document.enquiry.course.value;
	/*var c_center = window.document.enquiry.c_center.value;*/						
	//var question = window.document.enquiry.question.value;						
	
	var chk = 1;
	var str_alert = "";
	var s = 0;
		
 	var f = window.document.forms['enquiry'];
    for(var j = 0; j < f.elements.length; j++)
    {
        if(f.elements[j].type == 'radio')   
        {
			if(f.elements[j].checked == true)   
			{
				s = 1;
			}

        }
    }
	
	
	if(s == 0)
	{
		str_alert += 'Please select your gendar.\n';	
		chk = 0;	
	}
	
	if(fname != "")
	{
		var regex = new RegExp("^[a-zA-Z. ]+$");
		if(!regex.test(fname))
		{
			str_alert += 'Please insert only characters in first name field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the first name.\n';	
		chk = 0;
	}

	if(lname != "")
	{
		var regex = new RegExp("^[a-zA-Z. ]+$");
		if(!regex.test(lname))
		{
			str_alert += 'Please insert only characters in last name field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the last name.\n';	
		chk = 0;
	}

	if(dob1 == "")
	{
		str_alert += 'Please select a date for your Date of Birth.\n';	
		chk = 0;	
	}
	if(dob2 == "")
	{
		str_alert += 'Please select a month for your Date of Birth.\n';	
		chk = 0;	
	}
	if(dob3 == "")
	{
		str_alert += 'Please select a year for your Date of Birth.\n';	
		chk = 0;	
	}


	if(mobile_no != "")
	{
		var regex = new RegExp("^[0-9- ]+$");
		if(!regex.test(mobile_no))
		{
			str_alert += 'Please insert only numbers in mobile number field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the mobile number field.\n';	
		chk = 0;
	}
	
	if(email != "")
	{
		var regex = new RegExp("^([_a-z0-9_-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$");
		if(!regex.test(email))
		{
			str_alert += 'Please insert proper email address in email field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the email.\n';	
		chk = 0;
	}

	if(area == "")
	{
		str_alert += 'Please fill the area filed.\n';	
		chk = 0;	
	}

	if(city == "")
	{
		str_alert += 'Please fill the city field.\n';	
		chk = 0;	
	}

	/*if(state == "")
	{
		str_alert += 'Please fill the state field.\n';	
		chk = 0;	
	}

	if(pin == "")
	{
		str_alert += 'Please fill the pin field.\n';	
		chk = 0;	
	}*/

	if(course == "")
	{
		str_alert += 'Please select a course.\n';	
		chk = 0;	
	}

	/*if(c_center == "")
	{
		str_alert += 'Please select a center.\n';	
		chk = 0;	
	}*/


	if(chk == 1)
	{
		return true;
	}
	else
	{
		alert(str_alert);
		return false;
	}
}


function recruiter_check()
{
	var n_c_name = window.document.recruiter.n_c_name.value;
	var n_address = window.document.recruiter.n_address.value;
	var n_name = window.document.recruiter.n_name.value;
	var n_designation = window.document.recruiter.n_designation.value;
	var n_phone = window.document.recruiter.n_phone.value;
	var n_email = window.document.recruiter.n_email.value;
	var n_profile = window.document.recruiter.n_profile.value;
	var n_position = window.document.recruiter.n_position.value;
	var n_candidate = window.document.recruiter.n_candidate.value;
	var n_qualification = window.document.recruiter.n_qualification.value;
	var n_job_desc = window.document.recruiter.n_job_desc.value;						
	var n_location = window.document.recruiter.n_location.value;
	var n_salary = window.document.recruiter.n_salary.value;						
	//var n_auth = window.document.recruiter.n_auth.value;
	var n_c_type = window.document.recruiter.n_c_type.value;
	
	var chk = 1;
	var str_alert = "";
	
	if(n_c_name == "")
	{
		str_alert += 'Please enter company name.\n';	
		chk = 0;	
	}

	if(document.getElementById('n_c_type').checked == false)
	{
		str_alert += 'Please select company type.\n';	
		chk = 0;	
	}

	if(n_address == "")
	{
		str_alert += 'Please enter company address.\n';	
		chk = 0;	
	}

	if(n_name != "")
	{
		var regex = new RegExp("^[a-zA-Z. ]+$");
		if(!regex.test(n_name))
		{
			str_alert += 'Please insert only characters in name field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the name.\n';	
		chk = 0;
	}

	if(n_designation == "")
	{
		str_alert += 'Please enter designation.\n';	
		chk = 0;	
	}

	if(n_phone != "")
	{
		var regex = new RegExp("^[0-9- ]+$");
		if(!regex.test(n_phone))
		{
			str_alert += 'Please insert only numbers in phone field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the phone number field.\n';	
		chk = 0;
	}
	
	if(n_email != "")
	{
		var regex = new RegExp("^([_a-z0-9_-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$");
		if(!regex.test(n_email))
		{
			str_alert += 'Please insert proper email address in email field.\n';	
			chk = 0;
		}
	}
	else
	{
		str_alert += 'Please fill the email.\n';	
		chk = 0;
	}

	if(n_profile == "")
	{
		str_alert += 'Please enter company profile.\n';	
		chk = 0;	
	}

	if(n_position == "")
	{
		str_alert += 'Please enter the position title.\n';	
		chk = 0;	
	}
	
	if(n_candidate == "")
	{
		str_alert += 'Please enter no. of candidates required.\n';	
		chk = 0;	
	}
	
	if(n_qualification == "")
	{
		str_alert += 'Please enter Minimum Qualification .\n';	
		chk = 0;	
	}


	if(n_job_desc == "")
	{
		str_alert += 'Please fill the job description.\n';	
		chk = 0;	
	}

	if(n_location == "")
	{
		str_alert += 'Please enter job location.\n';	
		chk = 0;	
	}


	if(n_salary == "")
	{
		str_alert += 'Please fill the salary range.\n';	
		chk = 0;	
	}

	/*if(n_auth == "")
	{
		str_alert += 'Please enter value for salary fee to Recruiter.\n';	
		chk = 0;	
	}*/
	
	if(chk == 1)
	{
		return true;
	}
	else
	{
		alert(str_alert);
		return false;
	}
}

