	img_dir = "";
	 bname = navigator.appName;
     bver = parseFloat(navigator.appVersion);    
     v4=false;
     if (bver >= 4)
     	{
 		v4=true;

 		home1=new Image(); 
 		home1.src=img_dir + "images/mnu_home.gif"; 
 		home2=new Image ();
 		home2.src=img_dir + "images/mnu_home_.gif"; 

		mnu_family_search1=new Image(); 
 		mnu_family_search1.src=img_dir + "images/mnu_family_search.gif"; 
 		mnu_family_search2=new Image ();
 		mnu_family_search2.src=img_dir + "images/mnu_family_search_.gif"; 
		
		mnu_nanny_search1=new Image(); 
 		mnu_nanny_search1.src=img_dir + "images/mnu_nanny_search.gif"; 
 		mnu_nanny_search2=new Image ();
 		mnu_nanny_search2.src=img_dir + "images/mnu_nanny_search_.gif"; 

		mnu_family_reg1=new Image(); 
 		mnu_family_reg1.src=img_dir + "images/mnu_family_reg.gif"; 
 		mnu_family_reg2=new Image ();
 		mnu_family_reg2.src=img_dir + "images/mnu_family_reg_.gif"; 
		
		mnu_nanny_reg1=new Image(); 
 		mnu_nanny_reg1.src=img_dir + "images/mnu_nanny_reg.gif"; 
 		mnu_nanny_reg2=new Image ();
 		mnu_nanny_reg2.src=img_dir + "images/mnu_nanny_reg_.gif"; 
		
		mnu_family_rega1=new Image(); 
 		mnu_family_rega1.src=img_dir + "images/mnu_family_reg.gif"; 
 		mnu_family_rega2=new Image ();
 		mnu_family_rega2.src=img_dir + "images/mnu_family_reg_.gif"; 
		
		mnu_nanny_rega1=new Image(); 
 		mnu_nanny_rega1.src=img_dir + "images/mnu_nanny_reg.gif"; 
 		mnu_nanny_rega2=new Image ();
 		mnu_nanny_rega2.src=img_dir + "images/mnu_nanny_reg_.gif"; 

		mnu_testimonials1 = new Image(); 
 		mnu_testimonials1.src = img_dir + "images/mnu_testimonials.gif"; 
 		mnu_testimonials2 = new Image ();
 		mnu_testimonials2.src = img_dir + "images/mnu_testimonials_.gif"; 
 		
		mnu_useful_links1 = new Image(); 
 		mnu_useful_links1.src = img_dir + "images/mnu_useful_links.gif"; 
 		mnu_useful_links2 = new Image ();
 		mnu_useful_links2.src = img_dir + "images/mnu_useful_links_.gif"; 
 		
		helper_profile1 = new Image();
 		helper_profile1.src=img_dir + "images/mnu_helper_profile.gif"; 
		helper_profile2 = new Image();
 		helper_profile2.src=img_dir + "images/mnu_helper_profile_.gif"; 
 	}
     else (alert("WARNING !!! Your browser is too old and will not display the page optimally !\n           Please upgrade\n        Download it FREE from http://www.firefox.com !"));

	 var canada_area_codes = ['204', '226', '236', '249', '250', '289', 
		'306', '343', 
		'403', '416', '418', '438', '450', 
		'506', '514', '519', '579', '581', '587', 
		'600', '604', '613', '647', 
		'705', '709', '778', '780', 
		'807', '819', '867', '902', '905'];     

function isCanadaAreaCode(area_code){
	for (var i=0; i<canada_area_codes.length; i++) {
		if (canada_area_codes[i] == area_code){
			return true;
		}
	}
	return false;
}

function hilight(imagE){
	if (v4) {
		document [imagE].src=eval(imagE+"2.src");
	}
}
 
function lolight(imagE){
	if (v4) {
		document [imagE].src=eval(imagE+"1.src");
	}
}
function openWin( windowURL, windowName, windowFeatures ) { 
	return window.open( windowURL, windowName, windowFeatures ) ; 
} 

function openThin(url, name, width, height){
	open(url, name,"width="+width+",height="+height+",left=50,top=50,toolbar=no,scrollbars=yes,status=yes");
}

function openThin2(url, name, width, height){
	open(url, name,"width="+width+",height="+height+",left=50,top=50,toolbar=no,scrollbars=yes,status=yes,resizable=yes");
}

