//window.onerror=null

var x;
x=$(document);
//x.ready(inicializarEventos);


 stat=new Array();
msgWindow=""
n_ventanas=0 
compat = false;
mouse_x=0;
mouse_y=0;
quien0=null;
quien1=null;
quien2=null;
quien3=null;
colabora=null;

var visible = is_nav4up ? "visibility: hidden" : "visibility: hidden";
//alert("llllll")
//    var is_nav     = (parseInt(navigator.appVersion) >= 4) &&((agt.indexOf('mozilla') != -1) && (agt.indexOf('spoofer') == -1)
//		       && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera') == -1)
//		       && (agt.indexOf('webtv') == -1));
//var sw_arranque=(is_nav4up ? true : false)
var muestra_clickizq=false
if( parseInt( navigator.appVersion ) >= 3 ) { compat = true; }

//alert("Cargo Fotos");
  if (document.images) {

//    var linea_hor_f2= new Image; linea_hor_f2.src= "linea_hor_f2.gif";
//    var linea_hor_f3= new Image; linea_hor_f2.src= "linea_hor_f3.gif";
//    var linea_hor= new Image; linea_hor.src= "linea_hor.gif";
//    var boceto_web= new Image; boceto_web.src = "boceto_web.gif";
//    var logovfani= new Image; logovfani.src = "logovfani.gif";
//    var globosw= new Image; globosw.src = "globos.gif";
//    var globosw_f2= new Image; globosw_f2.src = "globos_f2.gif";

//    var ultimo_0   = new Image; ultimo_0.src	  = "imgprg/ultimo_0.gif";
//    var ultimo_1 = new Image; ultimo_1.src	= "imgprg/ultimo_1.gif";
//    var anterior_0   = new Image; anterior_0.src    = "imgprg/anterior_0.gif";
//    var anterior_1   = new Image; anterior_1.src    = "imgprg/anterior_1.gif";
//    var siguiente_0	= new Image; siguiente_0.src	= "imgprg/siguiente_0.gif";
//    var siguiente_1	= new Image; siguiente_1.src	= "imgprg/siguiente_1.gif";
//    var primero_0   = new Image; primero_0.src    = "imgprg/primero_0.gif";
//    var primero_1   = new Image; primero_1.src    = "imgprg/primero_1.gif";
  // alert(menuico_r1_c1_f1.src)
  }
if( parseInt( navigator.appVersion ) >= 3 ) { compat = true; }

var count = 0;
var hand = 0;
nav = (document.layers) ? true : false;
ie  = (document.all) ? true : false;
//if (nav)
////  skin = document.topdeck;
//  var skin = document.globos;
//if (ie)
//  var skin = globos.style;
//if (eval("(nav) ? document.layers['globos']:document.all['globos']")!=null){
//   var skin = (nav) ?  document.layers['globos']:document.globos.style;
//}
document.onmousemove = sustain;
if (nav){ document.captureEvents(Event.MOUSEMOVE)};
//*****************************************************

compat = false;

if( parseInt( navigator.appVersion ) >= 3 ) { compat = true; }

if (document.images) {
//    var linea_hor_f2= new Image; linea_hor_f2.src= "linea_hor_f2.gif";
//    var linea_hor_f3= new Image; linea_hor_f2.src= "linea_hor_f3.gif";
//    var linea_hor= new Image; linea_hor.src= "linea_hor.gif";
//    var boceto_web= new Image; boceto_web.src = "boceto_web.gif";
//    var logovfani= new Image; logovfani.src = "logovfani.gif";
/*
    var ultimo_0   = new Image; ultimo_0.src	= "imgprg/ultimo_0.gif";
    var ultimo_1 = new Image; ultimo_1.src    = "imgprg/ultimo_1.gif";
    var anterior_0   = new Image; anterior_0.src    = "imgprg/anterior_0.gif";
    var anterior_1   = new Image; anterior_1.src    = "imgprg/anterior_1.gif";
    var siguiente_0   = new Image; siguiente_0.src    = "imgprg/siguiente_0.gif";
    var siguiente_1   = new Image; siguiente_1.src    = "imgprg/siguiente_1.gif";
    var primero_0   = new Image; primero_0.src	  = "imgprg/primero_0.gif";
    var primero_1   = new Image; primero_1.src	  = "imgprg/primero_1.gif";
*/
}



//**********************************************************************
String.prototype.testNIE = function() {
    var dni = this.toUpperCase();
    var pre = dni.substr(0, 1);
    var prev = '0';
    if (pre == 'X')
       prev = '0';
    else if (pre == 'Y')
       prev = '1';
    else if (pre == 'Z')
       prev = '2';
    numero = prev + dni.substr(1,dni.length-1);
    return numero.testDNI();
}

String.prototype.testDNI = function() {
    dni = this.toUpperCase();
    numero = dni.substr(0,dni.length-1);
    numero_aux =numero;
    let = dni.substr(dni.length-1,1);
    let = let.toUpperCase();
    numero = numero % 23;
    letra = 'TRWAGMYFPDXBNJZSQVHLCKET';
    lletra = letra.charAt(numero);
    if (lletra != let){
        acepta=(confirm("Error en letra dni, trae ( "+numero_aux+let+" ) segun el cálculo debe ser la ( "+numero_aux+lletra+" ), \n Aceptar Sugerencia ???")?numero_aux+lletra:false);
        return acepta;
     }else{
        return (lletra == let)
     }
}
String.prototype.testCIF = function(){
    var pares = 0;
    var impares = 0;
    var suma;
    var ultima;
    var unumero;
    var uletra = new Array("J", "A", "B", "C", "D", "E", "F", "G", "H", "I");
    var xxx;
   
    texto = this.toUpperCase();
   
    var regular = new RegExp(/^[ABCDEFGHKLMNPQS]\d{7}[0-9,A-J]$/g);
    if (!regular.exec(texto)) return false;
         
    ultima = texto.substr(8,1);

    for (var cont = 1 ; cont < 7 ; cont ++){
        xxx = (2 * parseInt(texto.substr(cont++,1))).toString() + "0";
        impares += parseInt(xxx.substr(0,1)) + parseInt(xxx.substr(1,1));
        pares += parseInt(texto.substr(cont,1));
    }
    xxx = (2 * parseInt(texto.substr(cont,1))).toString() + "0";
    impares += parseInt(xxx.substr(0,1)) + parseInt(xxx.substr(1,1));
     
    suma = (pares + impares).toString();
    unumero = parseInt(suma.substr(suma.length - 1, 1));
    unumero = (10 - unumero).toString();
    if(unumero == 10) unumero = 0;
     
    if ((ultima == unumero) || (ultima == uletra[unumero]))
        return true;
    else
        return false;
}

function dni_nif(dni) {
//alert(dni);
dni=dni.replace("-","");
dni=dni.replace(" ","");
dni=dni.replace(".","");
	if (dni=="")
	{
		 alert("Tiene que introducir un valor para (DNI/NIE/CIF)");
		//form.nif.focus();
    		return false;
	}
	temp=dni=dni.toUpperCase();
/*	var a = dni;
	
	var temp=a.toUpperCase();
	var cadenadni="TRWAGMYFPDXBNJZSQVHLCKET";
	var v1 = new Array(0,2,4,6,8,1,3,5,7,9);*/
	if (temp!==''){
		//es un DNI
		if (!/^[ABCDEFGHKLMNPQSX]/.test(temp)){
					 numero = dni;
			 numero = numero.substr(0,numero.length-1);
			 numero =(ceros_izq(numero*1,8));
			 dni=(numero+dni.substr(dni.length-1,1));
			// alert(dni);
		    resultado_valida=dni.testDNI();
		    // alert("Valido dni "+dni+" --> "+resultado_valida)  
		     
		    if (!resultado_valida) {
		        alert("Error en DNI Introducido");
                return acepta_nif(temp);
             }else{
                 if (resultado_valida!=true){
                    dni=resultado_valida;
                }
             }
		}else{ 
			//Es un NIE o un CIF
//			if (/[x|X|y|Y]\d\d\d\d\d\d\d[a-zA-Z]/.test(temp)){ //Es un NIE
			if (/[x|X|y|Y]/.test(temp)){ //Es un NIE
			 numero = dni.substr(1,dni.length-1);
			 numero = numero.substr(0,numero.length-1);
			 numero =(ceros_izq(numero*1,7));
			 dni=(dni.substr(0,1)+numero+dni.substr(dni.length-1,1));
			// return dni.testNIE();
		    // alert("Valido dni "+dni+" --> "+resultado_valida)  
	 		    resultado_valida=dni.testNIE();
		    if (!resultado_valida){
		        alert("Error en NIE Introducido");
                return acepta_nif(temp);
            }else{
            
            }

			}else{ //Es un CIF
		    // alert("Valido CIF "+dni)           
             resultado_valida=dni.testCIF();
           //  alert("Valido CIF "+dni+" --> "+resultado_valida)  
    		    if (!resultado_valida) {
	    	        alert("Error en CIF o Valor Introducido Introducido");
                    return acepta_nif(temp);
                }
            }
		}
	}
	
	return dni;
}
//****************************
function acepta_nif(dni_trae){

return (confirm("El dato Introducido ( "+dni_trae+" ) parece Erróneo, ¿Aceptar de todos modos?")?dni_trae:false);

}
//****************************
function toCapitalCase(cadena) {

var re = /\s/;
var words = cadena.split(re);
re = /(\S)(\S+)/;
for (i = words.length - 1; i >= 0; i--) {
re.exec(words[i]);
words[i] = RegExp.$1.toUpperCase()
+ RegExp.$2.toLowerCase();
}

lleva=words.join(' ');
//alert(lleva);
return lleva;
} 



function dni_nif1(dni) {
//alert(dni);
dni=dni.replace("-","");
dni=dni.replace(" ","");
dni=dni.replace(".","");
	if (dni=="")
	{
		// alert("Tiene que introducir un valor para (DNI/NIE/CIF)");
		//form.nif.focus();
    		return "";
	}
	temp=dni=dni.toUpperCase();
/*	var a = dni;
	
	var temp=a.toUpperCase();
	var cadenadni="TRWAGMYFPDXBNJZSQVHLCKET";
	var v1 = new Array(0,2,4,6,8,1,3,5,7,9);*/
	if (temp!==''){
		//es un DNI // ABCDEFGHKLMNPQSX
        if (/^[ABCDEFGHKLMNPQSX]/.test(temp)){
					 numero = dni;
			 numero = numero.substr(0,numero.length-1);
			 numero =(ceros_izq(numero*1,8));
			 dni=(numero+dni.substr(dni.length-1,1));
			// alert(dni);
		    resultado_valida=dni.testDNI();
		    // alert("Valido dni "+dni+" --> "+resultado_valida)  
		    if (!resultado_valida) {
		        alert("Error en DNI Introducido");
                return acepta_nif(temp);
             }
		}else{ 
			//Es un NIE o un CIF
//			if (/[x|X|y|Y]\d\d\d\d\d\d\d[a-zA-Z]/.test(temp)){ //Es un NIE
			if (/[x|X|y|Y]/.test(temp)){ //Es un NIE
			 numero = dni.substr(1,dni.length-1);
			 numero = numero.substr(0,numero.length-1);
			 numero =(ceros_izq(numero*1,7));
			 dni=(dni.substr(0,1)+numero+dni.substr(dni.length-1,1));
			// return dni.testNIE();
		    // alert("Valido dni "+dni+" --> "+resultado_valida)  
	 		    resultado_valida=dni.testNIE();
		    if (!resultado_valida){
		        alert("Error en NIE Introducido1");
                return false;
            }else{
            
            }

			}else{ //Es un CIF
		    // alert("Valido CIF "+dni)           
             resultado_valida=dni.testCIF();
           //  alert("Valido CIF "+dni+" --> "+resultado_valida)  
    		    if (!resultado_valida) {
	    	        alert("Error en CIF Introducido");
                    return false;
                }
            }
		}
	}
	
	return dni;
}
//****************************
function ceros_izq(num,n_ceros){
 if (typeof n_ceros=="undefined"){
            n_ceros=10;
         }
	numtmp='"'+num+'"';
	largo=numtmp.length-2;
	numtmp=numtmp.split('"').join('');
	if(largo==n_ceros)return numtmp;
	ceros='';
	pendientes=n_ceros-largo;
	for(i=0;i<pendientes;i++)ceros+='0';
	return ceros+numtmp;

}

