 function cerca() {
     var testo = document.form_cerca.ricerca.value;
     if (testo.length < 3) {
		alert('Inserire almeno 3 caratteri');

         return false;
     } else {
         return true;
     }

 }

function manualSubmit(f) {
    	f.submit();
}


function centra(url, width, height, resizable, scroll) {

   	 	if (document.all) {
        	var x = window.screenLeft;
      	  	var y = window.screenTop;
        	var w = window.document.body.offsetWidth;
       	 	var h = window.document.body.offsetHeight;
    	}

    	else {
      	  	var x = window.screenX;
      	  	var y = window.screenY;
      	  	var w = window.outerWidth;
      	  	var h = window.outerHeight;
    	}

    	var cntx = x + Math.round((w - width) / 2);
    	var cnty = y + Math.round((h - height) / 2);

		cntx = 0;
		cnty = 0;

		win = window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' + width + ',height=' + height + ', resizable=' + resizable + ', scrollbars=' + scroll );
    	if(win.window.focus) { win.window.focus(); }
}

function getRSS(source, IdBox) {

   advAJAX.post({

      url : "script/getRSS.php",
      parameters : {
         "source" : source
      },

      onInitialization : function(obj) {
         //$("cLoadingIndicator").style.visibility = "visible";
      },

      onSuccess : function(obj) {
         document.getElementById(IdBox).innerHTML = obj.responseText;
         //$("cLoadingIndicator").style.visibility = "hidden";
      },

      onError : function(obj) {
         //$("cLoadingIndicator").style.visibility = "hidden";
         if( obj.status == 404 ) {
            alert("Pagina di ricerca non trovata.");
         }else {
            if(obj.responsetesto!=null) {
               alert(obj.responseText);
            }else {
               alert("Impossibile ricercare gli articoli.");
            }
         }
      }

   });

}
