$(document).ready(function(){
		$("#bannerPrincipal").find("table").removeClass("banner");
		$("#bannerPrincipal").find("table").removeClass("bannerCentral");
		$("#bannerPrincipal").find("img").removeClass("bannerImagen");
		if( $("#listaEnlaces").html()=="" ) $("#contenedorEnlaces").remove();
		if( $("#listaNotas").html()=="" ) $("#contenedorNotas").remove();

		//setVideoWidth();
		var path = $("input[@name=path]").val();
		$('div.pics a').lightBox({
			imageBtnClose:	path+'lightbox-btn-close.gif',
			imageBtnPrev: 	path+'lightbox-btn-prev.gif',
			imageBtnNext: 	path+'lightbox-btn-next.gif',
			containerResizeSpeed: 350	
		});
			//topu
	$("div#topu").find("br").remove();
	//el boletin
	$("div#boletin").find("br").remove();
	$(".agrandar").click(function(){
		agrandar();
	});
	//boton de busqueda
	$("#buscar").click(function(){$(this).val("");$(this).focus();});
	jq.asignarEnter("#buscar","$('#botonTitulo').click();");
	
});

	function agrandar(noticiaId){
		$("#noticia").find("div.pics:visible").find("a").eq(0).click();
	}

	function abrirVideo(noticiaId){
		window.open('noticia.mostrarVideo.php?noticiaId='+noticiaId,null,'height=410,width=440,status=no,toolbar=no,menubar=no,location=no');
	}
	
	function mostrar(div){
		$("#"+div).toggle("slow");
	}
	
	function cycleBoton(noticiaId){

		$("#galeria" + noticiaId).cycle({ 
		    fx:     'fade', 
		    speed:  0, 
		    timeout: 0, 
		    next:   '#next'+noticiaId, 
		    prev:   '#prev'+noticiaId 
		});
		$("div.flora").find("#galeria" + noticiaId).cycle({ 
		    fx:     'fade', 
		    speed:  0, 
		    timeout: 0, 
		    next:   '#next'+noticiaId, 
		    prev:   '#prev'+noticiaId 
		});
	}

	function cycle(noticiaId){
		$("#galeria" + noticiaId).cycle();
		$("div.flora").find("#galeria" + noticiaId).cycle();
		$(".boton" + noticiaId).remove();
		$("div.flora").find(".boton" + noticiaId).remove();
	}
	
	function cycleStop(noticiaId){
		var count = $("#galeria" + noticiaId).find("div.pics").size(); //# de imagenes en galeria		
		$("#galeria" + noticiaId).find("div.pics").slice(1,count).remove();
		$("div.flora").find("#galeria" + noticiaId).find("div.pics").slice(1,count).remove();
		$(".boton" + noticiaId).remove();
		$("div.flora").find(".boton" + noticiaId).remove();
	}
	
	function setVideoWidth(){

		$("object").removeAttr("width");
		$("object").removeAttr("height");
		$("object").attr("width",317);
		$("embed").removeAttr("width");
		$("embed").removeAttr("height");
		$("embed").attr("width",317);
	}
	
	function reportar(comentarioId)
	{
			$.ajax({
						type: "POST",
						url: "comentario.reportar.php",
						data: "comentarioId=" + comentarioId, 
						success: function(responseText) {
							if(responseText!="")
							{
								alert(responseText);
							}
						}						
				  });
	}
	
	function agrandarTexto()
	{
		var tam = $(".texto").css("font-size");tam = tam.replace("px","");
		var height = $(".texto").css("line-height");height = height.replace("px","");
		if (tam < 20)
		{
			tam = tam - (-2);
			height = height - (-2);
			$(".texto").css("font-size",tam+"px");
			$(".texto").css("line-height",height+"px");
		}
	}
	function disminuirTexto()
	{
		var tam = $(".texto").css("font-size");tam = tam.replace("px","");
		var height = $(".texto").css("line-height");height = height.replace("px","");
		if (tam > 14)
		{
		tam = tam - 2;
		height = height - 2;
		$(".texto").css("font-size",tam+"px");
		$(".texto").css("line-height",height+"px");
		}
	}
	
	function enviarComentario(noticiaId)
	{
		if($('input[@name=tieneSesion]').val()=='Y')
			jq.abrir('Ingresar un Comentario', 'comentario.edit.php?noticiaId='+noticiaId , '', 350,380);
		else
			jq.abrir('Ingresar', 'login.php', '', 290,250);
	}
	
	function enviarNoticia(noticiaId)
	{
		jq.abrir('Enviar Noticia', 'enviar.noticia.php?noticiaId='+noticiaId , '', 320,460);
	}
	
		function abrirGaleria(noticiaId){
		//jq.abrir('Mostrar Galeria','noticia.mostrarGaleria.php?noticiaId='+noticiaId,'',620,330);
		//var path = $("input[@name=path]").val();
		var path = '/lau/images/';
		$.ajax({
			url:  'noticia.mostrarGaleria.php',
			data: 'noticiaId='+noticiaId,
			success:function(response){
				$("#divframe").html(response);
				$('#gallery a').lightBox({
					imageBtnClose:	path+'lightbox-btn-close.gif',
					imageBtnPrev: 	path+'lightbox-btn-prev.gif',
					imageBtnNext: 	path+'lightbox-btn-next.gif',
					containerResizeSpeed: 350	
				});
				//$("#gallery").css("z-index","1000003");
				$('#gallery a').eq(0).click();
			}
		});
	}
	
	/*
	function abrirVentana(titulo,noticiaId){
		$.ajax({
			url:  'noticia.mostrarVentana.php',
			data: 'noticiaId='+noticiaId,
			success:function(response){
	
				$.modal( response,{
				overlayCss: {
   				 	backgroundColor: '#000'
   				 	
    			 	//cursor: 'wait'    			 	
  					},
  					
  					closeClass: "modalClose",
					closeHTML: "<a href='#'>X</a>"});
				$(".boton" + noticiaId).remove();
  				$("#simplemodal-container").css("height",  "auto");
  				$("#simplemodal-container").css("width",  "auto");
  				$("#simplemodal-container").find(".noticiaCompleta").css("padding-bottom","0px");
  				
			}
		});
		}*/
		
		function abrirVentana(titulo,noticiaId){
		jq.abrir('', 'noticia.mostrarVentana.php?noticiaId='+noticiaId, '', 250,170);
		$(".ui-dialog.flora").addClass("ventanaEmergente");
		$(".ui-dialog.flora").css("width","317px");
		$(".ui-dialog.flora").css("height","");
		$(".ui-dialog.flora").css("overflow-y","auto");
		$(".ui-dialog.flora").css("overflow-x","auto");
		$(".ui-dialog.flora").css("background","#000");
		$(".ui-dialog.flora").css("border","0");
	}
	
