// JavaScript Document
function popupImagen(url, titulo){
	window.open("modulos/popupFotos.php?"+url+"&titulo="+titulo,"AmpliarImagen","width=640,height=500,left=0,top=0,scrollbars=yes,resizable=no");	
}
function abrirPopup(url, ancho, alto){
	window.open(url,"Ventana","width="+ancho+",height="+alto+",left=0,top=0,scrollbars=yes,resizable=no");	
}


///////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////// FUNCIONES PAR LA GESTION DE COOKIES ////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

//Crea un cookie
function setCookie(nombre, valor, fechaExp) { 
  document.cookie = nombre + "=" + escape(valor) + 
     ((fechaExp == null) ? "" : ("; expires=" + fechaExp.toGMTString())) 
}

//Obtine el valor de un cookie
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}


function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break;
	}
	return null;
}

function detectarCookie(){
var cookieEnabled=(navigator.cookieEnabled)? true : false

//if not IE4+ nor NS6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
document.cookie="testcookie"
cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
}

 if (!cookieEnabled){ 
    document.getElementById("mesg_cookie").className='cookiesi';
    return false;
 }
 else{
    document.getElementById("mesg_cookie").className='cookieno';
    return true;
   }
//if (cookieEnabled) //if cookies are enabled on client's browser
//do whatever
}

