//Browser Support Code
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
	// Opera 8.0+, Firefox, Safari
	ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser does not support AJAX Entry !");
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			retVal = ajaxRequest.responseText;
			srchStr = /Passes Verif/;
			if (retVal.search(srchStr) > -1) {
				document.reqForm1.isVerified.value = "yes"; 

			} else {
				document.reqForm1.isVerified.value = "nono"; 
				alert('Request not Verified ' + "\n" + retVal );
 			}

			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}


	try {
 		 //do something that might cause an error
		 var theCallsign = document.getElementById('onexone').value;

	} catch( myError ) {
  		//if an error occurs, this code will be run
  		//two properties will (by default) be available on the
  		//object passed to the statement
  		alert( myError.name + ': ' + myError.message );
	} 

	// var theCallsign = document.getElementById('onexone').value;
	// var stdate = document.getElementById('start_date').value;

	try {
 		 //do something that might cause an error
		var stdate = document.getElementById('start_date').value;

	} catch( myError ) {
  		//if an error occurs, this code will be run
  		//two properties will (by default) be available on the
  		//object passed to the statement
  		alert( myError.name + ': ' + myError.message );
	}	

	try {
 		 //do something that might cause an error
		var enddate = document.getElementById('end_date').value;

	} catch( myError2 ) {
  		//if an error occurs, this code will be run
  		//two properties will (by default) be available on the
  		//object passed to the statement
  		alert( myError2.name + ': ' + myError2.message );
	}	


	// var queryString = "&action=verifyAvail&callsign=" + theCallsign + "&start_date=" + stdate + "&end_date=" + endate;


	try {
 		 //do something that might cause an error
		var queryString = "&action=verifyAvail&callsign=" + theCallsign + "&start_date=" + stdate + "&end_date=" + enddate ;

	} catch( myError3 ) {
  		//if an error occurs, this code will be run
  		//two properties will (by default) be available on the
  		//object passed to the statement
  		alert( myError3.name + ': ' + myError3.message );
	}	
	ajaxRequest.open("GET", "index.php?option=com_jumi&fileid=7" + queryString, true);
	ajaxRequest.send(null); 
}
