/* Ringraziamento particolare a "Andr3a" della libreria bytefx,
 * una tra le pių compatte e veloci librerie javascript grafiche.
 * link http://www.devpro.it/bytefx 
 */ 
var time=(window.ActiveXObject)?1:1;
function loadImages(){
	if (document.images){
	var filediimmagini = loadImages.arguments;
	var matriceprecaricate = new Array();
	for (var i=0; i<filediimmagini.length; i++){
	matriceprecaricate[i] = new Image;
	matriceprecaricate[i].src = filediimmagini[i];}}
}
function trim(stringa){
    while (stringa.substring(0,1) == ' '){
        stringa = stringa.substring(1, stringa.length);
    }
    while (stringa.substring(stringa.length-1, stringa.length) == ' '){
        stringa = stringa.substring(0,stringa.length-1);
    }
    return stringa;
}
function Is(){
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
}
function $Ajax(url,query,callback,postcallback,failure)
{
	var request=null;
	//per i browser su Mozilla
	if(window.XMLHttpRequest)
		request = new XMLHttpRequest();
	//per IE
	else if(window.ActiveXObject)
	{
		request = new ActiveXObject("Msxml2.XMLHTTP");
		if(!request) request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	//verifica se request non č stato inizializzato
	if(request)
	{
			request.open("POST",url,true);
			request.onreadystatechange=function(){
				if(request.readyState==4)
				{
					if(request.status==200) 
					{
						callback(request);
						if(postcallback) postcallback();
					}
					else if(failure) failure(request);
				}
			};
			request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
			request.send(query);
	}
	else alert("Problema nell'invio");
}
function $time(value){return value*time;}
function $C(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}
function $(id){return document.getElementById(id);}
function nl_clean(str){return str.split("\n").join("").split("\r").join("");}
function nl2br(str){return str.split("\n").join("<br />").split("\r").join("<br />");}/*&amp;*/