// JavaScript Dot Magazine
/* ----------------------------------------------------------------------------------------------------- AO CARREGAR A PÁGINA */
$(document).ready(function () {
  /* - - - - - - - - - - - - - - -  GALERIA */
  $("#btGaleria").click(function(){	
	$("#galeria").fadeIn("slow",function(){
	  // MODAL	 
	  $("#galeria").html('<div id="fecharGaleria"><img src="_imgSite/icoBtFechar.png" alt="fechar" title="fechar" /></div><div id="contGaleria"><div id="galeriaLabel" class="btGaleria1"></div><div id="galerias"></div><div id="galeriaFotos"></div></div>');
	  $("#galeria").css("width","100%").css("height",$(document).height());
	  // CONTEINER
	  $("#contGaleria").fadeIn('fast');
	  // GALERIAS
	  $("#galeriaLabel").html("<div class='btGaleria2'>Galerias</div>").fadeIn('fast');
	  $("#galerias").fadeIn('fast',function(){
		// PAGINA
		abreSessao("galeriasModal","galerias","");
	  });
	  
	  
	  
	  // FECHA MODAL
	  $("#fecharGaleria").click(function(){
		$("#galeria").fadeOut('fast');
		$("#galeria").html('');
	  });	  
	});
  });  
  
  // FADE OUT GALERIA
  $("#galeria").fadeOut('fast');
  
});

$(window).resize(function(){
  /* - - - - - - - - - - - - - - -  GALERIA */
  if($("#galeria").css("display") != "none")
  {
	$("#galeria").css("width","100%");
	$("#galeria").css("height",$(document).height());	
	
	//var posX = Math(($("#conteudo").css("width")/2)-485);
	//$("#galeriaLabel").html(posX);
  }
});

//ABRE FOTOS
function abrirFotos(idGaleria)
{
  alert(idGaleria);
}

function galeriaLabelOver(label)
{
  $("#galeriaLabel").html(label);
}

function galeriaLabelOut()
{
  $("#galeriaLabel").html('Galerias');
}



/* ----------------------------------------------------------------------------------------------------- ABRES CONTEUDO AJAX */
function abreSessao(pagina,frame,x1){
  if (window.XMLHttpRequest)
  { xmlhttp=new XMLHttpRequest(); }
  else
  { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }  
  
  xmlhttp.onreadystatechange=function()
  {
	$("#"+frame).hide();
	if (xmlhttp.readyState==4 && xmlhttp.status==200)
	{
	  $("#"+frame).html(xmlhttp.responseText);
	  $("#"+frame).show();
	}
  }
  xmlhttp.open("GET","_pg/"+pagina+".php?x1="+x1,true);
  xmlhttp.send();
}
/* ----------------------------------------------------------------------------------------------------- SCROLL MENU 
$(window).scroll(function () {
  //posiciona o menu topo com a barra de rolagem
  //if($(window).scrollTop() > 140){ $("#menuTopo").css("position","fixed").css("top","0px").css("z-index","1000"); }
  //else{$("#menuTopo").css("position","relative");}
});*/

/* ----------------------------------------------------------------------------------------------------- BLOQUEIA TECLADO E MOUSE */
/*
function desabilitarMouse(e) {
	
    var evento = e ? e : window.event;
    var botao = evento ? evento.which : evento.button;
    if (botao == 1)
        return true;
    else {
        botao = false;
        evento.returnValue = false;
        return false;
    }
}
function desabilitarTeclado(e) {
    
	var evento = e ? e : window.event;
    if (evento.ctrlKey) {
        evento.returnValue = false;
        return false;
    }
    else
        return true;
}

function retornarFalso(e) {
    //return false;
}

document.onkeydown = desabilitarTeclado;
document.onkeyup = desabilitarTeclado;
document.oncontextmenu = retornarFalso;
document.ondragstart = retornarFalso;
document.onmousedown = desabilitarMouse;
document.onmouseup = desabilitarMouse;
document.onselectstart = retornarFalso;
*/
