function Borrar(pag, id){if (confirm ("¿Seguro que desea eliminar este registro?")){document.location = pag + "Bor.asp?Id=" + id;}}
function recargar(){if(confirm("¿Seguro que desea cargar los datos originales?")){window.location.reload();}}
function cancelar(pag){if (confirm ("¿Seguro que desea cancelar la operación?")){document.location = pag + "Lis.asp";}}
function cancelar2(pag){if (confirm ("¿Seguro que desea cancelar la operación?")){document.location = pag;}}


function msg(m){document.getElementById("mensaje").innerHTML = m;}
function marcar(input, m){if (m){input.style.backgroundColor = "#FF3300";}else{input.style.backgroundColor = "";}}
function mensaje(){sLeft = (screen.availWidth - 350) / 2;sTop = (screen.availHeight - 400) / 2;div = document.getElementById("divMensaje");div.style.left = sLeft + "px";div.style.top = sTop + "px";div.style.visibility = "visible";}

var v;

function gestor(){if (v == null || typeof(v) != "undefined"){ancho = "800";alto = "600";xLeft = (screen.availWidth - ancho) / 2;xTop = (screen.availHeight - alto) / 2;v = window.open("../comun/Explorador.asp", "", "width=" + ancho + ", height=" + alto + ", top=" + xTop + ", left=" + xLeft);}else{}}

startList = function() 
{
	if (document.all&&document.getElementById){
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++){
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI"){
				node.onmouseover=function(){this.className+=" over";}
				node.onmouseout=function(){this.className=this.className.replace(" over", "");}
	}}}
}
window.onload=startList;
document.write('<div style="visibility:hidden;" id="divMensaje" class="divMensaje"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td><img src="img/ajax.gif" alt="Cargando..."></td><td>Cargando la imagen. Por favor, espere...</td></tr></table></div>');

/* Funciones de validación */
function validarReal(num)
{
    var erNum = /^[-]?([0-9]+)([,-.]?[0-9]+)?$/

    if(!erNum.test(num)) 
	{
       return false;
    }
	else
	{
		return true;
	}
}


function AbrirCerrar() 
{ 	
	var myConn = new XHConn();

	if (!myConn) alert("Protocolo XMLHTTP no disponible. Pruebe con un navegador m&aacute;s actual");
	
	var fnWhenDone = function (oXML) 
	{ 
		abierto = oXML.responseText;
		if (abierto == 1)
		{
			document.getElementById("estado").innerHTML = "Abierto";
			alert("La tienda ahora está abierta");
		}
		else
		{
			document.getElementById("estado").innerHTML = "Cerrado";
			alert("La tienda ahora está cerrada");
		}
		
		a = window.location.href.substr(-1, 1);
		if (a.substr(-1, 1) == "/")
		{
			document.location.reload();
		}
			
	};

	myConn.connect("AbrirCerrarAJAX.asp", "GET", "", fnWhenDone);
} 

function metas()
{
	xNombre = document.datos.Nombre.value;
	xDescripcion = document.datos.DescripcionCorta.value
	
	xNombre2 = limpiarPalabras (xNombre);
	xDescripcion2 = limpiarPalabras (xDescripcion);
	
	xMetas = xNombre2 + " "  + xDescripcion2
	xMetas = xMetas.replace(/ /g, ", ");
	
	with (document.datos)
	{
		MetaTitulo.value = xNombre;
		MetaDescripcion.value = xNombre//xDescripcion;
		MetaPalabrasClave.value = xNombre//xMetas;
	}
}

function limpiarPalabras(cad)
{
	cad = cad.toLowerCase();

	cad = cad.replace(/ a /g, " ");
	cad = cad.replace(/ e /g, " ");
	cad = cad.replace(/ o /g, " ");
	cad = cad.replace(/ y /g, " ");
	cad = cad.replace(/ de /g, " ");
	cad = cad.replace(/ en /g, " ");
	cad = cad.replace(/ para /g, " ");
	cad = cad.replace(/ su /g, " ");
	cad = cad.replace(/ sus /g, " ");
	cad = cad.replace(/ el /g, " ");
	cad = cad.replace(/ la /g, " ");
	cad = cad.replace(/ lo /g, " ");
	cad = cad.replace(/ los /g, " ");
	cad = cad.replace(/ las /g, " ");
	cad = cad.replace(/ un /g, " ");
	cad = cad.replace(/ una /g, " ");
	cad = cad.replace(/ unos /g, " ");
	cad = cad.replace(/ unas /g, " ");
	cad = cad.replace(/ esta /g, " ");
	cad = cad.replace(/ este /g, " ");
	cad = cad.replace(/ esto /g, " ");
	cad = cad.replace(/ estos /g, " ");
	cad = cad.replace(/ estas /g, " ");
	cad = cad.replace(/ con /g, " ");
	cad = cad.replace(/ es /g, " ");
	cad = cad.replace(/ son /g, " ");
	cad = cad.replace(/\./g, " ");
	cad = cad.replace(/,/g, " ");
	cad = cad.replace(/  /g, " ");
	
	return cad;
}

document.write ("<script language='javascript' src='../HLP/ayuda.js'></script>");
document.write('<script language="javascript" type="text/javascript" src="../scripts/cal.js"></script>');
document.write('<script language="javascript" type="text/javascript" src="../scripts/cal_conf.js"></script>');