function openSimple(url, name){
	newWindow = openWin( url, name, 'width=600,height=500,toolbar=0,location=1,directories=0,status=1,menuBar=1,scrollBars=1,resizable=1' ); 
	newWindow.focus();
	return newWindow;
}
function getCenterLeft(width){
	leftVal = (screen.width - width) / 2;
	return leftVal;
}
function getCenterTop(height){
	topVal = (screen.height - height) / 2;
	return topVal;
}
function openCenterWin(url, name, width, height, etc){
	var left = getCenterLeft(width);
	var top = getCenterTop(height);
	var w = window.open(url, name, "width="+width+",height="+height + ",left=" + left + ",top="+top + ","  + etc);
	w.focus();
	return w;
}
function showExternalSite(url, name){
	var width = 600 ;
	var height = 500;
	openCenterWin(url, name, width, height, "status,scrollbars,resizable=yes");
}
function showPrivacyStatement(){
	var width =400 ;
	var height = 400;
	openCenterWin("privacy.html", "privacy", width, height, "status,scrollbars,resizable=yes");
}
function showTermsofUse(){
	var width =400 ;
	var height = 400;
	openCenterWin("terms_of_use.html", "terms", width, height, "status,scrollbars,resizable=yes");
}
function showMembershipAgreement(type){
	var width =400 ;
	var height = 400;
	openCenterWin("membership_agreement.php?type=" + type, "terms", width, height, "status,scrollbars,resizable=yes");
}
function showInquiryForm(params){
	var width =420 ;
	var height = 380;
	openCenterWin("inquiry_form.php?" + params, "inquiry", width, height, "status,scrollbars,resizable=yes");
}
function showMedicalExam(){
	var width =420 ;
	var height = 380;
	openCenterWin("medical_examination.php", "medical_examination", width, height, "status,scrollbars,resizable=yes");
}
function showAirTicket(){
	var width =420 ;
	var height = 380;
	openCenterWin("air_ticket.php", "air_ticket", width, height, "status,scrollbars,resizable=yes");
}
function showInsurance(){
	var width =420 ;
	var height = 380;
	openCenterWin("insurance.php", "insurance", width, height, "status,scrollbars,resizable=yes");
}
function showNannyStatusHelpFromAdmin(){
	var width =420 ;
	var height = 380;
	openCenterWin("../status_help.php?type=N", "help", width, height, "status,scrollbars,resizable=yes");
}
function showFamilyStatusHelpFromAdmin(){
	var width =420 ;
	var height = 380;
	openCenterWin("../status_help.php?type=F", "help", width, height, "status,scrollbars,resizable=yes");
}
function showStatusHelp(){
	var width =420 ;
	var height = 380;
	openCenterWin("status_help.php", "help", width, height, "status,scrollbars,resizable=yes");
}
function showSampleTerminationLetter(){
	var width =600 ;
	var height = 600;
	openCenterWin("sample_termination_letter.pdf", "sample_termination", width, height, "status,scrollbars,resizable=yes");
}
function showSampleReceipt(){
	var width =600 ;
	var height = 600;
	openCenterWin("sample_receipt.pdf", "sample_receipt", width, height, "status,scrollbars,resizable=yes");
}
function showPicture($pic_url){
	var width =600 ;
	var height = 480;
	openCenterWin($pic_url, "pic", width, height, "status,scrollbars,resizable=yes");
}
function isValidEmail(emailEdit){
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = emailEdit.value;
   return (reg.test(address));
}
function capitalizeAndTrim(inputText){
	result = inputText.value.toUpperCase();
	result = result.replace(/ /gi, '');
	inputText.value = result;
}
function lowerCaseAndTrim(inputText){
	result = inputText.value.toLowerCase();
	result = result.replace(/ /gi, '');
	inputText.value = result;
}
function checkContactForm(form) {
  if (!form.name.value){
  	alert("Please Fill in Your Name.");
  	form.name.focus();
  }else if (!form.email.value){
  	alert("Please Fill in Your E-mail Address");
	form.email.focus();
  }else if (!isValidEmail(form.email)){
  	alert("Invalid Email Address, Please Correct It");
	form.email.focus();
  }else if (!form.telephone.value) {
  	alert("Please Fill in Your Telephone No.");
	form.telephone.focus();
  }else form.submit();
}
function checkMedExamForm(form) {
  if (!form.name.value){
  	alert("Please Fill in Your Name.");
  	form.name.focus();
  }else if (!form.telephone.value) {
  	alert("Please Fill in Your Telephone No.");
	form.telephone.focus();
  }else form.submit();
}
function checkFamiliesForm(form) {
  if (!form.name.value){
  	alert("Please Fill in Your Name.");
  	form.name.focus();
  }else if (!form.email.value){
  	alert("Please Fill in Your E-mail Address");
	form.email.focus();
  }else if (!isValidEmail(form.email)){
  	alert("Invalid Email Address, Please Correct It");
	form.email.focus();
  }else if (!form.password.value){
  	alert("Please Fill in Your Password");
	form.password.focus();
  }else if (form.password.value != form.password2.value){
  	alert("Password and Confirm Password are the equal, Please re-enter.");
	form.password.focus();
  }else form.submit();
}
function validateMandatoryDate(control, aDesc){
	if (control && ((control.value=="//") || (control.value==""))){
		alert("You must fill in the " + aDesc);
		hilightMandatoryChange(control);
		control.focus();
		return false;
	}
	return true;
}
function validateMandatoryCheckboxes(name, aDesc){
	var controls = document.getElementsByName(name);
	for (i=0; i<controls.length; i++){
		if (controls[i].checked)
			return true;
	}
	alert("You must fill in the " + aDesc);
	controls[0].focus();
	return false;
}
function hilightMandatory(control){
	if ($(control)){
		$(control).attr('class', 'mandatory-violation');
		$(control).unbind("keypress").bind("keypress", function () {$(this).removeClass('mandatory-violation');});				
		$(control).unbind("click").bind("click", function () {$(this).removeClass('mandatory-violation');});
	}
}
function hilightMandatoryChange(control){
	if ($(control)){
		$(control).attr('class', 'mandatory-violation');
		$(control).unbind("keypress").bind("keypress", function () {$(this).removeClass('mandatory-violation');});				
		$(control).unbind("click").bind("click", function () {$(this).removeClass('mandatory-violation');});
		$(control).unbind("change").bind("change", function () {$(this).removeClass('mandatory-violation');});
	}
}
function hilightMandatoryChangeOnly(control){
	if ($(control)){
		$(control).attr('class', 'mandatory-violation');
		$(control).unbind("change").bind("change", function () {$(this).removeClass('mandatory-violation');});
	}
}
function validateMandatory(control, aDesc){
	if (!control){
		return true;
	}
	sType = control.type;
	if ((sType=="text") || (sType=="password") || (sType=="textarea")){
		if (control.value==""){
			alert("You must fill in the " + aDesc);
			hilightMandatory(control);
			control.focus();
			return false;
		}
	}
	if (sType=="select-one"){
		if (control.value==""){
			alert("You must fill in the " + aDesc);
			hilightMandatoryChangeOnly(control);
			control.focus();
			return false;
		}
	}

	if (sType=="checkbox"){
		if (!control.checked){
			alert("You must check the " + aDesc);
			control.focus();
			return false;
		}
	}

	return true;
}
function validateEmail(control, aDesc){
	if (!isValidEmail(control)){
		alert(aDesc + " is an invalid email address. Please re-enter");
		hilightMandatory(control);
		control.focus;
		return false;
	}
	return true;
}
function validateEducationLevel(control){
	if (!control){
		return true;
	}
	if ( (control.value=="COLLEGE_LESS_2") || (control.value == 'HIGH_SCHOOL') ){
		alert("Your education level does not meet with the minimum requirement. We cannot accept your application. Sorry!");
		hilightMandatory(control);
		control.focus();
		return false;
	}
	return true;
}
function setCheckbox(field, state) {
	for (i = 0; i < field.length; i++) {
		field[i].checked = state;
	}
}
function setCheckboxByValue(field, value, state) {
	for (i = 0; i < field.length; i++) {
		if (field[i].value == value){
			field[i].checked = state;
		}
	}
}

