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];}
}


/*====================================================================================*/

//Validate ExistingFranchisors from
function Validate_ExistingFranchisors(frm)
{
	with(frm)
	{
		if(!IsEmpty(owner_name,"Please enter owner name"))
			return false;

		if(!IsEmpty(company_name,"Please enter company name"))
			return false;

		if(!IsEmpty(other_person,"Please enter Person other than owner completing this Form"))
			return false;

		if(!IsEmpty(phone,"Please enter phone"))
			return false;

		if(!IsEmpty(cell_phone,"Please enter cell phone"))
			return false;

		if(!IsEmpty(email,"Please enter email"))
			return false;
			
		if(!IsEmail(email,"Please enter valid email"))
			return false;
	
		if(!IsEmpty(website,"Please enter website url"))
			return false;
		
		if(!IsEmpty(business_desc,"Please enter business description"))
			return false;
		
		if(!IsEmpty(year,"Please enter year began franchising"))
			return false;
			
		if(!IsEmpty(hearabout,"Please enter where did you hear about us?"))
			return false;	
		
		frm.submit();
		return true;
	}
}

//Validate Needs Assesment analysis form
function Validate_NeedsAssess(frm)
{
	with(frm)
	{
		if(!IsEmpty(owner_name,"Please enter owner's name"))
			return false;

		if(!IsEmpty(company_name,"Please enter company's name"))
			return false;

		if(!IsEmpty(other_person,"Please enter Person other than owner completing this Form"))
			return false;

		if(!IsEmpty(title,"Please enter title"))
			return false;
						
		if(!IsEmpty(address,"Please enter address"))
			return false;

		if(!IsEmpty(city,"Please enter city"))
			return false;
			
		if(!IsEmpty(zip,"Please enter zipcode"))
			return false;
			
		if(!IsEmpty(title,"Please enter zip"))
			return false;

		if(!IsEmpty(phone,"Please enter phone"))
			return false;

		if(!IsEmpty(cell_phone,"Please enter cell phone"))
			return false;

		if(!IsEmpty(email,"Please enter email"))
			return false;
			
		if(!IsEmail(email,"Please enter valid email"))
			return false;
	
		if(!IsEmpty(website,"Please enter website url"))
			return false;
			
		if(!IsEmpty(timeforcontact,"Please enter best time for contact"))
			return false;
		
		if(!IsEmpty(business_desc,"Please enter business description"))
			return false;
		
		if(!IsEmpty(year,"Please enter year began franchising"))
			return false;
			
		if(!IsEmpty(location,"Please enter US franchised locations"))
			return false;
		
		if(hearabout.value == "" &&  referredby.value == "")
		{
			alert("Please enter where did you hear about us or who reffered you to us?");
			return false;
		}
		
		frm.submit();
		return true;
	}
}

//validate Survey Form pid=16
function Validate_Survey_Form(frm)
{
	with(frm)
    {		
		if(!IsEmpty(name, 'Please, Enter Name.'))
		{
			return false;
		}
		if(!IsEmpty(cname, 'Please, Enter Company Name.'))
		{
			return false;
		}
		if(!IsEmpty(address, 'Please, Enter Address.'))
		{
			return false;
		}
		if(!IsEmpty(city, 'Please, Enter City Name.'))
		{
			return false;
		}
		if(!IsEmpty(zipcode, 'Please, Enter Zipcode.'))
		{
			return false;
		}
		if(!IsEmpty(phone, 'Please, Enter Phone Number.'))
		{
			return false;
		}
		if(!IsEmpty(cphone, 'Please, Enter Cell Phone Number.'))
		{
			return false;
		}
		if(!IsEmail(email, 'Enter Valid Email Address.'))
		{
			return false;
		}
		if(!IsEmpty(website, 'Please, Enter Website Name.'))
		{
			return false;
		}
		if(!IsEmpty(contacttime, 'Please, Enter Contact Time.'))
		{
			return false;
		}
		
		if(hearfrom.value=='' && reffered.value=='')
		{
			if(!IsEmpty(hearfrom, 'Please, Enter Where did you hear about us?'))
			{
				return false;
			}
		}
		if(hearfrom.value=='')
		{
			if(!IsEmpty(reffered, 'Please, Enter Referred By.'))
			{
				return false;
			}
		}
		if(reffered.value=='')
		{
			if(!IsEmpty(hearfrom, 'Please, Enter Where did you hear about us?'))
			{
				return false;
			}
		}
		
		if(!IsEmpty(bdesc, 'Please, Enter BRIEF Description of Your Business.'))
		{
			return false;
		}
		if(!IsEmpty(comments, 'Please, Enter Comments.'))
		{
			return false;
		}
	}
	frm.submit();
	return true;
}	

//Validate ExistingFranchisors from
function Validate_PreEvaluation(frm, reqType)
{
	with(frm)
	{
		if(!IsEmpty(name,"Please enter name"))
			return false;

		if(!IsEmpty(phone,"Please enter phone"))
			return false;

		if(!IsEmpty(cphone,"Please enter cell phone"))
			return false;

		if(!IsEmpty(email,"Please enter email"))
			return false;
			
		if(!IsEmail(email,"Please enter valid email"))
			return false;

		req_type.value = reqType;
		
		frm.submit();
		return true;
	}
}