jQuery(function() {

 // carregando
  var loader = jQuery('<div id="loader"><img src="img/load.gif" alt="carregando..." /></div>')
  	.css({position: "fixed", top: "50%", left: "50%", 'z-index': 20})
  	.appendTo("body")
  	.hide();

  $(document).ajaxStart(function() {
    	loader.show();
    }).ajaxStop(function() {
    	loader.hide();
    }).ajaxError(function(a, b, e) {
    	throw e;
    });


});

  function popupoff() {
    document.getElementById("c_popup").style.visibility = "hidden";
  };

  function aviso(msg) {
    $('#aviso').html(msg);
    $('#aviso').slideDown('fast');
    setTimeout(function(){ $('#aviso').slideUp('fast') },8000);

  };


 function carregaBox(submenu,titulo,menu,id) {
    if ( typeof titulo == 'undefined' ) { titulo = ''; };
    if ( typeof menu == 'undefined' ) { titulo = ''; };
    if ( typeof id == 'undefined' ) { id = ''; };
    $('#box_conteudo').html("");
    $.ajax({
      url: "boxpage.php?submenu="+submenu+"&titulo="+titulo+"&menu="+menu+"&id="+id,
      cache: false,
      dataType: "html",
      success: function(html){
        $('#box_conteudo').html(html);
        $("#box").fadeIn();
      }
    });
  };

  function abreBanner(local) {
    carregaBox(local);
  };

$(function(){

  w = screen.availWidth;
  h = screen.availHeight;

  $('form').jqTransform({imgPath:'js/form/'});

  $("#box_fechar").live('click',function(){
    $("#box").fadeOut();
  });

  $("#aviso").live('click',function(){
    $("#aviso").fadeOut();
  });

});
