// JavaScript Document
 // form validation
	function validate_add()
	{
	// first name
	if(document.frm_write.first_name.value =="")
	{
         alert("Please enter your First Name.");
		 document.frm_write.first_name.focus();
		 return false;
	}
	
	// last name
	if(document.frm_write.last_name.value =="")
	{
         alert("Please enter your Last Name.");
		 document.frm_write.last_name.focus();
		 return false;
	}
	
	// school
	if(document.frm_write.school_id.value =="")
	{
         alert("Please select a B-School.");
		 document.frm_write.school_id.focus();
		 return false;
	}
	
	// Graduation Year
	if(document.frm_write.grad_year.value =="")
	{
         alert("Please select a Year of Graduation.");
		 document.frm_write.grad_year.focus();
		 return false;
	}
	
	// email address validation
	var emailID = document.frm_write.email;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address.");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
	}
	
	var p = document.frm_write.pass.value;
	var c = document.frm_write.pass2.value;
	var pl = p.length;
	var cl = c.length;
	
	if(p == "" ) {
		alert("Please enter your Password.");
		 document.frm_write.pass.focus();
		 return false;
	}
	if( pl < 6)
	{
		alert("Password field character must be greater than 5.");
		document.frm_write.pass.focus();
		return false;
	}
	
	var strength = passwordStrength(p);
	if(strength == "Very Weak"){
	alert("Sorry! Your Password is very weak. Please try with a strong password.");
	document.frm_write.pass.value = '';
	document.frm_write.pass.focus();
	return false;
	}
	
	if(strength == "Weak"){
	alert("Sorry! Your Password is weak. Please try with a strong password.");
	document.frm_write.pass.value = '';
	document.frm_write.pass.focus();
	return false;
	}
	
	if(c == "" ) {
		 alert("Please enter Confirm Password.");
		 document.frm_write.pass2.focus();
		 return false;
	}
	
	/*if( cl < 6)
	{
		alert("Password field character must be greater than 5.");
		document.frm_write.pass2.focus();
		return false;
	}*/
	
	if(p != c){
	alert("Password and Confirm Password should match.");
	document.frm_write.pass2.focus();
	return false;
	}
	
	// address
	if(document.frm_write.address1.value =="")
	{
         alert("Please enter your Address1.");
		 document.frm_write.address1.focus();
		 return false;
	}
	
			// country
	if(document.frm_write.country.value =="")
	{
         alert("Please select your Country.");
		 document.frm_write.country.focus();
		 return false;
	}
	
	// state
	if(document.frm_write.country.value != "United States" && document.frm_write.country.value != "India")
	{
		if(document.frm_write.state_Other.value ==""){
			 alert("Please enter your State.");
			 document.frm_write.state_Other.focus();
			 return false;
		}
	}
	
	// city
	if(document.frm_write.city.value =="")
	{
         alert("Please enter your City.");
		 document.frm_write.city.focus();
		 return false;
	}
	
	
	// zip
	if(document.frm_write.zip.value =="")
	{
         alert("Please enter your Zip Code.");
		 document.frm_write.zip.focus();
		 return false;
	}
	
	var Phone=document.frm_write.phone_no
	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please Enter your Phone Number")
		Phone.focus();
		return false;
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		Phone.value="";
		Phone.focus();
		return false;
	}
	
	var Mobile=document.frm_write.mobile_no
	
	if ((Mobile.value==null)||(Mobile.value=="")){
		alert("Please Enter your Mobile Number");
		Mobile.focus();
		return false;
	}
	if (checkInternationalPhone(Mobile.value)==false){
		alert("Please Enter a Valid Mobile Number");
		Mobile.value="";
		Mobile.focus();
		return false
	}
		
	// checkbox => Terms & conditions
	if(!document.frm_write.check_rules.checked)
	{
		alert("Please Read the Terms & Conditions of InterviewZone.com and check the box below");
		document.frm_write.check_rules.focus();
		return false;
	 }
	 
	return true;
}

function popup(url) 
	{
		//alert(url);
		 params  = 'width='+screen.width;
		 params += ', height='+screen.height;
		 params += ', top=0, left=0'
		 params += ', status=1,scrollbars=1,resizable=1'
		 /* params += ', toolbar=1,location=1,menubar=1,directories=1,copyhistory=1'*/
		 params += ', fullscreen=yes';
		
		 newwin=window.open(url,'windowname4', params);
		 if (window.focus) {newwin.focus()}
		 return false;
	}
	
	function show_state() {
	var cnt_val = document.getElementById('country').value;
	//alert(cnt_val);
		if(cnt_val == "United States"){
		//alert(cnt_val);
		document.getElementById('div_US').style.display = 'block';
		document.getElementById('div_India').style.display = 'none';
		document.getElementById('div_Other').style.display = 'none';
		}
		else if(cnt_val == "India"){
		//alert(cnt_val);
		document.getElementById('div_India').style.display = 'block';
		document.getElementById('div_US').style.display = 'none';
		document.getElementById('div_Other').style.display = 'none';
		}
		else {
		//alert(cnt_val);
		document.getElementById('div_US').style.display = 'none';
		document.getElementById('div_India').style.display = 'none';
		document.getElementById('div_Other').style.display = 'block';
		}
	}
	
	
	function check_show(id){
		if(document.getElementById(id).checked){
			document.getElementById('div1').style.display = "block";
		}
		if(!document.getElementById(id).checked){
			document.getElementById('div1').style.display = "none";
		}
	}

	
	function show_calendar(id){
	//alert(id);
	mCal = new dhtmlxCalendarObject(id, true);  
	mCal.show();
	mCal.setSkin("vista"); 
	mCal.setDateFormat("%M %d, %Y");
	}
	
	
