
function MM_openBrWindow(theURL,winName,features) { //v2.0
eval("detalle" + winName + " = window.open('"+ theURL +"', '" + winName + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=450,left = 245,top = 180');");
  
}

function cargaenIframe(vinculo,nombreiframe)
{
    //frames[nombreiframe].location.href=vinculo
    //alert(vinculo + ' ' + nombreiframe);
    //document.getElementById(nombreiframe).src=vinculo;

    window.open(vinculo,nombreiframe)
}

function muestraIframe(purl,pcapa){

 document.getElementById(pcapa).innerHTML="<iframe  width=100% height=1000px frameborder=0 src='"+ purl + "'></iframe>"
       
}



function muestraIframe500(purl,pcapa){

 document.getElementById(pcapa).innerHTML="<iframe  width=100% height=800 frameborder=0 src='"+ purl + "'></iframe>"
       
}


function mostrar13(purl,pcapa) {
         document.getElementById(pcapa).innerHTML="<iframe name='"& pcapa&"' id='"& pcapa &"' width=100% height=900 frameborder=0 src='"+ purl + "' onload='calcHeight(this.id)'></iframe>"
}




function mostrar(purl,pcapa) {

//alert(navigator.appName)
mivariable="<table width=100% height=100% ><tr><td align=center valign=top><img style='cursor:pointer' border=0 src='images/loader.gif' onclick='javascript:window.top.location.reload();' alt='¿Tarda demasiado? \n Haga clic para recargar el sitio'/></td></tr>"

document.getElementById(pcapa).innerHTML=mivariable


var xmlHttp=false;

//if ((pcapa=="principal" )||(pcapa=="menu_lat")){
    if ((/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) && pcapa=="principal" ){
        //alert(purl + ' - ' + pcapa)
         document.getElementById(pcapa).innerHTML="<iframe name='framefirefox' id='framefirefox' width=650px height=900 frameborder=0 src='"+ purl + "'></iframe>"
        //document.getElementById("framefirefox").src=purl
       }
  
   else {
  
     // var xmlHttp;
      var xmlHttp=false;
      try
        {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
            }
      catch (e)
        {
        // Internet Explorer
        try
          {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            
            }
          catch (e)
            {
            alert("Su navegador no soporta AJAX!");
            //document.getElementById(pcapa).innerHTML="<iframe  width=500 height=600 frameborder=0 src='"+ purl + "'></iframe>"
            //return false;
            }
          }
        }
        

    }
    
    
      
    
	var url,capa;
	url=purl;
	capa=pcapa;
	
	function unirhtml()      
	{      
		if(xmlHttp.readyState==4)        
			{        
			
			if (navigator.appName=="Netscapexx" && pcapa=="principalxx" ){
			
			document.getElementById(capa).innerHTML="TESTING..." + xmlHttp.responseText;
			}
			else{
				document.getElementById(capa).innerHTML=xmlHttp.responseText;}
				
			}
		if(xmlHttp.readyState==3)        
			{        
	document.getElementById(capa).innerHTML="<table width=100% height=100% ><tr><td align=center valign=middle><img src='images/loader.gif'/></td></tr></table>";

			}
	}    
	xmlHttp.onreadystatechange=unirhtml;
	//
	xmlHttp.open("GET",url,true);  
 
	xmlHttp.send(null);



  }
  
  
  
  
  
  
  
  function mostrar_post(purl,pcapa)
  {
  
  
        if (navigator.appName=="Netscape" && pcapa=="principal" ){
          document.getElementById(pcapa).innerHTML="<iframe  width=500 height=600 frameborder=0 src='"+ purl + "'></iframe>"
        }
  
    else {
    
    
  var xmlHttp;
 
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
	
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        document.getElementById(pcapa).innerHTML="<iframe  width=500 height=600 frameborder=0 src='"+ purl + "'></iframe>"
        //return false;
        }
      }
    }
    
    }
    
    
	var url,capa;
	url=purl;
	capa=pcapa;
	
	function unirhtml()      
	{      
		if(xmlHttp.readyState==4)        
			{        
				document.getElementById(capa).innerHTML=xmlHttp.responseText;
			}
		if(xmlHttp.readyState==3)        
			{        
				document.getElementById(capa).innerHTML="En proceso ..";
			}
	}    
	xmlHttp.onreadystatechange=unirhtml;
	xmlHttp.open("post",url,true); 
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	var pstrbusca;
	var pnomPrograma;
	var pnomDifusora;

	
	pstrbusca="";
	pnomPrograma=""; 
	pnomDifusora=0;
	
	medio_value=1
	
	//var pradio=document.getElementById("radio").value;
	
	
	for (i=0;i<document.Buscar.medio.length;i++) 
{ 
      if (document.Buscar.medio[i].checked) 
      { 
             medio_value = document.Buscar.medio[i].value; 
			 
      } 
} 

	
	
	pstrbusca=document.getElementById("StrBusca").value;
		
	var pmedio=medio_value;
		
	var pgenero='' /*document.getElementById("genero").value;*/
	var pnomPrograma='' /*document.getElementById("nomPrograma").value;*/
	var pnomDifusora='' /*document.getElementById("nomDifusora").value;*/
	var cp=document.getElementById("cvep").value;
	var cr=document.getElementById("cver").value;
	
	var pD_FI=document.getElementById("D_FI").value;
	var pM_FI=document.getElementById("M_FI").value;
	var pA_FI=document.getElementById("A_FI").value;
	var pD_FF=document.getElementById("D_FF").value;
	var pM_FF=document.getElementById("M_FF").value;
	var pA_FF=document.getElementById("A_FF").value;
	xmlHttp.send('StrBusca='+ encodeURI(pstrbusca) + '&Medio=' + pmedio + '&D_FI=' + pD_FI + '&M_FI=' + pM_FI + '&A_FI=' + pA_FI + '&D_FF=' + pD_FF + '&M_FF=' + pM_FF + '&A_FF=' +pA_FF + '&cvep=' + cp + '&cver=' + cr);
  }

  function recargaCombo1(valor){
  
window.FrameX.location="desarrollo.asp?datoX="+ valor +"&combo=1"
  
  }
  
    function recargaCombo2(valor){
  
window.FrameX.location="desarrollo.asp?datoX="+ valor +"&combo=2"
  
  }
  
  function uno(src) { 
    src.bgColor='#cccccc'
	//src.color='#ffffff';
	src.style.cursor="hand"; 
	//src.style.border='1px solid #ffffff';

} 
function dos(src) { 
    src.bgColor='';
	//src.color='#666666';
	src.style.cursor="default";
	//src.style.border='1px solid #F3F4F5'

} 


function abreLoader(dato){
	elemento1= document.getElementById("holdUploader");
	elemento2= document.getElementById("uploadFrame");
	elemento1.style.display = "block";
	elemento2.src=('uploadFile1.asp?tipo='+ dato );
}

function cierraLoader(dato){
	mostrar('boletines_'+dato+'.asp','principal')
	elemento1= document.getElementById("holdUploader");
	elemento2= document.getElementById("uploadFrame");
	elemento1.style.display = "none";
	elemento2.src=('');
}


function ocultaHerramientas(){
	elem1 = document.getElementById("herramientas");
	elem1.style.display = "none";
}

