    var objeto;
    objeto = 0;
    
    function cargar(url, destino){
		url = url.replace(" ","%20");
		objeto = document.getElementById("__contenido");
        xmlhttp.open("GET", url, true);
        objeto.innerHTML = "<p align='center'><b>Cargando p&aacutegina. Espere por favor...<br><img src='imagenes/loading.gif'></b></p>";
        xmlhttp.onreadystatechange=function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
               objeto.innerHTML = xmlhttp.responseText;
            }
        }
        xmlhttp.send(null);
		return false;
    }
	
	function procesar(url){
		url = url.replace(" ","%20");
	  	var resultado;
	  	xmlhttp.open("GET", url, false);
        xmlhttp.onreadystatechange=function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
               resultado = xmlhttp.responseText;
            }
        }
        xmlhttp.send(null);
        return resultado;
    }
	
	function CambiaColor(ncolor, id){
	  	document.getElementById(id).style.background = "#"+ncolor;
	}
	
	function Ventana(url){
		window.open(url, "ventana1", "width=550,height=400,scrollbars=NO");
	}
	
	function BotonDerecho(e){
        var msg = "Copyright© 2007 - Marbol S.A. de C.V.";
        if ((navigator.appName == 'Netscape' && e.which == 3) || (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)){
            alert(msg);
		}
		return false;
    }
    
    //document.onmousedown = BotonDerecho;
	//document.oncontextmenu = BotonDerecho;
	
	// Removes leading whitespaces
	function LTrim( value ) {
		var re = /\s*((\S+\s*)*)/;
		return value.replace(re, "$1");
		
	}
	// Removes ending whitespaces
	function RTrim( value ) {	
		var re = /((\s*\S+)*)\s*/;
		return value.replace(re, "$1");
	}
	
	// Removes leading and ending whitespaces
	function trim( value ) {
		return LTrim(RTrim(value));
	}
	
	function Enviar(idClase){
		var datos;
		datos = trim(document.getElementById("criterio").value);
		if(datos == "") datos = "random";
		cargar('buscarProducto.php?id_tipo=' + datos + '&id_clase=' + idClase);
		return false;
	}
	
	function isEnter(idClase){
		if(window.event.keyCode == 13){
			var objeto = document.getElementById("criterio");
			Enviar(idClase);
			objeto.value = trim(objeto.value);
			objeto.select();
			objeto.focus();
		}
	}
	
	function CambiaColor(ncolor, id){
	  	document.getElementById(id).style.background = "#"+ncolor;
	}
	
	function Ventana(url, w, h){
		x=(screen.width-w) / 2;
		y=(screen.height-h) / 2;
		var win = window.open(url, "ventana1", "width="+w+",height="+h+",scrollbars=yes, resizable=yes, status=yes, menubar=no, location=no, toolbar=no, titlebar=no, top="+y+", left="+x);
		win.focus();
	}
	
	function ValidaDelete(url){
		if(confirm("żEstá seguro que desea borrar este elemento?")){
			window.location = url;	
		}
	}