//**********************************************************************

    function initialize(coor_x,coor_y,zoom_trae) {
 // alert(coor_x);
      if (GBrowserIsCompatible()) {
         if (typeof zomm_trae=="undefined"){
            zoom_trae=16;
         }
       //  alert(coor_x+" / ("+coor_y+")");
        map = new GMap2(document.getElementById("map_canvas"));
        if (typeof coor_y!="undefined" && coor_y!="" ){
           // alert(1);
            map.setCenter(new GLatLng(coor_x,coor_y), zoom_trae);
        }else{
           // alert(2);
           // showAddress(coor_x);
          //  map.setCenter(new GLatLng(40.407022,-3.874859), zoom_trae);
        }
         map.setMapType(G_HYBRID_MAP);
         map.addControl(new GLargeMapControl());
         map.addControl(new GHierarchicalMapTypeControl());
         map.addControl(new GOverviewMapControl());
         
        geocoder = new GClientGeocoder();
      //  var mapControl = new GMapTypeControl();
      }
    }

    function showAddress(address,texto_pon) {
      //alert("3---->"+address);
      if (geocoder) {
        //alert(address);
        geocoder.getLatLng(
          address,
          function(point) {
          
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 17);
            			var marker = new GMarker(point);
            			map.addOverlay(marker);
              //  marker.openInfoWindowHtml("<b>"+address+"</b><br>Coordenadas:<br>Latitud : "+point.y+"<br>Longitud : "+point.x+"<a href=# target=ampliar><br><br>kkkk</a>");
marker.openInfoWindowHtml("<b>"+texto_pon+"</b><a href=index.php?p=mapa_google&arg='"+escape(address)+"',null,null,null,"+"'"+escape(texto_pon)+"'&blanca"+" target=ampliar><br><br>Ampliar</a>");
            
               // marker.openInfoWindowHtml("<b>"+texto_pon+"</b><br>"+address+"<a href=index.php?p=mapa_google&arg='"+escape(address)+"',null,null,null,"+"'"+escape(texto_pon)+"'&blanca"+" target=ampliar><br><br>Ampliar</a>");
             //var marker = new GMarker(point);
            // map.addOverlay(marker);
             // marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }


function ahora(){

var fecha=new Date();
var diames=fecha.getDate();
var diasemana=fecha.getDay();
var mes=fecha.getMonth() +1 ;
var ano=fecha.getFullYear();

var textosemana = new Array (7);
  textosemana[0]="Domingo";
  textosemana[1]="Lunes";
  textosemana[2]="Martes";
  textosemana[3]="Miércoles";
  textosemana[4]="Jueves";
  textosemana[5]="Viernes";
  textosemana[6]="Sábado";

var textomes = new Array (12);
  textomes[1]="Enero";
  textomes[2]="Febrero";
  textomes[3]="Marzo";
  textomes[4]="Abril";
  textomes[5]="Mayo";
  textomes[6]="Junio";
  textomes[7]="Julio";
  textomes[7]="Agosto";
  textomes[9]="Septiembre";
  textomes[10]="Octubre";
  textomes[11]="Noviembre";
  textomes[12]="Diciembre";

/*document.write("Fecha completa: " + fecha + "<br>");
document.write("Dia mes: " + diames + "<br>");
document.write("Dia semana: " + diasemana + "<br>");
document.write("Mes: " + mes + "<br>");
document.write("Año: " + ano + "<br>");
document.write("Fecha: " + diames + "/" + mes + "/" + ano + "<br>");
document.write("Fecha: " + textosemana[diasemana] + " " + diames + "/" + mes + "/" + ano + "<br>");
*/
return ("" + textosemana[diasemana] + ", " + diames + " de " + textomes[mes] + " de " + ano + "<br>");
}



//**************************
function dni_nif_ant(dni) {
if (dni=="") return true;
//alert("dniTrae a Verificar "+dni);
  numero = dni.substr(0,dni.length-1);
  let = dni.substr(dni.length-1,1);
  let = let.toUpperCase();
  //alert(numero+"--"+let);
  numero = numero % 23;
  letra='TRWAGMYFPDXBNJZSQVHLCKET';
  letra=letra.substring(numero,numero+1);
   // alert(numero+"--"+let+"---"+letra);
  if (letra!=let) {
    alert('Dni erroneo');
    return false;
   }else{
    return dni.toUpperCase();
   }
}



function dni_nif_ant2(dni) {
//alert(dni);
	if (dni=="")
	{
		 alert("Ha d'omplir el camp NIF");
		form.nif.focus();
    		return false;
	}
	
	var a = dni;
	
	var temp=a.toUpperCase();
	var cadenadni="TRWAGMYFPDXBNJZSQVHLCKET";
	var v1 = new Array(0,2,4,6,8,1,3,5,7,9);
	if (temp!==''){
		// No es un CIF ni un NIE, es un DNI
		if (!/^[ABCDEFGHKLMNPQSX]/.test(temp)){
			posicion = a.value % 23; /*Resto de la division entre 23 es la posicion en la cadena*/
			letra = cadenadni.charAt(posicion);
			if (!/^[A-Za-z0-9]{9}$/.test(temp)){ 
				//Es menos de 9 dígitos, añadimos la letra
				alert('El DNI tiene menos de 9 dígitos');
				a=a+letra ;
				//form.nif.focus();
		    		return false;
			}else{ 
				//Tiene los 9 dígitos, comprobamos si la letra esta bien
				posicion = a.substring(8,0) % 23; /*Resto de la division entre 23 es la posicion en la cadena*/
				letra = cadenadni.charAt(posicion);
				var letradni=temp.charAt(8);
				if (letra != letradni){
					alert("La Letra del DNI no es correcta."+letradni+" es diferent a "+letra);
					//form.nif.focus();
					void(0);
			    		return false;
				}
			}
		}else{ 
			//Es un NIE o un CIF
			if (/^[X]/.test(temp)){ //Es un NIE
				var temp1=temp.substr(1,8);
				posicion = temp1 % 23; /*Resto de la division entre 23 es la posicion en la cadena*/
				letra = cadenadni.substring(posicion,posicion+1);
				if (!/^[A-Za-z0-9]{9}$/.test(temp)){ //Es menos de 9 dígitos, añadimos la letra
					alert('El NIE tiene menos de 9 dígitos');
					a=a+letra ;
				//	form.nif.focus();
			    		return false;
				}else{ //Tiene los 9 dígitos, comprobamos si la letra esta bien
					var temp1=temp.substr(1,7);
					posicion = temp1 % 23; /*Resto de la division entre 23 es la posicion en la cadena*/
					letra = cadenadni.charAt(posicion);
					var letranie=temp.charAt(8);
					if (letra != letranie){
						alert("La letra del NIE no es correcta."+letranie+" es diferent a "+letra);
						//form.nif.focus();
						void(0);
				    	//	return false;			
					}
				}
			}else{ //Es un CIF
				var cifcontrol = 0;
				for( i = 2; i <= 6; i += 2 ){
					cifcontrol = cifcontrol + v1[ parseInt(temp.substr(i-1,1)) ];
					cifcontrol = cifcontrol + parseInt(temp.substr(i,1));
				};
				cifcontrol = cifcontrol + v1[ parseInt(temp.substr(7,1)) ];
				cifcontrol = (10 - ( cifcontrol % 10));

				if (!/^[A-Za-z0-9]{9}$/.test(temp)){ //Es menos de 9 dígitos, añadimos el dígito de control
					alert('El Cift iene menos de 9 dígitos');
					//form.nif.focus();
			    		return false;			
					a=a+cifcontrol;
				}else{
					if (cifcontrol!=temp.substr(8,1)){
						alert ('El dígito de control del CIF no es correcto.El correcte es '+cifcontrol);
						//form.nif.focus();
				    		return false;			
					}
				}
			}
		}
	}
}
//**************************
function impre_capa(que,css,logo,capa_titu,titu_print_capa) {
var ventana = window.open("", "", "");
//alert(capa_titu);
//alert(que);
//alert($("#"+que).html());
 var contenido = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">';
 if (typeof titu_print_capa!="undefined" && titu_print_capa!=""){
 // &&  titu_print_capa.indexOf('---')!=-1
 //alert(titu_print_capa);
 if (typeof titu_print_capa=="undefined"){
 
 }else{
  titu_print_capa=escape(titu_print_capa);
 }
 titu_print_capa=replaceString("_"," ",titu_print_capa);
 //   titu_print_capa= "<h1>"+titu_print_capa.replace("(","</h1><h2>")+"</h2>";
 //  titu_print_capa= titu_print_capa.replace(")","");
 }else{
    if (typeof document.getElementById(capa_titu).innerHTML!="undefined"){
       titu_print_capa=document.getElementById(capa_titu).innerHTML; 
       
      // alert(titu_print_capa);
    }else{
        titu_print_capa="";
    }
 }
 if (typeof capa_titu!="undefined" && capa_titu!=""){
    contenidi_titu= document.getElementById(capa_titu).innerHTML;
}else{
    contenidi_titu="";
}
 if (titu_print_capa.indexOf('---') != -1) titu_print_capa= "<h1>"+titu_print_capa.replace("---","</h1><h2>")+"</h2>";


fecha="<p>Fecha de Impresi&oacute;n : "+ahora();+"</p>"
//window.close();
titu_print_capa=unescape(titu_print_capa);
//alert(titu_print_capa);
//<div style='margin-top:10px;margin-bottom:30px;'>"+contenidi_titu+"</div>
var contenido = contenido + "<head><link rel='stylesheet' type='text/css' title='default' href='"+css+"' /><style type='text/css'>body{background-color:#fff;}</style></head><body onload='window.print();window.close();'><div style='text-align:left;' ><div align=right style='float:right;clear:both;width:100%;'><img src="+logo+" align='left'>"+titu_print_capa+"<div style='color:#000;'>"+fecha+"</div></div><div style='clear:both'></div>" + document.getElementById(que).innerHTML + "</div></body></html>";
ventana.document.open();
ventana.document.write(contenido);
ventana.document.close();
}
//*************************
function oculta_menu_bot() {
//alert("kkkqwwekwk");
    if (typeof stat['columder']=="undefined"){
       // alert(333)
        stat['columder']=1;
        len_columder=document.getElementById("columizq").offsetWidth;
      //alert((document.getElementById("container").offsetWidth)-10);
      max_ancho=(document.getElementById("container").offsetWidth)-10;
        ant_w_der=len_columder;
      //  alert( ant_w_der);
    }
	var izq=$("#columder");
	var der=$("#content");
	der.animate({"left": "+=50px"}, "slow");
	//alert(mnu_op);
	if (mnu_op){
	// izq.fadeIn("slow");
	   izq.show();
	    document.getElementById("columizq").offsetLeft
	    
	    der.width(len_columder);
	    
	    der.css('margin-left',max_ancho-len_columder);
	}else{
	//izq.fadeOut("slow");
	    izq.hide();
	   
	   der.width(max_ancho);
	   der.css('margin-left',0);
	}
//izq.toggle();
//der.toggle();
//	der.width(len_columizq+len_columder-10);

}
function oculta_menu(){
len_exterior=document.getElementById("exterior").offsetWidth;
len_content=document.getElementById("content").offsetWidth;
len_columder=document.getElementById("columder").offsetWidth;
len_columizq=document.getElementById("columizq").offsetWidth;
//alert(len_exterior);
//alert(len_content);
//alert(len_columizq+"--"+len_columder+"---"+len_content);

//alert(aux_ancho_capa_menu);
	//alert(document.getElementById("columder"));
	pinta=0;
	var x=$("#columizq");
	if (typeof document.getElementById("columder")!="undefined"){
		objParent_colder=document.getElementById("columder");
	}else{
	//return;
	}
	objParent_content=document.getElementById("content");
	//alert(typeof stat['columder']);
	
	if (typeof stat['columder']=="undefined"){
	//alert("Indefinido");
		aux_obj_content=objParent_content;
		aux_obj_colder=objParent_colder;
		stat['columder']=1;
		show_html('columder');
		ahora_no=false;
		//alert((is_ie && !is_ie7)?show_props(objParent_content.style):"FFX y IE7");
		if (is_ie && !is_ie7){
			//IE6
			//document.write(show_props(objParent_content));
			//alert(objParent_content.clientWidth);
		}
		//ant_width=(is_ie && !is_ie7)?objParent_content.clientWidth:objParent_content.clientWidth;
		ant_width=objParent_content.clientWidth;
		//ant_left=(is_ie && !is_ie7)?objParent_content.style.left:objParent_content.offsetLeft;
		//alert(objParent_content.offsetLeft)
		ant_left=objParent_content.offsetLeft;
		ant_w_izq=len_columizq;
		ant_w_der=len_columder;
		sw_caja=true;
		//ant_width=ant_width-10;
		//ant_left=ant_left-10;
                  x.hide();
            x.width(len_columizq+len_columder-10);
            x.show("normal");
	}else{
		ahora_no=true;
		show_html('columder');
        sw_caja=!sw_caja;
        if (sw_caja){
          x.hide();
            x.width(len_columizq+len_columder-10);
            x.show("normal");
        }else{
        x.hide();
        x.width(ant_w_izq-10);
       x.fadeIn("slow");
        }
	}
	
	if (ahora_no){
			
    }else{

		//x.width(len_content)
		//.css({"background-color":"blue"});
          
          
    }
		
   //
	//alert(aux_obj_content);
	//alert(stat['columder']);
	//alert(ant_left );
	//alert(ant_width);

//if (document.getElementById("content").offsetHeight<(document.getElementById("columder").offsetHeight-11)) {
//    document.getElementById("content").style.height=(document.getElementById("columder").offsetHeight-11)+'px';
//    //alert(document.getElementById("content").offsetHeight);
//}

	if (stat['columder']==1){
	//alert("Visible");
	    //x.width(len_content/(sw_caja?2:1))
		//objParent_content.style.marginLeft=aux_ancho_capa_menu+5+"px";
		//objParent_content.style.width=(ant_width)+"px";
		//objParent_content.style.width=(len_exterior-aux_ancho_capa_menu-15)+"px";
		//alert(len_exterior);
		//alert(objParent_content.style.width);
		//objParent_content.style.width=(ant_width-10)+"px";
		//objParent_content=aux_obj_content;
		//objParent_colder=aux_obj_colder;
	
	}else{
	  
	//alert("No Visible");
		//alert("oculto");
		//alert(objParent.clientWidth);
		//alert(typeof ant_width);
		//document.write(show_props(objParent.style));
		
		//ant_width=(is_ie && !is_ie7)?objParent_content.style.width:objParent_content.clientWidth;
		//ant_left=(is_ie && !is_ie7)?objParent_content.style.width:objParent_content.offsetLeft;
		if (is_ie && !is_ie7 ){ 
			//objParent_content.style.width="100%";
			//objParent_content.style.marginLeft=0;
			//objParent.style.width=ant_width;
		}else{
		}
		/*	new_width=document.getElementById("exterior").clientWidth-30
			//objParent_content.style.marginLeft="10px";
			
			//objParent_content.style.width=new_width+"px";
			objParent_content.style.width="100%";
			*/
			objParent_content.style.marginLeft="0px";
			objParent_content.style.width=(len_exterior-10)+"px";
		
	
	}
	//if (ahora_no) 
}


//**********************************************************************
function pinta_video(nombre,capa){
//nombre=nombre.replace("/","___");
//nombre=nombre.replace(".","----");
//alert(capa+"/"+nombre);
if(typeof capa!='undefined'){
	//alert("trae capa -> "+capa);
	//evalua="var "+capa+"_aux"+"=document.getElementById('"+capa+"').innerHTML;"
	evalua=capa+"_aux"+"=document.getElementById('"+capa+"').innerHTML;"
	//alert(evalua);
	eval(evalua);
	//var html_capa_aux=document.getElementById(capa).innerHTML;
	capa_aux = eval(capa+"_aux;");
	//alert(capa_aux);
	//alert("++++"+eval(capa+"_aux;"))
}

evalua2=capa+"_aux2";
esta_capa=(typeof(window[evalua2]));
//alert(esta_capa)
if(esta_capa!='undefined'){
	//alert(99999999)
	//alert("Definido------------->");
	document.getElementById(capa).innerHTML=eval(evalua2);
}else{
//alert("No Definido------------->cARGO FOTO");
//alert("no definida :"+evalua2);
loadPage(capa,null,'index.php?p=embed_media&arg=`'+escape(nombre)+'`,`'+capa+'`&nada=true');
}
/*if(typeof capa!='undefined'){
	evalua=capa+"_aux2"+"=document.getElementById('"+capa+"').innerHTML;"
	//alert(evalua);
	eval(evalua);
	//var html_capa_aux=document.getElementById(capa).innerHTML;
	capa_aux2 = eval(capa+"_aux2;");
	//alert(capa_aux);
	//alert("++++"+eval(capa+"_aux;"))
}else{
	
}*/

}

function isdefined( variable){
    return (typeof(window[variable]) == "undefined")?  false: true;
}

//********************************************************
function isempty(aTextField) {

   if ((aTextField.value.length==0) ||  (aTextField.value==null)) {
	alert(aTextField.value.length+"/"+aTextField.value);
      return true;
   }
   else { return false; }
}	
//******************** AJAX  **********************************

/* Código JavaScript:
*Esta libreria es una libreria AJAX creada por Javier Mellado con la inestimable
*colaboracion de Beatriz Gonzalez.
*y descargada del portal AJAX Hispano http://www.ajaxhispano.com
*contacto javiermellado@gmail.com
*
*Puede ser utilizada, pasada, modificada pero no olvides mantener
*el espiritu del software libre y respeta GNU-GPL
*/ 
function creaAjax(){
         var objetoAjax=false;
         try {
          /*Para navegadores distintos a internet explorer*/
          objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
          try {
                   /*Para explorer*/
                   objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
                   }
                   catch (E) {
                   objetoAjax = false;
          }
         }

         if (!objetoAjax && typeof XMLHttpRequest!='undefined') {
          objetoAjax = new XMLHttpRequest();
         }
         return objetoAjax;
}


function FAjax (url,capa,valores,metodo,objeto)
{
//alert(capa);
//alert(document.getElementById(capa));
          
//alert(objeto);

          if (typeof objeto=="undefined"){
              objeto = document;
          }
          var ajax=creaAjax();

              var capaContenedora = objeto.getElementById(capa);

//capa_nulo=isNull(capaContenedora);
//if (capa_nulo) return;
//document.write(show_props(capaContenedora));
/*Creamos y ejecutamos la instancia si el metodo elegido es POST*/
if(metodo.toUpperCase()=='POST'){
//alert(url);
         ajax.open ('POST', url, true); 
	//alert(capaContenedora);
	//alert(capaContenedora.nodeName+" es iframe");
	 if (capaContenedora.nodeName!="IFRAME" && capaContenedora.innerHTML){
	// alert(capaContenedora.nodeName+" es iframe");
		 ajax.onreadystatechange = function() {
			//if(true ||  apaContenedora.innerHTML){
			//alert(capaContenedora.nodeName)
			//alert("Cont_html : "+capaContenedora.innerHTML)
			//alert("AjaxResp : "+ajax.responseText)
			 if (ajax.readyState==1 ) {
					//  capaContenedora.innerHTML="<br>Cargando.......";
					  capaContenedora.innerHTML="<br><img src='imgprg/wait.gif'>";
			 }else if (ajax.readyState==4){
				   if(ajax.status==200 && capaContenedora.innerHTML){
					
					objeto.getElementById(capa).innerHTML=ajax.responseText;
				   } else if(ajax.status==404){
					capaContenedora.innerHTML = "La direccion no existe";
				   }else{
					    capaContenedora.innerHTML = "Error: ".ajax.status;
				   }
			}
		}
	}
         ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	// alert(valores);
         ajax.send(valores);
         return;
}
/*Creamos y ejecutamos la instancia si el metodo elegido es GET*/
if (metodo.toUpperCase()=='GET'){

         ajax.open ('GET', url, true);
         ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                                      capaContenedora.innerHTML="<br><img src='imgprg/wait.gif'>";
         }
         else if (ajax.readyState==4){
                   if(ajax.status==200){
                                             objeto.getElementById(capa).innerHTML=ajax.responseText;
                   }
                   else if(ajax.status==404)
                                             {

                            capaContenedora.innerHTML = "La direccion no existe";
                                             }
                                             else
                                             {
                            capaContenedora.innerHTML = "Error: ".ajax.status;
                                             }
                                    }
                  }
         ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
         ajax.send(null);
         return
}
} 
 


//*********************** UPLOAD FILE AJAX ***************************************************
//var http = createRequestObject();
//var uploader = '';

function createRequestObject() {
//alert(222)
    var obj;
    var browser = navigator.appName;
    
    if(browser == "Microsoft Internet Explorer"){
        obj = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
        obj = new XMLHttpRequest();
    }
    return obj;    
}

function traceUpload(uploadDir,action) {
         
   http.onreadystatechange = handleResponse;

   //http.open("GET", 'imageupload.php?uploadDir='+uploadDir+'&uploader='+uploader); 
   http.open("GET", action+'&uploadDir='+uploadDir+'&uploader='+uploader); 
   http.send(null);   
}

function handleResponse() {

    if(http.readyState == 4){
        document.getElementById(uploaderId).innerHTML = http.responseText;
        //window.location.reload(true);
    }
    else {
        document.getElementById(uploaderId).innerHTML = "Uploading File. Please wait...";
    }
}
function uploadFile(obj) {
//alert((obj));
    var uploadDir = obj.value;
    uploaderId = 'uploader'+obj.name;
  // alert('Que -->'+uploadDir)
    uploader = obj.name;
   //alert('aQUI   formName-->'+obj.name)
    //alert(document.getElementById('formName'+obj.name).action)
   
    //document.getElementById('iframe'+obj.name).style.display="block";
    
    //parent.document.getElementById("'.$nom_campo.'_docunew'.$id_trae.'").style.display
     formname='formName'+obj.name;
  //   alert('formName'+obj.name);
   // alert(document.getElementById(formname));
    if (false && parent.document.getElementById('iframe'+obj.name)) {
	//alert("Hay parent"+parent.document.getElementById('iframe'+obj.name));
	//alert("iframe ->"+parent.document.getElementById('iframe'+obj.name));
	//alert("form ->"+parent.document.getElementById(formname).action);
	parent.document.getElementById(formname).submit();
	//alert(1111);
    }else{
    	//alert("iframe ->"+document.getElementById('iframe'+obj.name));
	//alert("form ->"+document.getElementById(formname));
	//alert("form ->"+document.getElementById(formname).action);
	//alert(formname);
	document.getElementById(formname).submit();
    }
    
    

     
     
 //traceUpload(uploadDir, document.getElementById('formName'+obj.name).action,obj.name);    
  // traceUpload(uploadDir, obj.name);    
}  
function kkkk(valor_trae){
	alert(valor_trae);
}
function actu_campo(valor_trae,campo_input){
		//alert(campo_input.name+'--->'+valor_trae.name+'--->'+valor_trae.checked+'--->'+valor_trae.value);
		//alert(campo_input.value+' / '+'#'+valor_trae.value+'#');
		//alert(campo_input.value.indexOf('#'+valor_trae.value+'#'));
		
		if (valor_trae.checked){
			if (campo_input.value=='') {
				pon='#'+valor_trae.value+'#';
			}else if (campo_input.value.indexOf('#'+valor_trae.value+'#')==-1){	
			//alert(222);
				pon=valor_trae.value+'#';
			}else{
			pon='';
			}
			//alert(pon);
			campo_input.value=campo_input.value+pon;
			//alert(show_props(campo_input));
		}else{
			if (campo_input.value!='') {
				campo_input.value=campo_input.value.replace('#'+valor_trae.value,'');
			}
		}
	}
function uploadFile1(obj) {
    var uploadDir = obj.value;
    alert(obj.value);


	uploaderId = 'uploader'+obj.name;
    uploader = obj.name;
    nomform='formName'+obj.name
    alert(document.getElementById('formName'+obj.name));
  //alert(show_props(document.getElementById(nomform)));
  a=document.getElementById('formName'+obj.name);
   alert(a);
  a.submit();
  
    traceUpload(uploadDir, obj.name);    
}  
//***************************** FIN AJAX *************************************************
function sleep(millisecondi)
{
    var now = new Date();
    var exitTime = now.getTime() + millisecondi;

    while(true)
    {
        now = new Date();
        if(now.getTime() > exitTime) return;
    }
}

function sleep1 ( microseg ) { setTimeout ( " nada ( ) " , microseg ) ;return true;}; 
function nada() {  return true;}
//*************************************************************
//function show_html(id){objParent=document.getElementById(id); objDaughter=document.getElementById('iDMain'+id); if (stat[id]!=1) {stat[id]=1; objDaughter.style.display='block';} else {if(stat[id]==1){stat[id]=0; objDaughter.style.display='none'; }  }  }

function show_html(id,oculta){
  var x=$("#"+id);
  x.toggle("normal");
  //if (getCookie("web_ahora")=="afe09") redimensiona_columnas();

}

function show_html1(id,ver){
stat[id]=1;
  var x=$("#"+id);
 
if (ver==1) {
 x.fadeIn("normal");
// x.show().fadeTo("slow",1);

} else {
 x.fadeOut("fast");
}  
}

//*********************
function show_html_antok(id,oculta){
//alert(id+" \ "+oculta+" | "+stat[id]);
//alert(id+" \ "+objDaughter.style.display+" | "+stat[id]);

objParent=document.getElementById(id);
objDaughter=document.getElementById(id); 
//alert(objDaughter.style.display);
if (oculta) stat[id]=1;
if (oculta==1) { stat[id]=1;}
if (stat[id]!=1) 
{stat[id]=1; objDaughter.style.display='block';} else {if(stat[id]==1){stat[id]=0; objDaughter.style.display='none'; }  }  }
//**********************************
function show_html2(id,oculta){
//alert(id+" \ "+oculta+" | "+stat[id]);

objParent=document.getElementById(id);
objDaughter=document.getElementById(id); 
//alert(objDaughter.style.display);
if (oculta==1) {
	objDaughter.style.display='block';
}else{
	objDaughter.style.display='none'; 
}
/*if (oculta) stat[id]=1;
if (oculta==1) { stat[id]=1;}
if (stat[id]!=1) 
{stat[id]=1; objDaughter.style.display='block';} else {if(stat[id]==1){stat[id]=0; objDaughter.style.display='none'; }  }  }
*/
}
//***************************************************************
/*
function imprimesta(pinta){
if (pinta==1){
	//alert("voy a Imprimir");
	show_html('rightcolumn',1);
	//if (ie) show_html('rightcolumn');
	show_html('menu_h',1);
	show_html('topbanner_noticion',1);
	show_html('topbanner_login',1);
	//if (ie) show_html('topbanner_login');
	objParent=document.getElementById("content")
	//document.write(show_props(objParent));
	//if ( !document.getElementById || !document.getElementsByTagName ) {alert("aqui");}else{ alert("Aqui no");}
	ant_width=(ie)?objParent.style.width:objParent.clientWidth;
	
	//alert(ant_width);
	if (ie){ 
		objParent.style.Width="85%";
		
		//objParent.style.width=ant_width;
	}else{
		objParent.style.Width="85%";
	}
	this.print();
}else{
//if (!ie) alert("voy a Imprimir");
//	show_html('topbanner_login');
//	show_html('rightcolumn');
	document.location.href=document.location.href
}
//show_html('amigo');
//show_html('amigo');


//objParent=document.getElementById(id)
}*/

//***********************************************************
function isNull(a) {
    return typeof a == 'object' && !a;
}
function pontitu(){
 if (!isNull(quien0) && quien0!="") {
//alert(quien0);
if (ie){
	//alert("2."+document.quien0);
	
       document.quien0.SetVariable("quiennuevo",quien0);
       document.quien1.SetVariable("quiennuevo",quien1);
       document.quien2.SetVariable("quiennuevo",quien2);
       document.quien3.SetVariable("quiennuevo",quien3);
       document.colabora.SetVariable("quiennuevo",colabora);
    }else{
/*alert("2."+quien0);
//document.write(show_props(document.quien0))
 mydoc=window["quien0"];

      mydoc.SetVariable("quiennuevo",quien0);
      parent.titulo.document.quien1.SetVariable("quiennuevo",quien1);
      parent.titulo.document.quien2.SetVariable("quiennuevo",quien2);
      parent.titulo.document.quien3.SetVariable("quiennuevo",quien3);
      parent.titulo.document.colabora.SetVariable("quiennuevo",colabora);
*/	
    }
    }
}

function pop(orientation,msg) {
if (pon_globos!=true){
  return
}
 //content=msg
 content=  '  <table border="0" cellpadding="0" cellspacing="0" width="1" height="1"> '
+'  <tr>  '
+'    <td rowspan="2" colspan="2" >	'
+'	 <img src="shim.gif" width="1" height="1" border="0"> '
+'    </td>	  '
+'    <td align="left"> 	'
+'	<div align="left"><img src="shim.gif" width="1" height="18" border="0"></div>	'
+'    </td>	  '
+'    <td width="1">  '
+'	<div align="left" width="1"><img src="globos/globo_pico.gif" align="left" width="27" height="18" border="0"></div>	'
+'    </td>	  '
+'    <td>'
+'	<div align="left"><img	src="shim.gif" width="1" height="18" border="0"></div>	'
+'    </td>	  '
+'    <td rowspan="2" colspan="2">	'
+'	 <img src="shim.gif" width="1" height="1" border="0"> '
+'    </td>	  '
+'  </tr> '
+'  <tr>  '
+'    <td bgcolor="#000000" width="1">	'
+'	<div align="left"><img src="shim.gif" width="1" height="1" border="0"></div>'
+'    </td>	  '
+'    <td bgcolor="#000000" width="1">	'
+'	<div align="left"><img src="globos/globo_blancen.gif" align="left" width="27" height="1" border="0"></div>	'
+'    </td>	  '
+'    <td bgcolor="#000000" width="100%">   '
+'	<div align="left"><img src="shim.gif" width="1" height="1" border="0"></div>'
+'    </td>	  '
+'  </tr> '
+'  <tr>  '
+'    <td colspan="2" valign="top" height="7" width="11"><img src="globos/globo_supiz.gif" width="11" height="7" border="0"></td>   '
+'    <td colspan="3" bgcolor="#FFFFFF" height="1"><img src="shim.gif" width="1" height="1" border="0"></td>  '
+'    <td colspan="2" valign="top" height="7"><img  src="globos/globo_supder.gif" width="11" height="7" border="0"></td>'
+'  </tr> '
+'  <tr>  '
+'    <td width="1" bgcolor="#000000"><img src="shim.gif" width="1" height="1" border="0"></td>   '
+'    <td bgcolor="#FFFFFF" width="11"><img src="shim.gif" width="1" height="1" border="0"></td>  '
+'    <td colspan="3" bgcolor="#FFFFFF" height="2" nowrap><center><font size="-2" face="Geneva, Arial, Helvetica, san-serif" size=-1>'
+ msg
+'</font></center></td>     '
+'    <td bgcolor="#FFFFFF"><img src="shim.gif" width="11" height="1" border="0"></td>	'
+'    <td width="1" bgcolor="#000000"><img src="shim.gif" width="1" height="1" border="0"></td>   '
+'  </tr> '
+'  <tr>  '
+'    <td width="11" height="8" rowspan="2" colspan="2" valign="bottom"><img src="globos/globo_infizq.gif" width="11" height="8" border="0"></td>     '
+'    <td colspan="3" bgcolor="#FFFFFF" height="100%"><img src="shim.gif" width="1" height="7" border="0"></td> 	'
+'    <td rowspan="2" colspan="2" valign="bottom"><img src="globos/globo_infder.gif" width="11" height="8" border="0"></td>	'
+'  </tr> '
+'  <tr>  '
+'    <td height="1" bgcolor="#000000" width="1"><img src="shim.gif" width="1" height="1" border="0"></td>'
+'    <td height="1" bgcolor="#000000" width="1"><img src="shim.gif" width="1" height="1" border="0"></td>'
+'    <td height="1" bgcolor="#000000" width="1"><img src="shim.gif" width="1" height="1" border="0"></td>'
+'  </tr> '
+'</table>'
  if (nav) {
    var canvas = document.globos.document;
    canvas.write(content);
    canvas.close();
   // skin.visibility = "show";
   //	show_capa('globos',true)
  }
  else if (ie) {
    document.all("globos").innerHTML = content;

  //  skin.visibility = "visible";
  }
    show_capa('globos',true)
    hand = orientation;
}


function kill() {

  if (count >= 1 )
    var always=true;
  if (always == true) {
    hand = 0;
      show_capa('globos',false)
   }
  else
    count++;
}

function pon_globo(texto,pon){
  if (pon){
   pop(2,texto)
  }else{
     kill()
  }

}

function pon_globo1(texto,pon){
if (pon_globos==true){
  if (eval("(is_nav4up) ? document.layers['globos']:document.all['globos']")!=null){
	var x = mouse_x
     //(is_nav4up)? e.pageX : event.x+document.body.scrollLeft
	var y =  mouse_y
     //(is_nav4up)? e.pageY : event.y+document.body.scrollTop
     //   alert(x+"/"+y)
//   algo=((is_nav4up) ? document.layers['globos'] : document.all['globos'].style);
//	algo=((is_nav4up) ? document.layers['globos'].myform.textoglobo: document.all['globos'].myform.textoglobo);
      algo=((is_nav4up) ? document.layers['globos'].document.links: document.all['globos'].document.links[1]);
   //	 alert(show_props(algo,"formcapa"))
   algo.value=texto
   if (!is_nav4up){
     algo.innerHTML=texto
    // alert(show_props(algo,'capa1'))
     //alert(algo.innertext)
   }else{
  // algo.text=texto
   //  document.layers['globos'].myform.globotxt.value=texto
    document.layers['globos'].document.myform.textoglobo.value=texto.replace("<BR>", " ")
     //: document.all['globos'].myform.textoglobo);
  //   alert(algo.value)
   //alert(show_props(algo,'capa1'))
   }
   move_div('globos',x-50,y+15)
   //color_capa('globos','blue')
   show_capa('globos',pon)

   //document.write(A)
   //alert("KKKKKKKKKKKKKKKKKK")
  }else{
   alert('No definida capa de globos')
  }
 }
}
function init_mouse_cal() {
 alert('init')
	document.onmousedown = mouseDown
	document.onmousemove = sustain
	document.onmouseup = mouseUp
	if (is_nav4up ) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP )
}
function replace(theString, oldChars, newChars)
{
   while (theString.indexOf(oldChars) > -1)
   {
       charPosition = theString.indexOf(oldChars);
       theString = "" + (theString.substring(0, charPosition) + newChars + theString.substring((charPosition + oldChars.length), theString.length));
   }
}

