<!-- 

// Update Parent Window 
function updateParent(newURL) {
	opener.document.location = newURL
}

function winOpen(url){myWin=open("","winName","width=520,height=400,status=no,toolbar=no,menubar=no,scrollbars=yes"); return true; }

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

IE5plus = IE5 || IE6;
IEMajor = 0;

if (IE4plus)
{
	var start = navigator.appVersion.indexOf("MSIE");
	var end = navigator.appVersion.indexOf(".",start);
	IEMajor = parseInt(navigator.appVersion.substring(start+5,end));
	IE5plus = (IEMajor>=5) ? true : false;
}





/**
 * DHTML date validation script for dd/mm/yyyy. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isYear(dtStr1){

	var error_string = "";
	var daysInMonth = DaysArray(12)
	var pos1=dtStr1.indexOf(dtCh)
	var pos2=dtStr1.indexOf(dtCh,pos1+1)
	var strDay=dtStr1.substring(0,pos1)
	var strMonth=dtStr1.substring(pos1+1,pos2)
	var strYear=dtStr1.substring(pos2+1)
	strYr=strYear

	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	
	if (strYr > 2011)
	{
		return 1;
	}
	if (strYr == "2010" )
		{
		return -1;
	}
		if (strYr < 2010)
	{
		return 2;
	}

}


function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)//position of the first slash
	var pos2=dtStr.indexOf(dtCh,pos1+1)//position of the second slash
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	
	if (!NS6)
	{ 
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : dd/mm/yyyy")
		return false
	}
	if (strMonth.length<2 || month>12 || strMonth =="00" ){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<2 || day>31 || (month==02 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day12000")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	
	
return true

}

else 

{

if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : dd/mm/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day12")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
return true

}
}





/*
	 Validating step 1 ----------------------
*/

function step1_Validator(theForm)
{

	var alertsay = ""; // define for long lines

	// check to see if first name field is blank
	if (theForm.fname.value == "")
	{
	alert("You must enter a first name.");
	theForm.fname.focus();
	return (false);
	}
	
	
	
	// check to see if last name field is blank
	if (theForm.lname.value == "")
	{
	alert("You must enter a last name.");
	theForm.lname.focus();
	return (false);
	}
	
	
	// check if email field is blank
	var Email = theForm.email.value;

	if (Email == "" )
	{	alert("Please enter a value for the \"email\" field.");
		theForm.email.focus();
		return (false);
	}
	else
	{	var AtSym  = theForm.email.value.indexOf('@');
		var Dot    = theForm.email.value.lastIndexOf('.');
		var Space  = theForm.email.value.indexOf(' ');
		var Length = theForm.email.value.length - 2;   // Array is from 0 to length-2

		if ((AtSym < 1) ||                     // '@' cannot be in first position
			(Dot <= AtSym+1) ||                // Must be at least one valid char btwn '@' and '.'
			(Dot == Length ) ||                // Must be at least two valid chars after '.'
			(Space  != -1))                    // No empty spaces permitted
			{		alert("Your e-mail address is not valid. Please re-enter it.");
					theForm.email.focus();
					return (false);
			}
		
		var illegal_string = "/*+,/<>?;':[]{}\\|`~!#$%^&*()=";
		// keep a count of how many illegal characters appear in the fields
		var illegal_count=0;
		// next loop to run as many times as there are illegal characters to check against
		for (var loop=0; loop < illegal_string.length; loop++)
		{	// next bit assigns each consecutive illegal character into variable: "the_char" 
			the_char = illegal_string.charAt(loop);
			// next if statement means if illegal character appears in email number, increment count of illegal characters
			if (Email.indexOf(the_char) != -1)	// actually says: if illegal character does not NOT appear
			{	illegal_count++;	
			}
		}
		// next if statement prints error message only once if multiple illegal characters appear
		if (illegal_count > 0 || Email.length > 49)
		{		alert("Your email address contains invalid characters or \n has too many characters. Please Re-enter it.");
				theForm.email.focus();
				return (false);
		}
		
	
	}

// check if both passport fields are the same
	if (theForm.email.value != theForm.confirmEmail.value)
	{
		alert("The two email addresses are not the same.");
		theForm.confirmEmail.focus();
		return (false);
	}

		}






