﻿/*
	vrb = variabile
	val = valore variabile
	box = identificativo box
	es. showLoc("Anagrafica","4","BoxAnagrafica")
*/
// <!CDATA[
function search(vrb, val, box) {

// alert( 'vrb: ' + vrb + ' | val: ' + val + ' | box: ' + box);

	document.getElementById( box ).innerHTML = '<img alt="" height="16" src="http://www.crwe-cs.com/_library/ajax/ajax-loader.gif" width="16" />' ;

	if (vrb.length==0) { 
		document.getElementById( box ).innerHTML="";
		return;
	}

	var url="/ajax/server.ajax.asp";
	url=url+"?"+ escape( vrb ) + "=" + escape( val );
//	url=url+"?"+ escape( vrb ) + "=" + val ;


// alert( url );

	var xmlHttp = null;

	try { 
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlHttp=new XMLHttpRequest(); 
	}
	catch (e) {
		try { 
			// code for IE6
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
		}
		catch (e) { 
			// code for IE4, IE5
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		}
	}

	if (xmlHttp==null) {
		alert ("Il browser non supporta AJAX!");
		return;
	} 

	var content = null
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4) {
			if (xmlHttp.status==200) {
				content = xmlHttp.responseText;
				document.getElementById( box ).innerHTML=content.replace("'","\'");
			}
			else {
			    alert("Problem retrieving data:" + xmlHttp.statusText);
			}
		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

// ]]>
