// JavaScript Document

var no_coberturas = 0;
var largo_bdp = 0;
var tiempo;
var refreshMxM;
var temperature;
var initPanel=0;
var sInfo = "";
var getInfoReloaded;
var elements;
var settings;
var nTotalVideos=20;
var nTotalGaleriaFotos=20;
var sPaginacion = "";
var paginaActual=1;
var totalPaginas=1;
var initPag=0;
var endPag=0;
var myInterval;
var dInit=0;//10;
var myCadBP = "";
var resEnc = -1;
var IsGraphicElec = false;
var IsElec = true;
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

var arrValBP = new Array(4);
for(var i=0;i<4;i++) {  arrValBP[i]=0; }

var arrVal = new Array(12);
for(var i=0;i<12;i++) {  arrVal[i]=0; }

var cambiaBanner;
var countPub = 0;
var topPub = new Array(3);
    topPub[0]="recintoBanner.swf";
    topPub[1]="coronaBanner.swf";
    topPub[2]="mozblanBanner.swf";


$(function(){
	$(document).ready(function(){
//function alCargar(){
	
			  $("#elecciones").css({'visibility':'hidden'})
			  //$("#elecciones").css({'height':'0px'});
				setHead();
				setInfoCinta();
				SearchNotaFormFunc();
				$("#getSearchNota").click(function(){
					open("busqueda_panel.php?titulo="+$("#txtSearch").val(),"miVentana");
				});


				switch (Init){
						case 0:
									cambiaBanner = setInterval("fnCambiaBanner()",30000);
														   
									getXML("php/getMenuPrincipal.php","x=1",10);	
								    getXML("php/getCoberturas.php","x=1",11);
									getXML("php/get4Titulares.php","x=1",1);
									getXML("php/getSliders.php","x=1",2200);
									
									
									getXML("php/getMedia.php","x=0",2);
									getXML("php/getMxM.php","x=2",3);
									getXML("php/getMostReadyNota.php?Tipo=1","x=3",4);
									getXML("php/getMasComentadas.php?Tipo=1","x=3",41);
									getXML("php/getGaleryImagesMaster.php?IdGIG=0&source=4","x=7",7);
									getXML("php/getGaleryVideos.php?source=4&count=-1","",8);
									getXML("php/getColumns.php?IdColumna=0&Tipo=2","x=7",5);

									getXML("php/getNotasPorSeccion.php","x=9",6);
									
									getXML("php/getPubRight.php?ref=-1","x=1",9);

									//getXML("php/getNotas_Rapidas.php","x=1",1250);
								    //getXML("php/getSecciones.php?IdSec=20&count=0","x=1",1252);

									myInterval = setInterval("validOnLoad()", 500 );
									
						            fnCambiaBanner();
			
									

						        break;
						case 1:
								$("#contenedor1").height(500);
						        break;
				}			
								
				setPie();

				//   ******************* C O M M E N T **************
				
				getDialogForm();
		$(".someClass").tipTip();
		$(".someClass").tipTip({maxWidth: "auto", edgeOffset: 10});


	});

});

//			 }
			 
function getSenial(xml){
try{	
			
			getUStream();	
			getUStream1();	
	
			if ($("status",xml).text() == "2") return;
			        //$("tipo",media).text()
					$("media",xml).each(function(id) {
					        var media = $("media",xml).get(id);
							if ($("objeto",media).text()!="oPress1"){
								getMedia($("archivo",media).text(),
										 $("imagen",media).text(),
										 "video",
										 $("duracion",media).text(),
										 "oPress",
										 "245",
										 "207",mySource);
								$("#otMedia").html($("titulom",media).text());
								$("#odMedia").html($("descripcionm",media).text());
							}else{
								getMedia($("archivo",media).text(),
										 $("imagen",media).text(),
										 "video",
										 $("duracion",media).text(),
										 "oPress1",
										 "245",
										 "207",mySource);
								$("#otMedia1").html($("titulom",media).text());
								$("#odMedia1").html($("descripcionm",media).text());
							}
							arrVal[0]=1;
							arrValBP[1]=1;

				});
} catch (e) {
	alert(e.description);
}
					
}


function getMxM(xml){
			try{	
					  var sMxM="";
					  var i = 1;
					  if ($("status",xml).text() == "2") return;
					  $("nota",xml).each(function(id) {
									var nota = $("nota",xml).get(id);
									var nidnota = $("idnota",nota).text(); 
									if ((i % 2)==1){
										sMxM += (isIE) ? "<div class='divRowMxMBlue divRowMxMAddIE ui-corner-all'>" : "<div class='divRowMxMBlue divRowMxMAddWin ui-corner-all'>";
									}else{
										sMxM += (isIE) ? "<div class='divRowMxMWhite divRowMxMAddIE ui-corner-all'>" : "<div class='divRowMxMWhite divRowMxMAddWin ui-corner-all'>";
									}
									i++;
									sMxM += "<a class='aHora divRowCelMxMHora'>"+$("hora",nota).text()+" </a>";
									sMxM += "<a href='nota.php?idnota="+nidnota+"' class='aMxM'><p class='divRowCelMxMData'>"+$("titulo",nota).text()+"</p></a>";
									sMxM += "</div>";
						});
						if ($("#tabs-1").length) {document.getElementById("tabs-1").innerHTML = sMxM};
						arrVal[1]=1;
			} catch (e) {
				alert(e.description);
			}
			
}



function getMostReady(xml){
try{
	      var sMxM="";
		  var i = 1;
		  if ($("status",xml).text() == "1") {;
			  $("nota",xml).each(function(id) {
							var nota = $("nota",xml).get(id);
							var nidnota = $("idnotanl",nota).text(); 
	
							if ((i % 2)==1){
								sMxM += (isIE) ? "<div class='divRowMxMBlue divRowMxMAddIE ui-corner-all'>" : "<div class='divRowMxMBlue divRowMxMAddWin ui-corner-all'>";
							}else{
								sMxM += (isIE) ? "<div class='divRowMxMWhite divRowMxMAddIE ui-corner-all'>" : "<div class='divRowMxMWhite divRowMxMAddWin ui-corner-all'>";
							}
							i++;
							sMxM += "<a class='aCount divRowCelMxMHora' >"+$("count",nota).text()+" </a>";
							sMxM += "<a href='nota.php?idnota="+nidnota+"' class='aMxM'><p class='divRowCelMxMData'>"+$("titulonl",nota).text()+"</p></a>";

							sMxM += "</div>";
				});
		  }
		  if ($("#tabs-2").length) {document.getElementById("tabs-2").innerHTML = sMxM};
		  arrVal[2]=1;
} catch (e) {
	alert(e.description);
}
		  
}

function getMasComentadas(xml){
try{
	      var sMxM="";
		  var i = 1;
		  if ($("status",xml).text() == "1") {;
			  $("nota",xml).each(function(id) {
							var nota = $("nota",xml).get(id);
							var nidnota = $("idnota",nota).text(); 
	
							if ((i % 2)==1){
								sMxM += (isIE) ? "<div class='divRowMxMBlue divRowMxMAddIE ui-corner-all'>" : "<div class='divRowMxMBlue divRowMxMAddWin ui-corner-all'>";
							}else{
								sMxM += (isIE) ? "<div class='divRowMxMWhite divRowMxMAddIE ui-corner-all'>" : "<div class='divRowMxMWhite divRowMxMAddWin ui-corner-all'>";
							}
							i++;
							sMxM += "<a class='aCount divRowCelMxMHora' >"+$("count",nota).text()+" </a>";
							sMxM += "<a href='nota.php?idnota="+nidnota+"' class='aMxM'><p class='divRowCelMxMData'>"+$("titulo",nota).text()+"</p></a>";
							sMxM += "</div>";
				});
		  }
//sMxM += "<p id='imgProm' style='visibility:visible; text-align:center;'><img style='margin-top:15px;'src='images/pub/04morado.png' width='79' height='80' /> </p>";
		  
			if ($("#tabs-3").length) {document.getElementById("tabs-3").innerHTML = sMxM};
		arrVal[3]=1;
		
} catch (e) {
	alert(e.description);
}

}