function muestraHerramientas(){
	elem1 = document.getElementById("herramientas");
	elem1.style.display = "block";
}

function ejecuta(dato,total){



for (var x = 0; x <= total; x++)
   {
   myCell=document.getElementById("Cell"+x);
   myCell.className="noSelectoSk1";
   }

   myCell=document.getElementById("Cell"+dato);
   myCell.className="selectoSk1";

	
}

function ejecutaOr(dato,total){



for (var x = 0; x <= total; x++)
   {
   //alert(dato + ", " + total)
   myCell=document.getElementById("Cell"+x);
   myCell.className="noSelecto";
   }

   myCell=document.getElementById("Cell"+dato);
   myCell.className="selecto";

	
}

function ejecutaM(dato,total){

for (var x = 0; x <= total; x++)
   {
   //alert(dato + ", " + total)
   myCell=document.getElementById("Cell"+x);
   myCell.className="noSelectoM";
   }

   myCell=document.getElementById("Cell"+dato);
   myCell.className="selectoM";

	
}




function regresa(){

window.principal.innerHTML= window.oculto.innerHTML

}


function ejecuta3 (ID) {
	
	Desejecuta3()
   myCell=document.getElementById("Menu"+ID);
   myCell.className="select3";
   
   micontenido= document.getElementById("CellContenido");
   
   textA="Somos un equipo multidisciplinario de profesionales en las distintas ramas de la comunicaci&oacute;n, dedicados a responder a los retos del mercado y apoyarte en el cumplimiento de tus objetivos institucionales."
   textC="Desarrollado y registrado por Zimat, el modelo de Comunicaci&oacute;n Total proporciona una visi&oacute;n de conjunto de la comunicaci&oacute;n, distinguiendo y jerarquizando los mensajes para cada audiencia."
   textB="Relaciones corporativas y financieras, asuntos gubernamentales, comunicaci&oacute;n pol&iacute;tica, programas de responsabilidad social, prevenci&oacute;n y manejo de crisis, administraci&oacute;n del cambio organizacional y programas de mercadotecnia."
   textD="R&iacute;o churubusco 422 <br>Coyoac&aacute;n 04100 <br>M&eacute;xico DF<br><b>Tel</b> (52 55)<br>5554 5419<br>5659 6094<br><b>Fax</b><br>5554 5510<br>zimat@zimat.com.mx"
   link= "<br><br><a href='http://www.zimat.com' target='_blank'>Leer m&aacute;s...</a> "
   
   
   
   
   
   
   
   
   switch (ID){
case "A":
  micontenido.innerHTML= textA + link
  break;
case "B":
  micontenido.innerHTML= textB + link
  break;
case "C":
  micontenido.innerHTML= textC + link
  break;  
case "D":
  micontenido.innerHTML= textD + link
  break;  
  
default:
  
}

   
   
	
	}
	
	
 function abrepagina(IDCLIENTE,padre){
 
//alert(IDCLIENTE + "," + padre  )

 if (IDCLIENTE!= 0  ){ 

    if (IDCLIENTE == 99){ 

 window.open("../zimat","_self");
 }
 else {
  window.open("prelog.aspx?cve_cliente="+IDCLIENTE +"&padre=" + padre  , "_self");
 
 }}
 
 else {
 
 alert("El cliente no se ha dado de alta correctamente: " +  IDCLIENTE + ".");
 }
 
 }	
	

function abrepagina2(IDCLIENTE,padre,idusuario, usuario, contrasenia){
 
  window.open("prelog.aspx?cve_cliente="+IDCLIENTE +"&padre=" + padre +"&idUsuario=" + idusuario  , "_self");

 }
 
 function abrepagina3(nom_corto,usuario, contrasenia){

if (nom_corto != 2){
 
cadena= "../" + nom_corto + "/login.aspx?strlogin=" + usuario + "&strPassword=" + contrasenia + "&return=755"
 //alert(cadena);
window.open(cadena ,"_parent")
}
 }
 
 	
	
function Desejecuta3(){
	
	   myCell=document.getElementById("MenuA");
   myCell.className="Noselect3";
      myCell=document.getElementById("MenuB");
   myCell.className="Noselect3";
      myCell=document.getElementById("MenuC");
   myCell.className="Noselect3";
      myCell=document.getElementById("MenuD");
   myCell.className="Noselect3";
	
	}	
	
	
	
	


	function remplazar_ac()
	{
		var cad;
		cad=document.getElementById('StrBusca').value;
		/*
		cad=cad.replace('á','_');
		cad=cad.replace('é','_');
		cad=cad.replace('í','_');
		cad=cad.replace('ó','_');
		cad=cad.replace('ú','_');
		cad=cad.replace('Á','_');
		cad=cad.replace('É','_');
		cad=cad.replace('Í','_');
		cad=cad.replace('Ó','_');
		cad=cad.replace('Ú','_');
		
		cad=cad.replace('á','_');
		cad=cad.replace('é','_');
		cad=cad.replace('í','_');
		cad=cad.replace('ó','_');
		cad=cad.replace('ú','_');
		cad=cad.replace('Á','_');
		cad=cad.replace('É','_');
		cad=cad.replace('Í','_');
		cad=cad.replace('Ó','_');
		cad=cad.replace('Ú','_');
		cad=cad.replace('ñ','_');
		*/
		document.getElementById('StrBusca').value=cad
	}

	function ref(num_id, nombre)
	{
		var cad;
		cad="";
		cad="<tr>";
		cad=cad + "	<td>";
		cad=cad + "		<a href=javascript:mostrar('transformar.asp?id=" + num_id + "','principal');>" + nombre + "</a>";
		cad=cad + "	</td>";
		cad=cad + "</tr>";
		return cad
	}
  	
	
	
var rector=1
var stopit=0 
var a=1

function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}

function rattleimage(){

if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a<6){
shake.style.top=parseInt(shake.style.top)-rector
shake.style.filter="alpha(opacity=80)"
/* "Chroma(Color = #000000) Shadow(Color=#ff0000, Direction=225)" */


a++
}
setTimeout("rattleimage()",50)
}

function stoprattle(which){
	stopit=1
	which.style.left=0
	which.style.top=0
	a=1
	shake.style.filter="alpha(opacity=100)"
}
	
  function Rnd() {
var randomnumber=Math.floor(Math.random()*100)
return randomnumber
	}	
	
	
	function ocultaLoader(){
	elem1 = document.getElementById("loaderTable");
	elem1.style.display = "none";
	
	}
