function clear_input(obj){
	obj.style.backgroundImage = '';
	obj.onkeydown = obj.onmousedown = null;
}


function ajaxreq(){
	req = false;
   	if(window.XMLHttpRequest) { //non-ie
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
   	} else if(window.ActiveXObject) {  //ie
       	try {
        	req = new ActiveXObject('Msxml2.XMLHTTP');
      	} catch(e) {
        	try {
          		req = new ActiveXObject('Microsoft.XMLHTTP');
        	} catch(e) {
          		req = false;
        	}
		}
	}	
	return req;
}

function Trim(strTrim){
	return strTrim.replace(/^\s+|\s+$/g, '');
}

function loadorg (state_iid,city_iid,institution_iid) {
	var objState=$('#q28_'+state_iid);
	var objCity=$('#q213_'+city_iid);
	var objInstitution=$('#q212_'+institution_iid);
	objInstitution.html('<option selected="true" value="Other Institution" title="Other Institution">Other Institution</option>');
	
	objState.change(function(){
		$.post('enum.jsp', {state: objState.val()},
		function(response){
			objCity.html(response);
			
			if ((Trim(objState.val())!='' && Trim(response)=='<option value=""> </option>') || Trim(objState.val())==''){
				objInstitution.html('<option selected="true" value="Other Institution" title="Other Institution">Other Institution</option>');
			}else{
				objInstitution.html('');
			}
		});
		return false;
	});

	objCity.change(function(){
		$.post("enum.jsp", {state: objState.val(),city: objCity.val()},
		function(response){
			objInstitution.html(response);
		});
		return false;
	});
}

function loadrtype () {
	$.post("enum.jsp", {rtype: $('#rtype_29').val()},
	function(response){
		$('#level_22').html(response);
	});
	return false;
}