function getGaleriaImagenes(xml){
try{
	      var sMxM="";
		  var i = 1;
		  if ($("status",xml).text() == "2") return;
		  $("data",xml).each(function(id) {
					    var nota = $("data",xml).get(id);
						var nidnota = $("idgig",nota).text(); 

						$('#galImage'+i+' img').attr({src:$("image",nota).text()});
						$('#galImage'+i+' a').attr({href:'javascript:abrirVentana('+nidnota+');'});
						
						$('#galTitleImage'+i+' a').attr({href:'javascript:abrirVentana('+nidnota+');'});
						$('#galTitleImage'+i+' a').html($("titulo",nota).text());
						
						i++;

		  });
		  arrVal[4]=1;
		  
} catch (e) {
	alert(e.description);
}

}

function getGaleriaVideos(xml){
try{
		  var sMxM="";
		  var i = 0;
		  var vfile = "";
		  var vimage = "";
		  var vduracion = "";
		  var vtitulo = "";
		  var vdescripcion = "";
		  
		  if ($("status",xml).text() == "2") return;
		  
		  $("media",xml).each(function(id) {
				var nota = $("media",xml).get(id);
				var nidnota = $("idmedia",nota).text(); 

				i++;
						
				var titulo = $("titulo",nota).text();
				var descripcion = $("descripcion",nota).text();

				var linkVideo="javascript:getMediaGalery('"+$("archivo",nota).text()+"','"+$("image",nota).text()+"',"+$('duracion',nota).text()+",'"+titulo+"','"+descripcion+"')";
				
				if (i==1) {
					vfile = $("archivo",nota).text();
					vimage = $("image",nota).text();
					vduracion = $('duracion',nota).text();
					vtitulo = titulo;
					vdescripcion = descripcion;
				}
						
				$('#galVideo'+i+' img').attr({src:$("image",nota).text()});
				$('#galVideo'+i+' a').attr({href:linkVideo});
						
				$('#galTitleVideo'+i+' a').attr({href:linkVideo});
				$('#galTitleVideo'+i+' a').html(titulo);
		  });
			
			getMediaGalery(vfile,vimage,vduracion,vtitulo,vdescripcion);

			arrVal[5]=1;
			
} catch (e) {
	alert(e.description);
}

}

function getColumns(xml){
try{	
          var sHTML  = "<div class='ui-corner-all' id='tituloColSingleContainer'>";
               sHTML  += "<p class='tituloColSingle'>HOY ESCRIBEN</p>";
	      var i = 1;
		  var nota;
		  var nidcolumna;
		  var x = "";
		  if ($("status",xml).text() == "2") return;
		  $("columna",xml).each(function(id) {
					  nota = $("columna",xml).get(id);
					  nidcolumna = $("idcolumna",nota).text(); 
					  sHTML += "<div id='colA1' class='col ui-corner-top'>";
					  sHTML += "<div id='colImg'>";
					  x = (isIE) ? "width='160'":"width='170'";
					  sHTML += "<img "+x+" height='125' src='images/"+$("imgCol",nota).text()+"'/>";
					  sHTML += "</div>";
					  sHTML += "<div id='colDetalleColumna' >";
					  sHTML += "<a id='colLinkT' class='colLink' href='columna.php?IdColumna="+nidcolumna+"' ><p id='tituloCol' class='tituloCol'></p>"+$("titulo",nota).text()+"</a>";
					  sHTML += "<p id='brevedescCol' class='brevedescCol'>"+$("nombre",nota).text()+"</p>";
					  sHTML += "<a id='colLink' class='colLink' href='columna.php?IdColumna="+nidcolumna+"' ><p id='nc_colCol' class='nc_colCol'>"+$("tema",nota).text()+"</p></a>";
					  sHTML += "</div>";
					  sHTML += "</div>";
					  // sHTML += "<div id='colB1' class='colBorder'></div>";
				      i++;

		  });

		  
		  sHTML += "</div>";
		  $("#columnas").html(sHTML);
		  $('#columnas').css({'visibility':'visible'});

			arrVal[6]=1;
			
} catch (e) {
	alert(e.description);
}
			
}

function getSecciones(xml){
try{	
          var sHTML  = "<div class='ui-corner-all' id='tituloSecSingleContainer'>";
               sHTML  += "<p class='tituloSecSingle'>MAS INFORMACIÓN POR SECCIONES</p>";
	      var i = 1;
		  var nota;
		  var nidcolumna; 
		  var strSec = "";
		  var titulo = "";
		  var descripcion = "";
		  var imagen = "";
		  var alt = "";
		  //alert("hola");
		  if ($("status",xml).text() == "2") return;
		  $("sec",xml).each(function(id) {
					  nota = $("sec",xml).get(id);
					  nidsec = parseInt($("idsec",nota).text());
					  strSec = "";
					  sHTML += "<div id='sec' class='sec ui-corner-top'>";
					  sHTML += "<a  href='secciones_panel.php?IdSec="+nidsec+"' ><p id='tituloSecc' class='nc_sec'>"+$("seccion",nota).text()+"</p></a>";
					  sHTML += "<ul>";
					  titulo = $("seccion",nota).text();
					  imagen = $("thumb0",nota).text();
					  alt = $("alt0",nota).text();
					  for (var k=0;k<10;k++){
							if ($("idnota"+k,nota).text()>0){
					  			sHTML += "<li class='liSec'><div class='divliSec'>";
								sHTML += "<a id='secIdNota' class='linkSec' href='nota.php?idnota="+$("idnota"+k,nota).text()+"' >"+$("titulo"+k,nota).text()+"</a></div></li>";
								if (k == 0) {
									strSec += "<a class='EiSec1' href='secciones_panel.php?IdSec="+nidsec+"' >"+titulo+"</a>";
									strSec += "<div class='dEspBanDivInt'>";
									strSec += "<img class='ui-corner-all' src='"+imagen+"' alt='"+alt+"' style='width:100px; height:80px;'/>";
									strSec += "</div>";
									
									if ((nidsec==2) || (nidsec==3) || (nidsec==4)){
										strSec += "<div class='aTitleEspBanDivInt'>";
										strSec += "<p class='EiTit1'><a class='aEiTit1' href='nota.php?idnota="+$("idnota"+k,nota).text()+"'>"+$("titulo"+k,nota).text()+"</a></p>";
										strSec += "</div>";
									}else{
									    strSec += "<p class='EiTit1'><a class='aEiTit1' href='nota.php?idnota="+$("idnota"+k,nota).text()+"'>"+$("titulo"+k,nota).text()+"</a></p>";
									}
									switch (nidsec){
											case 2:
												   $("#dEspBan1").html(strSec);
												   break;
											case 3:
												   $("#dEspBan2").html(strSec);
												   break;
											case 4:
												   $("#dEspBan3").html(strSec);
												   break;
	
									}
									//alert(imagen);
								}
							}
					  }
					  sHTML += "</ul>";
					  sHTML += "</div>"
					  	
					  if (i<=4){
					     sHTML += "<div id='colB1' class='borderSec'></div>";
					  }
					  i++;
				      

		  });
		  

		  sHTML += "</div>";
		  $("#panelSecciones").html(sHTML);
		  $('#panelSecciones').css({'visibility':'visible'});
		  $('#dEsp1').css({'visibility':'visible'});
		  
			arrVal[7]=1;
			
} catch (e) {
	alert(e.description);
}

}


