  $(document).ready(function(){

    //inicializa sexylightbox
    SexyLightbox.initialize({
      color:'blanco',
      dir: 'sexyimages',
      emergefrom    : 'bottom',
      OverlayStyles : {
        'background-color': '#000000',
        'opacity' : 0.5
      }
    });

    //otros enlaces
    $("#btnTupa").click(function(){
      window.open('portalTransparencia/documentos/tupa/tupa2011.pdf', '_blank');
    });
    $("#btnLibroActas").click(function(){
      window.open('contenidos-nfs/files/otrosEnlaces/libroActas.pdf', '_blank');
    });
    $("#btnAdiosAnemia").click(function(){
      window.open('programaAdiosAnemia.php', '_self');
    });
    $("#btnTributosMunicipales").click(function(){
      window.open('tributosMunicipales.php', '_self');
    });
    $("#btnLicenciaFuncionamiento").click(function(){
      window.open('licenciasFuncionamiento.php', '_self');
    });


    //eventos reproductor
    $("#videoBox").mouseover(function(){
      $(this).removeClass("videoBoxOver");
      $(this).addClass("videoBoxOut");
    });
    $("#videoBox").mouseout(function(){
      $(this).removeClass("videoBoxOut");
      $(this).addClass("videoBoxOver");
    });

    //video1
    $("#videoBoxChico1").mouseover(function(){
      $(this).removeClass("videoBoxChicoOver");
      $(this).addClass("videoBoxChicoOut");
    });
    $("#videoBoxChico1").mouseout(function(){
      $(this).removeClass("videoBoxChicoOut");
      $(this).addClass("videoBoxChicoOver");
    });

    //video2
    $("#videoBoxChico2").mouseover(function(){
      $(this).removeClass("videoBoxChicoOver");
      $(this).addClass("videoBoxChicoOut");
    });
    $("#videoBoxChico2").mouseout(function(){
      $(this).removeClass("videoBoxChicoOut");
      $(this).addClass("videoBoxChicoOver");
    });

    //video3
    $("#videoBoxChico3").mouseover(function(){
      $(this).removeClass("videoBoxChicoOver");
      $(this).addClass("videoBoxChicoOut");
    });
    $("#videoBoxChico3").mouseout(function(){
      $(this).removeClass("videoBoxChicoOut");
      $(this).addClass("videoBoxChicoOver");
    });

    //video4
    $("#videoBoxChico4").mouseover(function(){
      $(this).removeClass("videoBoxChicoOver");
      $(this).addClass("videoBoxChicoOut");
    });
    $("#videoBoxChico4").mouseout(function(){
      $(this).removeClass("videoBoxChicoOut");
      $(this).addClass("videoBoxChicoOver");
    });

    //item videos
    //item1
    $("#item1").mouseover(function(){
      $(this).removeClass("item1");
      $(this).addClass("item11");
    });
    $("#item1").mouseout(function(){
      $(this).removeClass("item11");
      $(this).addClass("item1");
    });
    //item2
    $("#item2").mouseover(function(){
      $(this).removeClass("item2");
      $(this).addClass("item22");
    });
    $("#item2").mouseout(function(){
      $(this).removeClass("item22");
      $(this).addClass("item2");
    });
    //item3
    $("#item3").mouseover(function(){
      $(this).removeClass("item3");
      $(this).addClass("item33");
    });
    $("#item3").mouseout(function(){
      $(this).removeClass("item33");
      $(this).addClass("item3");
    });
    //item4
    $("#item4").mouseover(function(){
      $(this).removeClass("item4");
      $(this).addClass("item44");
    });
    $("#item4").mouseout(function(){
      $(this).removeClass("item44");
      $(this).addClass("item4");
    });
    //item5
    $("#item5").mouseover(function(){
      $(this).removeClass("item5");
      $(this).addClass("item55");
    });
    $("#item5").mouseout(function(){
      $(this).removeClass("item55");
      $(this).addClass("item5");
    });

    //eventos menu
    //historia
    $("#historia").mouseover(function(){
      $(this).removeClass("historia");
      $(this).addClass("historia2");
    });
    $("#historia").mouseout(function(){
      $(this).removeClass("historia2");
      $(this).addClass("historia");
    });
    $("#historia").click(function(){
      window.location.href = "historia.jsp";
    });
    //mapa
    $("#mapa").mouseover(function(){
      $(this).removeClass("mapa");
      $(this).addClass("mapa2");
    });
    $("#mapa").mouseout(function(){
      $(this).removeClass("mapa2");
      $(this).addClass("mapa");
    });
    $("#mapa").click(function(){
      window.location.href = "mapa.jsp";
    });
    //mapaZonificacion
    $("#mapaZonificacion").mouseover(function(){
      $(this).removeClass("mapaZonificacion");
      $(this).addClass("mapaZonificacion2");
    });
    $("#mapaZonificacion").mouseout(function(){
      $(this).removeClass("mapaZonificacion2");
      $(this).addClass("mapaZonificacion");
    });
    $("#mapaZonificacion").click(function(){
      window.location.href = "mapaZonificacion.jsp";
    });
    //poblacion
    $("#poblacion").mouseover(function(){
      $(this).removeClass("poblacion");
      $(this).addClass("poblacion2");
    });
    $("#poblacion").mouseout(function(){
      $(this).removeClass("poblacion2");
      $(this).addClass("poblacion");
    });
    $("#poblacion").click(function(){
      window.location.href = "poblacion.jsp";
    });
    //escudo
    $("#escudo").mouseover(function(){
      $(this).removeClass("escudo");
      $(this).addClass("escudo2");
    });
    $("#escudo").mouseout(function(){
      $(this).removeClass("escudo2");
      $(this).addClass("escudo");
    });
    $("#escudo").click(function(){
      window.location.href = "escudo.jsp";
    });

    //municipalidad
    $("#vision").mouseover(function(){
      $(this).removeClass("vision");
      $(this).addClass("vision2");
    });
    $("#vision").mouseout(function(){
      $(this).removeClass("vision2");
      $(this).addClass("vision");
    });
    $("#vision").click(function(){
      window.location.href = "vision.jsp";
    });
    $("#mision").mouseover(function(){
      $(this).removeClass("mision");
      $(this).addClass("mision2");
    });
    $("#mision").mouseout(function(){
      $(this).removeClass("mision2");
      $(this).addClass("mision");
    });
    $("#mision").click(function(){
      window.location.href = "mision.jsp";
    });
    $("#organigrama").mouseover(function(){
      $(this).removeClass("organigrama");
      $(this).addClass("organigrama2");
    });
    $("#organigrama").mouseout(function(){
      $(this).removeClass("organigrama2");
      $(this).addClass("organigrama");
    });
    $("#organigrama").click(function(){
      window.location.href = "organigrama.jsp";
    });
    $("#consejoMunicipal").mouseover(function(){
      $(this).removeClass("consejoMunicipal");
      $(this).addClass("consejoMunicipal2");
    });
    $("#consejoMunicipal").mouseout(function(){
      $(this).removeClass("consejoMunicipal2");
      $(this).addClass("consejoMunicipal");
    });
    $("#consejoMunicipal").click(function(){
      window.location.href = "consejoMunicipal.jsp";
    });
    $("#comisiones").mouseover(function(){
      $(this).removeClass("comisiones");
      $(this).addClass("comisiones2");
    });
    $("#comisiones").mouseout(function(){
      $(this).removeClass("comisiones2");
      $(this).addClass("comisiones");
    });
    $("#comisiones").click(function(){
      window.location.href = "comisiones.jsp";
    });
    $("#funcionarios").mouseover(function(){
      $(this).removeClass("funcionarios");
      $(this).addClass("funcionarios2");
    });
    $("#funcionarios").mouseout(function(){
      $(this).removeClass("funcionarios2");
      $(this).addClass("funcionarios");
    });
    $("#funcionarios").click(function(){
      window.location.href = "funcionarios.jsp";
    });
    $("#directorioTelefonico").mouseover(function(){
      $(this).removeClass("directorioTelefonico");
      $(this).addClass("directorioTelefonico2");
    });
    $("#directorioTelefonico").mouseout(function(){
      $(this).removeClass("directorioTelefonico2");
      $(this).addClass("directorioTelefonico");
    });

    //gestion
    $("#menuObrasx").mouseover(function(){
      $(this).removeClass("menuObrasx");
      $(this).addClass("menuObrasx2");
    });
    $("#menuObrasx").mouseout(function(){
      $(this).removeClass("menuObrasx2");
      $(this).addClass("menuObrasx");
    });
    $("#menuObrasx").click(function(){
      window.location.href = "obras.jsp";
    });
    $("#seguridadCiudadana").mouseover(function(){
      $(this).removeClass("seguridadCiudadana");
      $(this).addClass("seguridadCiudadana2");
    });
    $("#seguridadCiudadana").mouseout(function(){
      $(this).removeClass("seguridadCiudadana2");
      $(this).addClass("seguridadCiudadana");
    });
    $("#seguridadCiudadana").click(function(){
      window.location.href = "seguridad.jsp";
    });
    $("#defensaCivil").mouseover(function(){
      $(this).removeClass("defensaCivil");
      $(this).addClass("defensaCivil2");
    });
    $("#defensaCivil").mouseout(function(){
      $(this).removeClass("defensaCivil2");
      $(this).addClass("defensaCivil");
    });
    $("#educacion").mouseover(function(){
      $(this).removeClass("educacion");
      $(this).addClass("educacion2");
    });
    $("#educacion").mouseout(function(){
      $(this).removeClass("educacion2");
      $(this).addClass("educacion");
    });
    $("#educacion").click(function(){
      window.location.href = "educacion.jsp";
    });
    $("#juventud").mouseover(function(){
      $(this).removeClass("juventud");
      $(this).addClass("juventud2");
    });
    $("#juventud").mouseout(function(){
      $(this).removeClass("juventud2");
      $(this).addClass("juventud");
    });
    $("#cultura").mouseover(function(){
      $(this).removeClass("cultura");
      $(this).addClass("cultura2");
    });
    $("#cultura").mouseout(function(){
      $(this).removeClass("cultura2");
      $(this).addClass("cultura");
    });
    $("#programasSociales").mouseover(function(){
      $(this).removeClass("programasSociales");
      $(this).addClass("programasSociales2");
    });
    $("#programasSociales").mouseout(function(){
      $(this).removeClass("programasSociales2");
      $(this).addClass("programasSociales");
    });
    $("#programasSociales").click(function(){
      window.location.href = "desarrollo.jsp";
    });
    $("#serviciosComuna").mouseover(function(){
      $(this).removeClass("serviciosComuna");
      $(this).addClass("serviciosComuna2");
    });
    $("#serviciosComuna").mouseout(function(){
      $(this).removeClass("serviciosComuna2");
      $(this).addClass("serviciosComuna");
    });
    $("#serviciosComuna").click(function(){
      window.location.href = "salud.jsp";
    });

    //enlaces
    //up
    $("#up").mouseover(function(){
      $("#up").removeClass("up");
      $("#up").addClass("up2");
    });
    $("#up").mouseout(function(){
      $("#up").removeClass("up2");
      $("#up").addClass("up");
    });
    //down
    $("#down").mouseover(function(){
      $("#down").removeClass("down");
      $("#down").addClass("down2");
    });
    $("#down").mouseout(function(){
      $("#down").removeClass("down2");
      $("#down").addClass("down");
    });

    //botones utiles
    //imprimir
    $("#btnImprimir").mouseover(function(){
      $(this).removeClass("btnImprimir");
      $(this).addClass("btnImprimir2");
    });
    $("#btnImprimir").mouseout(function(){
      $(this).removeClass("btnImprimir2");
      $(this).addClass("btnImprimir");
    });
    $("#btnImprimir").click(function(){
      print();
    });
    //ampliar
    $("#btnAmpliarTexto").mouseover(function(){
      $(this).removeClass("btnAmpliarTexto");
      $(this).addClass("btnAmpliarTexto2");
    });
    $("#btnAmpliarTexto").mouseout(function(){
      $(this).removeClass("btnAmpliarTexto2");
      $(this).addClass("btnAmpliarTexto");
    });
    $("#btnAmpliarTexto").fontscale("#contenidoTexto","up",{unit:"px",increment:1});
    //textoOriginal
    $("#btnTextoOriginal").mouseover(function(){
      $(this).removeClass("btnTextoOriginal");
      $(this).addClass("btnTextoOriginal2");
    });
    $("#btnTextoOriginal").mouseout(function(){
      $(this).removeClass("btnTextoOriginal2");
      $(this).addClass("btnTextoOriginal");
    });
    $("#btnTextoOriginal").fontscale("#contenidoTexto","reset");
    //reducir
    $("#btnReducirTexto").mouseover(function(){
      $(this).removeClass("btnReducirTexto");
      $(this).addClass("btnReducirTexto2");
    });
    $("#btnReducirTexto").mouseout(function(){
      $(this).removeClass("btnReducirTexto2");
      $(this).addClass("btnReducirTexto");
    });
    $("#btnReducirTexto").fontscale("#contenidoTexto","down",{unit:"px",increment:1});

  });

  //carrusel fotos informacion
  function overItem(id){
    $(id).removeClass("fotoBoxChicoOver");
    $(id).addClass("fotoBoxChicoOut");
  }
  function outItem(id){
    $(id).removeClass("fotoBoxChicoOut");
    $(id).addClass("fotoBoxChicoOver");
  }

  //carrusel videos informacion
  function overItemVideo(id){
    $(id).removeClass("videoBoxChicoOver");
    $(id).addClass("videoBoxChicoOut");
  }
  function outItemVideo(id){
    $(id).removeClass("videoBoxChicoOut");
    $(id).addClass("videoBoxChicoOver");
  }

  //mostrar video en reproductor
  function mostrarVideo(thumbnail, video, descripcion){
    $("#video").attr("style", "display:none; background-image:url(contenidos-nfs/videos/desarrollo/" + thumbnail + ");");
    $("#mensajeVideo").attr("style", "display:none;");
    $("#mensajeVideo").html(descripcion);
    $("#enlaceVideo").attr("href", "video.php?url=" + video + "&TB_iframe=true&height=490&width=820&background=#000");
    $("#video").fadeIn("slow", function(){
      $("#mensajeVideo").fadeIn("slow");
    });
  }

  //abre lightbox del mensaje del alcalde
  function LightboxDelegate(url, caption) {
    SexyLightbox.display(url, caption);
  }
	
	//detecta navegador
	function bNavegador(){
		if(navigator.appName){
			if( navigator.appName == "Microsoft Internet Explorer") return 1;
			if( navigator.appName == "Netscape") return 2;
		}
		return 0;
	}
	
	//abre ventana
	function abreVentana(url){
		var x = bNavegador();
		if(window.screen && window.screen.availHeight){
			w = window.screen.availWidth - 10;
			h = window.screen.availHeight - 25;
			if(x==2){
				//si es mozilla
				h = h + 5;
			}else{
				//si es internet
				h = h - 15;
				w = w - 10;
			}
		}
		window.open(url, "ventana", "resizable=yes, scrollbars=yes, width = " + w + ", height = " + h + ", top=0, left=0", 1);
	}
	
