//Funzione personalizzata (vale anche per IE) per addListener
function addListener(element, baseName, handler){
   if (element != null){
	   if (element.addEventListener){
		   element.addEventListener(baseName, handler, false);
	   }
	   else if(element.attachEvent){
			element.attachEvent('on' + baseName, handler);
	   }
   }
} //addListener


//Questa funzione cambia il font degli oggetti 'p'
function changeFontSize(inc){

   var fontSize  = 12;	
   var minVarSize = 10;
   var maxVarSize = 18;
   var newCurrSize;
   
   if (inc >0){
	   newCurrSize = maxVarSize;
   }
   else if(inc <0){
	   newCurrSize = minVarSize;
   }
   else{
	   document.location.href = document.location;
   }
	   
   var p = document.getElementById("cnt_corpo").getElementsByTagName("p");

     
   for(n=0; n<p.length; n++) {

       if(p[n].style.fontSize) {
          var fontSize = parseInt(p[n].style.fontSize.replace("px", ""));
       } 
	   else {
          var fontSize = minVarSize;
       }

       p[n].style.fontSize =  newCurrSize +'px';
	   
   }
   
   var sp = document.getElementById("cnt_corpo").getElementsByTagName("span");
   for(n=0; n<sp.length; n++) {
       if(sp[n].style.fontSize) {
          var fontSize = parseInt(sp[n].style.fontSize.replace("px", ""));
       } 
	   else {
          var fontSize = minVarSize;
       }
       sp[n].style.fontSize =  newCurrSize +'px';
	   
   } 

}


function menu_amministrazione(){	
	document.location.href = 'post_sys_admin.php';
}


//Questa funzione verifica ed effettua la ricerca
function eseguiRicerca(){
	
	var valSearch = $('#searchFor').val();
	
	if (!valSearch || valSearch == ''){
	    alert('Specificare un parametro di ricerca!');
	    return;
	}
	
	$('#h_ricerca').val('ricerca');
	$('#frmsearch').submit();
	
}


function newQandA(objID){	

    if (document.getElementById(objID) != null){
	    
	    var oObjQA = new QandA(objID);

	    oObjQA.getLeft();
	    oObjQA.getTop();	
	    oObjQA.CreateForm();	
	}
}