function peque_pag1(href,ancho,alto){

//alert(href)

if (ancho==null)ancho=400;
if (alto==null)alto=300;
//alert (ancho+"/"+alto)
//alert(ancho);
//msgWindow=window.open(href,"peque","toolbar=no,scrollbars=auto,width="+ancho+",height="+alto)
nom_win = new Date();
nom_win =nom_win.getMilliseconds();
//alert(nom_win)
msgWindow=window.open(href,nom_win,"toolbar=no,scrollbars=yes,width="+ancho+",height="+alto)

//msgWindow=window.open(href,"peque","toolbar=no,scrollbars=yes,width="+ancho+",height="+alto)
//msgWindow.document.close()

}

/*
function img_modal(nomcapa,imgpon,carpeta,a){
		
	//	alert(eval("document.forms.myform."+imgpon+".value"))
		imgpon=eval("document.forms.myform."+imgpon+".value");
		$("#"+nomcapa).html("\<script\>$(\"a[rel*=modalPanel]\").modalPanel();\</script\><a href="+carpeta+"/"+imgpon+"  rel=\"modalPanel\"><img id=foto_pon src="+carpeta+"/"+imgpon+" align=middle border=0 '.$foto_ancho.'></a>");

}
*/

function img_encapa(nomcapa,imgpon,carpeta,formulario){
	//	alert(nomcapa+","+imgpon+","+carpeta+","+formulario);
	//	alert(eval("document.forms.myform."+imgpon+".value"))
		imgpon=eval("document.forms."+formulario+"."+imgpon+".value");
		$("#"+nomcapa).html("\<script\>$(\"a[rel*=modalPanel]\").modalPanel();\</script\><a href=\""+carpeta+"/"+imgpon+"\"  rel=\"modalPanel\"><img id=foto_pon src=\""+carpeta+"/"+imgpon+"\" align=middle border=0 width=120px></a>");

		}