function muestraLoader(){
	elem1 = document.getElementById("loaderTable");
	elem1.style.display = "block";
	
	}
	
	function ocultaComboFiltro(){
	//alert("oculta");
	//elem1 = document.getElementById("Filtro");
	//elem1.style.display = "none";
	
	}
	
	function muestraComboFiltro(){
	alert("muetra");	
	//elem1 = document.getElementById("Filtro");
	//elem1.style.display = "block";
	
	}
	

  function checaScroll(){
    //alert("funcion scroll");
  	elem1 = window.document.getElementById("slink");
	elem1.style.display = "block";
	
	elem2 = window.document.getElementById("stexto");
	elem2.style.display = "none";
  
  }
  
  function loadText2(texto,celda,imagen) {
  
  elemento1= document.getElementById(celda);
  elemento1.innerHTML=texto
  imagen1=document.getElementById("imgX");
  imagen1.src="images/im"+imagen+".jpg"
    }
    
    
      function loadText(texto,celda) {
  
  elemento1= document.getElementById(celda);
  elemento1.innerHTML=texto

    }
    
    
    function validar(formulario) {
  if ((formulario.direccionorigen.value.indexOf ('@', 0) == -1)||(formulario.direccionorigen.value.length < 5)) { 
    alert("Escriba un correo existente en el campo \"Remitente\"."); 
    formulario.direccionorigen.focus();
    return (false); 
  }
  
  if (formulario.comentarios.value.length < 10) {
    alert("Escriba por lo menos 10 caracteres en el campo \"Comentarios\".");
    formulario.comentarios.focus();
    return (false);
  }
  
  return (true); 
}


function checkAll(field,valor){
    
    if (valor==1){
        for (i = 0; i < field.length; i++)
        if(field[i].type == "checkbox"){
                field[i].checked = true;
               }
        }
       
    else{
    
        for (i = 0; i < field.length; i++)
        if(field[i].type == "checkbox"){
	        field[i].checked = false ;
            
            }
        }
        
   }
        
        
   
   
   

        
function CallNotas(field,accion,servicio,medio){



    cadena=""
    cadena2=""
    orden="" 
    contador=0
    resta=0
    var ix;
    ix=0;
    
    for (i = 0; i < field.length-resta ; i++){
  


    if(field[i].type == "checkbox"){
    
        if(field[i].checked == true ){
        
        if(field[i].id != "Gral"){
        ix=ix+1;
            
            
            if (ix<=100)
            {
            
        nombre=field[i].id
        nombre2=field[i].idx
        nombre=nombre.replace('Nota','');
            
            
            
            
                cadena= cadena + nombre + "|"
                cadena2= cadena2 + nombre2 + "|"

                contador=contador +1  
            }
            else
            {
                alert('Demasiadas notas para enviar por correo, maximo 100 notas');
                break;
            }
           }
    }}}
   
    if (contador==0){
        alert("Debe seleccionar al menos una nota")}
    else {
        
        
//        if(cadena.indexOf("-1")!=-1){
//        window.open("detallenotaenlacexnota.asp?servicio=" + servicio + "&id="+cadena2 +"&orden=" + orden );
//        }
//        else{
//         window.open("detallenotaEnlace.asp?servicio=" + servicio + "&id="+cadena +"&orden=" + orden  );
//        }

        
   //accion=2

            if(accion==1){window.open("detallenotaEnlace.asp?servicio=" + servicio + "&id="+cadena +"&orden=" + orden  );}
            //detallenotaenlacexnota
            if(accion==2){window.open("detallenotaenlacexnota.asp?servicio=" + servicio + "&id="+cadena +"&orden=" + orden );}
    }
}





function CallNotasX(field,accion,servicio,medio,Exportar ){
//alert();

    cadena=""
    orden="" 
    contador=0
    resta=0    
    
    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
    
        if(field[i].checked == true){
        
        if(field[i].id != "Gral"){
        
        nombre=field[i].id
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre+ "|"
            //orden= orden + field[i].name + "|"
            contador=contador +1  }
    }}}
   
    if (contador==0){
        alert("Debe seleccionar al menos una nota")}
    else {
    
    
    //medios 1=prensa  6= estados  7= internet
    
    // medios electronicos 2=radio  3=tv 4= radio y tv
    
            if(accion==1){window.open("detallenotaEnlace.asp?servicio=" + servicio + "&id="+cadena +"&orden=" + orden +"&export2=" + Exportar);}
            //detallenotaenlacexnota
            if(accion==2){window.open("detallenotaenlacexnota.asp?servicio=" + servicio + "&id="+cadena +"&orden=" + orden +"&export2=" + Exportar);}
            
            
            
    }
}


  function CallNotasBusqueda(id_busqueda){
  
  
             consulta="spS_carpetaonlinetemasnotas12345.-1,|-1|,-1,-1,-1,-1,|and.id_noticia.in(select.id_noticia.from.notasresultantesbusquedas.where.id_busqueda=" + id_busqueda + ")|";


           URL="temasnotas.aspx?consulta="  +consulta

               window.parent.open(URL, "myFrameXX" )
     
  }




function CallNotasWord(field,accion,URL,medio ){

    cadena=""
    orden="" 
    contador=0
    resta=0
    
    maximo=field.length
    
    if (maximo>10000){
    maximo=10000

    }

    for (i = 0; i < maximo; i++){
        if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
        nombre=field[i].getAttribute("idx")
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre + "|"
            contador=contador +1  
        }}}
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
    
    
    holdbt= document.getElementById("holdbt");
    holdbt.value=cadena
    
    //nombre=document.getElementById("Text1").value=cadena
    
    if (contador> 80){
cadena=""}

          URL=URL + "&Tipo=Word&notas="+cadena 
URL=URL.replace('consulta','Xconsulta');
if(accion==1){window.open(URL, "myFramer" )}
    
    }
}



function CallNotasExcel(field,accion,URL,medio ){

//alert(URL)

    cadena=""
    orden="" 
    contador=0
    resta=0



    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
        
        nombre=field[i].getAttribute("idx")//.idx
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre + "|"
            orden= ""
            contador=contador +1  
        }}}
    }
    
        
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
    
    holdbt= document.getElementById("holdbt");
    holdbt.value=cadena
    

        
if (contador> 80){
    cadena=""
}
        URL=URL + "&Tipo=Excel&notas="+ cadena +"&orden=" + orden + "" 
       // alert (URL)
if(accion==1){window.open(URL, "_blank" )}

//if(accion==1){showPopWin(URL,500,320,hidePopWin(true) )}
            


    }
}



function CallNotasEliminar(field,accion,URL,medio,id_carpeta){


        if (confirm("¿Está seguro de eliminar las notas selecionadas?")){
        
        accion= Math.abs(accion) 

//alert(field + " ," + accion + " ," + URL + " ," +  medio )

    cadena=""
    orden="" 
    contador=0
    resta=0

    for (i = 0; i < field.length-resta; i++){
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
        nombre=field[i].idx
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre + "|"
            //orden= orden + field[i].name + "|"
            contador=contador +1  
        }}}
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
        URL=URL + "&notas="+cadena +"&orden=" + orden + "&Accion=E" + "&id_carpeta=" + accion
        
        
        

                mostrar(URL, "principal")

        }
    }
}





///////////


function CallNotasPDFCombo(field,accion,URL,medio ){

    combo= document.getElementById("comboCarpetas");
if (combo.value!=-1){

    cadena=""
    orden="" 
    contador=0
    resta=0
    

    
    
    if (combo.value!=0){
    URL= URL + "" +combo.value;
    //alert(combo.value);
    
    }
    
    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
nombre=field[i].id
nombre=nombre.replace('Nota','');

            cadena= cadena + nombre + ","
            contador=contador +1  
          }
        }
      }
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
    
    
        cadena = cadena.replace(/Nota/g, "");
        

        
        URL = URL + "&id_nota=" + cadena +"XY"
        URL = URL.replace(",XY", "");
        URL = URL.replace(",,", "");
       // URL = URL.replace(/,/g, "|");
        
        
        

                if(accion==1){window.open(URL, "myFrame")}
                if(accion==999){window.open(URL, "myFrame")
                
                
                }

                
        } 
   }
}

