// Sniffer
// variabile per condizionali nulli
var vz=void(0)

var isNS=false,isNS6=false,isIE=false,isIE6=false,isMz=false,isOp=false,isKq=false,isSf=false,isOther=false
// inizializzazione delle stringhe per la compatibilità del menu con i browsers;
var ly="",lt="",sty="",fLeft="",fTop="",w="",h="",x="",y="",xp="",yp="",win_x="",win_y="",units="",nav_lang="";

// Browser Sniffer 
function set_browser(){
    /* 
    Descrizione della Funzione:
    Controlla il tipo di Browser del Client
    */
    //var t0=new Date().getTime();
	lt=".getElementsByTagName";
    ly="document.getElementById";
    sty=".style";
    var nvg=navigator.userAgent.toString(),pl_ra=navigator.plugins,plugins_name="",plugins_desc="",pl_num=pl_ra.length;
    for(p=0; p<pl_num; p++){
        plugins_name+=(pl_ra[p].name).toLowerCase()+"|";
        plugins_desc+=(pl_ra[p].description).toLowerCase()+"|"
    }
    // riconoscimento dei plugins piu' comuni
    // Macromedia Flash	
    plugins_name.indexOf("shockwave flash")!=-1 ? flash_pl=true : flash_pl=false;
    flash_ver=plugins_desc.charAt(plugins_desc.indexOf(".")-1);
    //alert(flash_pl+" - "+flash_ver)
    // Apple QuickTime
    plugins_name.indexOf("quicktime")!=-1 ? qt_pl=true : qt_pl=false;
    if(nvg.lastIndexOf("MSIE")!=-1 && nvg.lastIndexOf("Opera")==-1){
        //le=".all";
		isIE=true;
        if(nvg.lastIndexOf("MSIE 6")==-1){
			ly="document.all"
			lt=".all.tags" 
		}else{
			isIE6=true
		}
    }else if(nvg.lastIndexOf("Mozilla")!=-1 && nvg.lastIndexOf("Netscape")==-1 && nvg.lastIndexOf("Opera")==-1 && nvg.lastIndexOf("Safari")==-1 && nvg.lastIndexOf("Konqueror")==-1){
        isMz=true
    }else if(nvg.lastIndexOf("Netscape")!=-1 && nvg.lastIndexOf("Opera")==-1){
        isNS=true
        if(nvg.lastIndexOf("Netscape6")!=-1){
            isNS6=true
        }else if(nvg.lastIndexOf("Netscape/7")!=-1){
            isNS=false;
            isMz=true
        }
    }else if(nvg.lastIndexOf("Opera")!=-1){
        isOp=true
		isMz=true
    }else if(nvg.lastIndexOf("Safari")!=-1){
        isMz=true
		isSf=true
    }else if(nvg.lastIndexOf("Konqueror")!=-1){
        isMz=true
		isKq=true
    }else{
        isOther=true
    }

    if(isIE){
        fLeft=".pixelLeft";
        fTop=".pixelTop";
        w=".offsetWidth";
        h=".offsetHeight";
        x=".offsetLeft";
        y=".offsetTop";
        xp=x;
        yp=y;
        win_x="window.screenLeft";
        win_y="window.screenTop";
        win_w="document.body.offsetWidth";
        win_h="document.body.offsetheight";
        scr_w="screen.availWidth";
        scr_h="screen.availHeight";
        units="";
    }else if(isMz || isNS6){
        fLeft=".left";
        fTop=".top";
        w=".offsetWidth";
        h=".offsetHeight";
        xp=".offsetLeft";
        yp=".offsetTop";
        win_x="window.screenX";
        win_y="window.screenY";
        win_w="window.outerWidth";
        win_h="window.outerHeight";
        scr_w="window.screen.availWidth";
        scr_h="window.screen.availHeight";
		x=".offsetLeft";
        y=".offsetTop";
		// vecchie impostazioni
        //x=".offsetLeft+offsetParent.offsetLeft";
        //y=".offsetTop+offsetParent.offsetTop";
        units="px"
    }else if(isOp){
        fLeft=".left";
        fTop=".top";
        w=".offsetWidth";
        h=".offsetHeight";
        xp=".offsetLeft";
        yp=".offsetTop";
        x=".offsetLeft+offsetParent.offsetLeft";
        y=".offsetTop+offsetParent.offsetTop";
        win_x="window.screenLeft";
        win_y="window.screnTop";
        win_w="window.innerWidth";
        win_h="window.innerHeight";
        scr_w="window.screen.availWidth";
        scr_h="window.screen.availHeight";
        units="px"
    }
	if(isIE){
		 nav_lang=(navigator.userLanguage.toString()).substring(0,2);
	}else{
		 nav_lang=(navigator.language.toString()).substring(0,2);
	}
}

// questa funzione costruisce gli elementi HTML
function make_el(el,return_string){
	var el_f="";
	typeof(return_string)=="undefined" || return_string=="" ? return_string=false : vz;
	if(typeof(el)=="object"){
		el_f=eval(el)
		if(typeof(el_f.id)!=="undefined" && el_f.id!=""){
			return_string ? el_f=ly+"('"+el_f.id+"')" : vz;
		}
	}else{
		el_f=ly+"('"+el+"')";
		!return_string ? el_f=eval(el_f) : vz;
	}
	return el_f;
}
// lancio della funzione brower_sniffer(). E' necessario che venga eseguita da questo punto.
set_browser()
