//jQuery.noConflict();
$(document).ready(function() {
	$('#slider1').bxSlider({
		controls: false,
		//pager: true,
		//start_text: 'Iniciar',
		//stop_text: 'Parar',
		speed: 500,
		infiniteLoop: true,
		pause: 5500,
		
		pagerLocation: 'top',
	
		auto: true,
		autoControls: false,//true,
		autoHover: true,
		pager: true //false
		/*auto: true,
		infiniteLoop: true,
		hideControlOnEnd: true,
		pagerLocation: 'top',
		pager: true,
		randomStart: true*/
		//controls: false
	});

	$('#slider0').bxSlider({
		pause: 5500,
		mode: 'fade',
		captions: false,
		auto: true,
		controls: false,
		randomStart: true,
		autoControls: false,
		
		infiniteLoop: false,
		hideControlOnEnd: true,
		//mode: 'vertical',
		pager: false            
	});
	$('#slider3').bxSlider({
		mode: 'fade',
		captions: false,
		auto: true,
		controls: false,
		randomStart: true,
		autoControls: false,
		
		infiniteLoop: false,
		hideControlOnEnd: true,
		//mode: 'vertical',
		pager: true            
	});
	//$('#info_animacion').load("modulos/info_animacion.php");//carga los animacion
	//new wrapScroll("presupuesto_p");//deslizante
	//new wrapScroll("carnaval");
	new wrapScroll("flotante");
	$('.enlaces div.bx-wrapper').css('width', '100%');
	$('.enlaces div.bx-window').css({'width':'100%', 'height':'300px'});
	$('#info_videos').load("modulos/info_videos.php");//carga los videos
	$('#info_banner').load("modulos/info_banner.php");//carga los videos
	//$('.enlaces div.bx-window ul').css('margin':'0');
	if (typeof(swfobject) != "undefined")
	swfobject.registerObject("info_animacion", "9", "");
	var flashvars = {},
	params = {wmode:"transparent"},
	attributes = {};
	swfobject.embedSWF("fotos_slide.swf", "info_animacion", "995", "190", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
	show5();
});

function show5(){
	if (!document.layers&&!document.all&&!document.getElementById)
	return
	var Digital=new Date()
	var hours=Digital.getHours()
	var minutes=Digital.getMinutes()
	var seconds=Digital.getSeconds()
	var dn="AM" 
	if (hours>12){
	 dn="PM"
	 hours=hours-12
	}
	if (hours==0) hours=12
	if (minutes<=9)	minutes="0"+minutes
	if (seconds<=9)	seconds="0"+seconds
	//change font size here to your desire
	myclock=hours+":"+minutes+":" +seconds+" "+dn;
	if (document.layers){
	document.layers.liveclock.document.write(myclock)
	document.layers.liveclock.document.close()
	}
	else if (document.all)
	liveclock.innerHTML=myclock
	else if (document.getElementById)
	document.getElementById("liveclock").innerHTML=myclock
	setTimeout("show5()",1000)
}


function abrir(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, sustituir){

    var izquierda = (screen.availWidth - ancho) / 2;
    var arriba = (screen.availHeight - alto) / 2;

    var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
    var ventana = window.open(direccion,"ventana",opciones,sustituir);
}
function selecccionar_galeria(){
	var galeria_mpt = $('#galeria_mpt option:selected').val();
	$('#caja_contenido').load("modulos/galeria_mpt.php", {galeria_mpt: galeria_mpt}, function(){
		$('#gallery a').lightBox();																		  
	});
}
function pagina(pagina){
	$('#caja_contenido').load("modulos/galeria_mpt.php", {pagina: pagina}, function(){
		$('#gallery a').lightBox();																		  
	});
}
function info_carnaval(){
	$('#caja_contenido').load("modulos/carnaval2011.php", function(){
        $('#slider').s3Slider({
            timeOut: 5000
        });
	});
}
function info_presupuesto_p(){$('#caja_contenido').load("modulos/presupuesto_participativo.php");}
function info_audiencia(){$('#caja_contenido').load("modulos/audiencia_publica.php");}
function info_bicentenario(){
	$('#caja_contenido').load("modulos/info_bicentenario_zela.php", function(){
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
	
		//On Click Event
		$("ul.tabs li").click(function() {
	
			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab_content").hide(); //Hide all tab content
	
			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			return false;
		});
	});
}
function info_gastronomica(){
	$('#caja_contenido').load("modulos/info_feria_gastronomica.php", function(){
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
	
		//On Click Event
		$("ul.tabs li").click(function() {
	
			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab_content").hide(); //Hide all tab content
	
			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			return false;
		});
	});
}
function info_dia_danza(){$('#caja_contenido').load("modulos/info_dia_danza.php");}
function resu_carnaval(){
	$('#caja_contenido').load("modulos/carnaval2011_resultados.php", function(){
		$('#gallery a').lightBox();																		  
	});
}
function galeria_mpt(){
	$('#caja_contenido').load("modulos/galeria_mpt.php", function(){
		$('#gallery a').lightBox();																		  
	});
}

function info_portal_transparencia(){
	$('#contenedor_completo').load("modulos/portal_transparencia.php", function(){
        $("#contenido_completo").css("display","none");
		$("#contenedor_completo").css("display","block");
	});
}
function info_clima(){
	$('#contenedor_completo').load("modulos/clima_tacna.php", function(){
        $("#contenido_completo").css("display","none");
		$("#contenedor_completo").css("display","block");
	});
}
function info_transparencia(id){
	$('#caja_contenido').load("modulos/transparencia.php", {id_modulo: id}, function(){
        $("#contenido_completo").css("display","block");
		$("#contenedor_completo").css("display","none");
	});
}
function info_contactenos(){
	$('#caja_contenido').load("modulos/contactenos.php", function(){
		$("#contenido_completo").css("display","block");
		$("#contenedor_completo").css("display","none");
	});
}
function info_institucion(){
	$('#caja_contenido').load("modulos/institucion.php", function(){
		$("#contenido_completo").css("display","block");
		$("#contenedor_completo").css("display","none");
	});
}

function info_pagos(){$('#caja_contenido').load("modulos/pagosenlinea.php");}
function info_tributos(){$('#caja_contenido').load("modulos/tributos.php");}
function info_licencias(){$('#caja_contenido').load("modulos/licencias.php");}
function info_edificacion(){$('#caja_contenido').load("modulos/edificacion.php");}
function info_funcionarios(){$('#caja_contenido').load("modulos/funcionariosMPT.php");}		
function var_agenda(v_ano,v_mes,v_dia){$('#caja_calendario').load("modulos/calendario.php", {ano:v_ano,mes:v_mes,dia:v_dia});}
function agenda(v_ano,v_mes,v_dia){$('#caja_contenido').load("modulos/agenda.php", {ano:v_ano,mes:v_mes,dia:v_dia});}
function info_buzon(){$('#caja_contenido').load("modulos/buzon.php");}
function enviar_sugerencia(){
	var fechasol = document.getElementById('fechasol').value;
	var denunciante = document.getElementById('denunciante').value;
	var email = document.getElementById('email').value;
	var motivo = document.getElementById('motivo').value;
	var dni = document.getElementById('dni').value;
	
	if(denunciante == ''){
		alert('Debe ingresar su nombre completo');
		return 0;
	}
	if(email == ''){
		alert('Debe ingresar su email, es obligatorio.');
		return 0;
	}
	if(motivo == ''){
		alert('Debe ingresar la Descripcion de la Sugerencia');
		return 0;
	}
	$('#mensaje_buzon').load("modulos/buzon_respuesta.php", {fechasol:fechasol,denunciante:denunciante,email:email,motivo:motivo,dni:dni});
	return 1;
}

function ocultar_banner(id){//'midiv'
	var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
	el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
}

function click_banner(id){
	switch(id)
	{
		case 'carnaval':
			info_carnaval();
			var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
			el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
			//abrir('http://www.innovateperu.pe',0,1,1,1,1,1,1,600,400,1);
		break;
		case 'midiv':
			var el = document.getElementById(id);
			el.style.display = (el.style.display == 'none') ? 'block' : 'none';
			abrir('http://www.innovateperu.pe',0,1,1,1,1,1,1,600,400,1);
		break;
		case 'otrodiv':
			//abrir('http://www.indeci.gob.pe',0,1,1,1,1,1,1,600,400,1);
			abrir('http://www.indeci.gob.pe/plan_a_sismo/p_simulacro.htm',0,1,1,1,1,1,1,600,400,1);
		break;
		case 'playa':
			abrir('http://www.munitacna.gob.pe/mpt07/imagenes/playafitness.jpg',0,1,1,1,1,1,1,600,400,1);
		break;
		case 'orde':
			abrir('http://www.munitacna.gob.pe/mpt07/transparente/publicaciones/acuerdos/OM0002-11.pdf',0,1,1,1,1,1,1,600,400,1);
		break;
		case 'escudo':
			abrir('http://www.munitacna.gob.pe/mpt07/transparente/publicaciones/acuerdos/OM0005-09.pdf',0,1,1,1,1,1,1,600,400,1);
		break;
		case 'cerrar':
			var el = document.getElementById(id);
			el.style.display = (el.style.display == 'none') ? 'block' : 'none';
		break;
		case 'presupuesto_p':
			info_presupuesto_p();
			var el = document.getElementById(id);
			el.style.display = (el.style.display == 'none') ? 'block' : 'none'; 
		break;
	}
}


function noticia_detalle(Id){
	$('#caja_contenido').load("modulos/noticia_detalle.php", {idnoti: Id}, function(){
        $('#slider').s3Slider({
            timeOut: 3000
        });
	});
}


















/*banco credito funciones*/
function abreventanaMax_Certifica( aURL, aWinName, aRuta, pWidth, pHeight, cuadrante, param )
{
   // set deafaults
  eval(defaults(arguments, "", "","", 0, 0, 0, ""));
    
  // 1 si, 2 sd, 3 ii, 4 id, 5 c
  var lngX = 0;
  var lngY = 0;
  if (cuadrante == 1) {lngX = 0;lngY = 30;}
  else if (cuadrante == 2) {lngX = (anchoDisponibleVentana - pWidth - 15);lngY = 30;}
  else if (cuadrante == 3) {lngX = 0;lngY = (altoDisponibleVentana - 30 - pHeight);}
  else if (cuadrante == 4) {lngX = (anchoDisponibleVentana - pWidth - 15);lngY = (altoDisponibleVentana - 30 - pHeight);}
  else {lngX = ((anchoDisponibleVentana - pWidth) / 2);lngY = ((altoDisponibleVentana - pHeight) / 2);}

  var attrib = 'left='+lngX+',top='+(lngY - 30)+',screenX='+lngX+',screenY='+lngY+',';
  attrib += 'width='+pWidth +',height='+pHeight;
  if (param=="") {
      attrib += ',directories=no,status=no,resizable=yes';
      attrib += ',toolbar=no,menubar=no,scrollbars=yes,location=yes,maximize=yes';
  } else {
      attrib += param;
  }
  //cert_registerHit(23947, aRuta, "cert_Pivot");
  winwin=window.open(aURL, aWinName, attrib);
  winwin.focus();
}

function abreventanaMax_Certifica( aURL, aWinName, aRuta )
{
   var wOpen;
   var sOptions;

   sOptions = 'directories=no,status=yes,toolbar=no,menubar=no,scrollbars=yes';
   sOptions = sOptions + ',resizable=yes,location=yes,maximize=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 12).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   //cert_registerHit(23947, aRuta, "cert_Pivot");
   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}


function AbreVentana(pagina,nombre){
  var w=640, h=480;
  var windowName = nombre;
  var x = bNavegador();
  if (window.screen && window.screen.availHeight) {
    h = window.screen.availHeight - 63; // 63
    if( x==2 ) h = h - 11;
    w = window.screen.availWidth - 4;
  }
  window.open(pagina, windowName, "status=yes,resizable=yes,toolbar=no,scrollbars=yes,top=0,left=0,width=" + w + ",height=" + h, 1 );
}







function abreventana_Certifica(laurl, pWindowName,ruta, pWidth, pHeight, cuadrante, param) {

  // set deafaults
  eval(defaults(arguments, "", "","", 0, 0, 0, ""));
    
  // 1 si, 2 sd, 3 ii, 4 id, 5 c
  var lngX = 0;
  var lngY = 0;
  if (cuadrante == 1) {lngX = 0;lngY = 30;}
  else if (cuadrante == 2) {lngX = (anchoDisponibleVentana - pWidth - 15);lngY = 30;}
  else if (cuadrante == 3) {lngX = 0;lngY = (altoDisponibleVentana - 30 - pHeight);}
  else if (cuadrante == 4) {lngX = (anchoDisponibleVentana - pWidth - 15);lngY = (altoDisponibleVentana - 30 - pHeight);}
  else {lngX = ((anchoDisponibleVentana - pWidth) / 2);lngY = ((altoDisponibleVentana - pHeight) / 2);}

  var attrib = 'left='+lngX+',top='+(lngY - 30)+',screenX='+lngX+',screenY='+lngY+',';
  attrib += 'width='+pWidth +',height='+pHeight;
  if (param=="") {
      attrib += ',directories=no,status=no,resizable=yes';
      attrib += ',toolbar=no,menubar=no,scrollbars=yes,location=yes,maximize=yes';
  } else {
      attrib += param;
  }
  cert_registerHit(23947, ruta, "cert_Pivot");
  winwin=window.open(laurl, pWindowName, attrib);
  winwin.focus();
}

function abreventana(laurl, pWindowName, pWidth, pHeight, cuadrante, param) {

  // set deafaults
  eval(defaults(arguments, "", "", 0, 0, 0, ""));
    
  // 1 si, 2 sd, 3 ii, 4 id, 5 c
  var lngX = 0;
  var lngY = 0;
  if (cuadrante == 1) {lngX = 0;lngY = 30;}
  else if (cuadrante == 2) {lngX = (anchoDisponibleVentana - pWidth - 15);lngY = 30;}
  else if (cuadrante == 3) {lngX = 0;lngY = (altoDisponibleVentana - 30 - pHeight);}
  else if (cuadrante == 4) {lngX = (anchoDisponibleVentana - pWidth - 15);lngY = (altoDisponibleVentana - 30 - pHeight);}
  else {lngX = ((anchoDisponibleVentana - pWidth) / 2);lngY = ((altoDisponibleVentana - pHeight) / 2);}

  var attrib = 'left='+lngX+',top='+(lngY - 30)+',screenX='+lngX+',screenY='+lngY+',';
  attrib += 'width='+pWidth +',height='+pHeight;
  if (param=="") {
      attrib += ',directories=no,status=no,resizable=yes';
      attrib += ',toolbar=no,menubar=no,scrollbars=yes,location=yes,maximize=yes';
  } else {
      attrib += param;
  }
  winwin=window.open(laurl, pWindowName, attrib);
  winwin.focus();
}

function abreventanaFija(laurl, pWindowName) {
var attrib = 'left=0,top=0,screenX=0,screenY=0,width=790,height=550,directories=no,status=yes,';
attrib += 'toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=yes,maximize=yes';
winwin=window.open(laurl, pWindowName, attrib);
winwin.focus();
}

function abreventanaFija__Certifica(laurl, pWindowName,aRuta) {
var attrib = 'left=0,top=0,screenX=0,screenY=0,width=790,height=550,directories=no,status=yes,';
attrib += 'toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=yes,maximize=yes';
//cert_registerHit(23947, aRuta, "cert_Pivot");
winwin=window.open(laurl, pWindowName, attrib);
winwin.focus();
}
// nueva funcion para abrir ventana maximizada
function abreventanaMax( aURL, aWinName )
{
   var wOpen;
   var sOptions;

   sOptions = 'directories=no,status=yes,toolbar=no,menubar=no,scrollbars=yes';
   sOptions = sOptions + ',resizable=yes,location=yes,maximize=yes';
   sOptions = sOptions + ',width=' + (screen.availWidth - 12).toString();
   sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
   sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';

   wOpen = window.open( '', aWinName, sOptions );
   wOpen.location = aURL;
   wOpen.focus();
   wOpen.moveTo( 0, 0 );
   wOpen.resizeTo( screen.availWidth, screen.availHeight );
   return wOpen;
}

/**/





