///////////

function CallNotasPDF(field,accion,URL,medio ){
    cadena=""
    orden="" 
    contador=0
    resta=0

    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
        orden=field[i].getAttribute("ordenx")//.idx
        
        nombre=field[i].getAttribute("idx")//.idx
        nombre=nombre.replace('Nota','');
        //alert(orden)
        
            cadena= cadena + nombre + ","
            contador=contador +1  
          }
        }
      }
      //alert(cadena)
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
    
    
          //  document.cookie = "cadenaPDF=" + cadena;
          
          cadena = cadena.replace(/Nota/g, "");
          
          
    
        
        URL=URL + "&id_nota=" + cadena +"XY"
        URL = URL.replace(",XY", "");
        URL = URL.replace(",,", "");
        
        URL= URL + "&id_carpeta=" + accion

                if(accion==1){window.open(URL, "myFrame1")}
                else{window.open(URL, "myFrameRR1")}

                              
                

    }
}


function CallNotasPDFL(field,accion,URL,medio ){
    cadena=""
    orden="" 
    contador=0
    resta=0

    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
        nombre=field[i].id
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre + ","
            contador=contador +1  
          }
        }
      }
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
    
    
        cadena = cadena.replace(/Nota/g, "");
        URL=URL + "&id_nota=" + cadena +"XY"
        URL = URL.replace(",XY", "");
        URL = URL.replace(",,", "");
        
        

                //alert(URL)          

                if(accion==1){window.open(URL, "myFrame")}
                }
            if (medio==2 || medio==4 || medio==3){
                
                if(accion==1){window.open(URL, "myFrame" )}

    }
}



function OcultaCalendario(imgCierra,cierraCal){


elem1= document.getElementById(imgCierra);
elem2= document.getElementById(cierraCal);

if (elem2.style.display=="none"){

elem1.src="images/ples.jpg";
elem2.style.display = "";

}
else {
elem2.style.display = "none";
elem1.src="images/plus.jpg";

}
}



function OcultaGeneral(celdaMadre, celdaHija){
//alert(celdaMadre + "," + celdaHija)
    elem1= document.getElementById(celdaMadre);
    elem2= document.getElementById(celdaHija);

    if (elem2.style.display=="none"){ 
        elem1.style.backgroundImage="url(images/bgTopCell_opened.jpg)"
        elem1.title="Ocultar"
        elem2.style.display = "";

    }
    else {
        elem1.style.backgroundImage="url(images/bgTopCell_closed.jpg)"
        elem2.style.display = "none";
        elem1.title="Mostrar"
    }
}


function OcultaGeneral2(celdaMadre, celdaHija){
//alert(celdaMadre + "," + celdaHija)
    elem1= document.getElementById(celdaMadre);
    elem2= document.getElementById(celdaHija);

    if (elem2.style.display=="none"){ 
        elem1.src="images/ples.jpg"
        elem1.title="Ocultar"
        elem2.style.display = "";

    }
    else {
        elem1.src="images/plus.jpg"
        elem2.style.display = "none";
        elem1.title="Mostrar"
    }
}


function MuestraOcultaGrafRating(celdaMadre, celdaHija, url,piframe){
//alert(celdaMadre + "," + celdaHija)
    elem1= document.getElementById(celdaMadre);
    elem2= document.getElementById(celdaHija);
    
    if (elem2.style.display=="none"){ 
        elem1.src="images/ples.jpg"
        elem1.title="Ocultar"
        elem2.style.display = "";
        cargaenIframe(url,piframe);
        //

    }
    else {
        elem1.src="images/plus.jpg"
        elem2.style.display = "none";
        elem1.title="Mostrar"
    }
}

function MuestraOcultaGrafRating2(url) {

   
}


function CloseAll_Menulaton(valor) {


elem1= document.all;
elem2= document.getElementById("OCell");
elem3= document.getElementById("MCell");


    for (a=0;a<=elem1.length-1;a++){

            if (elem1[a].name =="cN"){ 
                
                if(valor=="O"){
                    elem1[a].style.display = "none";
                    elem2.style.display="none";
                    elem3.style.display="";
                    }
                if(valor=="M"){
                    elem1[a].style.display = "";
                    elem2.style.display="";
                    elem3.style.display="none";
                    }
            }
    }

}



function abreCelda(ID) {

myCell1=document.getElementById("fileAutomatica");
myCell2=document.getElementById("fileRSS");

myPic1=document.getElementById("imgAcceso");
myPic2=document.getElementById("imgTipo");

myCell1.style.display = "none";
myCell2.style.display = "none";

//myPic1.src="images/blanko.jpg"
//myPic2.src="images/blanko.jpg"


if (ID==1){myPic1.src="images/public.jpg"}
if (ID==2){myPic1.src="images/private.jpg"}

if (ID==3){
    
    myPic2.src="images/content.jpg"
}
if (ID==4){
    myCell1.style.display = "";
     myPic2.src="images/words.jpg"
}

if (ID==5){
    myCell2.style.display = "";
     myPic2.src="images/rss.jpg"
}

}



function CallNotasCarpeta(field,accion,URL,medio){

    var combo1 = document.getElementById("combocarpetas");
    var val = combo1.options[combo1.selectedIndex].text 

    //alert(val)
    cadena = ""
    cadena2 = ""
    orden="" 
    contador=0
    resta=0
    
    if (accion < 0) {


            CallNotasEliminar(field,accion ,URL, medio)
    
   }

    
    if (accion >0 ) {
    

    for (i = 0; i < field.length-resta; i++){
    //alert(field.length-resta)
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        
        if(field[i].id != "Gral"){
            nombre = field[i].getAttribute("idx")
            nombre2 = field[i].getAttribute("id")
            nombre = nombre.replace('Nota', '');
            nombre2 = nombre2.replace('Nota', '');

        cadena = cadena + nombre + "|"
        cadena2 = cadena2 + nombre2 + "|"
            contador=contador +1  
        }}}
    }
    //alert(cadena)
    if (contador==0){
        alert("Debe seleccionar al menos una nota...")
    }
    else {
    
    var w = ""
    //var selected_text = document.myform.combocarpetas.options[accion].text;



    URL = URL + "&notas=" + cadena + "&orden=" + orden + "&id_carpeta=" + accion + "&idtn=" + cadena2 + "&titulo=" + val
            
            //alert(URL)
            URL= URL.replace(/__VIEWSTATE/g,"")
                if (navigator.appName=="Netscape")
                {
                    //var ww
                    window.open(URL,"myFrame")
                    alert('Se realizó la acción solicitada')
                    //ww.close()
                    
                }
                    
                mostrar(URL, "principal" )
                
                
                }
             
      }
   }