/* (c) copyright 2000-2003 Michel Plungjan "michel at irt.org" */
function validateDate(date, month, year,type) {
	//alert(type);
  	var yyyy = year;
   /* mm and dd starts at 1 due to <option>Month and <option>Day */
 	var	 mm =  month;
  	var dd = date;
   	var test = new Date(yyyy,mm,dd,0,0,0);
	//alert(test);
    var todaysDate = new Date();
	var tyear = test.getFullYear();
    if (tyear != yyyy ||test.getMonth() != mm || test.getDate() != dd) {
      return false;
   }

	if ((type=='dob')||(type=='issuing')){
		if (test > todaysDate){
	 	//	alert("You have selected a date in the future");
	     return false;
		}
	}
	else if (type=='expiry'){
		if (test < todaysDate){
	 //	alert("Your passport seems to have expired.");
	     return false;
		}
	}
	else if (type=='travel'){
		if (test > todaysDate.setDate(todaysDate.getDate()+365)){
	 	//alert("Your travel date.");
	     return false;
	}
	}
	   
   return true;

 }


/*
	 Validating step 2 ----------------------
*/

function step2_Validator(theForm)
{	

var error_string = "";
	
	// check to see if given names field is blank
	if (theForm.appGName.value == "")
	{
		alert("You must enter the applicant's given names.");
		theForm.appGName.focus();
		return (false);
	} 
	
	// check to see if surname field is blank
	if (theForm.appSName.value == "")
	{
		alert("You must enter the applicant's last name.");
		theForm.appSName.focus();
		return (false);
	}

// check to see if surname field is blank
	if (theForm.appMName.length > 50)
	{
		alert("Too many characters.");
		theForm.appMName.focus();
		return (false);
	}
	if (theForm.appOName.length > 100 )
	{
		alert("Too many characters.");
		theForm.appOName.focus();
		return (false);
	}
	
	//Check to see if the date is a valid format
	
	// check if a country of citizen ship has been selected
	if ((theForm.DOBYear.selectedIndex ==-1))
	{
		alert(theForm.DOBYear.selectedIndex);		
		theForm.DOBDay.focus();
		return (false);
	}

	yearDOB = theForm.DOBYear.options[theForm.DOBYear.selectedIndex].value;
	monthDOB = theForm.DOBMonth.selectedIndex-1;
	dateDOB =  theForm.DOBDay.selectedIndex;
		if (validateDate(dateDOB,monthDOB, yearDOB,'dob') == false) {
				alert("Please check the date of birth \n The combination of day, month and year is not valid ");
		return (false);
	}



	if (theForm.gender.selectedIndex ==0 )
	{
		alert("Please select one of the \"gender\" options.");
		theForm.gender.focus();
		return (false);
	}
	
	//document.getElementById('dvIndividualForm').style.display = 'block';
	if (document.getElementById('marketing'))
	{
		if (theForm.marketing.selectedIndex ==0 )
		{//
			alert("Please select one of the options in how \"did you hear about us?\" dropdown.");
			theForm.marketing.focus();
			return (false);	
		}
	}
		
	// check if a country of birth has been selected 
	if (theForm.passDOBCountry.selectedIndex == 0 )
	{
		alert("Please select the country of birth.");
		theForm.passDOBCountry.focus();
		return (false);
	}
	// check if a passport number has been entered
	if (theForm.passNum.value == "")
	{
		alert("You must enter the applicant's passport number.");
		theForm.passNum.focus();
		return (false);
	}	
	
	// Passport number requires at least 5 characters be entered
	if ((theForm.passNum.value.length < 5) ||  (theForm.passNum.value.length > 12))
	{
	alert("The passport number is at least 5 characters long and less than 13 characters.");
	theForm.passNum.focus();
	return (false);
	}
	
	// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any "checkOK" string you desire
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZĊÄÖ abcdefghijklmnopqrstuvwxyzċäö-0123456789";
	var checkStr = theForm.passNum.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	if (ch == checkOK.charAt(j))
	break;
	if (j == checkOK.length)
	{
	allValid = false;
	break;
	}
	}
	if (!allValid)
	{
	alert("Please enter only letter and numeric characters in the passport number field.");
	theForm.passNum.focus();
	return (false);
	}
	
	// check if both passport fields are the same
	if (theForm.passNum.value != theForm.confirmpassNumber.value)
	{
		alert("The two passports numbers are not the same.");
		theForm.confirmpassNumber.focus();
		return (false);
	}
	
	// check if a country of citizen ship has been selected
	if (theForm.passCountry.selectedIndex == 0)
	{
		alert("Please select your citizenship.");
		theForm.passCountry.focus();
		return (false);
	}
	

	yearPassExp = theForm.passExpYear.options[theForm.passExpYear.selectedIndex].value;
	monthPassExp = theForm.passExpMonth.selectedIndex-1;
	datePassExp =  theForm.passExpDay.selectedIndex;
	if (validateDate(datePassExp,monthPassExp, yearPassExp,'expiry') == false) {
				alert("Please check the passport expiry date.");
	return (false);
	}


	yearPassIssuing = theForm.passIssuingYear.options[theForm.passIssuingYear.selectedIndex].value;
	monthPassIssuing = theForm.passIssuingMonth.selectedIndex-1;
	datePassIssuing =  theForm.passIssuingDay.selectedIndex;

