function headerCCH (id) {
   var ids = Array(3);
   ids[0] = 'hsf'; ids[1] = 'hsh'; ids[2] = 'hss';
   for(x=0;x<3;x++) {
      if(ids[x] == id) {
         document.getElementById(ids[x]).className='hselected';
         document.search.t.value = id;
      } else {
         document.getElementById(ids[x]).className='hselect';
      }
   }
   document.search.q.focus(); return false;
}
function toggle(show,hide) {
   document.getElementById(show).style.display = 'none';
   document.getElementById(show+"title").style.background= '#ffffff';
   document.getElementById(hide).style.display = 'block';
   document.getElementById(hide+"title").style.background= '#cccccc';
}
function ftoggle(id,num,mas) {
   if(num<1 || num>10) { num = 3; }
   cur = id.substring(4);
   if(mas == 1) { cur--; if(cur<1) { cur = num; } }
   else { cur++; if(cur>num) { cur = 1; } }
   for(i=0;i<num;i++) { document.getElementById(id.substring(0,4)+(i+1)).style.display='none'; }
   //mostramos
   document.getElementById(id.substring(0,4)+cur).style.display='block';
   return false;
}
/* Crea la capa de ajax {{{ */
function createRequestObject() {
        try {
                objetus = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                try {
                        objetus= new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                        objetus= false;
                }
        }
        if (!objetus && typeof XMLHttpRequest!='undefined') {
                objetus = new XMLHttpRequest();
        }
        return objetus
}/* }}} */
var http = createRequestObject();
var aaa = null;
var waiting = '';
/* Envío de variables por medio de GET {{{ */
function sndReq(url,argumentos,elid,javax) {
    aaa = elid;
    http.open('get', url+argumentos,true);
    if(javax == 'pdf') {
       http.onreadystatechange = handlePDF;
    } else {
       http.onreadystatechange = handleResponse;
    }
    http.send(null);
} /* }}} */
function handlePDF() {
   var moreID = document.getElementById(aaa);
   if(http.readyState == 4) {
      response = eval(http.responseText);
      moreID.innerHTML = '<a href="/hemeroteca/pdf;'+response.fecha+'"><img src="'+response.file+'" alt="" width="230" /></a><br /><strong>'+response.texto+'</strong> <a href="" onclick="return pdf(\'next\',\''+response.letra+'\');"><img src="/files/media/nextpdf.gif" alt=""/></a>';
   }
}
/* Manejador de respuestas de GET {{{ */
function handleResponse() {
    var moreID = document.getElementById(aaa);
    if (http.readyState == 1 && waiting != ''){
        moreID.style.display = "block";
        moreID.innerHTML = waiting;
    }
    if(http.readyState == 4) {
        response = http.responseText;
        moreID.innerHTML = response;
    }
} /* }}} */
function is_busy() {
   if(http.readyState == 3 || http.readyState == 1 || http.readyState == 2) { return true; }
   else { return false; }
}
function serror(arg) {
   alert('El Siglo de Torreón en Línea:\n\n'+arg);
   return false;
}
var picur=0;
function galBack(num,gal,pics) {
   picx = pics.split(",");
   picur = parseInt(picur);
   if(picur===0 || num < picur) {
       picur = picur+2;
   }
   if(!picx.hasOwnProperty((picur-1))) { picur=num;return false; }
   if(picx.hasOwnProperty(picur--)) {
      document.getElementById('gal'+gal+'_2').innerHTML = document.getElementById('pp'+picx[picur]).value;
   }
   if(!picx.hasOwnProperty((picur-1))) { picur=num;return false; }
   if(picx.hasOwnProperty(picur--)) {
      document.getElementById('gal'+gal+'_1').innerHTML = document.getElementById('pp'+picx[picur]).value;
   }
   return false;
}
function galNext(num,gal,pics) {
   picx = pics.split(",");
   picur = parseInt(picur);
   if(picur>0 && picur < num) {
       picur--;
   }
   if(!picx.hasOwnProperty((picur+1))) { picur=1; }
   if(picx.hasOwnProperty(picur++)) {
      document.getElementById('gal'+gal+'_1').innerHTML = document.getElementById('pp'+picx[picur]).value;
   }
   if(!picx.hasOwnProperty((picur+1))) { picur=1; }
   if(picx.hasOwnProperty(picur++)) {
      document.getElementById('gal'+gal+'_2').innerHTML = document.getElementById('pp'+picx[picur]).value;
   }
   return false;
}
function deleteComment(msg) {
   if(is_busy()) {
      alert('Espere un momento...');return false;
   }
   sndReq('/bin/dc;',msg,'m'+msg);
   return false;
}
function _(url,nombre,ancho,alto) {
  ancho = ancho ? ancho : 600; alto = alto ? alto : 480; nombre = nombre ? nombre : 'aux';
  aux = window.open(url,nombre,"width="+ancho+",height="+alto+",toolbar=no,directories=no,location=no,copyhistory=no,scrollbars=yes,resizable=yes");
  aux.focus();
  return false;
}
function pdf(current,dir) {
   if(is_busy()) { alert('Espere un momento...');return false; }
   sndReq('/bin/xpdf;',current+';'+dir,'pdf','pdf');
   return false;
}
function up2date(seccion) {
   if(is_busy()) { alert('Intente en unos instantes...'); return false; }
   waiting = '<p align="center"><img src="/media/waiting01.gif" alt="Espere..." alt="Procesando información...." /> Procesando... </p>';
   sndReq('/addons/foros.php','?s='+seccion,'forosx');
   waiting = '';
   return false;
}
function lastlast(seccion) {
   if(is_busy()) { return false; }   
   var tmp = '/files/media/top';
   if(seccion == 'last') {	
      document.getElementById('mosttoday').src = tmp+'22.gif';
      document.getElementById('mostyesterday').src = tmp+'33.gif'; 
      document.getElementById('last').src = tmp+'1.gif'; 
   }
   if(seccion == 'mosttoday') {	
      document.getElementById('last').src = tmp+'11.gif';
      document.getElementById('mostyesterday').src = tmp+'33.gif'; 
      document.getElementById('mosttoday').src = tmp+'2.gif'; }
   if(seccion == 'mostyesterday') {	
      document.getElementById('last').src = tmp+'11.gif';
      document.getElementById('mosttoday').src = tmp+'22.gif';	
      document.getElementById('mostyesterday').src = tmp+'3.gif'; }
   waiting = '<p align="center" style="padding:20px;background:#fff;"><img src="/media/waiting01.gif" alt="Espere..." alt="Procesando información...." /> Procesando... </p>';
   sndReq('/addons/lastlast.php','?s='+seccion,'newlistsid');
   waiting = '';
   return false;
}
/*
<!-- Dynamic Version by: Nannette Thacker -->
<!-- http://www.shiningstar.net -->
<!-- Original by :  Ronnie T. Moore -->
<!-- Web Site:  The JavaScript Source -->
<!-- Use one function for multiple text areas on a page -->
<!-- Limit the number of characters per textarea -->
<!-- Begin */
function textCounter(field,cntfield,maxlimit) {
   if (field.value.length > maxlimit) // if too long...trim it!
      field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
   else
      cntfield.value = maxlimit - field.value.length;
}
var veces = veces2 =  0;
function bannertop() {
   veces++;
   if(is_busy()) { return false; }
   if(veces >= 100) { clearInterval(timerMX); return false; }
   sndReq('/live/banner.php','?top='+veces,'banneroreja');
}
function bannernot() {
   veces2++;
   if(is_busy()) { return false; }
   if(veces2 >= 100) { clearInterval(timerBN); return false; }
   sndReq('/live/banner.php','?not='+veces2,'noticiapub');
}
/*
copiar a v3
*/
function galgox(wait,args) {
      $('w'+wait).src='/v3/fff.png';
      new Ajax.Request('/v3/live/foco.php?galit='+args, { method:'get', onSuccess: function(t){ $('imageit').update(t.responseText); $('w'+wait).src = '/media/spacer.gif';} });
      return false;
}
function clickclear(thisfield, defaulttext) {
   if (thisfield.value == defaulttext) { thisfield.value = ""; }
}
function clickrecall(thisfield, defaulttext) {
   if (thisfield.value == "") { thisfield.value = defaulttext; }
}
var windo;
function oW(url,w,h) {
   windo = window.open('',"imagen","width="+w+",height="+h+",toolbar=no,directories=no,location=no,copyhistory=no,scrollbars=yes,resizable=yes");
   windo.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n<title>El Siglo de Torreón</title>\n<style type="text/css">BODY { margin:0; padding:0; cursor:pointer;}</style>\n</head>\n<body onload="window.focus();window.self.print();" onclick="window.self.close();">\n');
   windo.document.write('<img src="'+url+'" onload="opener.resizeg(this.width,this.height);"></body></html>\n');
   windo.focus();
   windo.document.close();
   return false;
   }
function resizeg(w,h) { if(windo) { windo.resizeTo(w+40,h+85); } }