function CreaInput(field,quien,quien2){

    cadena=""
    orden="" 
    contador=0
    resta=0
    
        for (i = 0; i < field.length-resta; i++){
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        
        if(field[i].id != "Gral"){
        
        nombre=field[i].id
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre + "|"
            //orden= orden + field[i].name + "|"
            contador=contador +1  
        }}}
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    
else {

    m1=document.getElementById(quien);
    m2=document.getElementById(quien2);

    if (m2.style.display==""){
            m1.style.display = "";
            m2.style.display = "none";
        }
    else
        {
            m1.style.display = "";
            m2.style.display = "";
    }
}


}
 function InsertaSQL (tabla, campo, valor, campoTexto ){
 texto= document.getElementById(campoTexto).value;
 URL="EjecutaQuery.aspx?tabla=" + tabla + "&campo="+ campo + "&valor=" + valor  +"|'" + texto  +"'&accion=I";
 window.open(URL, "myFrame" );
 }
 
 function UpdateSQLStandar (tabla, campo, valor, condicion ){
 
 URL="EjecutaQuery.aspx?tabla=" + tabla + "&campo="+ campo + "&valor=" + valor  +"'&accion=U";
 window.open(URL, "myFrame" );
 }
 
 

  function InsertaSQLMail (tabla, campo, valor, campoTexto ){ 
 
 valor = valor.replace(/!/g, "'");
 
 texto= document.getElementById(campoTexto).value;
 
 if(isEmailAddress(document.getElementById(campoTexto),campoTexto)==true){
 
 URL="EjecutaQuery.aspx?tabla=" + tabla + "&campo="+ campo + "&valor=" + valor  +"|'" + texto  +"'&accion=I&respuesta=Alerta";
 window.open(URL, "myFrame" );}
 }
 
 
 function isEmailAddress(theElement, nombre_del_elemento )
{
var s = theElement.value;
var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
//if (s.length == 0 ) return false;
if (filter.test(s))
return true;
else
alert("Ingrese una dirección de correo válida");
theElement.focus();
return false;
}



 
 
 
  function EliminaSQL (tabla, campo, valor ){
 

 URL="EjecutaQuery.aspx?tabla=" + tabla + "&campo="+ campo + "&valor=" + valor  + "&accion=E"
 
 
 
 
 window.open(URL, "myFrame" )
  
 
 }
 
 function abreBusqueda(){
 
 texto= document.getElementById("textoABuscar").value;
 //alert(texto);
 texto="busquedaHold.aspx?textoABuscar=" + texto 
 mostrar(texto ,'principal');
 
 }
 
function InsertaSP (fecha,formulario,campoTexto)
{
    cadena = "";
    cadena2 = "";
    contador=0;
    resta=0;
    
    texto= document.getElementById(campoTexto).value;
 
 //'--exec sp_InsertaEtiqueta_cte_usuario '@activoEtiqueta',@id_cliente,@id_usuario,'@fecha','@activoRelacion' ,'@id_noticia' ,'@textoEtiqueta '
 
    for (i = 0; i < formulario.length-resta; i++){
        if(formulario[i].type == "checkbox"){
            if(formulario[i].checked == true){
                if(formulario[i].id != "Gral"){
                    cadena = cadena + formulario[i].id + "|";
                    cadena2 = cadena2 + formulario[i].idx + "|";
                    contador=contador +1;  
                }
            }
        }
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    if (contador < 21) {
        URL = "EjecutaQuery.aspx?fechaEt=" + fecha + "&idnotas=" + cadena + "&texto=" + texto + "&accion=S&itn=" + cadena2;
        window.open(URL, "myFrame");
    }
    else { 
    alert("No se pueden etiquetar más de 20 notas simultaneamente")
    
    }
}


function CalificaNotas(fecha,formulario)
{


    cadena = "";
    cadena2 = "";
    contador=0;
    resta=0;
    color=0;
    valor=0;
    colorx="Neutral";


    var radio = document.getElementsByName("radiobtn");
    for (var ii = 0; ii < radio.length; ii++)
    {
        if (radio[ii].checked)
            //alert(radio[ii].value);
            color =radio[ii].value
            
    }

    var radio = document.getElementsByName("radiobtn2");
    for (var ii = 0; ii < radio.length; ii++)
    {
        if (radio[ii].checked)
            //alert(radio[ii].value);
            valor =radio[ii].value;
            
            
                       
    }
    
    

switch (color) {
case "1": colorx = 'Positiva'; 
break;
case "0": colorx = 'Neutral'; 
break;
case "-1": colorx = 'Negativa'; 
break;
}
texto= "Calificacion:" + colorx + " Relevancia: " +  valor;
  
 //'--exec sp_InsertaEtiqueta_cte_usuario '@activoEtiqueta',@id_cliente,@id_usuario,'@fecha','@activoRelacion' ,'@id_noticia' ,'@textoEtiqueta '
 
    for (i = 0; i < formulario.length-resta; i++){
       if(formulario[i].type == "checkbox"){
            if(formulario[i].checked == true){
               if(formulario[i].id != "Gral"){
                   cadena = cadena + formulario[i].id + "|";
                   cadena2 = cadena2 + formulario[i].idx + "|";
                    contador=contador +1;  
                    
               }
           }
        }
   }
    if (contador==0){
        alert("Debe seleccionar al menos una nota");
    }
    //alert("EjecutaQuery.aspx?fechaEt=" + fecha + "&idnotas="+ cadena + "&color=" + color + "&valor=" + valor  + "&accion=S" + "&tabla=" );
    URL = "EjecutaQuery.aspx?fechaEt=" + fecha + "&idnotas=" + cadena + "&texto=" + texto + "&accion=S" + "&esCalificacion=1&itn=" + cadena2 ;
   window.open(URL, "myFrame");
}



function CalificaNotasUser(fecha, formulario, idcarpeta) {


    cadena = "";
    cadena2 = "";
    contador = 0;
    resta = 0;
    tono = 0;
    valor = 0;



    var radio = document.getElementsByName("radiobtn");
    for (var ii = 0; ii < radio.length; ii++) {
        if (radio[ii].checked)
        //alert(radio[ii].value);
            tono = radio[ii].value

    }

    var radio = document.getElementsByName("radiobtn2");
    for (var ii = 0; ii < radio.length; ii++) {
        if (radio[ii].checked)
        //alert(radio[ii].value);
            valor = radio[ii].value;
     }



   // texto = "Calificacion:" + colorx + " Relevancia: " + valor;

    //'--exec sp_InsertaEtiqueta_cte_usuario '@activoEtiqueta',@id_cliente,@id_usuario,'@fecha','@activoRelacion' ,'@id_noticia' ,'@textoEtiqueta '

    for (i = 0; i < formulario.length - resta; i++) {
        if (formulario[i].type == "checkbox") {
            if (formulario[i].checked == true) {
                if (formulario[i].idx != "Gral") {
                    cadena = cadena + formulario[i].idx + "|";
                    cadena2 = cadena2 + formulario[i].id + "|";
                    contador = contador + 1;

                }
            }
        }
    }
    if (contador == 0) {
        alert("Debe seleccionar al menos una nota");
    }
    //alert("EjecutaQuery.aspx?fechaEt=" + fecha + "&idnotas="+ cadena + "&color=" + color + "&valor=" + valor  + "&accion=S" + "&tabla=" );
    URL = "EjecutaQuery.aspx?fechaEt=" + fecha + "&idnotas=" + cadena + "&tono=" + tono + "&relevancia=" + valor + "&accion=C" + "&esCalificacion=1" + "&idcarpeta=" + idcarpeta+ "&itn=" + cadena2;
    window.open(URL, "myFrame");
}




var curId = '';


function buildOptions(max, id, increment, begin, align) { 

    var box = document.getElementById(id); 
        var option_placeholder = document.getElementById('option_placeholder'); 
        if (option_placeholder.style.display=='none' || curId != id) { 
            option_placeholder.style.display = 'none'; 
            openCombo(id, 'option_placeholder'); 
            curId = id; 

        } else { 
            option_placeholder.style.display='none'; 
    
        } 
} 




function buildOptions2(max, id, increment, begin, align) { 
    
    var box = document.getElementById(id);
    var option_placeholderW = document.getElementById('option_placeholderW');
    if (option_placeholderW.style.display == 'none' || curId != id) {
        option_placeholderW.style.display = 'none';
        openCombo(id, 'option_placeholderW'); 
            curId = id; 

        } else {
            option_placeholderW.style.display = 'none'; 
    
        }
    }


    function buildOptions3(max, id, increment, begin, align) {

        var box = document.getElementById(id);
        var option_placeholderW = document.getElementById('option_placeholderX');
        if (option_placeholderW.style.display == 'none' || curId != id) {
            option_placeholderW.style.display = 'none';
            openCombo(id, 'option_placeholderX');
            curId = id;

        } else {
            option_placeholderX.style.display = 'none';

        }
    }

    function buildOptions4(max, id, increment, begin, align) {

        var box = document.getElementById(id);
        var option_placeholderW = document.getElementById('option_placeholderY');
        if (option_placeholderW.style.display == 'none' || curId != id) {
            option_placeholderW.style.display = 'none';
            openCombo(id, 'option_placeholderY');
            curId = id;

        } else {
            option_placeholderY.style.display = 'none';

        }
    } 


function OperaNotas(field,action,cte) {



resta=0
contador=0
cadena=""

        for (i = 0; i < field.length-resta; i++){
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        
        if(field[i].id != "Gral"){
        
            cadena= cadena + field[i].id + "|"
            contador=contador +1  
        }}}
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {

window.open("OpenNotas.asp?id_temaNota=" + cadena + "&accion=" + action + "&rn=" + Rnd() +"&id_cliente="+ cte , "myFrame")
}
}