function ajustaDivContenedor1(){
        
		 if (dInit==0){
		 	getFormComment();

		 	$('#tabs').tabs();
		  	var x = $("#c1Izquierdo").height();
          	var y = $("#c1Derecho").height();
          	var z = $("#c1EnMedio").height();
		  	var o = 0;
	      	if (x >= y && x >= z){
		     	o = x;
	      	}else if (y >= x && y >= z){ 
			  	o = y;
		  	}else {
			  	o = z;
		  	}
			
		  	// alert(o);
		  
		  	//o=1300;
		  
      	  	$("#c1Izquierdo").height(o);
      	  	$("#c1Derecho").height(o);
      	  	$("#c1EnMedio").height(o);
		  
		  	$('#initializing').remove();
		  	$('#contenedor1').css({'visibility':'visible'});
		  	$("#tabs").css({'visibility':'visible'});
		  
		  	$('#media').css({'visibility':'visible'});

/*
		  if ($("#elecciones").length) {			   
			  $("#elecciones").css({'visibility':'visible'})
			  $("#elecciones").css({'width':'960px'});
			  if (IsGraphicElec) {
				 $("#elecciones").css({'height':'760px'});
				 $("#bannerPREP").css({'height':'130px'});
				 $("#graphElec").css({'height':'290px'});
				 $("#divLaGranelección").css({'margin-left':'10px'});
			  }else{
				   $("#elecciones").css({'height':'775px'});
				   $("#elecciones").css({'padding-top':'5px'});
			  }

		  }
*/
				refreshMxM = setInterval("getRefreshMxMReloaded()", 60000 );
//			refreshUN = setInterval("getRefreshUNReloaded()", 60000 );
//			refreshLGE = setInterval("getRefreshLGEReloaded()",300000 );
		  		initPanel=1;
				clearInterval(vShowSplash);
				dInit=0;
			}else{
				$("#lblInit").html("Cargando datos... iniciando en "+dInit+" segundos.")
			}
			
			
}

function getMediaPlus(vfile,vimage,vtipo,vduracion,vobject,vancho,valto)
{
	try{
			var x = "file="+vfile+"&image="+vimage+"&state=BUFFERING&bufferlength=20&quality=true&volume=50&abouttext=logydes.com&type=video&duration="+vduracion;
			var s1 = new SWFObject("videos/player.swf","ply",vancho,valto,"9","#FFFFFF");
			s1.addParam("allowfullscreen","true");
			s1.addParam("allowscriptaccess","always");
			s1.addParam("wmode","opaque");
			s1.addParam("flashvars",x);
			s1.write(vobject);
	} catch (err) {
		x = e.message;
		alert(err);
	}
}


function getMedia(vfile,vimage,vtipo,vduracion,vobject,vancho,valto,refpub)
{
	try{
			var x = "file="+vfile+"&image="+vimage+"&state=BUFFERING&bufferlength=20&quality=true&volume=50&abouttext=logydes.com&type=video&duration="+vduracion;
			var s1 = new SWFObject("videos/player.swf","ply",vancho,valto,"9","#FFFFFF");
			s1.addParam("allowfullscreen","true");
			s1.addParam("allowscriptaccess","always");
			s1.addParam("wmode","opaque");
			s1.addParam("flashvars",x);
			s1.write(vobject);
			//alert(vobject+ " "+vfile+" "+vimage+" "+vduracion+" "+vancho+" "+valto);
			
	} catch (err) {
		x = e.message;
		alert(err);
	}
}

function getMediaGalery(vfile,vimage,vduracion,vtitulo,vdescripcion)
{
	try{
			var x = "file="+vfile+"&image="+vimage+"&state=BUFFERING&bufferlength=20&quality=true&volume=50&abouttext=logydes.com&type=video&duration="+vduracion;
			var s1 = new SWFObject("videos/player.swf","ply",400,300,"9","#FFFFFF");
			s1.addParam("allowfullscreen","true");
			s1.addParam("allowscriptaccess","always");
			s1.addParam("wmode","opaque");
			s1.addParam("flashvars",x);
			s1.write('galVideo');
			
			$('#idTituloGalVideo').html(vtitulo);
			$('#idDetalleGalVideo').html(vdescripcion);
	} catch (err) {
		x = e.message;
		alert(err);
	}
}


function getPubRight(xml){
try{	
          var sHTML  = "";
          var sPA  = "";
          var sPC  = "";
		  var TresEspeciales = "";
		  var GraphDip = "";
		  var GraphAlc = "";
	      var i = 1;
		  var nota;
		  var nidcolumna; 
		  if ($("status",xml).text() == "2") return;
		  $("pub",xml).each(function(id) {
					  nota = $("pub",xml).get(id);
					  var x = parseInt($("ref",nota).text());
					  switch (x) {
						     case 0:
								  sPA += $("codigo",nota).text();
								  break;
						     case 1:
								  sPC += $("codigo",nota).text();
								  break;
							 case 2:										  
					  			  sHTML += $("codigo",nota).text();
								  break;
						     case 3:
								  TresEspeciales += $("codigo",nota).text();

								  break;
						     case 4:
								  GraphAlc += $("codigo",nota).text();
								  break;
						     case 5:
								  GraphDip += $("codigo",nota).text();
								  break;
					  }
		  });
		  //mySource se refiere a 0 = Portada Principal; 1 = Suplemento;
			//alert($("#resAlc").length);
		  IsGraphicElec = false;
		  switch (mySource){
							case 0:
								  $("#divPubSliderTwo").html(sHTML);
								  break;
							case 1:
								  $("#divPubSliderTwo").html(sHTML);
								  break;
							default:
								  $("#pubEspecialArriba").html(sPA);
								  $("#pubEspecialCentro").html(sPC);
								  $("#divPubSliderTwo").html(sHTML);
								  $("#dEspBanC1").html(TresEspeciales);
								  
								  if ($("#elecciones").length) {			   
								     	$("#resAlc").html(GraphAlc);
								     	$("#resDip").html(GraphDip);
										if (GraphDip != ""){
											IsGraphicElec = true;
										}
								  }
								  
								  break;
		  }
			arrVal[8]=1;
			arrValBP[2]=1;
} catch (e) {
	alert(e.description);
}

}

function getMenuPrincipal(xml){
		  var sHTML = "<a class='aMenuItem' href='index.html' target='_self'><p>INICIO</p></a>";
	      var i = 1;
		  var nota;
		  var nidcolumna; 
		  if ($("status",xml).text() == "2") return;
		  $("item",xml).each(function(id) {
					  nota = $("item",xml).get(id);
					  if ($("menu",nota).text()!=""){
					  	sHTML += "<a class='aMenuItem' href='secciones_panel.php?IdSec="+parseInt($("idsec",nota).text())+"' ><p>"+ $("menu",nota).text()+"</p></a>";
					  }
		  });
		  sHTML += "<a class='aMenuItem' href='secciones_panel.php?IdSec=-1' target='_self'><p style='color:#FFA;font-weight:bold;'>COLUMNAS</p></a>";
		  $("#menu").html(sHTML);
}

function getCoberturas(xml){
          var sHTML  = "";
	      var i = 1;
		  var nota;
		  if ($("status",xml).text() == "2") return;
		  $("cobertura",xml).each(function(id) {
					  nota = $("cobertura",xml).get(id);
					  $("#cobertura"+i).html($("codigo",nota).text());
					  $("#cobertura"+i).css({'visibility':'visible'});
					  i++;
		  });
}

function getPanelSecciones(xml){
         var sHTML  = "";
	     var i = 1;
		 var nPag = 0;
		 var nidSec = 0;
		 var nota;
		 if ($("status",xml).text() == "1") {
		  	    nPag = parseInt($("npags",xml).text());
		  	    nIdSec = parseInt($("idsec",xml).text());
				if (sPaginacion=="" || nPag==0){
					totalPaginas = nPag;
					sPaginacion = paginacion(nPag,nIdSec,0);
			    	$("#tituloSeccion").html($("seccion_nombre",xml).text());
				}
			    sHTML += sPaginacion;
				$("seccion",xml).each(function(id) {
							   nota = $("seccion",xml).get(id);
							   var nidnota = $("idnota",nota).text(); 
							   sHTML+="<div id='contenedorNotasSecciones'>";
							   sHTML+="<div id='cuerpoSeccion'>";
							   if (nIdSec>0){
								   sHTML+="<p id='tituloNotaSeccion'><a href='nota.php?idnota="+nidnota+"'  style='color:#009;'>"+$("titulo",nota).text()+"</a><BR/>";
								   sHTML+="<a style='color:#99C;font-weight:bold;font-size:12px;text-decoration:none;cursor:auto;'>"+$("fecha",nota).text()+"</a>";
								   sHTML+="</p>";                      
								   sHTML+="<p><a href='nota.php?idnota="+nidnota+"'  style='color:#000;'>"+$("intronota",nota).text()+"</a></p>";                      
							   }else{
								   sHTML+="<p id='tituloNotaSeccion'><a href='columna.php?IdColumna="+nidnota+"' style='color:#009;font-size:14px;'>"+$("titulo",nota).text()+"</a><BR/>";
								   sHTML+="<a href='columna.php?IdColumna="+nidnota+"'  style='color:#090;font-weight:bold;font-size:18px;'>"+$("tema",nota).text()+"</a><BR/>";
								   sHTML+="<a style='color:#99C;font-weight:bold;font-size:12px;text-decoration:none;cursor:auto;'>"+$("fecha",nota).text()+"</a>";
								   sHTML+="</p>";                      
								   sHTML+="<p><a href='columna.php?IdColumna="+nidnota+"'  style='color:#000;'>"+$("intronota",nota).text()+"</a>";
								   sHTML+="</p>";                      
							   }
							   sHTML+="</div>";
							   if ($("thumb",nota).text()!="."){
								   if (nIdSec>0){
									  sHTML+="<a href='nota.php?idnota="+nidnota+"'><img class='imgSeccion ui-corner-all' width='100' height='80' src='images/"+$("thumb",nota).text()+"'/> </a>";
								   }else{
									  sHTML+="<a href='columna.php?IdColumna="+nidnota+"'><img class='imgSeccion ui-corner-all' width='100' height='80' src='images/"+$("thumb",nota).text()+"'/> </a>";
								   }
							   }else{
								  sHTML+="<img width='100' height='80' src='images/core/fondoVacioThumb.png' />";
							   }
							   sHTML+="</div>";
			  });
		 } else {
			    $("#tituloSeccion").html("NO HAY DATOS");
		 }
		  
		 sHTML += sPaginacion;
		  
		 $("#contColumna").html(sHTML);
		 $(".textnPag").html(paginaActual+ "<a class='textDe'> de </a> "+totalPaginas);
		 
		 ajustaDivContenedor4();
}

