// JavaScript Document
function doLink(nUrl) {
var urlStr = nUrl + "?var1=" + variable1 + "&var2=" + variable2;
window.open(urlStr,'_blank','');
}

function checktimeinaddress(obj)
	{
		if(obj.value == "Less than Three Years")
			{
				$('#timeinaddresscomment').show();
			}
			else
			{
				$('#timeinaddresscomment').hide();
			}
	}
function checksecondapplicant(obj)
	{
		if (obj.checked) 
			{
				document.getElementById('secondapplicantcontainer').style.display="block";
			}
			else
			{
				document.getElementById('secondapplicantcontainer').style.display="none";
			}
	}
function checkcorrespondence(obj)
	{
		if (obj.checked) 
			{
				document.getElementById('correspondencecontainer').style.display="block";
			}
			else
			{
				document.getElementById('correspondencecontainer').style.display="none";
			}
	}

function setSelectIndex(objname, value)
	{
	var obj=document.getElementById(objname);
		for (i=0;i<obj.options.length;i++)
			{
				if (obj.options[i].index==value) 
					{	
						obj.options.selectedIndex=i;
					}
				
			}
	}

function checkUS(obj)
	{
		if (obj.value == 'United States')
			{
				alert('This product is not available for US Residents!');
				document.getElementById('Submit').disabled= true;
			}
			else
			{
				document.getElementById('Submit').disabled= false;
			}
	}


var homeAddress = "";
var corhomePhone;
var correspondanceAddressZip;
var homeAddressCountry;


function InitSaveVariables(form) 
	{
		data_correspondanceaddress = form.data_correspondanceaddress.value;
		data_correspondanceaddresszip = form.data_correspondanceaddresszip.value;
		data_homeaddresscountry = document.getElementById('data_correspondanceaddresscountry').selectedIndex;
	}

function CopyAddress(form) 
	{
		if (form.data_copy.checked) 
			{
				InitSaveVariables(form);
				form.data_correspondanceaddress.value = form.data_homeaddress.value;
				form.data_correspondanceaddresszip.value = form.data_homeaddresszip.value;
				setSelectIndex('data_correspondanceaddresscountry', document.getElementById('data_homeaddresscountry').selectedIndex)
			}
			else 
			{
				form.data_correspondanceaddress.value = data_correspondanceaddress;
				form.data_correspondanceaddresszip.value = data_correspondanceaddresszip;
				setSelectIndex('data_correspondanceaddresscountry', data_homeaddresscountry)
			}
}



//This function is used to open a new page showing the applicant search results
function OpenPopup(form)
{
var Country = form.applicantCountry.value ;
var FromDate = form.date1.value;
var ToDate = form.date2.value;
var Investor;
var SavePath = form.saveFilePath.value;
var checkboxVal;
if(form.printOption.checked == true)
{ checkboxVal = 'on';
}
var checkbox;

for (var i=0; i < form.myradio.length; i++)
   {
   if (form.myradio[i].checked)
      {
      Investor = form.myradio[i].value;
      }
   }


var url = 'resultContacts.php?country=' + Country +'&fromDate=' + FromDate +'&toDate=' + ToDate +'&Investor=' + Investor +'&SavePath=' + SavePath + '&checkboxVal=' + checkboxVal;

bla = window.open(url,'mywindow','resizable=1,scrollbars=1,height=650,width=1400');
bla.focus();


}
//This script will not be used anymore

 
//This script will not be used anymore

function showHideText(box,id)
{

var elm = document.getElementById(id)
id = id + '2';
var elm2 = document.getElementById(id)

elm.style.visibility = box.checked? "visible":"hidden"
elm2.style.visibility = box.checked? "visible":"hidden"

} 




function valid_required(field)
{
         if(field=="")
		 	{
         		return false;
         	}
    return true;
}


