//****************************
// cambio size font sito
//****************************
var currentFontSize = 5;
var minFontSize     = 48;
var maxFontSize     = 102;
var step            = 6;
function changeFontSize(sizeDifference){
    currentFontSize = currentFontSize + sizeDifference;
    fontSize = minFontSize + parseInt(currentFontSize * step);

    if(fontSize > maxFontSize){
        fontSize = maxFontSize;
    }else if(fontSize < minFontSize){
        fontSize = minFontSize;
    }
    
    setFontSize(fontSize);
    currentFontSize = parseInt((fontSize - minFontSize)/step);
    createCookie("FontSize", currentFontSize, 365);
    createCookie("cuFontSize", fontSize, 365);
};
function setFontSize(fontSize){
    document.body.style.fontSize = fontSize + '%';
};

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}



//****************************
// /cambio size font sito                   
//****************************



/**
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("slow");//jquery  
}
function hideElement(what){
 $(what).hide("slow");//jquery  
}
//scelta lingua sito
function flagSH(what,f){
    f==1 ? $(what).slideDown() : $(what).slideUp() ;  
}


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


function getContent(page){
    $("div#static_content").load(page);
    $("#navi").load(page+"&op=getNavi");
    
    
}

function setLinkQuestaPagina(link){
    if(link)
      $("div#link_page").html(" <a href='javascript:showElement(\"span#_linkto\")' >Link a questa pagina</a><br /><span id='_linkto' style='display:none'><br /><textarea rows='3' readonly>"+link+"</textarea></span><br />");
}


function _getContentToPrint(what){
     var htmlStr = $(what).html();
     return htmlStr;
     
}


//login
function login(uname,pwd,redir){
    
    
    if(uname && pwd){
        $("#waitMessage").show();      
        $.post("index.php",{ mod: "ariservata", smod: "login", username: uname, password: pwd }, function(rtn) {
             doResponse(rtn,redir);      
        }); 
        
    }
}

function doResponse(rtn,redir){
    $("#waitMessage").hide();     
    //alert(rtn);
    if(!rtn) {
        $("#serverResponseLogin").show();
        return;
        }
    $("#login_area").html(rtn);
    
    
    var _l = "index.php?mod=ariservata";
    document.location = _l;
       
} 
// /login