function getPanelFotos(xml){
          var sHTML  = "";
	      var i = 1;
		  var nota;
		  var nPag = parseInt($("npags",xml).text());
		  if (sPaginacion=="" || nPag==0){
			 totalPaginas = nPag;
			 sPaginacion = paginacion(nPag,0,1);
		  }
		  sHTML += sPaginacion;
		  $("data",xml).each(function(id) {
						nota = $("data",xml).get(id);
						var nidnota = $("idnota",nota).text(); 
						var nidgig = parseInt($("idgig",nota).text()); 
						sHTML+="<div id='contenedorPanelFotos'>";
						sHTML+="<div id='cuerpoSeccion'>";
						sHTML+="<p id='tituloNotaSeccion'><a href='javascript:abrirVentana("+nidgig+");'  style='color:#009;'>"+$("titulo",nota).text()+"</a></p>";                      
						sHTML+="<p><a href='nota.php?idnota="+nidnota+"'  style='color:#000;'>"+$("titulon2",nota).text()+"</a></p>";                      
						sHTML+="</div>";
						if ($("image",nota).text()!=""){
							sHTML+="<a href= href='javascript:abrirVentana("+nidgig+");' target='_blank'>";
							sHTML+="<img class='imgSeccion ui-corner-all' width='100' height='80' src='"+$("image",nota).text()+"'/>";
							sHTML+="</a>";
						}else{
							 sHTML+="<img width='100' height='80' src='images/core/fondoVacioThumb.png' />";
						}
						sHTML+="</div>";
			  });
		 sHTML += sPaginacion;
		 $("#contColumna").html(sHTML);
		 $(".textnPag").html(paginaActual+ "<a class='textDe'> de </a> "+totalPaginas);

		 ajustaDivContenedor4();
}

function getPanelVideos(xml){
         var sHTML  = "";
	     var i = 0;
		 var nota;
		 var nPag = 0;

		 var arrMedia = new Array(10);
	  	 for(var j=0;j<nTotalVideos;j++) { arrMedia[j]=new Array(5); }

		 if ($("status",xml).text() == "1") {
			nPag = parseInt($("npags",xml).text());
			if (sPaginacion=="" || nPag==0){
				totalPaginas = nPag;
				sPaginacion = paginacion(nPag,0,2);
			}
			sHTML += sPaginacion;
			$("media",xml).each(function(id) {
							   nota = $("media",xml).get(id);
							   sHTML+="<div id='contenedorPanelVideos'>";
							   sHTML+="<p id='gVideos"+i+"'></p>";                      
							   sHTML+="<p id='tituloPanelVideo'>"+$("titulo",nota).text()+"</p>";                      
							   sHTML+="<p id='detalleDescripcionVideo'>"+$("descripcion",nota).text()+"</p>";                      
						       sHTML+="</div>";
							   
							   arrMedia[i][0] = $("archivo",nota).text();				
							   arrMedia[i][1] = $("image",nota).text();
							   arrMedia[i][3] = $("duracion",nota).text();
							   arrMedia[i][4] = "gVideos"+i;
							   
							   i++;

			});
		 }  else {
			    $("#tituloSeccion").html("NO HAY DATOS");
		 }
		  
		 sHTML += sPaginacion;
		 $("#contColumna").html(sHTML);
		 for (var j=0;j<i;j++){
			 getMediaPlus(arrMedia[j][0],arrMedia[j][1],"video",arrMedia[j][3],arrMedia[j][4],"400","300");
		 }
		 $(".textnPag").html(paginaActual+ "<a class='textDe'> de </a> "+totalPaginas);
		 ajustaDivContenedor4();
}


function getXML(URL,Vars,nFunction){
		  jQuery.ajax({
						url: URL,//"php/getNotaPrincipal.php",
						async:true,
						data:Vars,
						contentType: "text/xml; charset=iso_8859-1",
						dataType: "xml",
						global: true,
						ifModified: false,
						processData:true,
						error: function(objeto, quepaso, otroobj){
							   //alert("La comunicaicón ha fallado, intente de nuevo: "+quepaso+"; fallo provocado por: "+URL+"; "+Vars+"; "+" Linea del error: "+nFunction);
						},
						success: function(xml){
								 switch(nFunction){
										case 1: 
											   getNotas(xml);
											   break;
										case 2:	
											   getSenial(xml);
											   break;
										case 3:					
											   getMxM(xml);
											   break;
										case 4:					
											   getMostReady(xml);
											   break;
										case 41:					
											   getMasComentadas(xml);
											   break;
										case 5:		
										       getColumns(xml);
											   break;
										case 6:					
										       getSecciones(xml);
											   break;
										case 7:					
										       getGaleriaImagenes(xml);
											   break;
										case 8:					
										       getGaleriaVideos(xml);
											   break;
										case 9:					
										       getPubRight(xml);
											   break;
										case 10:					
										       getMenuPrincipal(xml);
											   break;
										case 11:					
										       getCoberturas(xml);
											   break;
										case 12:					
										       getPanelSecciones(xml);
											   break;
										case 13:					
										       getPanelFotos(xml);
											   break;
										case 14:					
										       getPanelVideos(xml);
											   break;
										case 15:					
										       getVideoSingle(xml);
											   break;
										case 2000:					
										       getConfig(xml);
											   break;
										case 2010:					
										       getConfigNota(xml);
											   break;
										case 2020:					
										       getConfigColumna(xml);
											   break;
										case 2030:					
										       getConfigSec(xml);
											   break;
										case 2040:					
										       getConfigGalImg(xml);
											   break;
										case 2050:					
										       getConfigGalVideo(xml);
											   break;
										case 800:  					
											   getRespuestaSendMail(xml);
											   break;
										case 888:  				
											   getRespuestaComentario(xml);
											   break;
										case 889:  				
											   getValidaCAPTCHA(xml);
											   break;
										case 890:  				
											   getRespuestaRegistroNuevo(xml);
											   break;
										case 999:  //getNota					
											    getNotaPrincipal(xml);
											   break;
										case 1000:  //getColumna					
											    getColumna(xml);
											   break;
										case 1100:  //getColumna
											    getGaleryImages(xml);
											   break;
										case 2100:					
										       getResultadoBusqueda(xml);
											   break;
										case 2200: 
											   $.getSlider(xml);
											   break;
										case 3000:					
											   getMarcadorFut(xml);
											   break;
										case 4100:			
											   getEncuesta(xml);
											   break;
										case 4101:			
											   setEncuesta(xml);
											   break;
										case 4102:			
											   getEncuestaResultados(xml);
											   break;
										case 1250:					
										       //getUltimas_Noticias(xml);
											   break;
										case 1251:					
										       //getUltimaNoticias(xml);
											   break;
										case 1252:					
										       laGranEleccion(xml);
											   break;
								 }
						},
						timeout: 30000,
						type: "GET"
		  });
		  

}