function load_img_div_modal(nomcapa,img_trae){
var img1 = new Image();
    $(img).load(function () {
    $(img).hide();
   
    }).attr('src',img_trae);
}
//************************************
function peque_pag(href,ancho,alto,otros){

//if (ancho==null)ancho=670;
//if (alto==null)alto=550;
//dibr($(window).width());
max_w_ventana=$(window).width()-20;
max_h_ventana=$(window).height()-20;
if (ancho==null) ancho=$(window).width()-200;//670;
if (alto==null) alto=$(window).height()-200; //550;
if (ancho>max_w_ventana) ancho=max_w_ventana;
if (alto>max_h_ventana) alto=max_h_ventana;
//alert (ancho+"/"+alto)
	var openMyModal = function(source)
	{
		modalWindow.windowId = "myModal";
		modalWindow.width = ancho;
		modalWindow.height = alto;
		modalWindow.content = "<div style='background-color:#555'><a class='modalCloseImg' title='Close'></a><iframe width='"+ancho+"' height='"+alto+"' frameborder='0' scrolling='auto' allowtransparency='true' src='" +href + "'>&lt/iframe></div>";
		modalWindow.open();
	};	
	openMyModal();
	
/*		<div style="margin-left:200px; top:40px;">
		<h1>A Simple Modal: Example</h1>
		<p>
		<a href="#" onclick="openMyModal('login_blanca.htm'); return false;" class="icoMr">View Window</a>
		</p>
	</div>
*/
	
}
//********************************
function peque_pag_ant(href,ancho,alto,otros){
//alert(agt);
//alert(href)

nom_win = new Date();
nom_win =nom_win.getMilliseconds();
//alert(nomtarget);

if (ancho==null)ancho=$(window).width();//670;
if (alto==null)alto=$(window).height(); //480;
if (otros==null)otros="toolbar=0,resizable=1,scrollbars=1,status=0"
//alert(otros)

//alert (ancho+"/"+alto)
//alert(ancho);
//msgWindow=window.open(href,"peque","toolbar=no,scrollbars=auto,width="+ancho+",height="+alto)
msgWindow=window.open(href,nom_win,otros+",width="+ancho+",height="+alto)
//alert("kkkkkkkkkkkkkkkkkkk")
//msgWindow.document.close()

}

function sustain(e) {

//if (eval("(nav) ? document.layers['globos']:document.all['globos']")!=null){
//   var skin = (nav) ?  document.layers['globos']:document.all['globos'].style;
//}else{
  return
//}
var x = (is_nav4up )? e.pageX : event.x+document.body.scrollLeft
var y = (is_nav4up )? e.pageY : event.y+document.body.scrollTop
//  var x = (nav) ? e.pageX : event.x;
//  var y = (nav) ? e.pageY : event.y;
//  alert(hand)
  switch(hand) {
  case 0 :
   kill();
    break;
  case 1 :
    skin.left = x+10,  skin.top = y+10;
    window.status = "Demostración del panel de control";
    break;
  case 2 :
    skin.left = x-60,  skin.top = y+20;
    break;
  case 3 :
    skin.left = x-135, skin.top = y+10;
    window.status = "Right Popup";
    break;
  default:
    skin.left = x+10,  skin.top = y+10;
    break;
  }
//	    status = "x1---:"+	 x+" y1:"+y


}
function mouseDown(e) {
    que_boton=((is_nav4up)?e.which:event.button)
    if (que_boton!=1 && !muestra_clickizq) {
     alert("© SECOT")
      if (es_calen!=null){
  //	  alert("Es Calendario")
      }
      if (is_nav4up){
	    return false
      }else{
	return void(0)
	 //event.button=1
      }
    }
	if ((is_nav4up	&& e.which!=1) || (!is_nav4up && event.button!=1)) return true
	var x = (is_nav4up )? e.pageX : event.x+document.body.scrollLeft
	var y = (is_nav4up )? e.pageY : event.y+document.body.scrollTop
  //	 status = "pico x:"+x+" y:"+y
	mouse_x= x;
	mouse_y= y;
	return true
}