//	alert(monthPassIssuing)


	if (validateDate(datePassIssuing,monthPassIssuing, yearPassIssuing,'issuing') == false) {
				alert("Please check the passport issuing date.");
	return (false);
	}

	// check if a state of issue has been selected
	if (theForm.passIssuingState.selectedIndex == 0)
	{
		alert("Please select an Issuing State.");
		theForm.passIssuingState.focus();
		return (false);
	}
	

	if (document.getElementById('travel'))
	{
	
	yearTravel = theForm.TravelYear.options[theForm.TravelYear.selectedIndex].value;
	monthTravel = theForm.TravelMonth.selectedIndex-1;
	dateTravel =  theForm.TravelDay.selectedIndex;

//alert(yearTravel)
//alert(dateTravel)
//alert(monthTravel)
	if ((yearTravel != -1) && (monthTravel != -1) && (dateTravel !=0)) {

	if (validateDate(dateTravel,monthTravel, yearTravel,'travel') == false) {
				alert("You have put your travel date as more than 12 months away.  \n The visas are only valid for 12 months \n so if you are travelling later you need to apply for your visa  \n closer to your travel date.");
	return (false);
	}
	}
//	return (false);

}


	// check if a passport number has been entered
	if (theForm.passIssuingAuth.value == "")
	{
		alert("You must enter an issuing place/authority.");
		theForm.passIssuingAuth.focus();
		return (false);
	}
	


// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any "checkOK" string you desire
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZĊÄÖ abcdefghijklmnopqrstuvwxyzċäö-0123456789";
	var checkStr = theForm.passIssuingAuth.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	if (ch == checkOK.charAt(j))
	break;
	if (j == checkOK.length)
	{
	allValid = false;
	break;
	}
	}
	if (!allValid)
	{
		alert("Please enter only letter and numeric characters in the issuing place/authority field.\n I.e. no: / - . , _* .");
		theForm.passIssuingAuth.focus();
		return (false);
	}



	// check if a visa type has been selected
	if (theForm.vtName.selectedIndex == 0)
	{
		alert("Please select one of the visa type.");
		theForm.vtName.focus();
		return (false);
	}


}

/*
	 Validating Cancel on step2.asp ----------------------
*/

// Check that a string contains only letters and numbers
function validateAlphaNumerical(text) {
	if ((text.search(/[^\w\s]/) != -1) || (text.search(/\W/) != -1)) 
	{
		return false;
	}
	return true;
}


