function CheckBrowser() {
	var browser="None";
	if( navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) {
		browser = "NS4";
		version = 4;
	}
	if( document.getElementById ) {
		browser = "NS6";
		if( navigator.userAgent.indexOf("6.01") != -1 || navigator.userAgent.indexOf("6.0") != -1 ) {
			version = 6;
		}else {
			version = 6.1;
		}
	}
	if( document.all ) {
		if( document.getElementById ) {
			version = 5;
		}else {
			version = 4;
		}
		browser = "IE";
	}
	return browser;
}

//=====================================================
// Vedo tipo di browser ===============================
//=====================================================
var browser = CheckBrowser();
//=====================================================

//sistema operativo
function CeckOS() {
	var os = navigator.userAgent;
	if( os.indexOf("Mac") != -1 ) {
		os = "Mac";
	}else { 
		os = "Win";
	}
	return os;
}


//Posso settare il nome layer - true/false(visibile o nascosto)
function Stili(element,show){
	if(browser == "NS4") {
		if(document.layers[element]!= undefined) {
			if(show)
				document.layers[element].visibility="show";
			else
				document.layers[element].visibility="hide";
		}
	}
	if(browser == "IE") {
		if(document.all[element]!= null) {
			if(show)
				document.all[element].style.visibility="visible";
			else
				document.all[element].style.visibility="hidden";
		}
	}
	
	if(browser == "NS6") {
		if(document.getElementById(element)!= null) {
			if(show)
				document.getElementById(element).style.visibility="visible";
			else
				document.getElementById(element).style.visibility="hidden";
		}
	}
}


//Costruisco dinamicamente il div dei contenuti
function DivDinamico(element,contenuto) {
	if(browser == "NS4") {
		document.write("<LAYER style='position : absolute' id='" + element + "'>" + contenuto + "</LAYER>");
	}else {
		document.write("<DIV style='position : absolute' id='" + element + "'>" + contenuto + "</DIV>");
	}
}


//Posizionamento dinamico del div
function DivPosizione(element,sx,su) {
	if(browser == "NS4") {
		if(document.layers[element]!= undefined) {
			document.layers[element].left = sx;
			document.layers[element].top = su;
		}
	}
	if(browser == "IE") {
		if(document.all[element]!= null) {
			document.all[element].style.left = sx;
			document.all[element].style.top = su;
		}else
			alert("ciao");
	}
	if(browser == "NS6") {
		if(document.getElementById(element)!= null) {
			document.getElementById(element).style.left = sx;
			document.getElementById(element).style.top = su;
		}
	}	
}


//Allinea sempre a destra il div passato
function DivAllineaDestra(element, divlarg) {
	var x_coord = screen.width - divlarg;
	if(browser == "NS4") {
		if(document.layers[element]!= undefined) {
			document.layers[element].left = x_coord;
		}
	}
	if(browser == "IE") {
		if(document.all[element]!= null) {
			document.all[element].style.left = x_coord;
		}
	}
	if(browser == "NS6") {
		if(document.getElementById(element)!= null) {
			document.getElementById(element).style.left = x_coord;
		}
	}
	return x_coord;
}



