// Funciones para mostrar u ocultar las opciones de los pasos 2, 3 y 4
function ocultar() {
	var trs = document.getElementsByTagName("tr");
	for (var i=0;i<trs.length;i++) {
		if (trs[i].id.indexOf("linea") >= 0) {
			trs[i].style.display = "none";
		}
	}
}

function mostrar(el_tr) {
	var trs = document.getElementsByTagName("tr");
	for (var i=0;i<trs.length;i++) {
		if (trs[i].id.indexOf("linea") >= 0 && trs[i].id != el_tr) {
			trs[i].style.display = "none";
		}
	}
	
	var trs = document.getElementsByTagName("tr");
	for (var i=0;i<trs.length;i++) {
		if (trs[i].id.indexOf(el_tr) >= 0) {
			trs[i].style.display = "block";
		}
	}
}

/* 
Funciones de rollover y preload del DW. Se utilizan en los siguientes bloques de funciones.
*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);
/*
*/

/*
Funciones para cambiar y restaurar el color de fondo de un elemento que tenga aplicado
un determinado estilo CSS. El parametro id es el identificador del elemento.
Además las funciones hacen uso de los scripts de DW para el rollover de imagen.
*/
function cambiarFondo(id,imagen){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/ini03_o.gif',1);
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/ini03_o.gif',1);
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','./images/ini03_o.gif',1);
}
}

function restaurarFondo(id,imagen){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#EAEAEA';
MM_swapImgRestore();
}
}

/* Uso:
Para aplicar el rollover hay que introducir el sig. parámetro en la etiqueta que desencadene la acción: 
onMouseOut="restaurarFondo('fila01','img01');" onMouseOver="cambiarFondo('fila01','img01');"
El elemento que cambia el color de su estilo CSS va identificado con:
id="fila01"
La imagen que hace el rollover va identificada con la propiedad:
name="img01"
*/

/*
*/
function cambiarBoton(id,imagen){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot02_o.gif',1);
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot02_o.gif',1);
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','./images/bot02_o.gif',1);
}
}

function restaurarBoton(id,imagen){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#999999';
MM_swapImgRestore();
}
}
/*
*/

/*
*/
function cambiarBoton02(id,imagen){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot03_o.gif',1);
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot03_o.gif',1);
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','./images/bot03_o.gif',1);
}
}

function restaurarBoton02(id,imagen){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#E61B02';
MM_swapImgRestore();
}
}
/* 
*/

/*
*/
function cambiarBoton03(id,imagen,imagen2){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot04_o.gif',imagen2,'','./images/bot05_o.gif',1)	
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot04_o.gif',imagen2,'','./images/bot05_o.gif',1)	
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','./images/bot04_o.gif',imagen2,'','./images/bot05_o.gif',1)	
}
}

function restaurarBoton03(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#EAEAEA';
MM_swapImgRestore();
}
}
/* 
*/

/*
*/
function cambiarBoton04(id,imagen,imagen2){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot04_o.gif',imagen2,'','./images/bot06_o.gif',1)	
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot04_o.gif',imagen2,'','./images/bot06_o.gif',1)	
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','./images/bot04_o.gif',imagen2,'','./images/bot06_o.gif',1)	
}
}

function restaurarBoton04(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#EAEAEA';
MM_swapImgRestore();
}
}
/* 
*/

/*
*/
function cambiarBoton05(id,imagen){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot02_o.gif',1);
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot02_o.gif',1);
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','./images/bot02_o.gif',1);
}
}

function restaurarBoton05(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#999999';
MM_swapImgRestore();
}
}
/*
*/

/*
*/
function cambiarBoton06(id,imagen,imagen2){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot09_o.gif',1)	
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot09_o.gif',1)	
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#EAEAEA';
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot09_o.gif',1)	
}
}

function restaurarBoton06(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImgRestore();
}
}
/* 
*/

/*
*/
function cambiarBoton07(id,imagen,imagen2){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot07_o.gif',1)	
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot07_o.gif',1)	
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#EAEAEA';
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot07_o.gif',1)	
}
}

function restaurarBoton07(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImgRestore();
}
}
/* 
*/

/*
*/
function cambiarBoton08(id,imagen,imagen2){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot10_o.gif',1)	
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot10_o.gif',1)	
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#EAEAEA';
MM_swapImage(imagen,'','./images/bot08_o.gif',imagen2,'','./images/bot10_o.gif',1)	
}
}

function restaurarBoton08(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImgRestore();
}
}
/* 
*/
// Si no se quiere obligar ningun tamaño poner ancho y altura igual a cero.
function abrirUploadNoticias(id, ancho, altura, id_noticia) {
		var w = 460;
		var h = 205;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
        win = window.open('upload.php?id='+id+'&id_noticia='+id_noticia+'&ancho='+ancho+'&altura='+altura, 'upload', winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// Si no se quiere obligar ningun tamaño poner ancho y altura igual a cero.
function abrirUploadDocumentos(id, ancho, altura, id_prensa) {
		var w = 460;
		var h = 205;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
        win = window.open('upload.php?id='+id+'&id_prensa='+id_prensa+'&ancho='+ancho+'&altura='+altura, 'upload', winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// Si no se quiere obligar ningun tamaño poner ancho y altura igual a cero.
function abrirUploadComunicados(id, ancho, altura, id_prensa_comunicado) {
		var w = 460;
		var h = 205;
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
        win = window.open('upload.php?id='+id+'&id_prensa_comunicado='+id_prensa_comunicado+'&ancho='+ancho+'&altura='+altura, 'upload', winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// Comparacion de mayor o menor. El formato de la fecha debe ser dd/mm/yyyy. 
// Esta funcion comvierte la fecha en una variable formada en yyyymmdd, asi la comparacion es mas facil
function fechas_es_menor(fecha1,fecha2)
{
	var arrayfecha1=fecha1.split("/");
	arrayfecha1[0]="00"+arrayfecha1[0];
	arrayfecha1[1]="00"+arrayfecha1[1];
	var	fechar1=arrayfecha1[2]+arrayfecha1[1].substr(arrayfecha1[1].length-2,2)+arrayfecha1[0].substr(arrayfecha1[0].length-2,2);

	var	arrayfecha2=fecha2.split("/");
	arrayfecha2[0]="00"+arrayfecha2[0];
	arrayfecha2[1]="00"+arrayfecha2[1];
	var fechar2=arrayfecha2[2]+arrayfecha2[1].substr(arrayfecha2[1].length-2,2)+arrayfecha2[0].substr(arrayfecha2[0].length-2,2);

	return (fechar1<fechar2);
}

function cambiarBoton09(id,imagen){
// Netscape 4
if(ns4){
MM_swapImage(imagen,'','../images/bot08_o.gif',1)	
}
// Explorer 4
else if(ie4){
MM_swapImage(imagen,'','../images/bot08_o.gif',1)	
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#CCCCCC';
MM_swapImage(imagen,'','../images/bot08_o.gif',1)	
}
}

function restaurarBoton09(id){
// Netscape 4
if(ns4){
MM_swapImgRestore();
}
// Explorer 4
else if(ie4){
MM_swapImgRestore();
}
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){
captura = document.getElementById(id)
captura.style.backgroundColor='#FF6600';
MM_swapImgRestore();
}
}
 