

function btTrans(menulevel, imgnum, imgstate) {

	var tempimg = new Image() ;
	tempimg.src = (imgstate==1) ? "imgs/bt_"+menulevel+"_"+imgnum+"r.gif" : "imgs/bt_"+menulevel+"_"+imgnum+"t.gif" ;
	
	if (document.all && document.images["bt_"+menulevel+"_"+imgnum].filters.blendTrans) {
	
		document.images["bt_"+menulevel+"_"+imgnum].filters.blendTrans.apply();
		document.images["bt_"+menulevel+"_"+imgnum].filters.blendTrans.play();
	
	}

	document.images["bt_"+menulevel+"_"+imgnum].src = tempimg.src ;

}


function btShAll(imgobj, imgstate) {

	var tempimg = new Image() ;
	tempimg.src = (imgstate==1) ? "imgs/bt_4_1r.gif" : "imgs/bt_4_1t.gif" ;
	
	if (document.all && imgobj.filters.blendTrans) {
	
		imgobj.filters.blendTrans.apply();
		imgobj.filters.blendTrans.play();
	
	}

	imgobj.src = tempimg.src ;

}


function nextGal() {

	if (document.all && document.images["markimg"].filters.blendTrans) {
		document.images["markimg"].filters.blendTrans.apply();
		document.images["markimg"].filters.blendTrans.play();
	}

	showedgal = (showedgal < markimages.length -1 ) ? 1 + showedgal : 0 ;
	
	document.images["markimg"].src="/newdyn.php?id="+showedmark+"&s="+markimages[showedgal]+"&pat=gallery&w=320&h=240&c=0&fix=2" ;
	
}

function zoomGal(id,seq) {
	if (typeof seq == "undefined") {
	
		if (typeof markimages != "undefined" && typeof showedgal != "undefined") {
		
			seq = showedgal ;
		} else seq = 0 ;
	}
	var wc = screen.width ;
	var hc = screen.height ;
	var url = "../gallery/newpop.php?id="+id+"&s="+seq+"&wc="+wc+"&hc="+hc ;
	wpop = window.open (url, "wpop", "fullscreen=1,resizable=1,scrollbars=0")  ;
	
}

function zoomContatto(idcontatto) {

        wpop = window.open ("../contatti/pop.php?id="+idcontatto, "wpop", "resizable=1,scrollbars=0")  ;

}

function schedaOpen(id) {

	wedsc = window.open ("schedanew.php?idscheda="+id, "wedsc", "width=680,height=600,resizable=0,scrollbars=1") ;
	wedsc.focus() ;
	
}

function nospam(muser,mdomain) {

	if (typeof mdomain == "undefined") var mdomain = "philarmonica.it" ;
	location.href = "mailto:"+muser+"@"+mdomain ;

}

function zoomNews(idnews) {

	var wc = screen.width ;
	var hc = screen.height ;
	// var url = "/news/popnew.php?id="+idnews+"&wc="+wc+"&hc="+hc ;
	var url = "/news/popnew.php?id="+idnews+"&wc=1600&hc=1600" ;
	wpop = window.open (url, "wpop", "resizable=1,scrollbars=1")  ;

}

function startMarchi() {

	var mh = 0 ;
	if (document.getElementById("leftmainpads")) {
		mh = parseInt(document.getElementById("leftmainpads").offsetHeight,10)-128+35 ;
		if ( document.getElementById && ! document.all) mh += 10 ;
		if ( mh < 360 ) mh=360 ;
		document.getElementById("marchiright").style.height= mh+"px" ;
		
	}

	if (allmarchi_id && marchi_upper) {
		if (allmarchi_id.length > 0) {
			marchi_lower = 0 ;
			
			if ( mh > 0 ) {
				var nr_marchi_visibili = Math.floor ( mh / 120 ) ;

				if (nr_marchi_visibili <= marchi_upper) {
					for (var k = nr_marchi_visibili ; k < marchi_upper ; k++) {
					
						document.images["latmarcimg_"+k].src = "newdyn.php?t=1" ;
					
					}
					marchi_upper = nr_marchi_visibili ;
				}
			}
			
			
			trm = window.setInterval("scrollMarchi()",4000) ;
		} 
	}
}

function scrollMarchi() {

	marchi_lower = (1 + marchi_lower < allmarchi_id.length) ? 1 + marchi_lower : 0 ;
	
	for (j=0; j < marchi_upper ; j++) {
	
		if (document.all && document.images["latmarcimg_"+j].filters.blendTrans) {
	
			document.images["latmarcimg_"+j].filters.blendTrans.apply();
			document.images["latmarcimg_"+j].filters.blendTrans.play();
		
		}
		
		var u = (j+marchi_lower < allmarchi_id.length) ? j+marchi_lower : j + marchi_lower - allmarchi_id.length
		document.images["latmarcimg_"+j].src = "newdyn.php?id="+allmarchi_id[u]+"&pat=marchi&t=1" ;
		document.images["latmarcimg_"+j].alt = allmarchi_txt[u] ;
		document.getElementById("latmarc_"+j).href = "aziendadet.php?idmarchio="+allmarchi_id[u]+"&marchio="+escape(allmarchi_txt[u]) ;
	}

}

function openMarchio(idmarchio, idgruppo, idtipo) {

	if (typeof idmarchio == "undefined") void(0) ;
	else {
		if (typeof idgruppo == "undefined") idgruppo = 0 ;
		if (typeof idtipo == "undefined") idtipo = 0 ;
		var url = "aziendanew.php?idmarchio="+idmarchio+"&idgruppo="+idgruppo+"&idtipo="+idtipo ;
		wref = window.open(url, "marchio_"+idmarchio, "width=800,height=600,resizable=0,scrollbars=1") ;
		wref.focus() ;
	}
}