function buscar(){
	if(document.getElementById('q').value.length>=3){
		document.getElementById('frmBuscarHeader').action = "http://www.diarioshow.com/buscador";
		document.getElementById('frmBuscarHeader').submit();
	}else{
		alert("Debes ingresar al menos 3 letras");
	}
}

function validarEnc(form){
	var C;
	flag=false;
	for (C = 0; C <document.getElementById(form).rdoOpcion.length; C++){
		if (document.getElementById(form).rdoOpcion[C].checked){
			return document.getElementById(form).rdoOpcion[C].value;
			flag=true;
		}
	}
	if (!flag){
		return -1;
	}
}

function votar(form){
	if (parseInt(validarEnc(form))== -1){
		alert('Debes seleccionar una respuesta');
	}else{
		document.getElementById(form).action = "http://www.diarioshow.com/encuestas/"
		document.getElementById(form).target = "_blank"
		document.getElementById(form).submit();
	}	
}

function popup(theURL,winName,ancho,alto,features) {
 var wleft = (screen.width - ancho)/2
 var wtop = (screen.height - alto)/2 
 if (features==null) {
	 features = "scrollbars=0,fullscreen=0,resizable=0,status=0,toolbar=0,directories=0,location=0,menubar=0,copyhistory=0";
	 }
 window.open(theURL, winName, "width="+ancho+", height="+alto+", "+ features +", top= "+ wtop.toString() +", left="+ wleft.toString());
}

function popupPrint(theURL,winName,ancho,alto,features) {
 var wleft = (screen.width - ancho)/2
 var wtop = (screen.height - alto)/2 
 if (features==null) {
	 features = "scrollbars=1,fullscreen=0,resizable=0,status=1,toolbar=0,directories=0,location=0,menubar=0,copyhistory=0";
	 }
 window.open(theURL, winName, "width="+ancho+", height="+alto+", "+ features +", top= "+ wtop.toString() +", left="+ wleft.toString());
}

function begin(){
  	window.setInterval("refreshh()",900000);
}

function refreshh(){
	//window.location = "http://www.diarioshow.com/";
	location.reload();
}

function fAjax(){ 
	var xmlhttp=false; 
	
	try{ 
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	
	catch(e){ 
		try{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E){ 
			xmlhttp=false; 
		}
	}
	
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}

function insertarPagina(pagina){	
	var ajax=fAjax();
	var ventanaSel=pagina;
	ajax.open("POST",ventanaSel,true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");			
	ajax.send("ventana="+ventanaSel);
	ajax.onreadystatechange = function(){	
		if (ajax.readyState == 1) document.getElementById("respuestaHTML").innerHTML="<span class='link_titularB'>Cargando, por favor espere...</span>";
		else if (ajax.readyState == 4) document.getElementById("respuestaHTML").innerHTML=ajax.responseText;		
	}	
}

function ocultar_ribeiro(){ 
	$("#contenedor_ribeiro").css('display','none');
}