function cancelForm_Validator(theForm)
{
	if( confirm("Are you sure you want to cancel your application?") == true) 
	{
		location.href="removeAll.asp"
	}
}

function deleteForm_Validator(deleteForm)
{
	if( confirm("Delete?") == true) 
	{
		location.href="delete.asp"
	}
	else
	{
		return false
	}
}


/*
	 Validating modify.asp ----------------------
*/




function modify_Validator(theForm)
{
var error_string = "";
	
	// check to see if given names field is blank
	if (theForm.appGName.value == "")
	{
		alert("You must enter the applicant's given names.");
		theForm.appGName.focus();
		return (false);
	} 
	
	// check to see if surname field is blank
	if (theForm.appSName.value == "")
	{
		alert("You must enter the applicant's last name.");
		theForm.appSName.focus();
		return (false);
	}
	
	//Check to see if the date is a valid format
	var dt=document.theForm.dob
	if (isDate(dt.value)==false)
	{
		alert("Date of Birth:\nPlease ensure that the date of birth is \n entered in the right format (dd/mm/yyyy). \n For example 30/10/1972")
		dt.focus()
		return false
	}
		
	if (isDate(dt.value)==true)
	{
		
		
		if (isYear(dt.value) == 1)
		{
			error_string += "- Born in 2012?\n Please click to OK to confirm or cancel to modify\n";
			//alert("Please confirm the year of birth")
			//confirm("Are you sure it is the right year of birth?")
		}
		
	}	
		
		
		
		
		
		
		
	
	// check if a gender \has been selected
	if (theForm.gender.selectedIndex ==0 )
	{
		alert("Please select one of the \"gender\" options.");
		theForm.gender.focus();
		return (false);
	}
	
	// check if a country of birth has been selected 
	if (theForm.passDOBCountry.selectedIndex == 0 )
	{
		alert("Please select the country of birth.");
		theForm.passDOBCountry.focus();
		return (false);
	}
	
	// check if a passport number has been entered
	if (theForm.passNum.value == "")
	{
		alert("You must enter the applicant's passport number.");
		theForm.passNum.focus();
		return (false);
	}	
	
	// Passport number requires at least 5 characters be entered
	if ((theForm.passNum.value.length < 5) ||  (theForm.passNum.value.length > 12))
	{
	alert("The passport number is at least 5 characters long and less than 13 characters.");
	theForm.passNum.focus();
	return (false);
	}
	
	
	// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any "checkOK" string you desire
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZĊÄÖ abcdefghijklmnopqrstuvwxyzċäö-0123456789";
	var checkStr = theForm.passNum.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	if (ch == checkOK.charAt(j))
	break;
	if (j == checkOK.length)
	{
	allValid = false;
	break;
	}
	}
	if (!allValid)
	{
	alert("Please enter only letter and numeric characters in the passport number field.");
	theForm.passNum.focus();
	return (false);
	}
	

	// check if a country of citizen ship has been selected
	if (theForm.passCountry.selectedIndex == 0)
	{
		alert("Please select your citizenship.");
		theForm.passCountry.focus();
		return (false);
	}
	
	//Check to see if the date is a valid format
	var dt1=document.theForm.passExpiry
	if (isDate(dt1.value)==false)
	{
		alert("Passport expiry date: \nPlease ensure that the date is \n entered in the right format (dd/mm/yyyy). \n For example 03/01/2006")
		dt1.focus()
		return false
	}
	
	else if (isDate(dt1.value)==true)
	{
		if (isYear(dt1.value) == 2)
		{
			alert("The passport seems to have expired")
			//confirm("Are you sure it is the right year of birth?")
			dt1.focus()
			return false
		}
	}



	//Check to see if the date is a valid format
	var dt1=document.theForm.passIssuingDate
	if (isDate(dt1.value)==false)
	{
		alert("Passport issuing date: \nPlease ensure that the date is \n entered in the right format (dd/mm/yyyy). \n For example 03/01/2006")
		dt1.focus()
		return false
	}
	
	else if (isDate(dt1.value)==true)
	{
	//	if (isYear(dt1.value) == 2)
	//	{
		//	alert("The passport issuing date seems to be in the future")
			//confirm("Are you sure it is the right year of birth?")
			//dt1.focus()
			//return false
	//	}
	}

   // check if a gender \has been selected
	if (theForm.passIssuingState.selectedIndex ==0 )
	{
		alert("Please select an issuing state.");
		theForm.passIssuingState.focus();
		return (false);
	}

		// check to see if surname field is blank
	if (theForm.passIssuingAuth.value == "")
	{
		alert("You must enter an Issuing place/authority.");
		theForm.passIssuingAuth.focus();
		return (false);
	}

	

	// check if a visa type has been selected
	if (theForm.vtName.selectedIndex == 0)
	{
		alert("Please select one of the visa type.");
		theForm.vtName.focus();
		return (false);
	}
	if (error_string != "")
			
			{//	error_string = "You have left some details. \n\n" + error_string;
				if (confirm(error_string) == false)
				{
					theForm.dob.focus();
				return false
				}
				else 
				{
				return true
				}
			}
			
}

