/* 
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='#FF5E25';
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();
}
}
/*
*/


// 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 IsNumeric(sText)
{
        var ValidChars = "0123456789.";
        var IsNumber=true;
        var Char;

        for (i = 0; i < sText.length && IsNumber == true; i++) {
                Char = sText.charAt(i);
                if (ValidChars.indexOf(Char) == -1) {
                        IsNumber = false;
                }
        }
        return IsNumber;
}