function mouseMove(e) {
	var x = (is_nav4up )? e.pageX : event.x+document.body.scrollLeft
	var y = (is_nav4up )? e.pageY : event.y+document.body.scrollTop
	status = "x:"+x+" y:"+y
	mouse_x= x;
	mouse_y= y;
	return true
}

function mouseUp(e) {
	var x = (is_nav4up )? e.pageX : event.x+document.body.scrollLeft
	var y = (is_nav4up )? e.pageY : event.y+document.body.scrollTop
	mouse_x= x;
	mouse_y= y;
	return true
}
function usuar(){
//alert(this.parent.frames.quien.usuario_ht);
    if (eval("this.parent.frames.quien")==null){
	usr_ht=""
    }else{
	usr_ht='|'+this.parent.frames.quien.usuario_ht;
    }
return usr_ht
}

function lleva_funphp(fun,para){
  alert(fun+"('"+para+"')|ZmVy")
      window.open(fun+"('"+para+"')","_self")  ;
  // window.open("afe_bd.php3?|consultadb('estadisticas')|ZmVy","_self")  ;
//http://fer-movil/afe/newweb/afe_bd.php3?|consultadb('estadisticas')|ZmVy
//http://fer-movil/afe/newweb/afephp.php3?|pon_idkey_est('537|BILBAO031|BILBAO031')|ZmVy
}
function at(fullS,cadena_busca){
	// alert("esto es at : "+fullS+"/"+cadena_busca)
    for (var i=0; i<fullS.length; i++) {
      //alert(i+"("+fullS.substring(i,1)+")")
      cade_corta=fullS.substring(i,i+1)
	 //   alert(i+"("+cade_corta+"/"+fullS.substring(i,i+1))
      if ( cade_corta==cadena_busca) {
alert(2222)
	return fullS.substring(0,i)
       // fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)
      }
    }
   return ""
}
function replaceString(oldS,newS,fullS) {
  // Replaces oldS with newS in the string fullS
  //alert("----->"+fullS);
  for (var i=0; i<fullS.length; i++) {
   // alert(fullS.substring(i,i+oldS.length))
    if (fullS.substring(i,i+oldS.length) == oldS) {
      fullS = fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)
    }
   }
//   alert(fullS)
   return fullS
}

function cambia(w,x, y,z,a,b,r,s){
//alert(x)
//alert(eval(x+'.src'));
//alert(w +" / " + x +" / " + y+" / " +z);
//alert(r +" / " + s );
//alert(r == null );
//alert(eval(w+'.src')+"/"+document.images[z].src)
   if( compat ) { document.images[w].src=eval(x+'.src');
		if (!(y == null)) {document.images[y].src=eval(z+'.src');}
		if (!(a == null)) {document.images[a].src=eval(b+'.src'); }
		if (!(r == null)) {document.images[r].src=eval(s+'.src')} }
}
 //*************************
function cambia_fotocapa(foto_src,foto_trae,capa,tipo_graf)
{
//  foto_ant=foto_sw;
//alert(foto_src+"/"+foto_trae+"/"+capa+"/"+tipo_graf);
//alert(capa.substring( 1,2));
// Mira si es menu para guardar la imagen activa
if (capa.substring(0,2)=="mn"){
afoto_sw[capa.substring(2)]=foto_trae.substring(0,foto_trae.length-3)
//  alert(afoto_sw[capa.substring(2)])
}
//alert(eval("document."+foto_trae+".src"))
  if (tipo_graf==null){
     tipo_graf=".gif"
  }
//
     algo=(is_nav4up ? "document."+capa+".document." : "document.")+foto_src
  //alert(algo)
     obj=eval(algo);
 //alert(show_props(algo, "obj"))
    obj.src=foto_trae+tipo_graf;
}

function move_div(capa,x,y,ancho)
{
//alert(capa)
//d=(is_nav4up) ? document.layers[capa] : document.all[capa].style;
d=document.getElementById(capa).style;
//alert(show_props(d,'capa'))
//algo=(show_props(d,'capa'))
//document.write(algo)
//alert(d)
 d.left=x;
 d.top=y;
 if ((is_ie4) && ancho!=null) {
 // alert(ancho)
//    alert("************* "+ancho)
   d.pixelWidth=ancho;
 }
}

function show_props(obj, obj_name) {
//alert(obj_name)
	  var result = obj_name+"\n\n"
	  for (var i in obj)
		    result += obj_name + "." + i + " = " + obj[i] + "<br>\n"
		  //  alert(obj[i]=="[object]")
		    if (obj[i]=="[object]"){

//			result +="<br>-----------------------<br>"+show_props(obj[i],obj_name)+"<br>-----------------------<br>";
		    }
	  return result;
	  }
function color_capa(capa,color){
//ver1=((!ver)?"hidden":((is_nav4up)?"show":"visible"));
//alert(capa+"/"+color);
     if (is_nav4up && false) {
	//document[capa].visibility = ver1;
    //alert(capa+"/"+color);
	document[capa].bgColor = color;
//alert( show_props(document[capa],"capA"));
     } else {
	 // alert(capa+"/"+color);
    color=(color==null)?"":color;
//document.write( show_props(document.all[capa].style,"capA"));
//alert((color!="none")+"/"+color )
	if (color!="none"){
		document.getElementById(capa).style.backgroundColor = color;
		/*document.getElementById(capa).style.borderColor = "#005690";
		document.getElementById(capa).style.borderWidth = "1px";
		document.getElementById(capa).style.borderStyle = "dashed";*/
	}else{
	//aler("Aqui");
		document.getElementById(capa).style.backgroundColor = '';
		document.getElementById(capa).style.borderColor = '';
		//document.getElementById(capa).style.borderWidth = "0px";
		document.getElementById(capa).style.borderStyle = "";
	
	}
     }
}

function oculta_capas(ver,lite_capas){
//alert(lite_capas);
obj=document.Element;
 tags=document.getElementsByTagName("DIV")
 for (i = 0 ; i < tags.length ; i++ ) {
	   if (!tags[i].id.indexOf(lite_capas)) {
		tags[i].style.display='none';
		stat[tags[i].id]=0
		}
	   
	  //if (confirm(tags[i].id)) {
	//	document.write(show_props(tags[i]));
	//	//alert(tags[i].id)
	  }
	
	//break;
}

/*return 1;
 valor= tags[i].style.fontSize;
  for (var i in obj)
  if (confirm(i)) {
	;
  }
    if (i.indexOf("name")) result += obj_name + "." + i + " = " + obj[i] + "<br>\n"
  //  alert(obj[i]=="[object]")
    if (obj[i]=="[object]"){

//			result +="<br>-----------------------<br>"+show_props(obj[i],obj_name)+"<br>-----------------------<br>";
    }
    alert(result);
    */
//}
function show_capa(id,ver){
//stat[id]=ver;
//alert(id+"///"+stat[id]);
  var x=$("#"+id);
  x.toggle("slow");
if (ver==1) {
 x.fadeIn("fast");

} else {
 x.fadeOut("fast");
}  
}
function show_capa1(id,ver){
//ver1=((!ver)?"hidden":((is_nav4up)?"show":"visible"));
//alert(id+"/"+ver);
//document.getElementById(capa).style.display=ver1;
objDaughter=document.getElementById(id); 
//alert(objDaughter.style.display);
//alert(objDaughter.innerHTML);
stat[id]=1;

if (ver==1) {
objDaughter.style.display='block';

} else {
objDaughter.style.display='none'; 
}    

 /*    if (is_nav4up) {	 
	document.layers[capa].visibility = ver1;
// document[capa].bgColor = "#FFFFFF";
//   alert( show_props(document[capa],"capA"));
//    alert(document[capa].visibility);
     } else {
	document.all[capa].style.visibility =  ver1;
     }*/
}
function foto_abierta()
{
//alert(eval(msgWindow.closed))
//var a=eval(msgWindow.closed)
//alert("->"+a+"<-")
//alert(a==null)
//if (eval(msgWindow.closed)==false){msgWindow.close()};
	if (eval(msgWindow.closed)==null){
	}
	else
	{
	if (eval(msgWindow.closed)==false){msgWindow.close()};
	}
}

function arranca2(){
a=this.location.href
var_litestoy=""
//alert(show_props(a))

//  alert(a.substring(0,a.length-1))
// alert(a)
  if (!todo_bien){
  //alert('Voy');
    if (a.substring(a.length-1)=="#"){
      a=a.substring(0,a.length-1)
      // alert(show_props(this.location))

    }
   this.location.href=a
  }
  sw_arranque=false
  //alert('Vuelvo')
 // this.location=this.location+"#"
}
function carga_foto_ventana(foto,comentario,ancho_trae,alto_trae,directorio)
{
//alert("aqui");
foto_abierta()
//alert(document.images.length)
//alert(comentario==null)
n_ventanas=document.images.length+1;
imagen_nueva=new Image;
//alert(foto)
imagen_nueva.src=foto;
if (directorio==null){
  directorio="";
}else{
  directorio=directorio+"/";
}

imagen_nueva.src=directorio+foto;
//alert("Voy a Preload Aqui");
MM_preloadImages(imagen_nueva.src);
MM_preloadImages(imagen_nueva.src);
//alert(foto+'; nombre=' + document.images[document.images.length].name+
//alert(foto+'; nombre=' + document.images[n_ventanas].name+
//	'; height=' + ancho+
//    '; width=' + alto +
//	'; hspace=' + imagen_nueva.hspace +
//	'; vspace=' + imagen_nueva.vspace);
// analiza_foto()


document.images[n_ventanas]=imagen_nueva.src;
document.images[n_ventanas]=imagen_nueva.src;
//alert(document.images[n_ventanas])
if (ancho_trae==null){
ancho=imagen_nueva.height;
alto=imagen_nueva.width;
//alert(ancho+" <--- SIN Paremetros ---> "+alto)
}
else{
ancho=ancho_trae;
alto=alto_trae;
//alert(ancho+" <--- CON Paremetros ---> "+alto)
}

n_ventanas++;
//if (alto==0){
if (false){
	//alert(imagen_nueva.hspace)
	//carga_foto_ventana(foto,comentario)
}
else{
  if (alto<=(196+40)){
    alto=290;
  }
	if (!(comentario == null)) {
		ancho=ancho+10
	}else{
	      ancho=ancho-40
	}
	msgWindow=window.open('','window'+n_ventanas,'resizable=1,width='+(alto+35)+',height='+(ancho+120));
//	msgWindow=window.open('','descripcion1');
	msgWindow.document.write('<TITLE>&copy;'+""+' Vernatura</title>',"\n");
	msgWindow.document.write('<BODY TEXT="#000000" BGCOLOR="#EAFFB3" LINK="#000000" VLINK="#808080" ALINK="#990000">',"\n");
	msgWindow.document.write('<table border=0><tr><td colspan=2 align=center valign=top  WIDTH='+alto+ '><img src="'+imagen_nueva.src+'" HEIGHT='+ancho+' WIDTH='+alto+ ' border=0></td></tr>',"\n");
	msgWindow.document.write('<tr><td><IMG SRC="logopq.gif" BORDER=0  ALIGN=LEFT></td>');
	if (!(comentario == null)) {
	  msgWindow.document.write('<td><CENTER><FONT FACE="Verdana,Arial,Helvetica"><FONT SIZE=-1><b>'+comentario+'</FONT></FONT></CENTER>',"\n");
	}
	msgWindow.document.write('<FORM NAME="form2"><INPUT TYPE="button" VALUE="Cerrar Foto" onClick=self.close()></td></tr></table></FORM>');
//alert("KKKK")

// PRINT MsgWindow.document.write('</FORM><FORM NAME="form3"><INPUT TYPE="button" VALUE="Imprimir Foto" onClick=document.images[n_ventanas].print()> </FORM>',"\n");
	msgWindow.document.write('</BODY>',"\n");
	msgWindow.focus()
}
}
/* ------------------- */
/* Funciones generales */
/* ------------------- */

function Trim(cad)
{
  var aux="";
  var i,lg = cad.length;
  for (;lg>0 && cad.charAt(lg-1)<=' ';lg--);
  for (i=0;i<lg && cad.charAt(i)<=' ';i++);
  for (;i<lg;i++) aux = aux + cad.charAt(i);
  return aux;
}


function IsAlpha(car)
{
  car = car.toUpperCase();
  esp = " -áéíóúäëïöüÄËÏÖÜÁÉÍÓÚñÑ";
  return  (car>='A' && car<='Z') || esp.indexOf(car)!=-1;
}


// ARGUMENTOS FUNCION Abrir_Ventana
// theURL: Dirección
// winName: Nombre que queremos darle a la ventana
// Features:
	// scrollbars: Si tiene barras de desplazamiento
	// resizable: Si puede cambiarse tamaño
	// width y height: Dan tamaño a la ventana
	// top y left: Posiciona la ventana

function Abrir_Ventana(theURL, winName, features)
{
  window.open(theURL, winName, features);
}


