// No hace nada
function notdo(){}
//-------------------------------------------
// FUNCIONES CON VENTANAS
//-------------------------------------------
// Lanza una nueva ventana
function windowPopUp(href,prop) {
	popup=window.open(href,"popup",prop);
	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;
}
// OBJETOS
/* Recoger una unstacia de un OBJ DHTML con compatibilidad de navegadores */
function getObj(name) {
	obj = new Object();
    obj.obj = new Object();
    obj.style = new Object();
    obj.style.visibility = "";
    if (name != "") {
		if (document.all)  {
            obj.obj = document.all[name];
			if (obj.obj != "undefined" && obj.obj != null ) {
				obj.style = document.all[name].style;
			}
        }
        else if (document.getElementById) {
			obj.obj = document.getElementById(name);

			if (obj.obj != "undefined" && obj.obj != null ) {
				obj.style = document.getElementById(name).style;
			}
        }
        else if (document.layers) {
            obj.obj = document.layers[name];
			if (obj.obj != "undefined" && obj.obj != null ) {
				obj.style = document.layers[name];
			}
        }
    }
  return obj;
}
// Cambiar CONTENIDO
function alterContent(objeto, contenido){
	if (document.all)
		//dcontent.innerHTML=mycontent[i];
		document.all[objeto].innerHTML = contenido;
	else if (document.getElementById){
		rng = document.createRange();
		el = document.getElementById(objeto);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(contenido);
		while (el.hasChildNodes()) el.removeChild(el.lastChild);
		el.appendChild(htmlFrag);
	}
}
//-------------------------------------------
// MENUS - LISTA DE CAPAS -
//-------------------------------------------
var MenusJS = new Object();
var MenusTimerID = 0;
var MenusHideTime = 2; // en segundos
function addMenu(nombre) {
	MenusJS[nombre] = new Object();
	MenusJS[nombre]['timer'] = MenusHideTime;
}
function setMenuNumItems(nombre, num) {
	MenusJS[nombre]['num'] = num;
}
function getMenuNumItems(nombre) {
	return MenusJS[nombre]['num'];
}
function showMenuItem(nombre, item) {
	var objeto = new Object();
	MenusJS[nombre]['activo'] = true;
	MenusJS[nombre]['timer'] = MenusHideTime;
    objeto = getObj(item);
    objeto.style.visibility = 'visible';
    objeto.style.display = "";
}
function hideMenuItem(nombre, item){
	var objeto = new Object();
	//MenusJS[nombre]['activo'] = false;
    objeto = getObj(item);
    objeto.style.visibility = 'hidden';
    objeto.style.display = "none";
}
function hideAllMenu(nombre, item) {
	MenusJS[nombre]['activo'] = false;
	num = MenusJS[nombre]['num'];
	for (i=0; i < num; i++) {
		item_tmp = nombre + "_" + i;

		if (item == item_tmp ) { }
		else {
			hideMenuItem(nombre, item_tmp);
		}
	}
}
function activarMenu(nombre){
	MenusJS[nombre]['activo'] = true;
}
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);
}

// Iniciar la comprobacion de menus
//compruebaMenus();

/* 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();
}
/* 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()
}

/* FORMULARIOS */
function AccionOp(accionStr) {
	document.DATOS.op.value	= accionStr;
	document.DATOS.submit();
}

function ComentariosOp(accionStr,idStr) {
    document.COMENTARIOS.op.value=accionStr;
    document.COMENTARIOS.comentarioId.value=idStr;
    document.COMENTARIOS.submit();
}

/* Limitar numero de caracteres */
function checkInputSize(which, maxsize){
	which.value = which.value.substring(0, maxsize);
}
// FLASH
function makeFlashObj(file, name, width, height, bgcolor, flashVars) {
    msg = "";
    if (width == "") {
        widthStr = "";
    }
    else {
        widthStr = " width='" + width + "' ";
    }
    if (height == "" ) {
        heightStr = "";
    }
    else {
        heightStr = " height='" + height + "' ";
    }
    msg = '<OBJECT ';
    msg += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
    msg += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ';
    msg +=  widthStr + heightStr;
    msg += 'id="' + name + '" align="middle" >';
    msg += '\n<param name="allowFullScreen" value="true" />';
    msg += '\n<param name="bgcolor" value="' + bgcolor + '" />';
    msg += '\n<param name="allowScriptAccess" value="sameDomain" />';
    msg += '\n<param name="movie" value="' + file + '" />';
    msg += '\n<param name="quality" value="high" />';
	msg += '\n<param name="wmode" value="transparent" />';
    msg += '\n<param name="FlashVars" value="' + flashVars + '" />';
    msg += '\n<embed src="' + file + '" id="' + name + '" name="' + name + '"';
    msg += ' allowFullScreen="true" ';
    msg += ' quality="high" wmode="transparent" ';
    msg += widthStr + heightStr + 'bgcolor="' + bgcolor + '" align="middle" ';
    msg += 'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ';
    msg += 'FlashVars="' + flashVars + '" ';
    msg += 'pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    msg += '</OBJECT>';

    //ZZ alert(msg);
    document.write(msg);
}
/*
*
*/
function changeBackImage(id,imagen) {
    newImage = "url(" + imagen + ")";
    document.getElementById(id).style.backgroundImage = newImage;
}