function validateImageFilename(control, aDesc){
	if (control && control.value != ""){
		var filename = control.value.toLowerCase();
		var parts = filename.split('.');
		var ext = parts[parts.length-1];
		
		if (ext != "jpg" && ext != "gif" && ext != "png"){
			alert("Only jpg, gif, png extention file are allowed for " + aDesc);
			control.focus();
			return false;
		}
	}
	return true;
}
function validateDocFilename(control, aDesc){
	if (control && control.value != ""){
		var filename = control.value.toLowerCase();
		var parts = filename.split('.');
		var ext = parts[parts.length-1];
		
		if (ext != "jpg" && ext != "gif" && ext != "png" && ext != "doc" && ext != "docx" && ext != "pdf"){
			alert("Only jpg, gif, png, doc, docx, pdf extention file are allowed for " + aDesc);
			control.focus();
			return false;
		}
	}
	return true;
}
function showPaymentWindow(params){
	var width =500 ;
	var height = 400;
	openCenterWin("add_payment.php?" + params, "privacy", width, height, "status,scrollbars,resizable=yes");
}
function anyHasValue(start, position, finish, location, duties, reason){
	return (start && start.value!='')
		|| (position && position.value!='')
		|| (finish && finish.value!='')
		|| (location && location.value!='')
		|| (duties && duties.value!='')
		|| (reason && reason.value!='')
		;
}
//function markMissingVal(start, position, finish, location, duties, reason){
//	var msg = '';
//	if (start && start.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'Start Date';
//	}
//	if (position && position.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'Position';
//	}
//	if (finish && finish.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'Finish Date';
//	}
//	if (location && location.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'Location';
//	}
//	if (start && start.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'duties';
//	}
//	if (start && start.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'Start Date';
//	}
//	if (start && start.value == '') {
//		if (msg != '') msg = msg + ', ';
//		msg = msg + 'Start Date';
//	}
//}
function checkNanny2(form){
	var valMand = validateMandatory(form.experience, "Experience Summary")
	&& validateMandatory(form.exp_from_month_year1, "1. My Job Experiences: Start Date") 
	&& validateMandatory(form.exp_job_type1, "1. My Job Experiences: Position") 
	&& validateMandatory(form.exp_to_month_year1, "1. My Job Experiences: Finish Date") 
	&& validateMandatory(form.exp_location1, "1. My Job Experiences: Location") 
	&& validateMandatory(form.exp_main_duties1, "1. My Job Experiences: Main Duties") 
	&& validateMandatory(form.exp_reason_leaving1, "1. My Job Experiences: Reason for Leaving") 
	&& validateMandatory(form.enjoy_cooking, "Do you enjoy cooking?") 
	&& validateMandatory(form.cooking_skill, "How does your cooking skills?") 
	&& validateMandatory(form.why_choose_me, "Why choose me as your nanny")
	; 
	
	if (!valMand) return false;
	
	//check other exp
	if (anyHasValue(form.exp_from_month_year2, form.exp_job_type2, form.exp_to_month_year2,
			form.exp_location2, form.exp_main_duties2, form.exp_reason_leaving2)){
		var preDesc = '2. ';
		var mand2 = validateMandatory(form.exp_from_month_year2, preDesc + "My Job Experiences: Start Date") 
		&& validateMandatory(form.exp_job_type2, preDesc + "My Job Experiences: Position") 
		&& validateMandatory(form.exp_to_month_year2, preDesc + "My Job Experiences: Finish Date") 
		&& validateMandatory(form.exp_location2, preDesc + "My Job Experiences: Location") 
		&& validateMandatory(form.exp_main_duties2, preDesc + "My Job Experiences: Main Duties") 
		&& validateMandatory(form.exp_reason_leaving2, preDesc + "My Job Experiences: Reason for Leaving");
		if (!mand2)
			return false;
	}
		
	//check other exp
	if (anyHasValue(form.exp_from_month_year3, form.exp_job_type3, form.exp_to_month_year3,
			form.exp_location3, form.exp_main_duties3, form.exp_reason_leaving3)){
		var preDesc = '3. ';
		var mand2 = validateMandatory(form.exp_from_month_year3, preDesc + "My Job Experiences: Start Date") 
		&& validateMandatory(form.exp_job_type3, preDesc + "My Job Experiences: Position") 
		&& validateMandatory(form.exp_to_month_year3, preDesc + "My Job Experiences: Finish Date") 
		&& validateMandatory(form.exp_location3, preDesc + "My Job Experiences: Location") 
		&& validateMandatory(form.exp_main_duties3, preDesc + "My Job Experiences: Main Duties") 
		&& validateMandatory(form.exp_reason_leaving3, preDesc + "My Job Experiences: Reason for Leaving");
		if (!mand2)
			return false;
	}
	
	//check other exp
	if (anyHasValue(form.exp_from_month_year4, form.exp_job_type4, form.exp_to_month_year4,
			form.exp_location4, form.exp_main_duties4, form.exp_reason_leaving4)){
		var preDesc = '4. ';
		var mand2 = validateMandatory(form.exp_from_month_year4, preDesc + "My Job Experiences: Start Date") 
		&& validateMandatory(form.exp_job_type4, preDesc + "My Job Experiences: Position") 
		&& validateMandatory(form.exp_to_month_year4, preDesc + "My Job Experiences: Finish Date") 
		&& validateMandatory(form.exp_location4, preDesc + "My Job Experiences: Location") 
		&& validateMandatory(form.exp_main_duties4, preDesc + "My Job Experiences: Main Duties") 
		&& validateMandatory(form.exp_reason_leaving4, preDesc + "My Job Experiences: Reason for Leaving");
		if (!mand2)
			return false;
	}
	
	//check other exp
	if (anyHasValue(form.exp_from_month_year5, form.exp_job_type5, form.exp_to_month_year5,
			form.exp_location5, form.exp_main_duties5, form.exp_reason_leaving5)){
		var preDesc = '5. ';
		var mand2 = validateMandatory(form.exp_from_month_year5, preDesc + "My Job Experiences: Start Date") 
		&& validateMandatory(form.exp_job_type5, preDesc + "My Job Experiences: Position") 
		&& validateMandatory(form.exp_to_month_year5, preDesc + "My Job Experiences: Finish Date") 
		&& validateMandatory(form.exp_location5, preDesc + "My Job Experiences: Location") 
		&& validateMandatory(form.exp_main_duties5, preDesc + "My Job Experiences: Main Duties") 
		&& validateMandatory(form.exp_reason_leaving5, preDesc + "My Job Experiences: Reason for Leaving");
		if (!mand2)
			return false;
	}
	return true;
}
function checkNanny1(form){
	var mandatoryValidated = validateMandatory(form.email, "Email") 
	&& validateMandatory(form.password, "Password") 
	&& validateMandatory(form.confirm_password, "Confirm Password") 
	&& validateMandatory(form.first_name, "First Name") 
	&& validateMandatory(form.middle_initial, "Middle Initial")
	&& validateMandatory(form.last_name, "Last Name") 
	&& validateMandatoryDate(form.date_of_birth, "Date of Birth")
	&& validateMandatory(form.nationality, "Nationality")
	&& validateMandatory(form.height, "Height")
	&& validateMandatory(form.weight, "Weight")
	&& validateMandatory(form.spoken_language, "My Spoken Language")
	&& validateMandatory(form.marital_status, "Marital Status")
	&& validateMandatory(form.children_details, "Number and Ages of Children")
	&& validateMandatory(form.education_level, "Education Level")
	&& validateMandatory(form.religion, "Religion")
	&& validateMandatory(form.location, "Current Location")
	&& validateMandatory(form.phone, "Phone No.")
	&& validateMandatory(form.searchable, "Searchable by Family")
	&& validateMandatory(form.sibling, "Do you have brothers or sisters?")
	&& validateMandatory(form.sibling_details, "If yes, please provide their ages")
	&& validateMandatory(form.allergies, "Do you have any allergies?")
	&& validateMandatory(form.health_problems, "Do you have any health problems may prevent you from doing the essential duties of your job?")
	&& validateMandatory(form.smoke, "Do you smoke?")
	&& validateMandatory(form.alcohol, "Do you drink alcohol?")
	&& validateMandatory(form.swim, "Can you swim? If yes, how well do you swim?")
	&& validateMandatory(form.musical_instruments, "Do you play any musical instruments? If yes, please specify:")
	&& validateMandatory(form.drivers_license, "Do you have an International Driver's License?")
	&& validateMandatoryCheckboxes("preferred_location[]", "Preferred Location")
	&& validateMandatory(form.year_graduate, "Year of Graduation")
	&& validateMandatory(form.college, "Name of College")
	&& validateMandatory(form.diploma_achived, "Course Studied")
	&& validateMandatory(form.years_studied, "Years of Studied")
	&& validateMandatory(form.cpr_course, "Have you taken First Aid or CPR course?")
	&& validateMandatory(form.verification_text, "Verification Code")
	;
	
	if (!mandatoryValidated){
		return false;
	}

	if (!validateEducationLevel(form.education_level)){
		return false;
	}	
	return true;
}
function checkNanny3(form){
	return validateDocFilename(form.cert1, "Certificate 1")
		&& validateDocFilename(form.cert2, "Certificate 2")
		&& validateDocFilename(form.cert3, "Certificate 3")
		&& validateDocFilename(form.cert4, "Certificate 4")
		&& validateDocFilename(form.cert5, "Certificate 5")
		&& validateImageFilename(form.photo1, "Photo 1")
		&& validateImageFilename(form.photo2, "Photo 2")
		&& validateImageFilename(form.photo3, "Photo 3");	
	
}
function checkFamily3(form){
	return validateImageFilename(form.location_map, "Location Map")
		&& validateImageFilename(form.photo1, "My Photo 1")
		&& validateImageFilename(form.photo2, "My Photo 2")
		&& validateImageFilename(form.photo3, "My Photo 3");
}
