// inizio funzione swap image case history
function swapCase (swapImg) {
if (document.getElementById) {
document.getElementById('swap').src = swapImg.title;
 } else {
  return true;
 }
}
// fine funzione swap image case history




// inizio funzione menu

gia_fatto=0;
function mmenu(mID) {
	
	try{
		mymenu = document.getElementById(mID);
		var display = mymenu.style.display;
		close_others(mID);
		mymenu.style.display = (display == "block") ? "none" : "block";
		menu_on_pro(mID);
		gia_fatto=1;
		
	}
	catch(e){
		self.status=e.message;	
	}
}

//window.onload = function() {
//	var uls = document.getElementsByTagName("ul");
//	for (i=0;i<uls.length;i++) {
//		if(uls[i].className=="submenu")uls[i].style.display = "none";
//	}
//}

function close_all() {
	var uls = document.getElementsByTagName("ul");
	for (i=0;i<uls.length;i++) {
		if(uls[i].className=="submenu")uls[i].style.display = "none";
	}
}

function close_others (mID) {
	var uls = document.getElementsByTagName("ul");
//	var uls = document.getElementById("mID").getElementsByTagName("ul");
	for (i=0;i<uls.length;i++) {
		if (! (mID.indexOf(uls[i].getAttribute("id"))>-1)){
			if(uls[i].className=="submenu")uls[i].style.display = "none";
		}
	}
}

function menu_on_pro (theid){
	
	lev=0;

	pos_und=theid.indexOf("_",0);
	
	while(pos_und != -1){
		pos_und=theid.indexOf("_",pos_und+1);
		lev++;
		
		if (pos_und==-1)break;
	}
	if (lev==2) {
		idmenu = theid.substr(3,theid.length);
		idmenu = idmenu.substr(0,idmenu.lastIndexOf("_"));
		item_menu_root=document.getElementById(idmenu);
		item_menu_root.getElementsByTagName("a")[0].className="on1";
//		item_menu_root.getElementsByTagName("a")[1].className="";
	}
	if(gia_fatto)return;
	submenuitem = document.getElementById(theid);
	submenuitem.getElementsByTagName("a")[0].className="on"+lev;
}

// fine funzione menu

function ShowAndHide(div,totdiv) {
//	alert(div + ' ' + totdiv);
	for (var i=1; i<=totdiv; i++) {
		if (document.getElementById('div_'+i)) {
			if (i==div) {
				document.getElementById('div_'+i).style.display='block';
			} else {
				document.getElementById('div_'+i).style.display='none';
			}
		}
	}
}

//mail nospam

function mail_nospam(a,b,c)
{
	ret = '<a href="mai' + 'lto:'
	ret = ret + a + b + c + '@' + 'ac' + 'anto.' + 'net">' + a + b + c	+ '@' + 'ac' + 'anto.' + 'net' + '</a>';
	document.write (ret);
	return ret;
}

function mail_nospam_ws(a,b,c)
{
	ret = '<a href="mai' + 'lto:'
	ret = ret + a + b + c + '@' + 'web' + 'solute.' + 'it">' + a + b + c	+ '@' + 'web' + 'solute.' + 'it' + '</a>';
	document.write (ret);
	return ret;
}

function MostraMappa(act){
	var dis;
	if (act==0) {dis='none';} else {dis='block';}
	//alert(document.getElementById('sotto').style.display)
	//if (dis=='none') {correctPNG}	
	//document.getElementById('body').style.z-index=0;
	//document.getElementById('sotto').style.z-index=1;		
	document.getElementById('sotto').style.display=dis;	
	document.getElementById('sopra').style.display=dis;

}

function MostraMappa2(act){
	var dis;
	if (act==0) {dis='none';} else {dis='block';}
	//alert(document.getElementById('sotto').style.display)
	//document.getElementById('sotto').style.display=dis;	
	document.getElementById('sopra').style.display=dis;

}

/*inserite da Vale*/

function sendlink()
{
	var w=400;
	var h=230;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h)-h;
	szfet = "width="+w+",height="+h+",toolbar=0,resizable=1,top="+wint+",left="+winl+",scrollbars=0";
	//window.open("sendlink.asp?articolo.asp?art=348&cat=9", "Invia_Link",szfet);
	window.open("sendlink.asp?art=<%=id%>&url=<%=Questo_Url%>", "Invia_Link",szfet);

}
function printart(id,categ,subcateg)
{
	var w=600;
	var h=500;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h)-h;
	szfet = "width="+w+",height="+h+",resizable=1,top="+wint+",left="+winl+",scrollbars=1";
	window.open("print_art.asp?id="+id+"&categ="+categ+"&subcateg="+subcateg, "Stampa_Articolo",szfet);
}

function ChangeDiv(num) {
	NumFilm=25;
	if (num=='') {num=NumFilm}
	for (var i=1;i<=NumFilm;i++) {
		document.getElementById('d'+i).style.display='none';
	}
	document.getElementById('d'+num).style.display='block';

}

function ChangeRender(num) {
	NumFilm=30;
	if (num=='') {num=NumFilm}
	for (var i=1;i<=NumFilm;i++) {
		document.getElementById('d'+i).style.display='none';
	}
	document.getElementById('d'+num).style.display='block';
}