var req = null;

function createXMLHttpRequest() {
 var ua;
 if(window.XMLHttpRequest) {
 try {
  ua = new XMLHttpRequest();
 } catch(e) {
  ua = false;
 }
 } else if(window.ActiveXObject) {
  try {
	ua = new ActiveXObject("Microsoft.XMLHTTP");
  } catch(e) {
	ua = false;
  }
 }
return ua;
}

var response_area;

function sendRequest(file, response) {
//document.getElementById("ajax-loader").style.display = "";
	
req = createXMLHttpRequest();
response_area = response;

	var str = "";
	req.open('GET', file+'&x=rnd982g');
	if(response_area != 'none'){
		req.onreadystatechange = handleResponse_sections;
		}
		
		
		
	req.send(null);
			
 return false;
 
}


function handleResponse_sections() {
	
	

	if(req.readyState == 4){
		
		var response = req.responseText;
		document.getElementById(response_area).innerHTML = response;
		//document.getElementById("ajax-loader").style.display = "none";
		
	}
}


function ajaxUpdater(id,url) { 
	new Ajax.Updater(id,url,{asynchronous:true});  
}  

function CalcKeyCode(aChar) {
			  var character = aChar.substring(0,1);
			  var code = aChar.charCodeAt(0);
			  return code;
			}
			
function checkNumber(val) {
			  var strPass = val.value;
			  var strLength = strPass.length;
			  var lchar = val.value.charAt((strLength) - 1);
			  var cCode = CalcKeyCode(lchar);
			
			  if (cCode < 48 || cCode > 57 ) {
			    var myNumber = val.value.substring(0, (strLength) - 1);
			    val.value = myNumber;
			  }
			  return false;
			}

function show_additional_field(theoption,thediv){
		if(theoption=="Other"){
			window.document.getElementById(thediv).style.display = '';
			
		}		
		else{
			window.document.getElementById(thediv).style.display = 'none';
		}
	}	
		
			
			
