/***** COOKIES *****/

function setCookie(cookieName,cookieValue,nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString() + "; path=/";
}

function readCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

//get main style sheet
var pre = "<link rel=stylesheet href=\"css/estilos_"
var post = ".css\">"
if(readCookie("estilos")!=""){
	var estilos = readCookie("estilos");
}else{
	var estilos = "0";
}
document.write(pre+estilos+post);

//get menu js
var js;
switch (estilos){
	case "3":
		js = 'expanding-multiple_3.js';
		break;
	default:
		js = 'expanding-multiple.js';
		break;
}
pre = "<script type=\"text/javascript\" src=\"menuvert/udm-resources/";
post = "\"></script>"
document.write(pre+js+post);

function setCss(css){
	setCookie("estilos", css, 30);
	window.location = window.location.href;
}

function openMap(_url){
	window.open(_url, 'mapaWin', 'width=400,height=400');
}


function adjustTarget(target){
	var links = document.getElementsByTagName('a');
	for (var i=0; i<links.length; i++){
		links[i].href = 'javascript:openMapLink(\''+links[i].href+'\');'
	}

}

function openMapLink(href){
	window.opener.location = href;
		
	window.close();
}

function createJsLinks(){


	var lnk = document.getElementById("lnkMapa");
	lnk.onclick = new Function("openMap('"+lnk.href+"');return false;");

;
}

function init(){
	
	createJsLinks();

}