/* --------------------------------- */
/* Funciones de validacion de fechas */
/* --------------------------------- */

// Función que comprueba que el formato de fecha es correcto

function comprobarFecha(dia, mes, anio)
{
dia=(dia.length==1)?"0"+dia:dia;
mes=(mes.length==1)?"0"+mes:mes;
  var caracter;
  var cadena = dia + "/" + mes + "/"+ anio;
  var caracteresValidos = "/0123456789";
 // alert(cadena)
  //alert(mes)
  //alert(anio)
  if(cadena.length!=10 || cadena.charAt(2)!="/" || cadena.charAt(5)!="/")
  {
    return false;
  }
  for(var i=0;i<cadena.length;i++)
  {
    caracter = cadena.charAt(i);
    if(caracteresValidos.indexOf(caracter)<0)
    {
      return false;
    }
  }
  dia = parseInt(cadena.substr(0,2),10);
  mes = parseInt(cadena.substr(3,2),10);
  anio = parseInt(cadena.substr(6,4),10);
//alert("------------- "+dia+"/"+mes+"/"+anio)
  if(anio<=0)
  {
    return false;
  }
  switch(mes)
  {
    case 1:case 3:case 5:case 7:case 8:case 10:case 12:
    {
      if(dia<=0 || dia>31) return false;
      break;
    }
    case 4:case 6:case 9:case 11:
    {
      if(dia<=0 || dia>30) return false;
      break;
    }
    case 2:
    {
      if(anio%4)
      {
	if(dia<=0 || dia>28) return false;
      }
      else if(dia<=0 || dia>29) return false;
      break;
    }
    default:
    {
      return false;
    }
  }
  return true;
}


// Función que comprueba que la fecha de regreso sea mayor o igual que la de salida

function CompruebaRangos(di, mi, ai, df, mf, af)
{
//alert ("Comprueba :" +di+"/"+mi+"/"+ai+" # "+df+"/"+mf+"/"+af)

  if (ai<100)
  {
    ai = "20" + ai;
  }
  if (af<100)
  {
    af = "20" + af;
  }
  di = parseInt(di,10);
  mi = parseInt(mi,10);
  ai = parseInt(ai,10);
  df = parseInt(df,10);
  mf = parseInt(mf,10);
  af = parseInt(af,10);
//alert ("Comprueba :" +di+"/"+mi+"/"+ai+" # "+df+"/"+mf+"/"+af)
  if (af<ai)
  {
    return false;
  }
  if (af>ai) return true;
  if (mf<mi) return false;
  if (mf>mi) return true;
  if (df<di) return false;

  return true;
}


// Función que comprueba que una fecha sea posterior a la fecha actual

function CompruebaRango(df, mf, af, navegador)
{
  if (af<100)
  {
    af="20" + af;
  }

  df = parseInt(df,10);
  mf = parseInt(mf,10);
  af = parseInt(af,10);

  fa = new Date();
  da = fa.getDate();
  ma = fa.getMonth()+1;

  if (navegador=="ie")
  {
    aa = fa.getYear();
  }
  else
  {
    aa = 1900+fa.getYear();
  }

  if (af<aa) return false;
  if (af>aa) return true;
  if (mf<ma) return false;
  if (mf>ma) return true;
  if (df<da) return false;
  return true;
}


// Función que comprueba que la hora de regreso sea posterior a la hora de salida

function CompruebaHoras(di, mi, ai, df, mf, af, hs, hr)
{
  if((af==ai) && (mf==mi) && (df==di))
  {
    if (hr<=hs)
    {
      return false;
    }
  }
  return true;
}


// Función que comprueba que una hora sea posterior a la hora actual

function CompruebaHora(di, mi, ai, hs, navegador)
{
  mi = parseInt(mi,10);
  di = parseInt(di,10);
  hs = parseInt(hs,10);
  if (ai<100)
  {
    ai = "20" + ai;
  }
  ai = parseInt(ai,10);
  fa = new Date();

  if (navegador=="ie")
  {
    aa = fa.getYear();
  }
  else
  {
    aa = 1900+fa.getYear();
  }

  ma = fa.getMonth()+1;
  da = fa.getDate();
  ha = fa.getHours();

  if((aa==ai) && (ma==mi) && (da==di))
  {
    if (hs<=ha)
    {
      return false;
    }
  }
  return true;
}


/* --------------- */
/* Otras funciones */
/* --------------- */

// Función que comprueba que el número de vuelo sea correcto

function redimensionar() {
alert();
	//Redimensionar en NS causa problemas
	//window.onResize = redimensionar
	if (anchoVentana != window.innerWidth || altoVentana != window.innerHeight)
	document.location.href = document.location.href
}

function longitudMes(mes,agno) {
	if(mes==3||mes==5||mes==8||mes==10) return 30;
	else if (mes==1 && bisiesto(agno)) return 29;
	else if (mes==1) return 28;
	else return 31;
}

function introducir_fecha()
{
	mesmarcado=mesmarcado+1;
	agnomarcado_aux=agnomarcado.toString()
	if(diamarcado<10)
	{
		 dia = "0" + diamarcado;
	}
	else
	{
		dia = diamarcado;
	}
	if(mesmarcado<10)
	{
		mes = "0" + mesmarcado;
	}
	else
	{
		mes = mesmarcado;
	}
	if(window.opener.document.formulario.origen_destino.value=='origen')
	{
		window.opener.document.formulario.D_Day.value = dia
		window.opener.document.formulario.D_Month.value = mes
		window.opener.document.formulario.D_Anio.value = agnomarcado_aux.substring(2,4)
		aux=dia + "/" + mes + "/" + agnomarcado_aux.substring(2,4)
		window.opener.document.formulario.D_Fecha_usr.value = aux
	}
	else
	{
		window.opener.document.formulario.R_Day.value = dia
		window.opener.document.formulario.R_Month.value = mes
		window.opener.document.formulario.R_Anio.value = agnomarcado_aux.substring(2,4)
		aux=dia + "/" + mes + "/" + agnomarcado_aux.substring(2,4)
		window.opener.document.formulario.R_Fecha_usr.value = aux
	}
	window.close()
}

function bisiesto(agno) {
	if (((agno%4==0) && (agno%100!=0)) || (agno%400==0)) return true;
	else return false;
}

function escribir(texto,bloque) {
	//alert(bloque)
	if (ns4)
		{
		aux = eval(bloque)
		aux.open()
		aux.write(texto)
		aux.close()
		}
	else
		document.all[bloque].innerHTML=texto
}

function borrar() {
	for(i=1;i<43;i++) {
		if (ns4) casilla="document.Calendario.document.CalendarioCelda"+i+".document"
		else casilla="CalendarioCelda"+i
		contenido=''
		escribir(contenido,casilla)
	}

}


   function cargar_calendario_origen()
  {
    alert()
	document.myform.origen_destino.value='origen'
	window.open('calendario.html','Vernatura','scrollbars=no,resizable=no,width=210,height=210,top=200,left=400')
  }

  function cargar_calendario_destino()
  {
	document.myform.origen_destino.value='destino'
	window.open('calendario.jsp','Vernatura','scrollbars=no,resizable=no,width=210,height=210,top=200,left=400')
  }

    function cargar_calendario(nom_campo,aplicacion,nom_form)
  {
	 document.myform.origen_destino.value=nom_campo
	 document.myform.aplicacion.value=aplicacion
       //  alert(aplicacion)
	window.open('calendario.html','Vernatura','scrollbars=no,resizable=no,width=210,height=210,top=200,left=400')
  }
//*************************************************************  
function iSubmitEnter(oEvento, oFormulario){ 
//
     var iAscii; 

     if (oEvento.keyCode) {
	 iAscii = oEvento.keyCode; 
	// alert(iAscii +" -"+oEvento.keyCode)
     }else if (oEvento.which) {
	 iAscii = oEvento.which; 
     }else{ 
	 return false; 
    }
    // alert(iAscii +" -"+oEvento.keyCode)
     if (iAscii == 13) {
	//  alert(oEvento.keyCode);     
     //this.submit(); 
     eval(oFormulario);
     }else{
    //  alert(oEvento.keyCode);  
     void(0);
     }

     return true; 
} 
//*************************************************************
  // NUEVO CALENDARIO EN PHP
 function  pinta_calendario(nom_campo,nom_form,capa_trae){
//alert(nom_form);
if (typeof nom_form=="undefined") {

	nom_form="myform";
}
documento=" var form_viene= window.document."+nom_form+";";
//alert(documento);
eval(documento);
//alert(show_props(form_viene));
//    var form_viene=window.document.myform  ;
   //	alert(this.form) ;
   // alert(show_props(aplicacion));

//    document.myform.origen_destino.value=nom_campo
//alert(nom_campo);
    form_viene.origen_destino.value=nom_campo
  fecha_trae=(eval("form_viene.R_Fecha_usr_"+nom_campo+".value"));
 //alert(fecha_trae)
  if (fecha_trae){
     a=fecha_trae.split("/")
   var arg="&arg="+(a[1]*1)+","+(a[2]*1)

//alert(arg)

//    arg="";
  }else{
    arg="";
  }
  //document.myform.aplicacion.value=aplicacion
       //  alert(aplicacion)
 //	 var url_ves = 'secot.php?p=pinta_cal'+arg+'&t=Base%20de%20Datos%20del%20GABINETE&blanca=true&campo_pasa='+nom_campo;
   //	 alert(url_ves);
  //	msgWindow=window.open(url_ves,'calendario','scrollbars=no,resizable=no,width=150,height=170,top=200,left=400')
	// var url_ves = 'index.php?p=pinta_cal'+arg+'&arg_cal=null,null,'+nom_campo+'&t=Calendario Permanente&blanca=true&campo_pasa='+nom_campo;
	 
 	// alert(capa_trae);
	 if (typeof capa_trae=="undefined") {
	 var url_ves = 'index.php?p=pinta_cal'+arg+'&arg_cal=null,null,'+nom_campo+'&form_viene='+nom_form+'&blanca=true&campo_pasa='+nom_campo;
	     msgWindow=window.open(url_ves,'calendario','scrollbars=no,resizable=no,width=150,height=170,top=200,left=400')
	}else{
	
	    var url_ves = 'index.php?p=pinta_cal'+arg+'&arg_cal=null,null,'+nom_campo+'&form_viene='+nom_form+'&nada=true&campo_pasa='+nom_campo+'&capa_trae='+capa_trae;
	   //msgWindow=window.open(url_ves)
	   //msgWindow=window.open(url_ves,'calendario','scrollbars=no,resizable=no,width=150,height=170,top=200,left=400')
	   //  window.wrtite(url_ves);
	//     alert(url_ves)
	//   alert(document.getElementById(capa_trae).innerHTML);
	 //  alert(document.getElementById(capa_trae).style.display);
	   //document.getElementById(capa_trae).style.display='block';
	  // show_html(capa_trae)
	    //window.write("...s..s.s.s");
	     jloadpage(capa_trae,url_ves);
        /*
        window.onload = function(e) {
	     algo=$("#"+capa_trae).html();
	     algo="<div style='float:right;width:50px'><a href>Borrar</a></div>"+algo;
	     alert(algo);
	     $("#"+capa_trae).html(algo);
	    
	     } */
	}
	

     //peque_pag(url_ves,180,200,'scrollbars=0,resizable=0,status=0')
    //  peque_pag(url_ves,180,200,'status=0')
 }
 //********************************************
  function pasa_valor_fecha(que_pasa,nom_campo,form_trae,capa_trae){
  //alert(capa_trae);
  if (typeof form_trae=="undefined") {

	form_trae="myform";
}  
if (typeof capa_trae!="undefined") {
	documento="var form_viene= window.document."+form_trae+";";
}else{
	documento="var form_viene= window.opener.document."+form_trae+";";

}
//alert(documento);
eval(documento);
//alert("...."+form_viene);
  //var form_viene=window.opener.document.myform	;
//  alert(que_pasa)
  valida="form_viene.R_Fecha_usr_"+nom_campo+".value='"+que_pasa+"';"
//  alert("VAlida :"+valida);
  dime= eval(valida);
if (typeof eval("form_viene.D_Day"+nom_campo)!="undefined") {
       a=que_pasa.split("/")
   diaseleccionado=eval("form_viene.D_Day"+nom_campo+".value='"+a[0]+"';")
   messeleccionado= eval("form_viene.D_Month"+nom_campo+".value='"+a[1]+"';")
   agnoseleccionado= eval("form_viene.D_Anio"+nom_campo+".value='"+a[2]+"';")
   diaseleccionado=eval("form_viene.R_Day"+nom_campo+".value='"+a[0]+"';")
   messeleccionado= eval("form_viene.R_Month"+nom_campo+".value='"+a[1]+"';")
   agnoseleccionado= eval("form_viene.R_Anio"+nom_campo+".value='"+a[2]+"';")
   diaseleccionado=eval("form_viene.Day"+nom_campo+".value='"+a[0]+"';")
   messeleccionado= eval("form_viene.Month"+nom_campo+".value='"+a[1]+"';")
   agnoseleccionado= eval("form_viene.Anio"+nom_campo+".value='"+a[2]+"';")
   if (eval("form_viene."+nom_campo)!=null){
     agnoseleccionado= eval("form_viene."+nom_campo+".value='"+a[2]+"-"+a[1]+"-"+a[0]+"';")
  //	alert("Guarda en : "+nom_campo+" : "+eval("form_viene."+nom_campo+".value"));

   }
 //   eval("form_viene.Month"+nom_campo+".value='"+a[1]+"';")
}


   void(0);
 }

  //****************************************************************