function getNotas(xml)
{ 
try{
		var init=0;
		var MMM =0;
		var nNota = 0;

		var arrMedia = new Array(15);
		for(var i=0;i<5;i++) { arrMedia[i]=new Array(5); }
		if ($("status",xml).text() == "2") return;

		var i = 0;
		var	c1IzqHtml = "";
		$("nota",xml).each(function(id) {
					var nota = $("nota",xml).get(id);
					var nidnota = $("idnota",nota).text(); 
					var nombreContenedor = "vacio"+i;
					if (init==0) {
					    c1IzqHtml += "<div class='notaIntroInit ui-corner-all' style='margin-top:10px; padding-left:5px; padding-right:5px'><h2 class='tituloNotaPrincipal'> <a href='nota.php?idnota="+nidnota+"' class='linkNotaPrincipal' >";
					}else{
					    c1IzqHtml += "<div class='notaIntro'><h2 class='tituloNotaPrincipal'> <a href='nota.php?idnota="+nidnota+"' class='linkNotaPrincipal' >";
					}
					c1IzqHtml += $("titulo",nota).text();
					c1IzqHtml += "</a></h2>";
					c1IzqHtml += "<p class='detalleNotaPrncipal'>";
					c1IzqHtml += $("intronota",nota).text();
					c1IzqHtml += " <a class='aHora'>"+$("hora",nota).text()+" </a>";
					c1IzqHtml += "</p>";
								
					c1IzqHtml += "<div class='cMultimedia'><p id='"+arrMedia[i][4]+"'></p> </div>";
					c1IzqHtml += "<ul class='ulNotasPrincipales'>";
						
					for (var k=0;k<15;k++){
						 if ($("idnotanr"+k,nota).text()!=0){
							 c1IzqHtml += "<li class='liNotaRelPrincipal'>";
							 var x1 = "";
							 if ($("idgrupo"+k,nota).text()!=1){
							    x1 += "<b>"+$("nombregn"+k,nota).text()+" </b>";
							 }
							 MMM = $("idgrupo"+k,nota).text();
							if (MMM==-1){
								c1IzqHtml += "<a href=javascript:abrirVentana("+$("idnotanr"+k,nota).text()+")  class='aFotoGal' >"+$("nombregn"+k,nota).text()+": "+$("titulonr"+k,nota).text()+"</a> ";
							}else if (MMM==-2){
								var enlace = "javascript:abrirGrafico('"+$("maing"+k,nota).text()+"',"+$("ancho"+k,nota).text()+","+$("alto"+k,nota).text()+")";
								c1IzqHtml += "<a href="+enlace+"  class='aFotoGal' >"+$("nombregn"+k,nota).text()+": "+$("titulonr"+k,nota).text()+"</a> ";
							}else if (MMM==-3){
								var enlace = "javascript:abrirEncuesta("+$("idnotanr"+k,nota).text()+")";
								c1IzqHtml += "<a href="+enlace+"  class='aFotoGal' >"+$("nombregn"+k,nota).text()+": "+$("titulonr"+k,nota).text()+"</a> ";
							}else if (MMM==-4){
								var enlace = "javascript:abrirVideo("+$("idnotanr"+k,nota).text()+")";
								c1IzqHtml += "<a href="+enlace+"  class='aFotoGal' >"+$("nombregn"+k,nota).text()+": "+$("titulonr"+k,nota).text()+"</a> ";
							}else{
								 c1IzqHtml += "<a href='nota.php?idnota="+$("idnotanr"+k,nota).text()+"' class='linkNota' >"+x1+$("titulonr"+k,nota).text()+"</a> ";
						     	c1IzqHtml += "<a class='aHora'>"+$("hora"+k,nota).text()+" </a>";
							}
						 c1IzqHtml +="</li>";
		
						  }
					 }
					 c1IzqHtml += "</ul>";
					 c1IzqHtml += "</div>";
				     init = 1;
		});
		$('#c1Izquierdo').prepend(c1IzqHtml);


		arrVal[9]=1;
		
} catch (e) {
	alert(e.description);
}
		
}

$.getSlider = function(xml){
try{
		var cTSlider = "<ul id='portfolio-desc' class='grid_4 alpha omega'>";
		var cSliderButton = "<ul id='slide_nav'>";

		var cSlider = "<div id='innerfade-holder' class='container_16'>";
    		cSlider += "<div class='grid_12 alpha'>";
      		cSlider += "<ul id='portfolio'>";

		var nNota = 0;


		$("nota",xml).each(function(id) {
					var nota = $("nota",xml).get(id);
					var nidnota = $("idnota",nota).text(); 
					cSlider += "<li>";
					cSlider += "<a href='nota.php?idnota="+nidnota+"' >";
					cSlider += "<img class = 'notaImgPrincipal ui-corner-all' src='images/"+$("root",nota).text()+"' alt='"+$("alt",nota).text()+"' />";
					cSlider += "</a>";
					cSlider += "<a class='aTituloNota' href='nota.php?idnota="+nidnota+"'>"+$("titulo",nota).text()+"</a>";
					cSlider += "<p class='dMediaSilder'>"+$("comment",nota).text();
					cSlider += "<a class='aHora'> "+$("hora",nota).text()+"   </a> [";
					cSlider += "<a class='leerNota' href='nota.php?idnota="+nidnota+"' >Leer Nota</a>]";
					cSlider += "</p>";
					cSlider += "</li>";

					cTSlider += "<li></li>";
								
					cSliderButton += "<li class='slide_"+nNota+"'></li>";
								
					nNota++;	  

		});

      	cSlider  += "</ul>";
      	cSliderButton  += "</ul>";

	  	cSlider += cSliderButton;
	  
      	cSlider += "<ul id='slide_control'>";
      	cSlider += "<li id='first_button' class='first_button'></li>";
      	cSlider += "<li id='prev_button'  class='prev_button'></li>";
      	cSlider += "<li id='pause_button' class='pause_button'><span style='display:none;'>pause</span></li>";
      	cSlider += "<li id='next_button'  class='next_button'></li>";
      	cSlider += "<li id='last_button'  class='first_button'></li>";
      	cSlider += "</ul>";
	  	cSlider += "</div>";
	
	  	cTSlider += "</ul>";

      	cSlider += cTSlider;
	  
	  	cSlider += "<div class='clear'> &nbsp; </div>";
  	  	cSlider += "</div>";

		$("#imgNoticia1").html(cSlider);
		

        $('ul#portfolio').innerfade({
                        speed: 1000,
                        timeout: 5000,
                        type: 'sequence',
                        containerheight: 	'220px',
                        slide_timer_on: 	'yes',
                        slide_ui_parent: 	'portfolio',
                        slide_ui_text:		'portfolio-desc',
                       	pause_button_id: 	'pause_button',
                       	slide_nav_id:		'slide_nav'
        });
        $.setOptionsButtonEvent();
                        
        $("#pause_button").click(function() {
            $.pause();
        });
        $("#next_button").click(function() {
            $.next();
        });
                        
        $("#prev_button").click(function() {
            $.prev();
        });
                        
        $("#first_button").click(function() {
        	$.first();
        });
                        
        $("#last_button").click(function() {
        	$.last();
        });
		
		arrVal[10]=1;
		
} catch (e) {
	alert(e.description);
}
}


function abrirGrafico(grafico,ancho,alto) {
    //open("images/graficos/"+grafico,"miVentana", "toolbar=no,directories=no,menubar=no,status=no,width="+ancho+",height="+alto);
	np("images/graficos/"+grafico, ancho, alto) 

}

function abrirEncuesta(idencuesta) {
    //open("images/graficos/"+grafico,"miVentana", "toolbar=no,directories=no,menubar=no,status=no,width="+ancho+",height="+alto);
	np("encuesta.php?idencuesta="+idencuesta, 400, 500) 

}

function abrirVideo(video) {
    //open("images/graficos/"+grafico,"miVentana", "toolbar=no,directories=no,menubar=no,status=no,width="+ancho+",height="+alto);
	np("video.php?idvideo="+video, 400, 500) 

}