function swapImage(img, src) { 
    var img = document.getElementById(img); 
    img.src = src; 
} 


document.onclick=check;  
function check(e){  
    var target = (e && e.target) || (event && event.srcElement);  
    var obj1 = document.getElementById('option_placeholder'); 
    
     if (obj1!= null){
    checkParent(target)?obj1.style.display='none':null;  }
    
}  
function checkParent(t){  
    while(t.parentNode){  
        var myPlaceholder = document.getElementById('option_placeholder'); 
        var myTextbox = document.getElementById('text1'); 
        var myImage = document.getElementById('imgText1'); 
        var myTextbox2 = document.getElementById('text2'); 
        var myImage2 = document.getElementById('imgText2'); 
        if(t==myPlaceholder ||  t==myTextbox || t==myImage ||  t==myTextbox2 || t==myImage2){  
            return false  
        }  
        t=t.parentNode  
    }  
    return true  
}  

// show the options where the event took place 
 function openCombo(textbox, div) { 
        var div = document.getElementById(div); 
        var box = document.getElementById(textbox); 
        div.style.position = 'absolute';  
        if(div.style.display=='none') { 
        var X = (findPosX(box));  
        var Y = findPosY(box) + 19; 
        div.style.left =  (X - 1) + 'px';  
        div.style.top = Y + 'px';  
        div.style.display = ''; 
        } else { 
            div.style.display = 'none'; 
        } 
    } 
     
function findPosX(obj) 
{ 
    var curleft = 0; 
    if(obj.offsetParent) 
        while(1)  
        { 
          curleft += obj.offsetLeft; 
          if(!obj.offsetParent) 
            break; 
          obj = obj.offsetParent; 
        } 
    else if(obj.x) 
        curleft += obj.x; 
    return curleft; 
} 

function findPosY(obj) 
{ 
    var curtop = 0; 
    if(obj.offsetParent) 
        while(1) 
        { 
          curtop += obj.offsetTop; 
          if(!obj.offsetParent) 
            break; 
          obj = obj.offsetParent; 
        } 
    else if(obj.y) 
        curtop += obj.y; 
    return curtop; 
} 

function suscribeME(){

elem1= document.getElementById('consultaX'); 
elem2= document.getElementById('textConSus'); 
elem3= document.getElementById('clienteSus'); 
elem4= document.getElementById('EnviarA'); 
elem5= document.getElementById('periodicidad');
elem6= document.getElementById('TipoContenido');
elem7= document.getElementById('maximoNumero');
elem8= document.getElementById('conLiga');


titulo ="Envio de notas para " + elem3.value
consulta =elem1.value
elem2.value=consulta;/// escribe en textbox consulta


//Definiendo variables
NotasxCorreo=1;
LecturaMP3=0;
LigaPodcastxCorreo=0;
rss=0;
resumen=0;
contenido=0;

rutaRSS="''";
periodicidad="1";
activo=0;
horadeLanzamiento=elem5.value;

switch(elem6.value) {
    case 1:
    resumen=1;
    contenido=0;
    break;

    case 2:
    resumen=0;
    contenido=1;
    break;
    
    case 3:
    resumen=1;
    contenido=1;
    break;
    
    case 4:
    resumen=0;
    contenido=0;
    break;
    
    
}

if (elem7.value=="Todas" ){
    limiteNotas="1000";
}
else{
    limiteNotas=elem7.value;
}
ligaTestigo=elem8.value;
textoCorreo="";
prueba=1;

myURL="ProcesaSuscripcion.aspx?titulo=" +  titulo + "&consulta=" +  consulta + "&NotasxCorreo=" +  NotasxCorreo + "&LecturaMP3=" +  LecturaMP3 + "&LigaPodcastxCorreo=" +  LigaPodcastxCorreo + "&rss=" +  rss + "&rutaRSS=" +  rutaRSS + "&periodicidad=" +  periodicidad + "&activo=" +  activo + "&horadeLanzamiento=" +  horadeLanzamiento + "&resumen=" +  resumen + "&contenido=" +  contenido + "&limiteNotas=" + limiteNotas + "&ligaTestigo=" +  ligaTestigo + "&textoCorreo=" +  textoCorreo + "&prueba=" +  prueba +"&accion=A"


window.open(myURL,'_blank')


}

function tabGraficas(tab){

elem1= document.getElementById(tab); 
elem2= document.getElementById("tbl"+tab); 
//elem3= document.getElementById("holdGraph");


TA.className="noselecto";
TB.className="noselecto";
TC.className="noselecto";
TD.className="noselecto";
TE.className="noselecto";
TF.className="noselecto";

elem2.style.display = "";


tblTA.style.display="none";
tblTB.style.display="none";
tblTC.style.display="none";
tblTD.style.display="none";
tblTE.style.display="none";
tblTF.style.display="none";

elem1.className="selecto";
elem2.style.display = "";


//elem2.style.display = "";


window.open( 'tabControl.asp?ses='+ tab ,'IF1')
//window.open( 'tabControl.aspx?ses='+ tab ,'IF2')

}


