function Carrito_Mostrar2(bRecargar){
	if(bRecargar == null) bRecargar = true;
	if(bRecargar) window.frames.frmCarrito.location = "/carrito.php";
	var Layer_Carrito = document.getElementById("divCarrito");
	
	if(typeof(window.innerWidth) == 'number'){
		iVentanaW = window.innerWidth;
		iVentanaH = window.innerHeight;
	}
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		iVentanaW = document.documentElement.clientWidth;
		iVentanaH = document.documentElement.clientHeight;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		iVentanaW = document.body.clientWidth;
		iVentanaH = document.body.clientHeight;
	}
	
	if(typeof(window.pageYOffset) == 'number'){
		iScrollY = window.pageYOffset;
	}
	else if(document.body && (document.body.scrollLeft || document.body.scrollTop)){
		iScrollY = document.body.scrollTop;
	}
	else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){
		iScrollY = document.documentElement.scrollTop;
	}
	else iScrollY = 0;
	
	iVentanaX = (Math.round((parseInt(iVentanaW) / 2) - (parseInt(Layer_Carrito.offsetWidth) / 2)));
	iVentanaY = (Math.round((parseInt(iVentanaH) / 2) - (parseInt(Layer_Carrito.offsetHeight) / 2))) + iScrollY;
	
	with(Layer_Carrito.style){
		left = "400" + "px";
		top = "50" + "px";
		visibility = "visible";
	}
}

function Carrito_Mostrar(bRecargar){
	if(bRecargar == null) bRecargar = true;
	if(bRecargar) window.frames.frmCarrito.location = "/carrito.php";
	var Layer_Carrito = document.getElementById("divCarrito");
	
	if(typeof(window.innerWidth) == 'number'){
		iVentanaW = window.innerWidth;
		iVentanaH = window.innerHeight;
	}
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		iVentanaW = document.documentElement.clientWidth;
		iVentanaH = document.documentElement.clientHeight;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		iVentanaW = document.body.clientWidth;
		iVentanaH = document.body.clientHeight;
	}
	
	if(typeof(window.pageYOffset) == 'number'){
		iScrollY = window.pageYOffset;
	}
	else if(document.body && (document.body.scrollLeft || document.body.scrollTop)){
		iScrollY = document.body.scrollTop;
	}
	else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){
		iScrollY = document.documentElement.scrollTop;
	}
	else iScrollY = 0;
	
	iVentanaX = (Math.round((parseInt(iVentanaW) / 2) - (parseInt(Layer_Carrito.offsetWidth) / 2)));
	iVentanaY = (Math.round((parseInt(iVentanaH) / 2) - (parseInt(Layer_Carrito.offsetHeight) / 2))) + iScrollY;
	
	with(Layer_Carrito.style){
		left = iVentanaX + "px";
		top = iVentanaY + "px";
		visibility = "visible";
	}
}

function Carrito_Agregar(iIDProveedor){
	window.frames.frmCarrito.location = "/carrito.php?accion=agregar&id=" + iIDProveedor;
	Carrito_Mostrar(false);
}

function Carrito_Cerrar(){
	var Layer_Carrito = document.getElementById("divCarrito");
	with(Layer_Carrito.style){
		left = "-1000px";
		top = "-1000px";
		visibility = "visible";
	}
}

function AyudaEnLinea(){
	window.open("/chat/live/main.php", "", "width=500,height=500,top=100,left=100,scrollbars=yes");
}

function Favoritos_Agregar(){
	if(document.all){
		window.external.AddFavorite(window.location.href, document.title);
	}
	else{
		alert("Lo sentimos, pero tu navegador de Internet no permite agregar una pagina a la lista de favoritos de manera automatica. Para hacerlo, por favor usa el menu \"Favoritos\" de tu navegador para agregar esta pagina a tu lista de favoritos."); 
	}
	return false;
}

function XMLHttpObject(){
	if(navigator.userAgent.indexOf("Opera") != -1) return false;
	var objXMLHttp = false;
	
	if(window.XMLHttpRequest){
		objXMLHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		try{
			objXMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
			objXMLHttp.overrideMimeType("text/xml");
		}
		catch(e){
			try{
				objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				objXMLHttp = false;
			}
		}
	}
	return objXMLHttp;
}

var AJAX_ERROR_NOSUPPORT = 0;
var AJAX_ERROR_HTTP = 1;
var AJAX_ERROR_OTHER = 2;

function AJAXRequest(sURL, sMethod, sData, Callback, bErrorAlerts, bXMLParsing){
	if(bXMLParsing == null) bXMLParsing = false;
	if(bErrorAlerts == null) bErrorAlerts = true;
	var objXMLHttp = new XMLHttpObject();
	if(!objXMLHttp){
		if(bErrorAlerts) alert("Sorry, in order to use this feature you need to upgrade your browser to the latest version of Internet Explorer, Firefox, or Safari.");
 		if(Callback) Callback(null, [AJAX_ERROR_NOSUPPORT]);
		return;
	}
	objXMLHttp.onreadystatechange = function(){
		if(objXMLHttp.readyState == 4 || objXMLHttp.readyState == "complete"){
			if(objXMLHttp.status == 200){
				if(Callback) Callback((bXMLParsing ? objXMLHttp.responseXML : objXMLHttp.responseText), false);
			}
			else{
				if(bErrorAlerts) alert("We're sorry, there was a problem while trying to process your request. Please try again in a few moments.");
				if(Callback) Callback(null, [AJAX_ERROR_HTTP, objXMLHttp.status, objXMLHttp.responseText]);
			}
		}
	}
	try{
		if(typeof(sData) == "object"){
			if(sData.elements){
				var aForm = new Array();
				for(i=0; i<sData.elements.length; i++){
					switch(sData.elements[i].type){
						case "text":
							aForm.push(sData.elements[i].name + "=" + escape(sData.elements[i].value));
							break;
						case "textarea":
							aForm.push(sData.elements[i].name + "=" + escape(sData.elements[i].value));
							break;
						case "select-one":
							aForm.push(sData.elements[i].name + "=" + escape(sData.elements[i].value));
							break;
					}
				}
				sData = aForm.join("&");
			}
			else{
				sData = "";
			}
		}
		sMethod = sMethod.toUpperCase();
		objXMLHttp.open(sMethod, sURL + (sMethod == "GET" ? "?" + sData : ""), true);
		if(sMethod == "POST"){
			objXMLHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			objXMLHttp.setRequestHeader("Content-length", sData.length);
			objXMLHttp.setRequestHeader("Connection", "close");
		}
		objXMLHttp.send(sMethod == "POST" ? sData : null);
	}
	catch(Error){
		if(bErrorAlerts) alert("We're sorry, there was a problem while trying to process your request. Please try again in a few moments.");
		if(Callback) Callback(null, [AJAX_ERROR_OTHER, Error.message]);
	}
}