function ajustaDivContenedor4(){

		  $('#initializing').remove();

		  if ($("#c1IzquierdoSeccion").height() < largo_bdp) {
			  $("#c1IzquierdoSeccion").height(largo_bdp);
		  }
		  
		  $('#base').css({'visibility':'visible'});
		
		  getFormComment();
		  
}


function getConfig(xml){
          var sHTML  = "";
	      var i = 1;
		  var nota;
		  largo_bdp = 0;
		  if ($("status",xml).text() == "2") return;
		  	  $("response",xml).each(function(id) {
			  	nota = $("response",xml).get(id);
					largo_bdp = parseInt($("largo_contenedor1_nota",nota).text());
					arrValBP[0]=1;
			  });
}

function getConfigSec(xml){
          var sHTML  = "";
	      var i = 1;
		  var nota;
		  largo_bdp = 0;
		  if ($("status",xml).text() == "2") return;
		  	  $("response",xml).each(function(id) {
			  	nota = $("response",xml).get(id);
					largo_bdp = parseInt($("largo_contenedor1_nota",nota).text());
					getXML("php/getMenuPrincipal.php","x=1",10);	
					getXML("php/getSecciones.php?IdSec="+pIdSec+"&count=0",'x=1',12);
			  });
}

function getResultadoBusqueda(xml){

          var sHTML  = "";
	      var i = 1;
		  var nPag = 0;
		// var nidSec = 0;
		  var nota;
		  if ($("status",xml).text() == "1") {
		  	    nPag = parseInt($("npags",xml).text());
		  	    myCadBP = "?titulo="+$("dato",xml).text();
				if (sPaginacion=="" || nPag==0){
					totalPaginas = nPag;
					sPaginacion = paginacion(nPag,0,3);
			    	$("#tituloBP").html("Resultado de la Búsqueda: <br/><p style='font-weight:normal;'>Título = "+$("dato",xml).text()+"</p>");
				}
			    sHTML += sPaginacion;
				$("seccion",xml).each(function(id) {
							   nota = $("seccion",xml).get(id);
							   var nidnota = $("idnota",nota).text(); 
							   sHTML+="<div id='contenedorNotasSecciones'>";
							   sHTML+="<div id='cuerpoSeccion'>";
							   sHTML+="<p id='tituloNotaSeccion'><a href='nota.php?idnota="+nidnota+"'  style='color:#009;'>"+$("titulo",nota).text()+"</a></p>";                      
							   sHTML+="<p>"+$("intronota",nota).text()+"</p><br/>";
							   sHTML+="<p> <div>";
						   
							   sHTML+="<p style='float:left;'>Sección: <a class='aSeccionBP'>"+$("seccionn",nota).text()+"</a></p>";                      
							   sHTML+="<p style='float:left;padding-left:10px;'>Fecha: <a class='aSeccionHoraBP'>"+$("fecha",nota).text()+" "+$("hora",nota).text()+"</a></p>";                      
							   sHTML+="</div></p>";

							   sHTML+="</div>";
							   if ($("thumb",nota).text()!="."){
								  sHTML+="<a href='nota.php?idnota="+nidnota+"'><img class='imgSeccion ui-corner-all' width='100' height='80' src='images/"+$("thumb",nota).text()+"'/> </a>";
							   }else{
								  sHTML+="<img width='100' height='80' src='images/core/fondoVacioThumb.png' />";
							   }
							   sHTML+="</div>";
			  });
		  } else {
			    $("#tituloBP").html("NO HAY DATOS");
		  }
		  
		sHTML += sPaginacion;
		  
		 $("#contColumna").html(sHTML);
		 $(".textnPag").html(paginaActual+ "<a class='textDe'> de </a> "+totalPaginas);
		 
		 arrValBP[3]=1;
		 
		 //ajustaDivContenedor4();

}


function setPaginacion(pIdSec,Count,Docto){
		
		 var int = $("#contColumna").height();
		 $("#contColumna").html("<div style='margin:20px;'><img src='images/core/loader_2.gif' style='padding-bottom:10px;' /><p> Cargando datos, por favor, espere </p></div>");
		 paginaActual = Count+1;
		 int = $("#contColumna").height(int);
		 switch(Docto){
			    case 0: //Secciones
		 			 getXML("php/getSecciones.php?IdSec="+pIdSec+"&count="+Count,'x=1',12);
					 break;
			    case 1: //Galeria de Fotos
					 getXML("php/getGaleryImagesMaster.php?IdGIG=0&count="+Count,"x=7",13);
					 break;
			    case 2: //Galeria de Videos
					 getXML("php/getGaleryVideos.php?IdGIG=0&source=0&count="+Count,"x=7",14);
					 break;
			    case 3: //Secciones
					 getXML("php/getBusquedaNota.php"+myCadBP+"&count="+Count,'x=1',2100);
					 break;
		 }
}


function getConfigGalImg(xml){
          var sHTML  = "";
	      var i = 1;
		  var nota;
		  largo_bdp = 0;
		  if ($("status",xml).text() == "2") return;
		  	  $("response",xml).each(function(id) {
			  	nota = $("response",xml).get(id);
					largo_bdp = parseInt($("largo_contenedor1_nota",nota).text());
					getXML("php/getMenuPrincipal.php","x=1",10);	
					getXML("php/getGaleryImagesMaster.php?IdGIG=0&count=0","x=7",13);
			  });
}

function getConfigGalVideo(xml){
          var sHTML  = "";
	      var i = 1;
		  var nota;
		  largo_bdp = 0;
		  if ($("status",xml).text() == "2") return;
		  	  $("response",xml).each(function(id) {
			  	nota = $("response",xml).get(id);
					largo_bdp = parseInt($("largo_contenedor1_nota",nota).text());
					getXML("php/getMenuPrincipal.php","x=1",10);	
					getXML("php/getGaleryVideos.php?IdGIG=0&source=0&count=0","x=7",14);
			  });
}


function setPie(){
	     var sPie  = "<p>T&eacute;rminos Legales Todos los Derechos Reservados &copy; 2009 | <a id='lblRegInit' class='someClass' title='Escribe aqui tus comentarios'>Dudas y Comentarios</a></p>";
		     sPie += "<p>Av. Pag&eacute;s Llergo No. 116 Col. Nueva Villahermosa, Villahermosa, Tabasco, MX. Tel (01 993) 312-17-55</p>";
		     sPie += "<p>Optimizada para IE 7.0, Firefox 3.0, Safari 4.0, Opera 9.0 o versiones mas recientes.</p>";
             sPie += "<p id='pieValidator'>";
			 sPie += "<a href='http://store.apple.com/us' target='_blank' class='someClass' title='Dise&ntilde;ado en Mac y para Mac'>";
             sPie += "<img src='images/core/madeonamac.gif' style='padding-right:0.5em;' class='smallbanner' alt='MADE ON A MAC' />";
             sPie += "</a>";
             sPie += "<a href='http://validator.w3.org/check?uri=http://www.diariopresente.com.mx' target='_blank' class='someClass' title='Validado por la W3C'>";
             sPie += "<img src='http://www.w3.org/Icons/valid-xhtml10' alt='Valid XHTML 1.0 Transitional' height='31' width='88'/>";
             sPie += "</a>";
             sPie += "</p>";
		$("#pie").html(sPie)	 
}

function setHead(){
		 var shead = "<div>";
			 shead +="<p>Fundador:</p>";
			 shead +="<p>Jorge F. Calles Broca (&dagger;)</p>";
			 shead +="</div>";

		 $("#encabezado_izquierdo").html(shead);
}

/*
<div id="TT_P1R7vKBms6macT"><h2><a href="http://www.tutiempo.net/">El tiempo</a></h2><a href="http://www.tutiempo.net/tiempo/Villahermosa/MMVA.htm">El tiempo en Villahermosa</a></div>
<script type="text/javascript" src="http://www.tutiempo.net/TTapi/cc/P1R7vKBms6macT"></script>
*/