function crearTabs(){


if(TB.style.display == "none"){
    TB.style.display = "";
    return;
}

if(TC.style.display == "none"){
    TC.style.display = "";
    return;
}

if(TD.style.display == "none"){
    TD.style.display = "";
    return;
}

if(TE.style.display == "none"){
    TE.style.display = "";
    return;
}

if(TF.style.display == "none"){
    TF.style.display = "";
    Tplus.style.display = "none";
    return;
}


}

function ConstruyeCorreo(field)
{
   cadena=""
    orden="" 
    contador=0
    resta=0
    currentID=""
    arregloNotas=""
    
    //id=""tr" & dr("id_temanota") & """
    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        
        if(field[i].id != "Gral" ){       
            
            nombre=field[i].id
            nombre=nombre.replace('Nota','');            
            arregloNotas= arregloNotas + nombre + ",";
      
      
       }
      }
     }
    }

arregloNotas = arregloNotas + "X"
arregloNotas=arregloNotas.replace(',X','');

consultaD = "spS_carpetaonlinetemasnotas 123,|-1|,-1,-1,-1,-1,| and id_temanota in(" + arregloNotas + ")|"

URLxD = "temasnotas.aspx?escorreo=1&sinBarraHerramientas=1&tem=-1&temad=Envío&med=-1&medio=todo&consulta=" + consultaD + "&rnd="  + Rnd() * 100


//document.all("CajaContendio").value=document.getElementById("TablaContenido").innerHTML  

mostrar(URLxD, "principal")
//window.open(URLxD, "_blank")

}

function validate_email(field)
	{
	with (field)
		{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
		  {
			  return false}
		else {return true}
		}
}



function exportaXLS(field,accion,medio ){
//alert(field.length)
   cadena=""
    orden="" 
    contador=0
    resta=0
    
   
    URL= "temasnotasExcel.aspx?tem=-1&temad=-1&cveCTE=-1&med=" + medio + "&medio=" + medio + "&porTemas=-1&busqueda=1";
    //prompt ("URL",URL);


    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        
        if(field[i].id != "Gral" ){
        
            if( i < 90){
            nombre=field[i].id
            nombre=nombre.replace('Nota','');
            cadena= cadena + nombre + "|"
            contador=contador +1  
        }

       }
      }
     }
    }
    
    //prompt ("cadena",cadena);
    //alert (cadena)
    //prompt ("contador",contador);
    
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
        URL=URL + "&Tipo=Excel&notas="+cadena +"&orden=" + orden + "" 
        //prompt ("URL",URL);
        
            if (medio==-1 || medio==1 || medio==7 || medio==6 || medio==71 || medio==72 || medio==9 || medio==91 || medio==92 ){
                if(accion==1){window.open(URL, "myFrame" )}
                }
            if (medio==2 || medio==4 || medio==3){
                if(accion==1){window.open(URL, "myFrame" )}
                }
    }
}


function exportaDoc(field,accion,medio ){
//alert(field)
   cadena=""
    orden="" 
    contador=0
    resta=0
    URL= "temasnotasWord.aspx?tem=-1&temad=-1&cveCTE=-1&med=" + medio + "&medio=" + medio + "&porTemas=-1&busqueda=1";


    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
        
        nombre=field[i].id
        nombre=nombre.replace('Nota','');

        cadena= cadena + nombre + "|"
        //orden= orden + field[i].name + "|"
        contador=contador +1  
        }}}
    }
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
        URL=URL + "&Tipo=Word&notas="+cadena +"&orden=" + orden + "" 
            if (medio==-1 || medio==1 || medio==7 || medio==6 || medio==71 || medio==72 || medio==9 || medio==91 || medio==92 ){
                if(accion==1){window.open(URL, "myFrame" )}
                }
            if (medio==2 || medio==4 || medio==3){
                if(accion==1){window.open(URL, "myFrame" )}
                }
    }
}


 function ejecutaTab(tab){
elem1=document.getElementById("A");
elem2=document.getElementById("B");
elem3=document.getElementById("C");
elem4=document.getElementById("D");
elemm1=document.getElementById("menuA");
elemm2=document.getElementById("menuB");
elemm3=document.getElementById("menuC");
elemm4=document.getElementById("menuD");
elem1.style.display="none";
elem2.style.display="none";
elem3.style.display="none";
elem4.style.display="none";
//elemm1.style.background="#bebebe";
//elemm2.style.background="#bebebe";
//elemm3.style.background="#bebebe";
//elemm4.style.background="#bebebe";

//elem1.style.backgroundImage="url(images/bgTopCell_opened.jpg)"

elemm1.style.backgroundImage="url(images/noselectocoyo.jpg)";
elemm2.style.backgroundImage="url(images/noselectocoyo.jpg)";
elemm3.style.backgroundImage="url(images/noselectocoyo.jpg)";
elemm4.style.backgroundImage="url(images/noselectocoyo.jpg)";

document.getElementById(tab).style.display="";
emelentox=document.getElementById("menu"+tab);
emelentox.style.backgroundImage="url(images/selectocoyo.jpg)";

}


function ejecutaTabrojo(tab){
elem1=document.getElementById("A");
elem2=document.getElementById("B");
elem3=document.getElementById("C");
elem4=document.getElementById("D");
elemm1=document.getElementById("menuA");
elemm2=document.getElementById("menuB");
elemm3=document.getElementById("menuC");
elemm4=document.getElementById("menuD");
elem1.style.display="none";
elem2.style.display="none";
elem3.style.display="none";
elem4.style.display="none";
//elemm1.style.background="#bebebe";
//elemm2.style.background="#bebebe";
//elemm3.style.background="#bebebe";
//elemm4.style.background="#bebebe";

//elem1.style.backgroundImage="url(images/bgTopCell_opened.jpg)"

elemm1.style.backgroundImage="url(images/noselectorojo.jpg)";
elemm2.style.backgroundImage="url(images/noselectorojo.jpg)";
elemm3.style.backgroundImage="url(images/noselectorojo.jpg)";
elemm4.style.backgroundImage="url(images/noselectorojo.jpg)";

document.getElementById(tab).style.display="";
emelentox=document.getElementById("menu"+tab);
emelentox.style.backgroundImage="url(images/selectorojo.jpg)";

}


function ocultaElemento(celda){

elem1=document.getElementById(celda);
elem1.style.display="none";


}

function ConfirmaRetorno(){

elem1=document.getElementById("strlogin");
elem2=document.getElementById("strpassword");

URL='login.aspx?strlogin='+ elem1.value + '&strpassword='+ elem2.value;
//alert(URL);

if(confirm('Su sesión ha terminado.\n ¿Desea ingresar nuevamente?')){
window.parent.location=URL;} 
else{window.parent.location.reload();}

}