function pasa_valores(nom_campo,tipo_vent,valores,formulario,campos){
  re = /','/gi;
  // alert("Valores "+valores);
//
   valores="'"+valores+"'";
   campos="'"+campos+"'";
   valores= replaceString("|","','",valores);
   campos= replaceString("|","','",campos);
  // alert("campos "+campos);
  // alert(nom_campo);
  //alert(valores=="")
  if (valores=="''"){
  //  alert("Me voy")
     //return "";
  }
  //  alert("Valores ("+valores+")");
  // alert("formulario "+formulario);
   eval("tab_campos= new Array("+campos+");");
   eval("tab_valores= new Array("+valores+");");
  //   eval("valor_pongo=document.forms."+formulario+"."+nom_campo+"_lst[document.forms."+formulario+"."+nom_campo+"_lst.selectedIndex].value;") ;
  //   alert("----"+valor_pongo);
  // alert(show_props(tab_campos));
  // alert(show_props(tab_valores));
  if (tipo_vent!="busca"){
    for (var i=0; i < tab_campos.length; i++) {
  //  alert(tab_campos[i]+"="+tab_valores[i])
      pasa_valor="document.forms."+formulario+"."+tab_campos[i]+".value='"+((valores!="''")?tab_valores[i]:"")+"';";
    //	 alert(pasa_valor);
       if (eval("document.forms."+formulario+"."+tab_campos[i])!=null && (eval("document.forms."+formulario+"."+tab_campos[i]))!="" ){
	   eval(pasa_valor);
       }else{
//	  pasa_valor="document.forms."+formulario+"."+tab_campos[i]+".value='"+tab_valores[i]+"';";
	  //	alert("nulo ->"+"document.forms."+formulario+"."+tab_campos[i]+".value;")
       }

     }
   }
   eval("valor_pongo=document.forms."+formulario+"."+nom_campo+"_lst[document.forms."+formulario+"."+nom_campo+"_lst.selectedIndex].text;") ;
 //  alert(valor_pongo);
  // document.write(show_props(eval("document.forms."+formulario+"."+nom_campo+"_lst[document.forms."+formulario+"."+nom_campo+"_lst.selectedIndex];")));
    // eval("valor_pongo=document.forms."+formulario+"."+nom_campo+"_lst[document.forms."+formulario+"."+nom_campo+"_lst.selectedIndex].value;") ;
      pasa_valor="document.forms."+formulario+"."+nom_campo+".value='"+valor_pongo+"';";
   //	alert(pasa_valor);
      eval(pasa_valor);

}
//*************************************************************
function identifica() {
//   alert('Esto es Identifica JS :'+document.identif.usrsecot.value);
//  if (document.identif.usrsecot.value==null || document.identif.usrsecot.value==""){
  if (document.identif.usrsecot.value=="" || document.identif.passsecot.value==""){
//or document.identif.passsecot.value==null
	alert("Para Identificarse, Por favor Introduzca Nombre de Usuario y Contraseña");
	return;
   }
  // alert('Esto es Identifica JS :'+document.identif.usrsecot.value+"  "+document.identif.action);
   document.identif.submit()
}
//**************************************************************
function poneColor( pag, color )

{
alert("Esto es Pone_COlor")
	if (color==1)
	{
		pag.document.fgColor="Black";
		pag.document.bgColor="White";
	}
	if (color==2)
	{
		pag.document.fgColor="Blue";
		pag.document.bgColor="Yellow";
	}
	if (color==3)
	{
		pag.document.fgColor="Yellow";
		pag.document.bgColor="Black";
	}
	if (color==4)
	{
		pag.document.fgColor="#800080";
		pag.document.bgColor="#FFEEEE";
	}
}
//********************* C O O K I E S *********************************
function guarda_form_cook(nom_form,accion) {
//alert("formproc_"+nom_form);
formproc=eval("document.formproc_"+nom_form+";");
//alert(formproc.length);
cookie = document.cookie

//return 1
   //	  alert(cookie.length+" --- "+cookie);
if (formproc.length==null) return;
//alert(show_props(formproc));

 //document.write(document.cookie);
for (var i = 0; i < formproc.length; i++) {
//document.write(show_props(formproc[i]));
if (i<5){
//alert(formproc[i].name+"/"+formproc[i].value);
//alert(show_props(formproc[i]));
}
if (accion==null){
guarda_input_cookie("cookie_proc_"+nom_form,formproc[i]);
}else{
//alert()
recibe_cook_a_form("cookie_proc_"+nom_form,formproc[i]);
}
	//if (obj[i].checked) cookie_value = obj[i].name + '=[' + i + ']'
}
return;
}
function guarda_input_cookie(pref,obj){
domain		= '';
path		= '/';
secure		= '';

	var cookie_value = '';
	var objType = new String(obj.type);
//	alert("guarda_form - "+obj.name+" "+objType+" "+obj.value);
	switch(objType.toLowerCase()) {
		case "checkbox" :
			if (obj.checked) cookie_value = pref +'['+obj.name + ']=1'
			//else cookie_value = pref + obj.name + '=[0]'
			else cookie_value = pref +'['+ obj.name + ']=0'
			break;
		case "undefined" :
			// a.k.a. radio field.
			for (var i = 0; i < obj.length; i++) {
				if (obj[i].checked) cookie_value = pref +'['+ obj[i].name + ']=' + i + ''
			}
			break;
		case "select-one" :
			//alert(obj.options[obj.selectedIndex].value+"/"+obj.value+"/"+obj.selectedIndex);
			cookie_value = pref +'['+ obj.name + ']=' + obj.options[obj.selectedIndex].value + '';
		       // cookie_value = pref +'['+ obj.name + ']=' + obj.selectedIndex + '';
			break;
		case "radio" :
			// a.k.a. radio field.
			for (var i = 0; i < obj.length; i++) {
				if (obj[i].checked) cookie_value = pref +'['+ obj[i].name + ']=' + i + ''
			}
			break;
		case "select-multiple" :
			cookie_value = pref +'['+ obj.name + ']=';
			for (var i = 0; i < obj.options.length; i++) {
				if (obj.options[i].selected) cookie_value += '+' + i
			}
			cookie_value += '';
			break;
		case "textarea" :
			 alert("TexteArea - "+obj.name+" "+objType+" "+obj.value)
			cookie_value = pref +'['+ obj.name + ']=' + escape (obj.value) + '';
			break;			      
		default :
			// We assume all other fields will have
			// a valid obj.name and obj.value
		   //	alert("Default - "+obj.name+" "+objType+" "+obj.value)
			cookie_value = pref +'['+ obj.name + ']=' + obj.value + '';
	}

	if (cookie_value) {
	     var now = new Date() ;
	     var hours = now.getHours();
	     var minutes = now.getMinutes();
	     var seconds = now.getSeconds();
	     mi_time=now.getTime();
	     var d = new Date (mi_time + 24*60*60*1000)
	     var fecha_exp=getexpirydate(1)
	      /*
		document.cookie = cookie_value +
		((domain.length > 0) ? ';domain=' + domain : '') +
		((path) ? ';path=' + path : '') +
		((secure) ? ';secure' : '') +
		'expires=' + fecha_exp ;
		//';expires=' + fecha_exp;
		*/
	    cookie_color=cookie_value+ '; expires=' + fecha_exp ;
	    
	     document.cookie =	cookie_color;
	   //alert("22 guarda_form - "+"--->"+cookie_value+"..."+cookie_value.length);
	}
	//alert(cookie_value);
	return 1;
}
function recibe_cook_a_form(pref,obj) {
if (pref == null) pref = "";
     // alert(obj.name);
	var cookie = '', real_value = '';
	cookie = document.cookie
  //	 alert(cookie.length+" ### "+cookie);
	//cookie = cookie+";";
	
	var objType = new String(obj.type);
	if (obj.name)
		var objName = new String(obj.name);
	else
		var objName = new String(obj[0].name);
/*
      busca=pref + ((pref)?"[":"") + objName + ((pref)?"]":"") ;
	 //alert(cookie.indexOf(busca)+"/"+busca);
	var offset_start = cookie.indexOf(busca) ;

      // alert(cookie+"\nww("+busca+") /"+offset_start+"-> tipo : >-"+obj.type);

       if (offset_start == -1){
	 alert("Me las Piro");
	 return 1;
       }

	var offset_start_length = busca.length + 1;
	offset_start = offset_start + offset_start_length;
	var offset_end = cookie.indexOf(';', offset_start);
	 alert(busca+" +++/"+offset_start+" / "+offset_start_length+" / "+offset_end+" / "+real_value);
	real_value = cookie.substring(offset_start, offset_end);
*/
 busca=pref + ((pref)?"[":"") + objName + ((pref)?"]":"") ;
real_value = getCookie (busca)
//alert(busca+" = "+real_value);
	//real_value = obj.value;
   //alert(cookie.indexOf(busca)+"/"+busca +" / "+" -> recibe form -> "+objName+" -> valor -> "+real_value+"-> tipo : >-"+obj.type);
//    alert("recibe cook  - "+obj.name+" "+objType+" "+real_value)
	switch(objType.toLowerCase()) {

		case "checkbox" :
	       // alert("Aqui");
	       if (real_value == '1' || real_value == 'on' ) obj.checked = 1
			else obj.checked = 0
			break;
		case "undefined" :
			obj[objName].checked = 1;
			break;
		case "select-one" :
			//obj.selectedIndex = real_value;
			obj.value = real_value;
			break;
		case "radio" :
	      // alert(show_props(obj));
		//  alert(obj[objName]);
			for (var i = 0; i < obj.length; i++) {
			alert(obj[i].checked);
				if (obj[i].checked) {
				alert("aaaaqqqui")
				obj[objName] =	i ;
				}
			}

			//obj[objName].checked = 1;
			break;
		   //		  alert("Radio");
	    //		     // return ;
			//obj.selectedIndex = real_value;
			/*
		      for (var i = 0; i < obj.radio.length; i++) {
				if (obj.radio[i].selected) cookie_value += '+' + i
				alert(obj.radio[i].selected);
			}
			cookie_value += '';			   
			*/
			break;			      
		case "select-multiple" :
			for (var i = 0; i < obj.options.length; i++) {
				if ((real_value.indexOf('+' + i)) > -1)
					obj.options[i].selected = 1;
				else
					obj.options[i].selected = 0;
			}
			break;
		case "textarea" :
			// alert("TexteArea111 - "+obj.name+" "+objType+" "+real_value)
			//cookie_value = pref +'['+ obj.name + ']=' + escape (obj.value) + '';
			obj.value = unescape (real_value);
			break;				   
		default :
			obj.value = real_value;
			break;
	}

	return 1;
}
function borra_Cookie (name) {
  var exp = new Date();
 // FixCookieDate (exp); // Correct for Mac bug
  exp.setTime (exp.getTime() - 1);  // This cookie is history
  
  var cval = getCookie (name);
 // alert(name+" - "+cval);
  //if (cval != null)
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function getCookie(name){
  var cname = name + "=";
  var dc = document.cookie;
  //alert(dc);
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
      
	return unescape(dc.substring(begin, end));
    }
  }
  return null;
}
function getexpirydate( nodays){
var UTCstring;
Today = new Date();
nomilli=Date.parse(Today);
Today.setTime(nomilli+nodays*24*60*60*1000);
UTCstring = Today.toUTCString();
return UTCstring;
}