function ValidateForm()
{
var errorFlag = 0;
var newline = "\n";
var txtFocusControlName = "";
//return true ;
//////////////////////////////////////////////////////////////////////////////////////

pd1 = new Array('docnumber', 'idtype','title','firstname','lastname','countryissue','townofbirth','birthcountry')
pd2 = new Array('docnumber', 'idtype','title','firstname','lastname','countryissue','townofbirth','birthcountry')
data = new Array('country','zip','street', 'town', 'housenumber','homephone','timeinaddress','email','contactmethod','emptype','pobt', 'terms');
corrdata = new Array('corrcountry','corrzip','corrstreet','corrtown','corrhousenumber');
function empty(obj)
	{
		if (document.getElementById(obj).type == 'text')
			{
				if (document.getElementById(obj).value=='') {return true} else {return false}
			}
		if (document.getElementById(obj).type == 'checkbox')
			{
				if (!document.getElementById(obj).checked) {return true} else {return false}
			}
		if (document.getElementById(obj).tagName == 'TEXTAREA')
			{
				if (document.getElementById(obj).value=='') {return true} else {return false}
			}
		if (document.getElementById(obj).tagName == 'SELECT')
			{
				if (document.getElementById(obj).value=='Please Select')
					{
						return true
					}
					else if (document.getElementById(obj).value=='Other')
					{
						if ((obj == 'pd1_title') && (document.getElementById('pd1_othertitle').value!='')) return false;
						if ((obj == 'pd2_title') && (document.getElementById('pd2_othertitle').value!='')) return false;
						if ((obj == 'data_emptype') && (document.getElementById('data_otheremp').value!='')) return false;
						return true
					}
					else 
					{
						return false
					}
			}
	}
function markerror(id)
	{
		errorFlag++;
		$('#qm_'+id).find('img').attr('src', 'BLME-images/helpm_button.png');
	}
function clearerror(id)
	{
		$('#qm_'+id).find('img').attr('src', 'BLME-images/help_button.png');
	}


if (document.getElementById('data_secondapplicant').checked)
for (i=0; i<pd2.length; i++)
	{
		if (empty('pd2_'+pd2[i])) {markerror('pd2_'+pd2[i]);} else {clearerror('pd2_'+pd2[i]);}
	}
for (i=0; i<pd1.length; i++)
	{
		if (empty('pd1_'+pd1[i])) {markerror('pd1_'+pd1[i]);} else {clearerror('pd1_'+pd1[i]);}
	}
	
	
for (i=0; i<data.length; i++)
	{
		if (empty('data_'+data[i])) {markerror(data[i]);} else {clearerror(data[i]);}
		///////////////////////////////////////////////////////////////////
		if (data[i] == 'email')
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('data_'+data[i]).value)))
			{
				markerror(data[i]);
				markerror('emailconfirm');
			}
		else if (document.getElementById("data_emailconfirm").value != document.getElementById("data_email").value)
			{
				alert('Check the email addresses');
				return false;
				markerror(data[i]);
				markerror('emailconfirm');
			}
		else
			{
				clearerror(data[i]);
				clearerror('emailconfirm');
			}

		///////////////////////////////////////////////////////////////////
		
	}

if (document.getElementById('data_correspondence').checked)
for (i=0; i<corrdata.length; i++)
	{
		if (empty('data_'+corrdata[i])) {markerror(corrdata[i]);} else {clearerror(corrdata[i]);}
	}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// CUSTOM ERRORS //////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (document.getElementById('data_secondapplicant').checked)
if (
	(document.getElementById('pd2_dateofbirthy').value == 0) ||
	(document.getElementById('pd2_dateofbirthm').value == 0) ||
	(document.getElementById('pd2_dateofbirthd').value == 0)
	) {markerror('pd2_dateofbirth');} else {clearerror('pd2_dateofbirth');}

if (
	(document.getElementById('pd1_dateofbirthy').value == 0) ||
	(document.getElementById('pd1_dateofbirthm').value == 0) ||
	(document.getElementById('pd1_dateofbirthd').value == 0)
	) {markerror('pd1_dateofbirth');} else {clearerror('pd1_dateofbirth');}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//data_photoid

if(errorFlag != 0)
{
  alert(" Certain Mandatory fields are empty!\n"+"Please review and submit again");
  return false;
}
  return true;
}




<!-- Begin

//  End -->