function sendTwitter(ID, link ,tipo){


link="http://www.emedios.com.mx/genericas/" + link


if (tipo==1){
textoNota= Left(ID,110)
window.open("http://twitter.com/home?status=" + textoNota + " " + link, "_blank")
}

//'http://www.facebook.com/sharer.php?u=http://www.eluniversal.com.mx/notas/630626.html&t=Científicos_de_UNAM_ganan_Ig_Nobel_de_Química

if (tipo==2){
textoNota= Left(ID,110)
window.open("http://www.facebook.com/sharer.php?u=" + link + "&t=" + textoNota , "_blank")
}
//'http://www.google.com/bookmarks/mark?op=add&bkmk=http://www.eluniversal.com.mx/notas/630626.html&title=CientÃ­ficos+de+UNAM+ganan+Ig+Nobel+de+QuÃ­mica

if (tipo==3){
textoNota= Left(ID,110)
window.open("http://www.google.com/bookmarks/mark?op=add&bkmk=" + link + "&title=" + textoNota , "_blank")
}

}

function Left(texto, n)
{ 
if(n>texto.length)  
n=texto.length; 
return texto.substring(0, n);

}

function muestraRating(A){

    elem1=document.getElementById("menu_lat");
    elem2=document.getElementById("principal");
    elem3=document.getElementById("herramientas");

    if (A=="0"){
        elem1.style.display="";
        elem2.style.display="";
        elem3.style.display="";
        mostrar("blank.asp","centralArea");

    }
    else{
        elem1.style.display="none";
        elem2.style.display="none";
        elem3.style.display="none";
        mostrar("graficadorUniver.aspx","centralArea");
    }

}

//////////////////////////////////////////

function ahah(url, target) {
mivariable="<table width=100% height=100% border=0 ><tr><td align=center valign='top'><img style='cursor:pointer' border=0 src='images/loader.gif' onclick='javascript:window.top.location.reload();' alt='¿Tarda demasiado? \n Haga clic para recargar el sitio'/></td></tr>"

  document.getElementById(target).innerHTML = mivariable;
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function load(name, div) {
	ahah(name,div);
	return false;
}




function OrdenaNotas(field,accion,idcarpeta) {
    
        id_noticia=""
    orden="" 
    contador=0
    resta=0
    URL= "temasnotasCarpeta.aspx?accion=o"
    
        for (i = 0; i < field.length-resta ; i++){
            if(field[i].type == "text"){
            contador=contador+1
            orden= orden + field[i].value + ","
            id_noticia= id_noticia + field[i].id + ","
            }
        }
  
    if (contador==0){
        alert("Debe seleccionar al menos una nota")}
    else{
    
   
    URL=URL + "&id_carpeta=" + idcarpeta + "&ord=" + orden +"&idn=" + id_noticia
    
     //
       // window.open(URL,"_blank")
    //mostrar(URL, "principal" )
    window.open(URL, "myFrame")

        }
}


function SeleccionarCombo(combo, valor) 
{
 document.getElementById(combo).value= valor

//alert('Valor:' + combo+' ' + ' - Item: ' + valor);
}

function calcHeight(objeto)
{
  //find the height of the internal page
  var the_height= document.getElementById(objeto).contentWindow.document.body.scrollHeight;
  //var the_width= document.getElementById(objeto).contentWindow.document.body.scrollWidth;
  //change the height of the iframe
  
  document.getElementById(objeto).height= the_height+100;
  
  //document.getElementById(objeto).width= the_width+100;
}


function valid(f) {
!(/^[A-zÑñ0-9_.@ ]*$/i).test(f.value)?f.value = f.value.replace(/[^A-zÑñ0-9_.@ ]/ig,''):null;
} 


function OcultaTestigo(iframe,celdaHija,fecha,testigo){

//alert(celdaMadre + "," + celdaHija)
    elem1= document.getElementById(iframe);////iframe
    elem2= document.getElementById(celdaHija);

    if (elem2.style.display=="none"){ 
        elem1.src="testigosDirecto.aspx?fecha=" + fecha  + "&ptestigo=" + testigo;               
        elem2.style.display = "";        
    }
    else {
    elem2.style.display = "none";
        elem1.src=""
        
    }
    
   //window.parent.calcHeight("centerFrame")
}


// All browser bookmark script 
function bookmarksite(title,url){ 
if (window.sidebar) // firefox 
    //window.sidebar.addPanel(title, url, ""); Dont use until it's fixed 
    alert('Dear Firefox user, please press CTRL+D to Bookmark this page!'); 
else if(window.opera && window.print){ // opera 
    var elem = document.createElement('a'); 
    elem.setAttribute('href',url); 
    elem.setAttribute('title',title); 
    elem.setAttribute('rel','sidebar'); 
    elem.click(); 
}  
else if(document.all)// ie 
    window.external.AddFavorite(url, title); 
}


function OcultaGrafica(id_tema,medio,id_cliente,fecha){
//tr
elem1= document.getElementById("tr"+id_tema);
//if
elem2= document.getElementById("if"+id_tema);
//src
URL="graficadoruniver.aspx?medio="+ medio +"&campos=gfuente&opcion=notas&titulo=Notas por Fuente&clienteP="+ id_cliente +"&store=sp_ggraficas_cuantitativas_detalle_mediosdinamicos&mitema="+ id_tema + "&mifecha=" + fecha 

if (elem1.style.display == "none"){
    elem1.style.display = ""; 
    elem2.src=URL; 
}
else{elem1.style.display = "none";
    elem2.src="loading.asp";
}



//window.open(URL,"_blank")
}


function calcHeight2(objeto,plus)
{
  //find the height of the internal page
  var the_height= document.getElementById(objeto).contentWindow.document.body.scrollHeight;
  //var the_width= document.getElementById(objeto).contentWindow.document.body.scrollWidth;
  //change the height of the iframe
  
  document.getElementById(objeto).height= the_height+plus;
  
  //document.getElementById(objeto).width= the_width+100;
}



function CallNotasPDF2(field,accion,URL,medio ){

//alert(URL)

    cadena=""
    orden="" 
    contador=0
    resta=0

    for (i = 0; i < field.length-resta; i++){
    
    if(field[i].type == "checkbox"){
        if(field[i].checked == true){
        if(field[i].id != "Gral"){
             
        nombre=field[i].getAttribute("idx")//.id
        nombre=nombre.replace('Nota','');
        
            cadena= cadena + nombre + ","
            orden= ""
            contador=contador +1  
        }}}
    }
    
        
    if (contador==0){
        alert("Debe seleccionar al menos una nota")
    }
    else {
   // alert(contador)
    holdbt= document.getElementById("holdbt");
    holdbt.value=cadena
            
if (contador> 800){
    cadena=""
}
//URL = URL + "" + cadena + "0"

URL = URL.replace('@idnews', cadena + "0");
       // alert (URL)
if(accion==1){window.open(URL, "_blank" )}

    }
}


function cambiaOrdenNotas(url, orden) {
        URLX = "temasnotas.aspx?" + url + "&ordenEspecial=" + orden;
  //  alert(URLX);
    mostrar(URLX, 'principal')
}

function cambiaSeleccionCombo(valor) {

    if (valor == "") { valor=1}
    var x = document.getElementById("comboOrden")
   x.selectedIndex = valor-1;
    //alert(valor);

}


function abreNube() {
    
    elem2 = document.getElementById("tif367");
    elem2.style.display = "";
    window.open('tagcloud.aspx?token=6545e83kekk390', 'if367');

}

function Doclick(elemento) {
    elem1 = document.getElementById(elemento);
    elem1.click();

}

