/**
common func
*/
function NewWindow(mypage, myname, w, h, scroll) { 
var winl = (screen.width - w) / 2; 
var wint = (screen.height - h) / 2; 
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable' 
win = window.open(mypage, myname, winprops) 
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } 
} 

function MM_openBrWindow(theURL,winName,features) { //v2.0
  neo=window.open(theURL,winName,features);
  //--- Forza il focus
  if(neo.window.focus){neo.window.focus();}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  //alert(selObj.options[selObj.selectedIndex].value)
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/** 
//------mod contatti------//
*/
function submit_form(){
 document.forms["form_contatti"].submit();
}
function check_form(theform){
 rtn = Validatore_Form(theform);
 if (rtn==false){
    return (rtn);
 }else{
      showElement('#waitMessage');    
      disable_it();
     
      }
}
function preload_i(image){
 image1 = new Image();
 image1.src = "js/ajaxtabs/"+image;
}
function disable_it(){
 document.getElementById("p_send").disabled = true;
}
function showElement(what){
 //document.getElementById(what).style.display='inline';
 //$(what).style.display = 'inline'; //prototype 
 $(what).show();//jquery  
}
function hideElement(what){
 $(what).hide();//jquery  
}
//scelta lingua sito
function flagSH(what,f){
    f==1 ? $(what).slideDown() : $(what).slideUp() ;  
}


//------/contatti------// 






// cookies
function setCookie(c_name,value,expiredays){
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}    

function getCookie(c_name){
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}    
// cookies
 
       
// grab per stampa
function _getContentToPrint(what){
     var htmlStr = $(what).html();
     return htmlStr;
     
}       
//login
function login(uname,pwd,redir){
    if(uname && pwd){
        $("#waitMessage").show(); 
        $("#p_send").hide(); 
        $.post("index.php",{ mod: "ariservata", smod: "login", username: uname, password: pwd }, function(rtn) {
             doResponse(rtn,redir);      
        }); 
        
    }
}

function doResponse(rtn,redir){
    $("#waitMessage").hide();
    $("#p_send").show();      
    //alert(rtn);
    if(!rtn) {
        $("#serverResponseLogin").show();
        t = setTimeout(" hideElement('#serverResponseLogin')",2000);     
        return;
        }
     else{   
        var _l = redir;
        document.location = _l;
     }  
} 
// /login
 

  






