/* Variables predefinidas antes de iniciar el JS */
var itCS = 0;

/* Funciones para apartados grandes*/

	/******************************************************************************/
	/****************** Reproductor de destacados y más leidos ********************/
	/******************************************************************************/
	var totalbloques = 9;
	var ibloquesa = 1;
	var ibloquesb = 1;
	
	
	
	function bloqueinimasleidos(direccion){
		
		if(direccion == "atras"){ 
			ibloquesa = ibloquesa - 1;
		}else{
			ibloquesa = ibloquesa + 1; 
		}
		
		if(ibloquesa > totalbloques){ ibloquesa = 1; }
		if(ibloquesa < 1){ ibloquesa = 9; }
		
		objajax('divBloquemasleidos','inc/ajax.bloquesuperior.masleidos.php?id='+ ibloquesa,document);
	}
	
	function postearcomentario(idC,idE){
comentario = document.getElementById('textComentario').value;
objajaxpost('divComentarios','inc/comentarios.php','s='+ idC +'&id='+ idE +'&comentario='+ comentario,document);
document.getElementById('textComentario').value = '';
}
	
	function bloqueinidestacados(direccion){
		
		if(direccion == "atras"){ 
			ibloquesb = ibloquesb - 1;
		}else{
			ibloquesb = ibloquesb + 1; 
		}
		
		if(ibloquesb > totalbloques){ ibloquesb = 1; }
		if(ibloquesb < 1){ ibloquesb = 9; }
		
		objajax('divBloquedestacados','inc/ajax.bloquesuperior.destacados.php?id='+ ibloquesb,document);
	}
	
	function iniciarbloques() {
		bloqueinimasleidos('masleidos','adelante')
		bloqueinidestacados('destacados','adelante')
	initbloquea = window.setInterval("bloqueinimasleidos('masleidos','adelante')", 15000);
	initbloqueb = window.setInterval("bloqueinidestacados('destacados','adelante')", 15000);
	}
	
	function bloquestop(tipo){
		if(tipo == "masleidos"){
		window.clearInterval(initbloquea);
		}else{
		window.clearInterval(initbloqueb);
		}
	}
	
	function bloquestart(tipo){
		if(tipo == "masleidos"){
			initbloquea = window.setInterval("bloqueinimasleidos('masleidos','adelante')", 15000);
		}else{
			initbloqueb = window.setInterval("bloqueinidestacados('destacados','adelante')", 15000);
		}
	}
	
	/******************************************************************************/
	/************************************* FIN DEL REPRODUCTOR *****************************************/
	/******************************************************************************/




/* Funciones */
function cambiosize() {
	if(itCS == 0) {
	document.getElementById('celdatexto').style.fontSize='15px';
	}
	if(itCS == 1) {
	document.getElementById('celdatexto').style.fontSize='17px';
	}
	if(itCS == 2) {
	document.getElementById('celdatexto').style.fontSize='13px';
	}
	itCS++;
	if(itCS > 2) { itCS=0; }
}

function login(){
	if(document.getElementById('comunidadLogin').style.display == "none"){
		document.getElementById('comunidadGeneral').style.display = "none";
		document.getElementById('comunidadLogin').style.display = "block";
		document.getElementById('divLogin').style.display = "none";
	}else{
		document.getElementById('comunidadGeneral').style.display = "block";
		document.getElementById('comunidadLogin').style.display = "none";
		document.getElementById('divLogin').style.display = "none";
	}
}
function loginfocus(campo){
	if(campo.value == "user"){ campo.value = "";	}
}
function loginblur(campo){
	if(campo.value == ""){ campo.value = "user"; }	
}
function submitlogin(userLogin,passLogin,recordarLogin){
	document.getElementById('divLogin').style.display = "block";
	objajax('divLogin','inc/ajax.login.php?userKB='+ userLogin +'&passKB='+ passLogin+'&permanKB='+ recordarLogin,document,'miniloader');
	document.getElementById('comunidadGeneral').style.display = "none";
	document.getElementById('comunidadLogin').style.display = "none";
}
function rememberlogin(){
	if(document.getElementById('recordarkb').value == ""){
		document.getElementById('recordarkb').value = "si";
		document.getElementById('rememberlogin').style.fontWeight = "bold";
	}else{
		document.getElementById('recordarkb').value = "";
		document.getElementById('rememberlogin').style.fontWeight = "normal";
	}
}

function eflyer(mail){
	if(document.getElementById("divEflyer").style.display == "none"){
	document.getElementById("divEflyer").style.display = "block";
	document.getElementById("divEflyerRespuesta").style.display = "none";
	}else{
		var tipo;
	document.getElementById("divEflyer").style.display = "none";
	document.getElementById("divEflyerRespuesta").style.display = "block";
	if(document.getElementById("radioAlta").checked){ tipo = "alta"; }else{ if(document.getElementById("radioBaja").checked){ tipo = "baja"; }else{ tipo = "";} }
		objajax('divEflyerRespuesta','inc/ajax.eflyer.php?m='+ tipo +'&email='+ mail,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];}
}
//-->