/*
	 Validating step 4 ----------------------
*/

function step4_Validator(step4)
{
	var alertsay = ""; // define for long lines

	// alert if the box is NOT checked
	if (!step4.terms.checked)
	{
	alertsay = "Just a reminder that you have to agree to the authorisation to continue with payment"
	alert(alertsay);
	step4.terms.focus();
	return false;
	}
}



function cancelForm_Validator(step4)
{
	if( confirm("Are you sure you want to cancel your application?") == true) 
	{
		location.href="removeAll.asp?sAppID='<% sAppID %>'";
	}
}


/*
	 Validating appDetails  ----------------------
*/

function appDetails_Validator(theForm)
{
	// check if a gender \has been selected
	if (theForm.staff.selectedIndex ==0 )
	{
		alert("Please select your name.");
		theForm.staff.focus();
		return (false);
	}
}



function visaReports_Validator(getVisas)
{
	// check if a gender \has been selected
	if (getVisas.startDate.value != "")
	{
		if (isDate(getVisas.startDate.value)==false)
		{
			getVisas.startDate.focus()
			return false
		}
		if (getVisas.endDate.value == "")
		{	alert("Please select both a start and end date.");
			getVisas.endDate.focus();
			return false;
		}
	}

	if (getVisas.endDate.value!= "")
	{
		if (isDate(getVisas.endDate.value)==false)
		{
			getVisas.endDate.focus()
			return false
		}
		if (getVisas.startDate.value == "")
		{	alert("Please select both a start and end date.");
			getVisas.startDate.focus();
			return (false);
		}
	}
}

function checkTravelDate(theForm)
{

//Check to see if the date is a valid format
	var dt2=document.theForm.travelDate
	
	if (dt2.value != "")	{
		if (isDate(dt2.value)==false)
		{
			dt2.focus()
			return false
		}
	}
}


function checkStaffReport(getStaff)
{
	//Check to see if a staff has been selected
	if (getStaff.staff.selectedIndex ==0 )
	{
		alert("Please select a staff name.");
		getStaff.staff.focus();
		return (false);
	}
}



function checkaffiliateReport(getaffiliate)
{
	//Check to see if a staff has been selected
	if (getaffiliate.affiliate.selectedIndex ==0 )
	{
		alert("Please select an affiliate.");
		getaffiliate.affiliate.focus();
		return (false);
	}
}

function checkAppReport(getApplications)
{
	//Check to see if a staff has been selected
	if (getApplications.marketing.selectedIndex ==0 )
	{
		alert("Please select a marketing medium.");
		getApplications.marketing.focus();
		return (false);
	}
	
	//Check to see if a staff has been selected
	if (getApplications.affiliate.selectedIndex ==0 )
	{
		alert("Please select an affiliate.");
		getApplications.affiliate.focus();
		return (false);
	}
}


