var bIsMobile=false;
jQuery.fn.center = function () {
    this.css("position","absolute");
	var iTop=($(window).height() - this.height() ) / 2+$(window).scrollTop();
	if (iTop<380) iTop=470;
    this.css("top", iTop + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}
jQuery.fn.centermobile = function () {
    this.css("position","absolute");
	var iTop=$(window).scrollTop();
    this.css("top", iTop + "px");
    return this;
}
var iMouseClickX,iMouseClickY;
$(document).click(function(e){
      iMouseClickX=e.pageX;
	  iMouseClickY=e.pageY;
   }); 

function ControlloAxl(strEvento,strIdControllo)
{
 var strEvID=strEvento+"_"+strIdControllo.id;
 var element,strDato;
 
 if(strEvID==strEvento+"_undefined") strEvID=strEvento+"_"+strIdControllo;
 
 switch(strEvID)
 {
  case "mouseover_LayerAccediLogin":  break;
  case "mouseout_LayerAccediLogin":  break;
  default: break;
 }
}

function cercanelsito()
{
	
}


function login()
{
 
}
function registrati()
{
 window.open("registrazione.php","_blank","width=490,height=560,status=no");	
}
function rinfo()
{
 window.open("rinfo.php","_blank","width=480,height=620,status=no");	
}

function shownews(idnew)
{
window.open('popupnews.php?id='+idnew,'news','width=526,height=600,toolbar=no,scrollbar=no,menubar=no');
}

function ajaxshownews(idnew,showonlylayer)
{
  ElementoVisibile("LayerShowNews",true);
  ajaxchiudishownews();
  $("#LayerShowNews").html("<table width=\"100%\"><tr><td width=\"100%\" height=\"100%\"><img src=\"img/ajax-loader.gif\"></td></tr></table>");
  $("#LayerShowNews").css("top",($(document).scrollTop()+50)+"px");
  if($.browser.msie) 
  {
	  var iVersion=parseInt($.browser.version, 10);
	  if(iVersion < 9)
	  {
	   var element=document.getElementById("LayerShowNews");
	   hPIEDettaglio=element.addBehavior ("img/PIE.htc");
	  }
  }
  $("#LayerShowNews").slideDown(1400);
  if(showonlylayer!=true)
  {
    $.post("ajaxhelper.php","funz=ajaxshownews&id="+idnew,function(retdata) {
    $("#LayerShowNews").html(retdata);
  });
  }
  if(showonlylayer!=true) $("#LayerShowNews").click(function() { ajaxchiudishownews(); });
  else  $("#LayerShowNews").unbind("click");
}
var hPIEDettaglio;
function ajaxchiudishownews()
{
	if($.browser.msie) 
    {
	  var element=document.getElementById("LayerShowNews");
	  element.removeBehavior (hPIEDettaglio);
    }
	$('#LayerShowNews').fadeOut();
}

function ajax_form_submit_CommentaNews() {
 $("#textareaprivacy").html("");
 var options = {
          dataType:  'script' 
    };
$("#FORMSTATICO").ajaxForm(options);
}

function iscrizione_newsletter()
{
 window.location.href="index.php?pagina=2125520294"; 
}
function chiudiregnewsletter()
{
  $('#LayerContenitoreFormRegistrazioneNewsletter').fadeOut();	
}

var oldarch;
function archivio_news(iAnno)
{
  oldarch=$("#LayerArchivioNews").html();
  $.post("ajaxhelper.php","funz=archivionewsmesi&anno="+iAnno,function(retdata) {
  $("#LayerArchivioNews").html(retdata);
  });
}
function switchbackarch()
{
	$("#LayerArchivioNews").html(oldarch);
}
function shad1()
{
 $('#LayerPub').center();
 $('#LayerPub').fadeIn();
}
function commentanews(idnews)
{
 ElementoVisibile("LayerFormCommentaNotizia",true);
 var element=document.getElementById("FUNZ");
 element.value=idnews;
}

function registrazionesupporter()
{
 window.location.href="index.php?pagina=1487623593";
}