function setInfoCinta(){

             sInfo = "";


			 sInfo += "<div class='infoTemp' style='width:80px'>";
			 sInfo += "<div id='TT_edY3vypmgTma8h'><h2><a href='http://www.tutiempo.net/'></a></h2><a href='http://www.tutiempo.net/tiempo/Villahermosa/MMVA.htm'></a>";
             sInfo += "</div>";
			 sInfo += "<script type='text/javascript' src='http://www.tutiempo.net/TTapi/cc/edY3vypmgTma8h'></script>";
             sInfo += "</div> ";
			 
             sInfo += "<div class='infoTemp' style='width:240px;'>";
             sInfo += "<a href='php/feed.php' style='float:left;'><img style='margin-top:5px;' src='images/core/rss.gif' /></a>";
             sInfo += "<p style='padding-top:8px;'>Villahermosa, Tabasco, M&eacute;x. </p>";
             sInfo += "</div> ";

             sInfo += "<div id='infoFechaHora'>";
             sInfo += "<p id='myDateTime'>Hora Actual</p>";
             sInfo += "</div>";
	
			 $("#infoCinta").html(sInfo);
             
			 tiempo = setInterval("getDateTime()", 1000 );
			 
			 getInfoReloaded = setInterval("getInfoCintaReloaded()", 60000 );
			 
 }

function SearchNotaFormFunc(){
		 var xInfo  = "<div id='findNota'>";
             xInfo += "<ul>";
             xInfo += "<li><p>Buscar </p></li>";
             xInfo += "<li><input id='txtSearch' style='width:160px; @width:140px;'/></li>";
             xInfo += "<li style='padding-left:3px;'><a id='getSearchNota' style='display:block;'><img src='images/core/SearchRecord.png' width='18' height='18' /></a></li>";
             xInfo += "</ul>";
             xInfo += "</div>";

			 $("#SearchNotaForm").html(xInfo);

}


function getRefreshMxMReloaded(){
         getXML("php/getMxM.php","x=2",3);
		 getXML("php/getMostReadyNota.php?Tipo=1","x=3",4);
		 getXML("php/getMasComentadas.php?Tipo=1","x=3",41);
}

function getRefreshUNReloaded(){
         getXML("php/getNotas_Rapidas.php","x=2",1251);
}

function getRefreshLGEReloaded(){
         //getXML("php/getNotas_Rapidas.php","x=2",1252);
		 getXML("php/getSecciones.php?IdSec=20&count=0","x=1",1252);
}


function getInfoCintaReloaded(){
         $("#infoCinta").html(sInfo);
}


function getUStream(){
/*
var xHtml = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553524500' width='245' height='207' id='utv593554'><param name='flashvars' value='autoplay=false&amp;brand=embed&amp;cid=2702087'/><param name='allowfullscreen' value='true'/><param name='allowscriptaccess' value='true'/><param name='movie' value='http://www.ustream.tv/flash/live/1/2702087'/><embed flashvars='autoplay=false&amp;brand=embed&amp;cid=2702087' width='245' height='207' allowfullscreen='true' allowscriptaccess='always' id='utv593554' name='utv_n_29976' src='http://www.ustream.tv/flash/live/1/2702087' type='application/x-shockwave-flash' /></object>";

var xHtml = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553524500' width='245' height='207' id='utv640470'><param name='flashvars' value='autoplay=true&amp;brand=embed&amp;cid=2999455'/><param name='allowfullscreen' value='true'/><param name='allowscriptaccess' value='always'/><param name='movie' value='http://www.ustream.tv/flash/live/1/2999455'/><embed flashvars='autoplay=true&amp;brand=embed&amp;cid=2999455' width='245' height='207' allowfullscreen='true' allowscriptaccess='always' id='utv640470' name='utv_n_79364' src='http://www.ustream.tv/flash/live/1/2999455' type='application/x-shockwave-flash' /></object>";

*/

var xHtml = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553524500' width='245' height='207' id='utv891343'><param name='flashvars' value='autoplay=false&amp;brand=embed&amp;cid=2999455'/><param name='allowfullscreen' value='true'/><param name='allowscriptaccess' value='always'/><param name='movie' value='http://www.ustream.tv/flash/live/1/2999455'/><embed flashvars='autoplay=false&amp;brand=embed&amp;cid=2999455' width='245' height='207' allowfullscreen='true' allowscriptaccess='always' id='utv891343' name='utv_n_902665' src='http://www.ustream.tv/flash/live/1/2999455' type='application/x-shockwave-flash'/></object>";

	$("#ustream").html(xHtml);
		
	// $('#ustream').remove();

}

function getUStream1(){

/*
// Entrevista a Humberto Mayans
var xHtml = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='245' height='207' id='utv771753' name='utv_n_963569'><param name='flashvars' value='autoplay=false' /><param name='allowfullscreen' value='true' /><param name='allowscriptaccess' value='always' /><param name='src' value='http://www.ustream.tv/flash/video/2641741' /><embed flashvars='autoplay=false' width='245' height='207' allowfullscreen='true' allowscriptaccess='always' id='utv771753' name='utv_n_963569' src='http://www.ustream.tv/flash/video/2641741' type='application/x-shockwave-flash' /></object>";
*/

/*
var xHtml = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='245' height='207' id='utv771753' name='utv_n_963569'><param name='flashvars' value='autoplay=false' /><param name='allowfullscreen' value='true' /><param name='allowscriptaccess' value='always' /><param name='src' value='http://www.ustream.tv/flash/video/2695661' /><embed flashvars='autoplay=false' width='245' height='207' allowfullscreen='true' allowscriptaccess='always' id='utv771753' name='utv_n_963569' src='http://www.ustream.tv/flash/video/2695661' type='application/x-shockwave-flash' /></object>";
     xHtml += "<p class='dMedia'>Entrevista a Fernando Landeros Presidente de Fundación Teletón</p>";

	$("#ustream1").html(xHtml);

*/
}

function paginacion(nPag,nSec,Docto){
		 endPag=nPag;
		 var sPag  = "<div class='divPag'>";
			 sPag += "<ul class='ulPag'>";
			 sPag += "<li class='liLey'>";
			 sPag += "<a class='textLey' >Páginas |</a>";
			 sPag += "</li>";
			 if (endPag>19){endPag=19;totalPaginas=endPag;}
			 for (var i=initPag;i<endPag;i++){
				 sPag += "<li class='liPag'>";
			     sPag += "<a class='textPag' href='javascript:setPaginacion("+nSec+","+i+","+Docto+")'>"+(i+1)+"</a>";
				 sPag += "</li>";
			 }
			 sPag += "<li class='linPag'>";
			 sPag += "<a class='textLey' >| Esta viendo la Página: </a>";
			 sPag += "<a class='textnPag' ></a>";
			 sPag += "</li>";
			 sPag += "</ul>";
			 sPag += "</div>";
	     return sPag;
}


function getVideoSingle(xml){
         var sHTML  = "";
	     var i = 0;
		 var nota;
		var varchivo = "";				
		var vimage = "";
		var vduracion = "";
		var vgVideos = "";

		 if ($("status",xml).text() == "1") {
			$("media",xml).each(function(id) {
							   nota = $("media",xml).get(id);
							   sHTML+="<div id='contenedorSingleVideo'>";
							   sHTML+="<p id='gVideos' style='position:absolute; top:0px; left:0px; margin:0px;border:0px; padding:0px; vertical-align:top; text-align:left;'></p>";                      
							   sHTML+="<p id='tituloPanelVideo' style='position:absolute; top:285px; left:0px; margin-left:10px;margin-right:20px; width:380px;'>"+$("titulo",nota).text()+"</p>";											  							   sHTML+="<p id='detalleDescripcionVideo' style='position:absolute; top:335px; left:0px; margin-left:10px; margin-right:20px; width:380px;'>"+$("descripcion",nota).text()+"</p>";								      						   sHTML+="</div>";
	
							   sHTML += "<div style='position:fixed;top:90%;left:50%;widht:100%;margin-left:auto;margin-right:auto;text-align:center;left:160px;'>";
							   sHTML += "<a id='cerrar' href='javascript:window.close()'></a>";
							   sHTML += "</div>";
							   
								$("#sVideo").html(sHTML);

								varchivo = $("archivo",nota).text();				
							    vimage = $("image",nota).text();
							    vduracion = $("duracion",nota).text();
							    vgVideos = "gVideos";
							   
								 getMediaPlus(varchivo,vimage,"video",vduracion,vgVideos,"400","300");
			});
		  
			 
		 }
}


