// No hace nada
function notdo() {}

//-------------------------------------------
// FUNCIONES CON VENTANAS
//-------------------------------------------
// Lanza una nueva ventana
function windowPopUp(href,prop) {
	popup=window.open(href,"popup",prop);
	popup.focus();
	popup.focus();
}

// Re-escala una ventana
function windowResize(ancho,alto){
	window.resizeTo(ancho,alto);
}

// Cierra la ventana activa
function windowClose(){
	self.close();
}

//-------------------------------------------
// A DESPRECIAR EN FUTURAS VERSIONES
//-------------------------------------------
// Lanza una nueva ventana
function popupwin(href,prop) {
	popup=window.open(href,"popup",prop);
	popup.focus();
}

//-------------------------------------------
// ARRAYS
//-------------------------------------------
// Rotacion de un array a la izquierda con indice basado en 1
function arrayRotateIzquierda_1(arr){
	len = arr.length;
	
	if ( len > 1 ) {
		
		// Guardo el primer elemento
		tmp = arr[1];
		
		// Realizo la rotacion
		for (i=2; i < len ; i++){
			arr[i-1] = arr[i];
		}
		
		// Coloco el primer elemento en su sitio
		arr[len-1] = tmp;
	}

	return arr;
}

// Rotacion de un array a la derecha con indice basado en 1
function arrayRotateDerecha_1(arr){
	len = arr.length;
	
	if ( len > 1 ) {
		
		// Guardo el ultimo elemento
		tmp = arr[len-1];
		
		// Realizo la rotacion
		for ( i=(len - 1); i > 1 ; i--){
			arr[i] = arr[i-1];
		}
		
		// Coloco el primer elemento en su sitio
		arr[1] = tmp;
	}

	return arr;
}

//-------------------------------------------
// MENUS - LISTA DE CAPAS -
//-------------------------------------------
var MenusJS = new Object();
var MenusTimerID = 0;
var MenusHideTime = 3; // en segundos

// Iniciar la comprobacion
compruebaMenus();

function addMenu(nombre) {
	MenusJS[nombre] = new Object();
	MenusJS[nombre]['timer'] = MenusHideTime;
}

function setMenuNumItems(nombre, num) {
	MenusJS[nombre]['num'] = num;
}

function showMenuItem(nombre, item) {
	MenusJS[nombre]['activo']	= true;
	MenusJS[nombre]['timer']	= MenusHideTime;

	if (document.layers) {
		document.layers[item].visibility = 'show';
	}
	else if (document.all) {
		document.all[item].style.visibility = 'visible';
	}
	else if (document.getElementById) {
		document.getElementById(item).style.visibility = 'visible';
	}	
}

function hideMenuItem(nombre, item){
	
	MenusJS[nombre]['activo'] = false;
	
	if (document.layers) {
		document.layers[item].visibility = 'hide';
	}
	else if (document.all) {
		document.all[item].style.visibility = 'hidden';
	}
	else if (document.getElementById)	{
		document.getElementById(item).style.visibility = 'hidden';
	}
}

function hideAllMenu(nombre, item) {
	MenusJS[nombre]['activo'] = false;
	num = MenusJS[nombre]['num'];
	
	for (i=1; i <= num; i++) {
		item_tmp = nombre + "_" + i;
			
		if (item == item_tmp ) { }
		else {
			hideMenuItem(nombre, item_tmp);
		}
	}
}

function desactivarMenu(nombre){
	MenusJS[nombre]['activo'] = false;
}

function compruebaMenus(){
	for (menu in MenusJS) {
		
		time	= MenusJS[menu]['timer'];
		activo	= MenusJS[menu]['activo'];
		
		if (activo == false) {
			time -= 1;
			MenusJS[menu]['timer'] = time;
			
			if ( time <= 0 ) {
				hideAllMenu(menu, "");
				MenusJS[menu]['timer'] = MenusHideTime;
				MenusJS[menu]['activo'] = true;
			}
		}
	}
	
	MenusTimerID = setTimeout("compruebaMenus()", 1000);	
}


/* ENVIAR PAGINA A UN AMIGO */
 function enviarA( URLENC ) {
	win_prop	= "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=350";
	ventAmi		= window.open('send_to.php?url=' + URLENC, 'enviarA', win_prop);
	ventAmi.focus();
}

/* IMPRIMIR PAGINA */
 function ImprimirPagina( URLIMP ) {
	win_prop	= "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=750,height=550";
	ventPrn		= window.open( URLIMP , 'imprimirP', win_prop);
	ventPrn.focus();
}

/* Funciones de OVER */
function tdMenuOver(obj) {
	/*td.style.backgroundColor=color;*/
	/*obj.style.backgroundImage="URL(imagenes/fondoMenuV.gif)";*/
	null;
}

function tdMenuOverNieto(obj) {
	/*td.style.backgroundColor=color;*/
	/*obj.style.backgroundImage="URL(imagenes/fondoMenuVMAS.gif)";*/
	null;
}

function tdMenuOut(obj) {
	/*obj.style.backgroundImage=""; */
	null;
}

/* AUMENTAR Y REDUCIR LETRAS */
// StyleSwitcher functions
function setActiveSS(title) {
	var i, a, main;
	for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
}

function getActiveSS() {
	var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled ) return a.getAttribute("title");
	} return null;
}

function getPreferredSS() {
	var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title");
	} return null;
}
	
function createCookie(name,value,days) {
	if (days) {
		var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString();
	} else expires = ""; document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) {
	var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null;
}

window.onload = function(e) {
	var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredSS(); setActiveSS(title);
}

window.onunload = function(e) {
	var title = getActiveSS(); createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredSS();
setActiveSS(title);


/* -- Adobe GoLive JavaScript Library */
/* -- Global Functions */
function CSScriptInit() {
	if(typeof(skipPage) != "undefined") { if(skipPage) return; }
	idxArray = new Array;
	for(var i=0;i<CSInit.length;i++)
		idxArray[i] = i;
	CSAction2(CSInit, idxArray);
}

CSInit = new Array;
CSExit = new Array;
CSStopExecution=false;
function CSAction(array) {return CSAction2(CSAct, array);}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var aa = fct[array[i]];
		if (aa == null) return false;
		var ta = new Array;
		for(var j=1;j<aa.length;j++) {
			if((aa[j]!=null)&&(typeof(aa[j])=="object")&&(aa[j].length==2)){
				if(aa[j][0]=="VAR"){ta[j]=CSStateArray[aa[j][1]];}
				else{if(aa[j][0]=="ACT"){ta[j]=CSAction(new Array(new String(aa[j][1])));}
				else ta[j]=aa[j];}
			} else ta[j]=aa[j];
		}			
		result=aa[0](ta);
	}
	return result;
}
CSAct = new Object;
function CSClickReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return true; /* dont follow link */
	else return false; /* dont follow link */
}
/* -- Action Functions */
// Version 1.1. A Michael Ahgren action.
function CSRemoveIEbox(){
if (document.images&&navigator.userAgent.indexOf("MSIE")!=-1){
	for(i=0;i<document.links.length;i++){
		target=eval("document.links[i]")
		target.onfocus=blurHandler
		}
	}
}
function blurHandler(){
	obj=window.event.srcElement
if(obj.tagName == "A"||obj.tagName=="AREA") obj.blur()
}