function checkVisaReport(getVisas)
{
	//Check to see if a staff has been selected
	if (getVisas.category.selectedIndex ==0 )
	{
		alert("Please select a visa type.");
		getVisas.category.focus();
		return (false);
	}
	
		if (getVisas.country.selectedIndex ==0 )
	{
		alert("Please select country.");
		getVisas.country.focus();
		return (false);
	}	
}



function checkDates(theForm)
{

	var error_string = "";

	// check if a date has been selected
	if (theForm.startDate.value != "")
	{
		if (isDate(theForm.startDate.value)==false)
		{
			error_string += "* Valid start date \n";
		}
		
		if (theForm.endDate.value == "")
		{
			error_string += "* An end date \n";
		}
	}
	else
	{
		error_string += "* A start date \n";
	}

	if (theForm.endDate.value!= "")
	{
		if (isDate(theForm.endDate.value)==false)
		{
			error_string += "* Valid end date \n";
		}
		if (theForm.startDate.value == "")
		{	
			error_string += "* Start date \n";
		}
	}
	
	if (error_string != "")
	{
		alert("The following cannot be empty: \n \n" + error_string);
		return (false);
	}
	return (true);
}


function hideLinks(){
  Links=document.links;
	for (i=0;i<Links.length;i++){
	 	if (Links[i] != "javascript:;"){
			Links[i].onmouseover=function(){temp=this.href; window.status='Australian ETA Visa'; return true;}
     		Links[i].onmouseout=function(){temp=this.href;}
			if (Links[i] == "logout.asp?logout=1"){
				Links[i].onclick=function(){window.status='Australian ETA Visa'; return true;}				
			}
			else if (Links[i] == "logout.asp?logout=1"){
			//else if (Links[i] == "https://evisastoaustralia.com/secure/migration/logout.asp?logout=1"){
				Links[i].onclick=function(){window.status='Australian ETA Visa'; return true;}
			}
			else{
				Links[i].onclick=function(){window.status='Australian ETA Visa'; return winOpen();return true;}
			}
		}
	}
}


function  feedbackValidator(feedback)
{
	//Check to see if a name has been selected
	if (feedback.firstname.value == "") 
	{
		alert("Please enter a name.");
		feedback.firstname.focus();
		return (false);
	}
	
	
	
	var Email = feedback.email.value;

	if (Email == "")
	{	alert("Please enter a value for the \"email\" field.");
		feedback.email.focus();
		return (false);
	}
	else
	{	var AtSym  = feedback.email.value.indexOf('@');
		var Dot    = feedback.email.value.lastIndexOf('.');
		var Space  = feedback.email.value.indexOf(' ');
		var Length = feedback.email.value.length - 2;   // Array is from 0 to length-2

		if ((AtSym < 1) ||                     // '@' cannot be in first position
			(Dot <= AtSym+1) ||                // Must be at least one valid char btwn '@' and '.'
			(Dot == Length ) ||                // Must be at least two valid chars after '.'
			(Space  != -1))                    // No empty spaces permitted
			{		alert("Your e-mail address is not valid. Please re-enter it.");
					feedback.email.focus();
					return (false);
			}
		
		var illegal_string = "/*+,/<>?;':[]{}\\|`~!#$%^&*()=";
		// keep a count of how many illegal characters appear in the fields
		var illegal_count=0;
		// next loop to run as many times as there are illegal characters to check against
		for (var loop=0; loop < illegal_string.length; loop++)
		{	// next bit assigns each consecutive illegal character into variable: "the_char" 
			the_char = illegal_string.charAt(loop);
			// next if statement means if illegal character appears in email number, increment count of illegal characters
			if (Email.indexOf(the_char) != -1)	// actually says: if illegal character does not NOT appear
			{	illegal_count++;	
			}
		}
		// next if statement prints error message only once if multiple illegal characters appear
		if (illegal_count > 0)
		{		alert("your email address contains invalid characters.Please Re-enter it.");
				feedback.email.focus();
				return (false);
		}
	
	}
	//Check to see if a staff has been selected
	if (feedback.comments.value == "") 
	{
		alert("Please enter some comments.");
		feedback.comments.focus();
		return (false);
	}


}


//-->
