function objetus() { 
	var objetus = false;
    try { 
        objetus = new ActiveXObject("Msxml2.XMLHTTP"); 
    } 
    catch(e) {
      	try { 
            objetus = new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
        catch(e) {
        	try {objetus = new ActiveXObject("Msxml2.XMLHTTP.3.0");}
        	catch(e) {
        		try {objetus = new ActiveXObject("Msxml2.XMLHTTP.4.0");}
        		catch(e) {
        			try {objetus = new ActiveXObject("Msxml2.XMLHTTP.5.0");}
        			catch(e) { objetus = false; }
        		}
        	}
        }
        	
    } 
    if(!objetus && typeof XMLHttpRequest != 'undefined') {    	
        objetus = new XMLHttpRequest(); 
    } 
    return objetus; 
} 


//==================================================================
function getResults(load, loadhtml, cont, method, url, values) { 
    var obj = objetus();
    var send;
    
    if(method.toUpperCase() == "POST") {
    	send = values;
    }
	else if(method.toUpperCase() == "GET") {
		url += '?'+values; 
		send = null;
	}
	
   	obj.open(method, url, true);
    		
    obj.onreadystatechange = function() { 
    	//alert(obj.readyState);
    	if(obj.readyState == 1) {
    		document.getElementById(load).innerHTML = loadhtml;
    	}
        else {
            if(obj.readyState == 4) { 
            	if(obj.status == 200) {
            		if(load != cont) document.getElementById(load).innerHTML = "";
            		//alert(obj.responseText);
            		//alert(document.getElementById(cont).innerHTML);
        			document.getElementById(cont).innerHTML = obj.responseText; 			
            	}
            	else
            		alert('Error '+obj.status);
            }
    	} 
    } 
    obj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    obj.send(send); 
    return;
} 

//===================================================================
function getAlert(load, loadhtml, method, url, values) { 
    var obj = objetus();
    var send;
    
    if(method.toUpperCase() == "POST") {
    	send = values;
    }
	else if(method.toUpperCase() == "GET") {
		url += '?'+values; 
		send = null;
	}
	
   	obj.open(method, url, true);
    			
    obj.onreadystatechange = function() { 
    	//alert(obj.readyState);
    	if(obj.readyState == 1) {
    		document.getElementById(load).innerHTML = loadhtml;
    	}
        else {
            if(obj.readyState == 4) { 
            	if(obj.status == 200) {	
            		document.getElementById(load).innerHTML = "";
        			alert(obj.responseText); 
            	}
            	else
            		alert('Error '+obj.status);
            }
    	} 
    } 
    obj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    obj.send(send); 
    return;
} 
