//browser detection
if(navigator.appName == "Netscape")
	var isNetscape = true;
if(navigator.appName == "Microsoft Internet Explorer") 
	var isExplorer = true;

//OS detection
if (navigator.appVersion.indexOf("Win")!=-1) 
	var isWin = true;
if (navigator.appVersion.indexOf("Mac")!=-1) 
	var isMac = true;
if (navigator.appVersion.indexOf("X11")!=-1) 
	var isUnix = true;
if (navigator.appVersion.indexOf("Linux")!=-1) 
	var isLinux = true;

//Version detection
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var version= navigator.appVersion.substring(0,1);
//window.location=ÓURLÓ

var winVar = null;
function apribig(url,lung,larg) {
	if (winVar != null) {
		winVar.close();
	}
	winVar = window.open(url,"foto","width="+lung+",height="+larg+",menu=false");
}

function showHideDiv(divId){
	if (document.getElementById(divId))
	if (document.getElementById(divId).style.visibility=='hidden'){
		document.getElementById(divId).style.visibility='visible';
	}else{
		document.getElementById(divId).style.visibility='hidden';
	}
}

function showHideSpan(spanId){
	if (document.getElementById(spanId))
	if (document.getElementById(spanId).style.display=='none'){
		document.getElementById(spanId).style.display='block';
	}else{
		document.getElementById(spanId).style.display='none';
	}
}

function hideDiv(divId){
	if (document.getElementById(divId))
	if (document.getElementById(divId).style.visibility=='visible'){
		document.getElementById(divId).style.visibility='hidden';
	}
}

function showDiv(divId){
	if (document.getElementById(divId)) {
		document.getElementById(divId).style.visibility='visible';
	}
}

function expandDIV(obj, v){
	var h=document.getElementById(obj).style['width'];
	h=parseFloat (h);
	if (h<=400) 
		h+= v;
	document.getElementById(obj).style['width']=h+'px';
}

function reduceDIV(obj, v){
	var h=document.getElementById(obj).style['width'];
	h=parseFloat (h);
	if (h>100) 
		h-= v;
	document.getElementById(obj).style['width']=h+'px';
}

function simplePreload(){
	var args = simplePreload.arguments;
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++){
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	}
}

function helpAlert(text){
	alert(text);
}

//windowDimentionDetection
var winWidth,winHeight;
function getWindowDimencionW(){
	if (navigator.appName=="Netscape") {
		winWidth = window.innerHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winWidth = document.body.offsetHeight;
	}
	return winWidth;
}

function getWindowDimencionW(){
	if (navigator.appName=="Netscape") {
		winWidth = window.innerWidth;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winWidth = document.body.offsetWidth;
	}
	return winWidth;
}

// debugger
function scriptDebugger(){
	var str = "";
	for (i=0;i<arguments.length;i++){
		str+= arguments[i].name +"<br>";
	}
	var win = window.open("", "debugWin", "width=300,height=200"); // a window object
	win.document.open("text/html", "replace");
	win.document.write("<HTML><HEAD><TITLE>New Document</TITLE></HEAD><BODY>"+str+"</BODY></HTML>");
	win.document.close();
}

// video
function showMovie(theMovie,title, autostart, pageOrContainerId, width, height){
	if (!autostart)
		autostart=false;
	if (!width)
		width=480;
	if (!height)
		height=360;

	var image = theMovie.replace('.flv', '.jpg');
	image='flash_rune.gif';
	var videoContent ='<div align="center">';
	videoContent +='<object type="application/x-shockwave-flash" data="flv/mediaplayer.swf?image='+image+'&autostart='+autostart+'&file='+theMovie+'" width="'+width+'" height="'+height+'" wmode="transparent">';
	videoContent +='<param name="movie" value="flv/mediaplayer.swf?image='+image+'&autostart='+autostart+'&file='+theMovie+'" width="'+width+'" height="'+height+'"/>';
	videoContent +='<param name="wmode" value="transparent" />';
	videoContent +='<param name="allowfullscreen" value="true" />';
	videoContent +='</object>';
	videoContent +='</div>';
	document.getElementById(pageOrContainerId).style.display='';
	document.getElementById(pageOrContainerId).innerHTML = videoContent + "<br><div align='center' style='cursor:pointer' class='textSmallBlackBold' onClick='closeMovie()'>chiudi</div>";
}
function closeMovie() {
	document.getElementById('video').innerHTML = "<div id='video' style='display:none;'></div>";
}
