function IsEmpty( inputStr ) { if ( null == inputStr || "" == inputStr ) { return true; } return false; }

function ValidateForm(form) {
var errmsg = "";
var newline = "\n";
var txtFocusControlName = "";
var Ok = true;


if(IsEmpty(form.applicantName.value))
   	{
      	errmsg = errmsg + ">>Contact name required.";
      	if (txtFocusControlName=="") txtFocusControlName = 'applicantName';
      	Ok  = false ;
      	document.getElementById('LabAppname').className = "redText";
      	document.getElementById('NameErrorCol').innerHTML = 'Please provide Name';
   	}
	else 
   {
		document.getElementById('LabAppname').className = "blueText";
		document.getElementById('NameErrorCol').innerHTML = '';
   	}
	
	
if(IsEmpty(form.applicantEmail.value))
   {
   	  	errmsg = errmsg + newline + ">>Email address cannot be blank.";
      	if (txtFocusControlName =="") txtFocusControlName = 'applicantEmail';
      	Ok  = false ;
      	document.getElementById('EmailErrorCol').innerHTML = 'Email Address Required.';
   }
   else 
   {
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.applicantEmail.value)))
	   		{
   	  			errmsg = errmsg + newline + ">>Not a valid email address.";
     	  		if (txtFocusControlName =="") txtFocusControlName = 'applicantEmail';
          		document.getElementById('EmailErrorCol').innerHTML ='Invalid Email address.' ;
          		Ok  = false ;
     	  	}
          	else 
			{ 
				document.getElementById('EmailErrorCol').innerHTML ='';
			}
    }
	
	
if(IsEmpty(form.applicantCountry.value) || form.applicantCountry.value=="Please Select One")
   	{
   	  	errmsg = errmsg + newline + ">>Country of residence required.";
      	if (txtFocusControlName=="") txtFocusControlName = 'applicantCountry';
       	document.getElementById('CtryErrorCol').innerHTML ='Country is required.';
      	Ok  = false ;
   	}
   	else 
	{ 
		if (form.applicantCountry.value=='UK')
   	    	{
   	      		var FoundIt = '';
				var obj=document.forms[1].UkStatus;
   	      		for (i=0;i<obj.length;i++) 
					{
	      				if (obj[i].checked) 
							{
	      						FoundIt = obj[i].value;
	      					}
	      			}
	       	if (IsEmpty(FoundIt))
		   		{
	          		errmsg = errmsg + newline + ">>UK Status option is required .";
	           		if (txtFocusControlName=="") txtFocusControlName = 'UkStatus';
	           		Ok  = false ;
	           		document.getElementById('ukStatusErrorCol').innerHTML ='With the UK a Status is required.';
     		    }
              	else 
			   	{
					document.getElementById('ukStatusErrorCol').innerHTML =''
				}	 	
   	    	}
         	else 
			{
				document.getElementById('ukStatusErrorCol').innerHTML =''
			}
	} 
if (Ok) 
	{
		return true ;
	}
	else
	{
		//document.getElementById(txtFocusControlName).focus();
		return false;
	}


}



function ActionPopup(OptionSelected) {
var Residency = OptionSelected.value ;
$("#Submit").show();
$('.adds').css("display","none");
    switch (Residency)
	{
        case "USA":
			$("#usaAdd").show();
			$("#Submit").hide();
			break;
        case "UK":
			$("#ukAdd").show();
		 	break;
    }
}



function openTermsOfUse()

{
      emailwindow=dhtmlmodal.open('TermsOfUse', 'div', 'MaskedUSADiv', 'Terms of Use', 'width=720px,height=570px,center=1,resize=0,scrolling=0')

}

