<!--
/*
Form2Pop Script- By Peter Bailey (http://www.peterbailey.net)
Featured on JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
*/
function createTarget(t){
	window.open("", t, "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=650");
	return true;
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function frmChecker(){
	var subYN = "true";
	var errMsg = "The form could not be submitted due to the following blank fields:\n----------------------------------------------------------------------------";

	//get the values of the radio buttons
	var rbWorkRest = get_radio_value("restaurant_yn"); 
	var rbParther = get_radio_value("partner_yn");

	if(document.franchiseForm.name.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nName"
	}
	if(document.franchiseForm.address.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nAddress"
	}
	if(document.franchiseForm.city.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nCity"
	}
	if(document.franchiseForm.country.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nCountry"
	}
	if(document.franchiseForm.ctry_code.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nCountry Code"
	}
	if(document.franchiseForm.years.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nYears"
	}
	if(document.franchiseForm.bus_phone.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nBusiness Phone"
	}
	if(document.franchiseForm.home_phone.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nHome Phone"
	}
	if(document.franchiseForm.email.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nEmail"
	}
	if(document.franchiseForm.citizen.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nCitizenship"
	}
	if(document.franchiseForm.residence.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nPermanent Residence"
	}
	if(document.franchiseForm.status.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nImmigration Status"
	}
	/*if(document.franchiseForm.restaurant_yn.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nPreviously Workd in the Restaurant Industry"
	}*/
	if(rbWorkRest == 'yes') {
		if(document.franchiseForm.restaurant_y.value == ''){
		subYN = "false"	
		errMsg = errMsg + "\nPresent and Past Restaurant Industry Experience"
		}
	}
	if(rbWorkRest == 'no') {
		if(document.franchiseForm.restaurant_n.value == ''){
		subYN = "false"	
		errMsg = errMsg + "\nCurrent Business and Position"
		}
	}
	if(rbParther == 'yes') {
		if(document.franchiseForm.partnerBrief.value == ''){
			subYN = "false"	
			errMsg = errMsg + "\nPartner Brief Background Description"
		}
		
		if(document.franchiseForm.parterPercent.value == ''){
			subYN = "false"	
			errMsg = errMsg + "\nEquity Partner Percentage"
		}
		
		if(document.franchiseForm.pers_worth2.value == '') {
			subYN = "false"	
			errMsg = errMsg + "\nPartner 1 Approximate Personal Net Worth"
		}
		
		if(document.franchiseForm.pers_cash2.value == '') {
			subYN = "false"	
			errMsg = errMsg + "\nPartner 1 Approximate Personal Cash Available"
		}
		
		if(document.franchiseForm.bus_worth2.value == '') {
			subYN = "false"	
			errMsg = errMsg + "\nPartner 1 Approximate Business Net Worth"
		}
		
		if(document.franchiseForm.bus_cash2.value == '') {
			subYN = "false"	
			errMsg = errMsg + "\nPartner 1 Approximate Business Cash Available"
		}
	}
	if(document.franchiseForm.companyExp.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nOperating and Development Experience"
	}
	if(document.franchiseForm.pers_worth1.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nApproximate Personal Net Worth"
	}
	if(document.franchiseForm.pers_cash1.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nApproximate Personal Cash Available"
	}
	if(document.franchiseForm.bus_worth1.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nApproximate Business Net Worth"
	}
	if(document.franchiseForm.bus_cash1.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nApproximate Business Cash Available"
	}
	
	if(document.franchiseForm.prelimPlans.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nPreliminary Plans for Financing "
	}
	if(document.franchiseForm.countryInterest.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nCountry of Interest"
	}
	if(document.franchiseForm.futureDev.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nApproximate Personal Cash Available"
	}
	if(document.franchiseForm.sign.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nDigital Signature"
	}
	if(document.franchiseForm.signDate.value == '') {
		subYN = "false"	
		errMsg = errMsg + "\nSignature Date"
	}

	
	if (subYN == "false"){
		alert(errMsg);
		return false;
	}
	
}

function get_radio_value(checker){
	var radioVal
	if(checker == 'restaurant_yn')  {
		for (var i=0; i < document.franchiseForm.restaurant_yn.length; i++) {
		   if (document.franchiseForm.restaurant_yn[i].checked) {
			  return document.franchiseForm.restaurant_yn[i].value;
		   }
		}
	}

	if(checker == 'partner_yn')  {
		for (var i=0; i < document.franchiseForm.partner_yn.length; i++) {
		   if (document.franchiseForm.partner_yn[i].checked) {
			  return document.franchiseForm.partner_yn[i].value;
		  }
	   }
	} 
	
 }
//-->