function getFormComment(){
				$('#lblRegInit').click(function() {
						$('#dialogForm2').removeClass('ocultaFormulario');
						$('#dialogForm2').addClass('muestraFormulario');
						$('#txtNombre').focus();
						$('#dialogForm2').dialog('open');
						//$('#formComment#txtNombre').focus();
						$('#txtNombre').focus();

						return false;
				});				

}

function validOnLoad(){
	     var IsOK=1;
		 //for (var i=0;i<12;i++) { 
		 for (var i=0;i<10;i++) { 
		     if (arrVal[i]==0){
			    IsOK = 0;
			 }
		 }
		 if (IsOK==1){
			 
//			 if ((arrVal[0]==1) && (arrVal[1]==1) && (arrVal[2]==1) && (arrVal[3]==1) && (arrVal[4]==1) && (arrVal[5]==1) && (arrVal[6]==1) && (arrVal[7]==1) && (arrVal[8]==1) && (arrVal[9]==1) && (arrVal[10]==1) && (arrVal[11]==1)){
			 if ((arrVal[0]==1) && (arrVal[1]==1) && (arrVal[2]==1) && (arrVal[3]==1) && (arrVal[4]==1) && (arrVal[5]==1) && (arrVal[6]==1) && (arrVal[7]==1) && (arrVal[8]==1) && (arrVal[9]==1) && (arrVal[10]==1) ){
				vShowSplash = setInterval("showSplash()", 1000);
			    ajustaDivContenedor1();
			 clearInterval(myInterval);
			 }else{
				$("#lblInit").html("Cargando datos... por favor, espere...")
			 
			 }
			 
		 }


}

function ActualizaMarcador(pVal) {
         getXML("php/getMarcador.php?idmarcador="+pVal,"x1=2",3000);
}

function getMarcadorFut(xml){
/*
var TE = $("#TIempoEnVivo");
var PR = $("#pResFut");

	if ((TE.length>0) && (PR.length>0)){
*/	
			 $("#TIempoEnVivo").html("");
			 $("#pResFut").html("");
		
			  if ($("status",xml).text() == "2") return;
			  $("nota",xml).each(function(id) {
					var nota = $("nota",xml).get(id);
					$("#TIempoEnVivo").html($("campo2",nota).text()).show("slow");
					$("#pResFut").html($("campo3",nota).text());
							
			  });
			  
//	}   

}


function getUStreamBig(){
		 var xHTML  = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='400' height='320' id='utv851027'>";
		     xHTML += "<param name='flashvars' value='autoplay=false&amp;brand=embed&amp;cid=574933'/><param name='allowfullscreen' value='true'/>";
			 xHTML += "<param name='allowscriptaccess' value='always'/><param name='movie' value='http://www.ustream.tv/flash/live/1/574933'/>";
			 xHTML += "<embed flashvars='autoplay=false&amp;brand=embed&amp;cid=574933' width='400' height='320' allowfullscreen='true' ";
			 xHTML += "allowscriptaccess='always' id='utv851027' name='utv_n_323516' src='http://www.ustream.tv/flash/live/1/574933' type='application/x-shockwave-flash' />";
			 xHTML += "</object>";
			 
			$("#ustreamBig").html(xHTML);
			//$("#ustream").html("");
}

function laGranEleccion(xml){

         var sHTML  = "";
		 var nota;
		 if ($("status",xml).text() == "1") {
				$("seccion",xml).each(function(id) {
							   nota = $("seccion",xml).get(id);
							   var nidnota = $("idnota",nota).text(); 
							   sHTML+="<div style='position:relative; height:80px; width:200px; margin-left:10px; margin-top:10px; float:left; border-bottom:#BBB 1px solid;'>";							   										              				   if ($("thumb",nota).text()!="."){
								   sHTML+="<img style='float:left; margin-right:10px;' class='ui-corner-all'  src='images/"+$("thumb",nota).text()+"' width='80' height='64'/>";
							   }else{
								  //sHTML+="<img width='100' height='80' src='images/core/fondoVacioThumb.png' />";
                                  sHTML+="<img style='float:left; margin-right:10px;' class='ui-corner-all' src='images/core/fondoVacioThumb.png' width='80' height='64'/>";
							   }

							   
                               sHTML+="<div style='margin-left:10px;'>";
                               sHTML+="<ul style='list-style:none; list-style-type:none; margin-left:10px;'>";

							   sHTML+="<li style='color:#F60;font-size:10px;'>"+$("fecha",nota).text()+"</li>";
                               sHTML+="<li  style='text-align:left;'><a href='nota.php?idnota="+nidnota+"' class='aNotaElect'>"+$("titulo",nota).text()+"</a></li>";
                               //sHTML+="<li><a href='nota.php?idnota="+nidnota+"'>"+$("intronota",nota).text()+"</a></li>";

							   sHTML+="</ul>";
                               sHTML+="</div>";
                               sHTML+="</div>";
			  });
		 }
		 sHTML += sPaginacion;
		  
		 $("#divLaGranelección").html(sHTML);
			 arrVal[11]=1;
		 
}

function getUltimaNoticias(xml){
		     var xHTML  = "<ul style=' list-style:none; list-style-type:none;'>";
			 if ($("status",xml).text() == "2") return;
			 $("nota",xml).each(function(id) {
				 var nota = $("nota",xml).get(id);
				 var nidnota = parseInt($("idnota",nota).text()); 
		         if (nidnota>=0){
					 xHTML += "<li style='color:#700; float:left;margin-bottom:5px;'>"+$("hora",nota).text()+" </li>";
					 xHTML += "<li style='color:#555; margin-left:55px; padding-left:-55px;margin-bottom:5px;'>"+$("titulo",nota).text()+"</li>";
				 }
			 });
             xHTML += "</ul>";
			 $("#Ultimas_Noticias").html(xHTML);
}

function getUltimas_Noticias(xml){
try{
/*	
			 getProfile_Tweeter();
			 getProfileFacebook();
			 getUStreamBig();
			 getUltimaNoticias(xml);
*/			 
} catch (e) {
  alert(e.description);
}

}


function getProfile_Tweeter(){

var xHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' width='290' height='320'id='TwitterWidget' align='middle'> <param name='allowScriptAccess' value='always' /><param name='allowFullScreen' value='false' /><param name='movie' value='http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#000000' /><param name='FlashVars' value='userID=82608449&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml'><embed src='http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf' quality='high' bgcolor='#000000' width='290' height='320' name='TwitterWidget' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' FlashVars='userID=82608449&styleURL=http://static.twitter.com/flash/widgets/profile/smooth.xml'/></object>";
			
			 $("#Profile_Tweeter").html(xHTML);
}

function getProfileFacebook(){

		 var xHTML = "<script type='text/javascript' src='http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/es_ES'></script><script type='text/javascript'>FB.init('532a1300550f6aaa6d5b50df85e66fbc');</script><fb:fan profile_id='148728718378' stream='1' connections='10' width='280' height='300'></fb:fan><div></div>";
		 $("#divFacebook").html(xHTML);
}

function showSplash(){
	     ajustaDivContenedor1();
         dInit--;	
}


function fnCambiaBanner(){

			// 
			//alert('media/'+topPub[countPub]);
		
		//$("#jqMedia").show("slow");
try
{
 isIE6  = navigator.appVersion.indexOf("MSIE");

/*
		 $("#jqMedia").jlEmbed({ 
		 id: "myMedia", 
		 plugin: "adobeflash", 
		 url: "http://www.diariopresente.com.mx/media/"+topPub[countPub], 
		 width: 960, 
		 height: 100, 
		 loop: "yes", 
		 autoplay: "yes", 
		 params: 'allowscriptaccess=local allownetworking=local scale=showall quality=high flashvars= wmode=transparent quality=high', 
		 format: 'objectembed' 
		 });

*/

$("#jqMedia").flashembed("http://www.diariopresente.com.mx/media/"+topPub[countPub]); 

//$("#lblP").html(topPub[countPub]);

		if (countPub==2){
			 countPub=0;
		  }else{
			   countPub++;
		  }


} catch (e) {
  alert(isIE6);
}
		  

}