// JavaScript Document

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 MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.title; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una dirección email válida.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' debe contener un número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un número válido.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+'\n'; }
  } if (errors) alert('Los siguientes datos son indispensables:\n'+errors);
  document.MM_returnValue = (errors == '');
}


function displayDate() {
  var now = new Date();
  var today = now.getDate();
  var month = now.getMonth();
   var year = now.getFullYear();

		var dayName = new Array(7)
	  dayName[0]="Domingo";
      dayName[1]="Lunes";
      dayName[2]="Martes";
      dayName[3]="Miércoles";
      dayName[4]="Jueves";
      dayName[5]="Viernes";
      dayName[6]="Sábado";
      
    
	var monthName = new Array(12)
      monthName[0]="Enero";
      monthName[1]="Febrero";
      monthName[2]="Marzo";
      monthName[3]="Abril";
      monthName[4]="Mayo";
      monthName[5]="Junio";
      monthName[6]="Julio";
      monthName[7]="Agosto";
      monthName[8]="Septiembre";
      monthName[9]="Octubre";
      monthName[10]="Noviembre";
      monthName[11]="Diciembre";

  		//document.write(dayName[now.getDay()] +  ", " + today + " de " + monthName[month] + ", " + year);
		document.write(today + " de " + monthName[month] + " de " + year);
  	
  
}



function mmLoadMenus() {
  if (window.menu_1) return;
 
 window.menu_1 = new Menu("root",140,18,"Arial, Helvetica, sans-serif",11,"#FFFFFF","#005481","#005481","#C3D6E5","left","middle",2,0,1000,-5,7,true,true,true,0,true,true);
	menu_1.addMenuItem("¿Por&nbsp;qué&nbsp;escoger&nbsp;a&nbsp;C&W?","location='inter.asp?s=1&ss=1'");
  	menu_1.addMenuItem("Equipo","location='inter.asp?s=1&ss=2'");
  	menu_1.addMenuItem("Preguntas&nbsp;frecuentes","location='inter.asp?s=1&ss=3'");
   menu_1.hideOnMouseOut=true;
   menu_1.bgColor='#C3D6E5';
   menu_1.menuBorder=1;
   menu_1.menuLiteBgColor='';
   menu_1.menuBorderBgColor='';
   
   window.menu_2 = new Menu("root",145,18,"Arial, Helvetica, sans-serif",11,"#FFFFFF","#005481","#005481","#C3D6E5","left","middle",2,0,1000,-5,7,true,true,true,0,true,true);
	menu_2.addMenuItem("Para&nbsp;ciudadanos","location='inter.asp?s=2&ss=5'");
  	menu_2.addMenuItem("Para&nbsp;empresas","location='inter.asp?s=2&ss=6'");
	menu_2.addMenuItem("Para&nbsp;ONG","location='inter.asp?s=2&ss=15'");
  	menu_2.addMenuItem("Para&nbsp;Estado&nbsp;y&nbsp;sector&nbsp;p&uacute;blico","location='inter.asp?s=2&ss=16'");
   menu_2.hideOnMouseOut=true;
   menu_2.bgColor='#C3D6E5';
   menu_2.menuBorder=1;
   menu_2.menuLiteBgColor='';
   menu_2.menuBorderBgColor='';
   
    window.menu_3 = new Menu("root",160,18,"Arial, Helvetica, sans-serif",11,"#FFFFFF","#005481","#005481","#C3D6E5","left","middle",2,0,1000,-5,7,true,true,true,0,true,true);
	menu_3.addMenuItem("Novedades","location='inter.asp?s=3&ss=7'");
	menu_3.addMenuItem("Puntos&nbsp;de&nbsp;Vista","location='inter.asp?s=3&ss=8'");	
	menu_3.addMenuItem("Casos","location='inter.asp?s=3&ss=9'");
	//menu_3.addMenuItem("Bajo&nbsp;la&nbsp;lupa","location='inter.asp?s=3&ss=12'");
	//menu_3.addMenuItem("C&W&nbsp;opina","location='inter.asp?s=3&ss=13'");
	menu_3.addMenuItem("Enlaces","location='inter.asp?s=3&ss=14'");
  menu_3.hideOnMouseOut=true;
  menu_3.bgColor='#C3D6E5';
  menu_3.menuBorder=1;
  menu_3.menuLiteBgColor='';
  menu_3.menuBorderBgColor='';
  menu_1.writeMenus();
}



function doOutline(targetId,imgId) {
	var targetElement;
	var imgElement;
  	targetElement = document.getElementById(targetId);
	imgElement = document.getElementById(imgId);
	
     if (targetElement.style.display == "none") {
        targetElement.style.display = "";
				document[imgElement.name].src = 'images/menos.gif';
     } else {
        targetElement.style.display = "none";
				document[imgElement.name].src = 'images/mas.gif';
	}
}

function doOutline_only(targetId) {
	var targetElement;
  	targetElement = document.getElementById(targetId);
	
	var tags = document.getElementsByTagName("div");
	
	for (var i = 0; i < tags.length; i++) {
		tags[i].style.display = 'none';
		}


     if (targetElement.style.display == "none") {
        	targetElement.style.display = "";
     } 
}




function despliega() {
  var div_persona;
  var div_especificaciones;
  div_persona = document.getElementById('persona');
  div_especificaciones = document.getElementById('especificaciones');

		if (document.formulario.referencia.options[document.formulario.referencia.selectedIndex].value == "recomendacion"){
			div_persona.style.display = "";
			div_especificaciones.style.display = "none";
			document.forms['formulario'].especificacion.value = '';
		} 
		else if (document.formulario.referencia.options[document.formulario.referencia.selectedIndex].value == "otro"){
			div_persona.style.display = "none";
			document.forms['formulario'].persona.value = '';
			div_especificaciones.style.display = "";
		} 
		else{
			div_persona.style.display = "none";
			div_especificaciones.style.display = "none";
			document.forms['formulario'].persona.value = '';
			document.forms['formulario'].especificacion.value = '';
		}
}


function cambio_campo_hidden() {
	
	document.forms['editar1_2'].id_publi_hidden.value = document.editar1_1.id_publi.options[document.editar1_1.id_publi.selectedIndex].value
}




function makeRequest(url) {

        var httpRequest;

        if (window.XMLHttpRequest){

          // If IE7, Mozilla, Safari, etc: Use native object
          var httpRequest = new XMLHttpRequest()

		}

		else 
		{
		if (window.ActiveXObject){
          // ...otherwise, use the ActiveX control for IE5.x and IE6
          var httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); 
          }

}


        if (!httpRequest) {
            //alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
		
		
        httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
        httpRequest.open('GET', url, true);
        httpRequest.send('');

}

    function alertContents(httpRequest) {

        if (httpRequest.readyState == 4) {
            if (httpRequest.status == 200) {
               document.getElementById('termino').innerHTML = httpRequest.responseText;
				refresh();
            } else {
               // alert('There was a problem with the request.');
            }
        }
		
    }


function refresh(){
	setTimeout("makeRequest('includes/termino.asp')",30000); 
}




function Change_hid_campo1 () {
	document.editar1_2.head_escondido.value = document.editar1_1.nombre.options[document.editar1_1.nombre.selectedIndex].value;	
}

function Changenews() {
	
	document.editar1_1.hid_Tipo_Changed.value = "True";
	document.editar1_1.submit();
}