function pon_color(color){
pon_cookie("color",color,true);
}
//*************************************************
function pon_cookie(nom_cookie,valor_cookie,recarga,path_cook){
//alert("voy a poner cookie ("+nom_cookie+"="+valor_cookie+")");
 var cookie_pon = nom_cookie + "=" + escape(valor_cookie) + ";" ;
 // alert(color);
//+"; expires="+escape(90000);
//alert(cookie_color);
var now = new Date() ;
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
mi_time=now.getTime();
//Wdy, DD-Mon-YY HH:MM:SS GMT
//dia_exp=
//alert();
var d = new Date (mi_time + 24*60*60*1000)
//alert(d.format('day, month dd, yyyy hh:mm:ss timezone'));
var fecha_exp=getexpirydate(0.1)
//alert(fecha_exp);
//document.cookie += "expires=" + cookieDate(time + 24*60*60*1000)


//cookie_color = "color" +"=" + escape(color);
//  document.cookie=cookie_color;
//  document.cookie += ";expires=" + String(d);
 if(typeof path_cook!='undefined'){
	path_cook=";path="+path_cook; 
 }else{
	path_cook="";
 }
 //alert("--->"+path_cook);
cookie_pon=cookie_pon+ "expires=" + fecha_exp + path_cook ;

//alert(cookie_pon)
document.cookie =  cookie_pon;
//alert(recarga)
if (recarga=="undefined"){
document.location.reload();
}
}
function winstatus(algo) { //v3.0
//alert(algo);
if (algo!=""){
//window.defaultStatus=algo;
window.status=algo;
}else{
//window.defaultStatus='';
window.status="";
}
}
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];}
}
function checkEmail(valor) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
  //alert("La dirección de email " + valor + " es correcta.") 
    return (true)
  } else {
 // alert("La dirección de email es incorrecta.");
    return (false);
  }

}
function verifica_voto(form_algo){
//alert(show_props(form_algo));
//alert(form_algo.voto.value)
if (confirm(' Confirme su Voto ¿ correcto ?')){
//alert('lll')
form_algo.submit();
}else{
alert('Cancela Voto');void(0)
}
}
function capa_carga_html(obj_name,ver,capa_aux){
// La Capa Que recibe, tiene que tener otra paralela llamada aux_obj_nme sin contenido html 
//
if (capa_aux == undefined){
//alert("aqui")
	var nom_capa="aux_"+obj_name;
}else{
//alert("nulo")
//alert(obj_name+","+capa_aux)
	var nom_capa=capa_aux;
}
 
// alert(nom_capa)
// alert(document.getElementById(obj_name).innerHTML)
 if (ver){
 document.getElementById(nom_capa).innerHTML=document.getElementById(obj_name).innerHTML;
 }else{
  document.getElementById(nom_capa).innerHTML=""
 }
 capa_visible(nom_capa,ver)
 /*
  if (is_nav4up) {
   if (ver==0) {
      ver1='hidden';
   } else {
      ver1="show"; } 
 } else {
   if (ver==0){
      ver1='hidden';
   } else {
      ver1="visible";
   }
 }
 if (is_nav4up) {
	document[obj_name].visibility = ver1;
     } else if (is_nav5up){
	document.getElementById(obj_name).style.visibility =	ver1;
     } else {
	document.all[obj_name].style.visibility =  ver1;
     }
*/     
}
function capa_visible(obj_name,ver){
 if (is_nav4up) {
   if (ver==0) {
      ver1='hidden';
   } else {
      ver1="show"; }
 } else {
   if (ver==0){
      ver1='hidden';
   } else {
      ver1="visible";
   }
 }
 if (is_nav4up) {
	document[obj_name].visibility = ver1;
     } else {
	document.getElementById(obj_name).style.visibility =	ver1;
     /*} else if (is_nav5up){
	document.all[obj_name].style.visibility =  ver1;*/
	
     }
}
function modoedit(){
modo_edit=getCookie ("modoedit")
//alert(modo_edit)

 if (modo_edit=='false' || modo_edit==null){
// || getCookie (busca)
//alert("No es Edit")
modo_edit=false
}else{
//alert("Es Edit")
modo_edit=true
}
modo_edit=!modo_edit
 var cookie_color = "modoedit" + "=" + escape(modo_edit) + ";" ;
 var now = new Date() ;
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
mi_time=now.getTime();
var d = new Date (mi_time + 24*60*60*1000)
var fecha_exp=getexpirydate(1)
cookie_color=cookie_color+ "expires=" + fecha_exp ;
//alert(cookie_color)
document.cookie =  cookie_color;
document.location.reload();
return null;

}
function strcount(cadena,busca){
kk=cadena;
  var a = kk.split(/busca/g); // split the sentence into an array of words
 count= a.length;
 alert(count);
return count;
}
//*************************************************
var nn4 = (document.layers);
var nn6 = (document.getElementById && !document.all);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
function loadPage1(id,nestref,url) {
//


if (nn4) {
var lyr = (nestref)? eval('document.'+nestref+'.document.'+id) : document.layers[id]
lyr.load(url,lyr.clip.width)
}
else if(ie4) parent.contentFRM.location = url;
else if(ie5 || nn6) document.getElementById('contentFRM').src = url;
}
function showPage(id) {
if (ie4) {
document.all[id].innerHTML = parent.contentFRM.document.body.innerHTML;
}
else if(nn6 || ie5) { 
alert("Aqui1")
//document.getElementById(id).innerHTML = window.frames['contentFRM'].document.getElementById('theBody').innerHTML;
//alert(window.frames['contentFRM'].document.getElementById('theBody').innerHTML);
alert(show_props(window.frames['contentFRM'].document));
//document.getElementById('contentFRM').innerHTML;
document.getElementById(id).innerHTML = window.frames['contentFRM'].document.getElementById('theBody').innerHTML;
}
}
/*</script>
</HEAD>
<BODY onload="parent.showPage('contentLayer')">
</BODY>
<!-- Copiar en la página html destino -->
<a href="javascript:loadPage('contentLayer',null,'ejemplo.html')">Cargar página html</a>
<iframe name="contentFRM" id="contentFRM" width="0" height="0" frameborder="0">
</iframe>
<div id="contentLayer" style="position:absolute; width:345px; height:115px; z-index:1; left: 186px; top: 304px"></div>
*/
function poncursor(tipo) {
document.body.style.cursor = tipo;
}
//*****************
function jloadpage(containerid,url,objeto){

if (typeof objeto=="undefined") objeto=document;
var obj_capa=objeto.getElementById(containerid);
stat[containerid]=1;
obj_capa.innerHTML="<br><img src='imgprg/wait.gif'>";
  var x=$("#"+containerid);
  var response_lleva=3;
  x.load(url,function(response, status, xhr) {
   //alert(status);
  if (status == "error") {
   // var msg = "Sorry but there was an error: ";
  //  $("#error").html(msg + xhr.status + " " + xhr.statusText);
 obj_capa.innerHTML='Error Ajax';
// alert("111");
  var response_lleva=0;
 // return false;
  }else{
   var response_lleva=1;
   
  }
});
//alert(response_lleva);
//return response_lleva;
return;
}
//*************************
function loadPage(containerid,kk,url) {
//function ajaxpage(url, containerid){
//alert(url)
//alert("containerid : "+containerid);
if (typeof containerid=="object"){
//alert("Trae u8n Objeto");
	var obj_capa=containerid;
}else if (typeof containerid=="document."){
	alert("Trae u8n String");
	alert(eval(containerid));
	var obj_capa=containerid;	
}else{
	var obj_capa=document.getElementById(containerid);
}
//poncursor("wait");
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {

page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{

page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
//alert(document.getElementById(containerid).innerHTMLL);

//alert(containerid);indexOf(
if(true || obj_capa){
	obj_capa.innerHTML="<br><img src='imgprg/wait.gif'>";
}     
 //alert("-----"+url);
page_request.open('GET', url, true);
poncursor("auto");
/*
page_request.onreadystatechange=function() {
  if (page_request.readyState==4) {
   alert(page_request.getAllResponseHeaders())
  }
 }
*/
page_request.send(null);

}

function loadpage(page_request, containerid){
if (typeof containerid=="object"){
//alert("Trae u8n Objeto");
	var obj_capa=containerid;
}else{
	var obj_capa=document.getElementById(containerid);
}
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
//alert(containerid);
if(true ||  obj_capa){
obj_capa.innerHTML=page_request.responseText;
}
//alert(page_request.responseText)
}

function loadobjs(){
//alert(22222222222222222222);
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
//*/*******************************
function zoomtext(Accion,Elemento){
//inicializaciones
//obj=document.getElementById(Elemento);
//if (obj.style.fontSize==""){
//obj.style.fontSize="100%";
//}
//actual=parseInt(obj.style.fontSize); //valor actual del tamaño del texto 
incremento=10;// el valor del incremento o decremento en el tamaño 
 //getBody = document.getElementsByTagName('body')[0];
 //alert(show_props(document.getElementsByTagName(Elemento)))
 tags=document.getElementsByTagName(Elemento)
 for (i = 0 ; i < tags.length ; i++ ) {

 valor= tags[i].style.fontSize;
 valor=valor.replace("%","");
 //alert(valor); 
 actual =(valor=="") ?100:valor;
 valor=actual+incremento;
 tags[i].style.fontSize=(valor*1)+"%"
  //alert(tags[i].style.fontSize);
 //alert(show_props(tags[i]).)
	//getallTags =  tags.getElementsByTagName(tags[i]);
 //alert(getallTags)
 }
//getallTags = document.getElementsByTagName(Elemento);
// actual=getallTags[Elemento].style.fontSize;
// alert(Elemento+"/"+actual);
//accion sobre el texto 
/*
if(Accion=="reestablecer"){
obj.style.fontSize="100%"
getallTags[Elemento].style.fontSize="100%"
}
if(Accion=="aumentar"){
valor=actual+incremento;
//obj.style.fontSize=valor+"%"
getallTags[Elemento].style.fontSize=valor+"%"
}
if(Accion=="disminuir"){
valor=actual-incremento;
//obj.style.fontSize=valor+"%"
getallTags[Elemento].style.fontSize=valor+"%"
} */
}

//***************************

function cambiaestilo(title) {
 /* var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }*/
  setActiveStyleSheet(title)
  pon_cookie("style",title);
document.location.href = document.location.href
}

function setActiveStyleSheetCursor(title) {

if(window.event.keyCode == 13) {
setActiveStyleSheet(title)
}
}
function setActiveStyleSheet(title) {
//alert(title);
var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
			if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1
		&& a.getAttribute("rel").indexOf("alt") == -1
		&& a.getAttribute("title")
		) return a.getAttribute("title");
	}
return null;
}
function aqui(){
alert("AAAAQQQUUUII");
}
function valida_soli_aprobada(valores){
//document.write(show_props(d));
//alert("Valores Trae ->"+valores);

lleva=true;
if (valores.indexOf('tipo_asesoria') == -1){
	alert("Debe Seleccionar el Tipo de Asesoria");
	lleva=false;
}else if (valores.indexOf('sector_actividad') == -1){
	alert("Debe Seleccionar el Sector de Actividad Empresarial");
	lleva=false;
}else if (valores.indexOf('obj_asesoria') == -1){
	alert("Indique el Objeto de la Asesoría");
	lleva=false;
}else if (valores.indexOf('asesores[') == -1){
	alert("Debe Asignar Uno o más Asesores para Gestionar esta Asesoría");
	lleva=false;
}
if (lleva && confirm('¿ Admitir esta Solicitud para Realizar la Asesor&iacute;a : ?')){
	//loadPage('lista_cuadro',null,'index.php?p=dibr&arg="Procesando Envío..."&nada=true');
}else{
	lleva=false;
}
return(lleva);
}
//******************************************************

function dame_valores_form(d){
//document.write(show_props(d));
if (d.length==null) return;
lleva="";
a="";
//alert(d.length);
for (var i = 0; i < d.length; i++) {
	//alert(d[i].name+"/"+d[i].value);
	//,\'&cod_dele=\'+escape(d.delegacion.value)+\'&
	//if (i==1) document.write(show_props(d[i]));
	//a=a+d[i].type+"="+escape(d[i].value)+"<br>";
	valor=d[i].value;
	//alert(d[i].type);
	//alert(valor);
	//if(d[i].type=="checkbox") alert(d[i].checked);
	if(d[i].type=="checkbox" ){
	    if (!d[i].checked){
	        valor="";
	    }else{
	        //valor=1;
	        //if( d[i].options[j].selected == true)    valor +=   d[i].options[j].value+'#'; 
	       if ((d[i].name.indexOf('[]') != -1)) {
	            valor="";
	            while (true){
	            	//a=a+d[i].type+"="+escape(d[i].value)+"<br>";
	               
	                //alert("Es Check Multiple : ("+i+")-----"+d[i]+"++++"+d[i].name+"+++++"+d[i].value); 
	                if (d[i].checked) valor +=d[i].value+'#';
	                campo_aux=d[i].name;
	                i++;
	                
	               /* if (!confirm(campo_aux+"--"+i+"-"+d[i].name)){
	                 break;
	                };
	                */
	               // alert(typeof (d[i]));
	                if (typeof (d[i])!="undefined"){
	                    if (campo_aux!=d[i].name){
	                    i--;
	                  //  alert(valor);
	                    break;
	                    }
	                }else{
	                	                    i--;
	                  //  alert(valor);
	                    break;
	                }
	            }
	       }
	    }
	  //alert("Vañlor check");
	 }else if(d[i].type=="select-multiple"){
	// alert("Es Multiple :"+d[i].options.length);
	     valor="";
			for (var j = 0; j < d[i].options.length; j++) {
		
              if( d[i].options[j].selected == true)    valor +=   d[i].options[j].value+'#'; 
 

			}
			//alert("Es SeleMulti  "+valor );
	 }
	
		//alert("Es Chekox "+d[i].checked);
	 if (valor!="") {
		if (lleva!="") lleva=lleva+"+";
		//lleva=lleva+"'&"+d[i].name+"='+escape("+d[i].value+")";
		//lleva=lleva+"\'&"+d[i].name+"=\'+"+escape(d[i].value);
		lleva=lleva+"&"+d[i].name.replace("[]","")+"=+"+escape(valor);
	}
}
//document.write(a);



//alert(lleva);
return(lleva);
}


//******************************************************
window.onload = function(e) {
var cookie = getCookie("style");
if ((cookie == "s1") || (cookie == "s2") || (cookie == "s3"))  {
cookie="";
}
var title = cookie ? cookie : getPreferredStyleSheet();
//alert(title);
setActiveStyleSheet(title);
}
window.onunload = function(e) {
//alert(getCookie("style"));
var title = getActiveStyleSheet();
//createCookie("style", title, 365);
pon_cookie("style", title, 365);
}
var cookie = getCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
//************************************


