function checkvt() {
	var country = document.getElementById('country').value;
	var nationality = document.getElementById('nationality').value;
	 if (nationality != "" && country !="") {
			if (country != nationality) {
				var query = "/visatypes.php?country="+country+"&nationality="+nationality;
				execquery(query,'visatypediv');
			} else {
				document.getElementById('visatypediv').innerHTML="<strong>Nationality and Country should be different</strong>";
			}
	}	
}

function checkct() {
	var country = document.getElementById('country').value;
	var nationality = document.getElementById('nationality').value;
	if (nationality !="") {
		var query = "/visacountries.php?&nationality="+nationality+"&country="+country;
		var thetext = "";
        	var xmlhttp=false;
        	/*@cc_on @*/
        	/*@if (@_jscript_version >= 5)
        	// JScript gives us Conditional compilation, we can cope with old IE versions.
        	// and security blocked creation of the objects.
       	 	try {
                	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        	} catch (e) {
                	try {
                        	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                	} catch (E) {
                        	xmlhttp = false;
                	}
        	}
        	@end @*/
        	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
               		xmlhttp = new XMLHttpRequest();
        	}
        	if (query != "") {
                	xmlhttp.open("GET", query,true);
                	xmlhttp.onreadystatechange=function() {
                        	if (xmlhttp.readyState==1) {
                                	document.getElementById('submitbutton').disabled=true;
                        	}
                        	if (xmlhttp.readyState==4) {
                                	//a function that comes after update.
                                	//alert(xmlhttp.responseText);
                                	document.getElementById('countrydiv').innerHTML = xmlhttp.responseText;
                        		checkvt();
				}
                	}
                	xmlhttp.send(null);
        	} else {
        	}
	}

}



function execquery(query,target)
{
var thetext = "";
        var xmlhttp=false;
        /*@cc_on @*/
        /*@if (@_jscript_version >= 5)
        // JScript gives us Conditional compilation, we can cope with old IE versions.
        // and security blocked creation of the objects.
        try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                try {
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                        xmlhttp = false;
                }
        }
        @end @*/
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest();
        }
        if (query != "") {
                xmlhttp.open("GET", query,true);
                xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==1) {
				document.getElementById('submitbutton').disabled=true;
			}
                        if (xmlhttp.readyState==4) {
                                //a function that comes after update.
                                //alert(xmlhttp.responseText);
                                document.getElementById(target).innerHTML = xmlhttp.responseText;
				document.getElementById('submitbutton').disabled=false;
                        }
                }
                xmlhttp.send(null);
        } else {
        }
}

