conta1 = ""
conta2 = ""
conta3 = ""
conta4 = ""
conta5 = ""
conta6 = ""
conta7 = ""
mappa = 0
myFPosition = 0

function showSolution(quale) {
    myImg = document.getElementById("myPixelHeight")
    switch (quale) {
        case 1:
            myImg.style.height = "60"
            break;
        case 2:
            myImg.style.height = "90"
            break;
        case 3:
            myImg.style.height = "124"
            break;
    }
    myImg.style.display = "block"
    myImg.style.borderBottom = "1px solid #EEE"
    document.getElementById("solRightCol").style.borderLeft = "1px solid #EEE"
    document.getElementById("lyrSol"+quale).style.display = "block"
    document.getElementById("rett" + quale).style.display = "block"
}

function hideSolution(quale) {
    myImg = document.getElementById("myPixelHeight")
    myImg.style.display = "none"
    myImg.style.borderborderBottom = "none"
    document.getElementById("solRightCol").style.borderLeft = "none"
    document.getElementById("lyrSol" + quale).style.display = "none"
    document.getElementById("rett"+quale).style.display="none"
}

function CKLogin(pathFile) {
    openTickbox("inputData.asp?pathFile=" + pathFile, "700", "400", 0)
}

function closeFromPopup() {
    closeTickBox();
    parent.clearTimeout(parent.myFPosition)
}

function showFCKEditor(id, idLingua, myData, showData) {
    MF = document.postFCKText
    MF.myData.value = myData
    MF.showData.value = showData

    myTextLyr = document.getElementById("myDetText")
    myWholeText = myTextLyr.innerHTML
    myIndex = myWholeText.indexOf("<!--START-->")
    myIndex += "<!--START-->".length

    myDateToHide = myWholeText.substring(0, myIndex)
    MF.strData.value = myDateToHide

    myTextLyr.style.display = "none"
    MF.style.display = "block"
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	caricato=true
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function colorabordo(quale){
	if(quale.style.border=="#000 1px solid"){
		quale.style.border="#AAA 1px solid"
	}else{
		quale.style.border="#000 1px solid"
	}
}


function controlla_1step(questo){
	var mio = document.getElementById("lyr_form")
	if(questo.checked){
		if(letto == false){
			alert(eval("step1_"+document.req.lingua))
		}
		mio.style.display="block"
		if(questo.dove=="popup"){
			parent.window.resizeTo(536,495)
		}
		if(questo.dove=="stampa"){
			parent.window.resizeTo(480,500)
		}
		parent.topzero.location="../carica.asp?caricaora=1"
	}else{
		mio.style.display="none"
		if(questo.dove=="popup"){
			parent.window.resizeTo(520,232)
		}
		if(questo.dove=="stampa"){
			parent.window.resizeTo(480,368)
		}
	}
}


function controlla_2step(questo){
	if(questo.value=="si"){
		if(letto2 == false){
			//alert("Prima di procedere con la compilazione del modulo, vi consigliamo di leggere\nla nota informativa sul trattamento e l'invio dei dati personali")
			alert(eval("step2_"+document.req.lingua))
		}
		parent.topzero.location="../carica.asp?caricaora=3"
	}
}

function copiamail(questo){
	document.req.mlist.value=questo.value
}

function clearMenu(myMenuItem, myMenuItem2){
	var subMenuItems = parent.myFrame.document.getElementsByName(''+ myMenuItem +'');
	var subMenuItems2 = parent.myFrame.document.getElementsByName(''+ myMenuItem2 +'');
	for (i = 0; i < subMenuItems.length; i++) {
        subMenuItems[i].style.fontWeight='normal';
    }
	for (j = 0; j < subMenuItems2.length; j++) {
        subMenuItems2[j].style.fontWeight='normal';
    }
}

function checkLeftMenu(menuId, myMenuItem) {
    var subMenuItems = document.getElementsByName(''+ myMenuItem +'');
    for (i = 0; i < subMenuItems.length; i++) {
        subMenuItems[i].style.fontWeight='normal';
    }
    subMenuItems[menuId].style.fontWeight='bold';
}

function checkLeftMenu2(menuId, myMenuItem){
	var menuLast = document.req.lastChecked.value;
	if (menuLast != null && menuLast != '')
	{
		var oldVar = document.getElementsByName(''+ menuLast +'')
		for (i = 0; i<oldVar.length;i++){
			oldVar[i].style.fontWeight='normal'
		}
	}
	//alert (menuLast)
	var newVar = document.getElementsByName(''+ myMenuItem +'')

	for (i = 0; i<newVar.length;i++){
		newVar[i].style.fontWeight='normal'
	}
	newVar[menuId].style.fontWeight='bold'
	
	if (document.req.lastChecked.value != null
		&& document.req.lastChecked.value != '')
		{
		document.req.lastChecked.value = myMenuItem;
		}
		
}

function checkTopMenu(menuId, myMenuItem){
	var newVar = document.getElementsByName(''+ myMenuItem +'')
	for (i = 0; i<newVar.length;i++){
		newVar[i].className='top_menu' 
	}
	newVar[menuId].className='top_menu_on'
}

function checkBottomMenu(menuId, myMenuItem){
	var newVar = document.getElementsByName(''+ myMenuItem +'')
	for (i = 0; i<newVar.length;i++){
		newVar[i].className='bottom_menu' 
	}
	newVar[menuId].className='bottom_menu_on'
}

function resizeFrame(myFrame, myDiv){
	//alert (myFrame)
	//alert (myDiv)
	var myObj = parent.document.getElementById(''+ myFrame +'')
	//alert (myObj)
	if(myObj){
	   myObj.style.height = document.getElementById(''+ myDiv +'').offsetHeight
	}
	//alert (myObj.style.height)
}

function setLanguage(quale){
	myForm = document.formLanguage
	if(myForm){
		myField = myForm.langWebSite
		if(myField){
			myField.value = quale
			myForm.submit()
		}
	}
}

function checkSearch(messaggio){
	myForm = document.searchForm
	if(myForm){
		myField = myForm.searchField
		if(myField){
			quale = myField.value
			if(quale.length < 3){
				alert(messaggio)
				myField.focus()
				return false;
			}
			myForm.submit()
		}
	}
}

function impostaLogoDefault(questo){
	questo.src = "../staff/images/logo.gif"
}

function SH_Coming(myStatusComing,myTopComing){
	var myLyrComing = document.getElementById("lyrComing")
	if(myLyrComing){
		if(myTopComing!=""){
			myLyrComing.style.top = myTopComing
		}else{
			myLyrComing.style.top = "50%"
		}
		myLyrComing.style.display=myStatusComing
	}
}

function cambiapagina(operation,messerrore){
	var myForm = eval("document.formPaging")
	switch(operation){
		case "back":
			myForm.numPage.value--
		break    
		case "next":
			myForm.numPage.value++
		break
		case "ricerca":
			if(myForm.page_field.value==0 || isNaN(myForm.page_field.value)){
				alert(messerrore)
				myForm.page_field.focus()
				return false;
			}
			myForm.numPage.value = myForm.page_field.value
		break
		default:
			if(operation!=""){
				myForm.numPage.value = operation
			}else{
				return false;
			}
	}
	myForm.submit()
}

function cambiapaginaCatalogue(operation,messerrore){
	var myFormPaging = eval("document.formPaging")
	var myForm = eval("document.searchProducts")
	switch(operation){
		case "back":
			myForm.numPage.value--
		break    
		case "next":
			myForm.numPage.value++
		break
		case "ricerca":
			if(myFormPaging.page_field.value==0 || isNaN(myFormPaging.page_field.value)){
				alert(messerrore)
				myFormPaging.page_field.focus()
				return false;
			}
			myForm.numPage.value = myFormPaging.page_field.value
		break
		default:
			if(operation!=""){
				myForm.numPage.value = operation
			}else{
				return false;
			}
	}
	myForm.submit()
}

var myScrollPageTimeout
var going = 0
function scrollaPaging(come){
	if(going == 1){
		var myObj = document.getElementById("scrollPaging")
		if(come=="next"){
			var myObjInsideWidth = document.getElementById("scrollPagingIn").offsetWidth-3
			if(myObj.scrollLeft < myObjInsideWidth){
				myObj.scrollLeft = myObj.scrollLeft + 3
				myScrollPageTimeout = setTimeout("scrollaPaging('"+come+"')",1)
			}else{
				myObj.scrollLeft = myObjInsideWidth -3
				clearTimeout(myScrollPageTimeout)
			}
		}else{
			if(myObj.scrollLeft > 3){
				myObj.scrollLeft = myObj.scrollLeft - 3
				myScrollPageTimeout = setTimeout("scrollaPaging('"+come+"')",1)
			}else{
				myObj.scrollLeft = 0
				clearTimeout(myScrollPageTimeout)
			}
		}
	}
}

function SHAltSim(quale){
	myObjAlt = document.getElementById("lyrPhoto_"+quale)
	if(myObjAlt){
		if(myObjAlt.style.display=="" || myObjAlt.style.display=="none"){
			myObjAlt.style.display="block"
		}else{
			myObjAlt.style.display="none"
		}
	}
}

function stopScrollaPaging(){
	clearTimeout(myScrollPageTimeout)
	going = 0
}

function caricaDefault(questo){
	questo.src="../images/1pixel.gif"
	questo.style.background = "url(../images/imgdefault.jpg)"
	questo.style.backgroundPosition = "center center"
	questo.style.backgroundRepeat = "no-repeat"
}

function zoomImmagini(pagina,titolo,varLink_2,varTipoOggetto_2,varTipoLink_2,varImg_2,varTesto_2,myActualId){
	myObjVar = eval(myActualId)
	myVar = ""
	if(myObjVar) myVar = myObjVar
	window.open(pagina+'?titolo='+titolo+'&varLink_2='+varLink_2+'&varTipoOggetto_2='+varTipoOggetto_2+'&varTipoLink_2='+varTipoLink_2+'&varImg_2='+varImg_2+'&varTesto_2='+varTesto_2+'&myActualId='+myVar,'zoom','scrollbars=yes,resizable=yes,width=800,height=600')
}

function ricercaNews(testoTitAlmeno,testoTitVuoto,testoSelAzienda,testoSelTipo){
	var myForm = document.searchNews
	if(myForm.newssearchField.value.length < 3){
		alert(testoTitAlmeno)
		myForm.newssearchField.focus()
		return false;
	}
	if(myForm.newssearchField.value == ""){
		alert(testoTitVuoto)
		myForm.newssearchField.focus()
		return false;
	}
	if(myForm.newssearchAzienda.selectedIndex==0){
		alert(testoSelAzienda)
		myForm.newssearchAzienda.focus()
		return false;
	}
	if(myForm.newssearchTipologia.selectedIndex==0){
		alert(testoSelTipo)
		myForm.newssearchTipologia.focus()
		return false;
	}
	myForm.nomeAziendaSearchNews.value = myForm.newssearchAzienda.options[myForm.newssearchAzienda.selectedIndex].text
	myForm.submit()
}

function cambiaPaginaDaLink(myStrTipoLink,myStrLink){
	myPrevAddress = ""+document.location
	myPrevAddress = myPrevAddress.replace("http://","")
	var myArrString = myPrevAddress.split("/")
	myAddress = ""
	for(i=0;i<myArrString.length-1;i++){
		myAddress = myAddress + myArrString[i] + "/"
	}
	if(myStrTipoLink==0){
		document.location = "http://"+myAddress+myStrLink
	}else{
		window.open(myStrLink,'','')
	}
}

function accendimenu(quale){
	var myObj = document.getElementsByName("top_menu")[quale]
	if(myObj) myObj.className = myObj.className+"_on"
}

function accendimenusotto(quale){
	var myObj = document.getElementsByName("bottom_menu")[quale]
	if(myObj) myObj.className = myObj.className+"_on"
}

function searchJob(myError){
	if(document.jobSearch.categoria.selectedIndex==0 && document.jobSearch.azienda.selectedIndex==0){
		alert(myError)
		document.jobSearch.categoria.focus()
		return false;
	}
	document.jobSearch.submit()
}

function cambiaNRP(questo,fieldToUpdate,secondField){
	var myValue = questo.options[questo.selectedIndex].value
	if(myValue!=""){
		document.getElementsByName("caricaNRP")[0].src="/caricaNRP.asp?id="+myValue+"&fieldToUpdate="+fieldToUpdate
	}else{
		var myObj = eval("document.req."+fieldToUpdate)
		for (i=myObj.options.length;i>=1;i--){
			myObj.options[i]=null
		}
		if(secondField!=""){
			var myObj = eval("document.req."+secondField)
			for (i=myObj.options.length;i>=1;i--){
				myObj.options[i]=null
			}
		}
	}
}

function mostraaltroconosciuti(questo){
	var myValue = questo.options[questo.selectedIndex].value
	myStatus = "none"
	if(myValue=="0"){
		myStatus = "block"
	}
	document.getElementById("lyraltroconosciuti").style.display=myStatus
	document.req.altroconosciuti.value=""
}

function controllaSettore(questo){
	var myValue = questo.options[questo.selectedIndex].value
	var myBackground = "#EEE"
	var myDisabled = true
	if(myValue==0){
		myBackground = "#FFF"
		myDisabled = false
	}
	document.req.sector_specify.style.background = myBackground
	document.req.sector_specify.disabled = myDisabled
	if(!document.req.sector_specify.disabled) document.req.sector_specify.focus()
}

function goToProd(quale){
	document.searchProducts.action = "catalogue_visua.asp"
	document.searchProducts.method = "get"
	document.searchProducts.id.value = quale
	document.searchProducts.submit()
}

function goBack(){
	if(document.searchProducts.length > 1){
		document.searchProducts[1].submit()
	}else{
		document.searchProducts.submit()
	}
}

function addToYourCat(whichOne,operazione,message){
	proceed = "ok"
	opType = ""
	if(whichOne!=""){
		myFrame = document.getElementById("frameMyCatalogue")
		if(myFrame){
			if(!document.cookie){
				alert(message)
			}else{
				if(operazione=="togli"){
					if(window.confirm(message)){
						opType="&opType=togli"
					}else{
						proceed = "no"
					}
				}
				if(proceed == "ok") myFrame.src = "addToMyCatalogue.asp?id="+whichOne+opType
			}
		}
	}
}

function addToCompare(whichOne,whichCols,operazione,message){
	proceed = "ok"
	opType = ""
	if(whichOne!=""){
		myFrame = document.getElementById("frameMyCatalogue")
		if(myFrame){
			if(!document.cookie){
				alert(message)
			}else{
				if(operazione=="togli"){
					if(window.confirm(message)){
						opType="&opType=togli"
						document.getElementById("contentTable").rows[0].deleteCell(whichCols)
						
					}else{
						proceed = "no"
					}
				}
				if(proceed == "ok") myFrame.src = "addToCompare.asp?id="+whichOne+opType
			}
		}
	}
}

function openCompare(){
	try {
		window.open("compare.asp","compare","scrollbars=yes,resizable=yes,top=10,left=10,width="+(screen.width-30)+",height="+(screen.height-100)) // IE only
	}catch(ex){
		window.open("compare.asp","compare","scrollbars=yes,resizable=yes,top=10,left=10,width=800,height=500") // standards compliant; doesn't work in IE
	}
}

function selArts(whichOne,myStatus){
	document.getElementById("lyrCompare_"+whichOne).style.display=myStatus
	document.getElementById("myFrameCompare_"+whichOne).src = "compareArticles.asp?id="+whichOne
}

function confirmArticles(whichOne,operazione,message){
	builtAssociation = ""
	myObjForm = document.req.addArticle
	for(i=0;i<myObjForm.length;i++){
		if(myObjForm[i].checked){
			builtAssociation = builtAssociation + whichOne + "[code]" + myObjForm[i].value + ","
		}
	}
	if(builtAssociation!="") builtAssociation = builtAssociation.substring(0,(builtAssociation.length-1))
	myFrame = parent.document.getElementById("frameMyCatalogue")
	if(myFrame) myFrame.src = "addToCompare.asp?id="+builtAssociation
	myDivOut = parent.document.getElementById("lyrCompare_"+whichOne)
	if(myDivOut) myDivOut.style.display="none"
}

function SH_BenefitsCategory(whichCat){
	var myObj = document.getElementById("lyrCatBenefits_"+whichCat)
	if(myObj.style.display=="" || myObj.style.display=="none"){
		myObj.style.display="block"
	}else{
		myObj.style.display="none"
	}
}

function checkGlobalSearch(messaggio){
	myForm = document.searchForm
	if(myForm.searchField.value=="" || myForm.searchField.value.length<3){
		alert(messaggio)
		myForm.searchField.focus()
		return false;
	}
	myForm.submit()
}

function modTxtFromViewMode(quale,myLingua){
	parent.topFrame.location="../gestViewMode.asp?idTipoTesto="+quale+"&idLingua="+myLingua
	return false;
}

myIdGalleryT = 0
function loadGallery(tickPage){

		var fo = new SWFObject("/viewer.swf", "viewer", "100%", "100%", "8", "#000000");

		// SIMPLEVIEWER CONFIGURATION OPTIONS
		// To use an option, uncomment it by removing the "//" at the start of the line
		// For a description of config options, go to: 
		// http://www.airtightinteractive.com/simpleviewer/options.html
		myIdGalleryT = tickPage
		fo.addVariable("xmlDataPath", "/gallery.asp?id="+tickPage);

		//fo.addVariable("firstImageIndex", "5");	
		//fo.addVariable("langOpenImage", "Open Image in New Window");
		//fo.addVariable("langAbout", "About");	
		//fo.addVariable("preloaderColor", "0xFFFFFF");
		
		fo.write("flashRassegna");	
}

function attLbl(myObj,status1,status2){
	myObjs= document.getElementsByName("linklbl")
	for(i=0;i<myObjs.length;i++){
		myObjs[i].className = "lbllinks"
	}
	myObj.className = "lbllinksOn"
	document.getElementById("flashRassegna").style.display = status1
	document.getElementById("Panoramiche").style.display = status2
	if(status2 == "block") fPanoramiche.location = "panoramiche.asp?id="+myIdGalleryT
}

function restartGallery(){
	attLbl(document.getElementsByName('linklbl')[0],'block','none')
}


function setSubMenuHeight(thisOne) {
    myObj = document.getElementById('lyrMenu_' + thisOne)
    if(myObj) document.getElementById('lyrMenu_' + thisOne + '_1').style.height = document.getElementById('lyrMenu_' + thisOne + '_2').offsetHeight + 'px'
}

function openRss(myObj) {
    myObjs = document.getElementsByName("rssLinks")
    for (i = 0; i < myObjs.length; i++) {
        mId = myObjs[i].id.replace("myRSSLink_", "")
        myObjs[i].className = "rssLinks linkAll"
        myTempObj = document.getElementById("myRss_" + mId)
        if (myTempObj) myTempObj.style.display = "none"
        myTempObj = document.getElementById("outerFrame_" + mId)
        if (myTempObj) myTempObj.style.display = "block"
    }
    myObj.className = "rssLinksOn linkAll"
    mId = myObj.id.replace("myRSSLink_", "")
    myTempObj = document.getElementById("myRss_" + mId)
    if (myTempObj) {
        myTempObj.style.display = "block"
        myFrame = eval("iFrameRss_" + mId)
        myFrame.location = "/loadRSSWidget.asp?id=" + mId
    }
}

function openGallery(quale) {
    self.parent.tb_show(("Galleria immagini" || "galleria" || null), "/gallery/index.asp?page=" + quale + "&idContent=" + gPageId + "&KeepThis=true&TB_iframe=true&height=600&width=1010", ("" || false), window);
}

function openExt(myUrl,myTitle) {
    var p = parent;
    p.$("#TB_window").remove();
    p.$("body").append("<div id='TB_window'></div>");
    p.tb_show((myTitle || "Extranet" || null), myUrl, ("" || false), window); return false;
}

function showHideRightMenu() {
    myBar = document.getElementById("RightBar")
    myBarImg = myBar.getElementsByTagName("IMG")[0]
    myRightMenu = document.getElementById("RightMenu")

    if (myBarImg.src.indexOf("Right") > -1) {
        myTitle = "Mostra Menu"
        imgSrc = "frLeft.png"
        divRight = -129
    } else {
        myTitle = "Nascondi Menu"
        imgSrc = "frRight.png"
        divRight = 0
    }

    myBarImg.src = "/images/" + imgSrc
    myBar.title = myTitle

    $('#RightMenu').animate({ right: divRight }, { duration: 500 });
}

function hideMyTB() {
    myValoriColfert = document.getElementById("ValoriColfert")
    myBlackCover = document.getElementById("BlackCover")
    myColfertWindow = document.getElementById("ColfertWindow")
    myColfertDiritti = document.getElementById("LyrDiritti")
    myColfertEspositori = document.getElementById("LyrEspositori")
    myColfertExpoGallery = document.getElementById("LyrGallery")

    myValoriColfert.style.display = "none"
    myBlackCover.style.display = "none"
    myColfertWindow.style.display = "none"
    myColfertDiritti.style.display = "none"
    myColfertEspositori.style.display = "none"
    myColfertExpoGallery.style.display = "none"

    showHideFlash("block")
}

function moveLyr() {
    myColfertWindow = document.getElementById("ColfertWindow")
    if (myColfertWindow) {
        myColfertWindow.style.top = $(window).scrollTop() + "px"
    }
}

function showHideFlash(myDisplay) {
    myObjs = document.getElementsByTagName("object")
    for (i = 0; i < myObjs.length; i++) {
        myObjs[i].style.display = myDisplay
    }
}

function ShowExpoGallery(myLang, subName) {
    showHideFlash("none")
    myMainTable = document.getElementById("mainTable")
    if (myMainTable) {
        myColfertExpoGallery = document.getElementById("LyrGallery")
        myBlackCover = document.getElementById("BlackCover")
        myTitle = document.getElementById("galleryTitle")
        if (myTitle) myTitle.innerHTML = "" + subName

        myBlackCover.style.height = getDocHeight() + 'px'

        $('#BlackCover').animate({ opacity: 0.7 }, { duration: 1 });

        myBlackCover.style.display = "block"
        myColfertExpoGallery.style.display = "block"

        fGalleryColSx.location = "/LoadImages.asp?idLingua=" + myLang
        fGalleryColDx.location = "/LoadVideos.asp?idLingua=" + myLang
    }
}

function showTBWithoutFrameDiritti() {
    showHideFlash("none")
    myMainTable = document.getElementById("mainTable")
    if (myMainTable) {
        myColfertDiritti = document.getElementById("LyrDiritti")
        myBlackCover = document.getElementById("BlackCover")

        myBlackCover.style.height = getDocHeight() + 'px'

        $('#BlackCover').animate({ opacity: 0.7 }, { duration: 1 });

        myBlackCover.style.display = "block"
        myColfertDiritti.style.display = "block"

        $("#testoDiritti").autoscroll(AUTOSCROLL_Y);
    }
}

function openEspositori() {
    showHideFlash("none")
    myMainTable = document.getElementById("mainTable")
    if (myMainTable) {
        myColfertEspositori = document.getElementById("LyrEspositori")
        myBlackCover = document.getElementById("BlackCover")

        myBlackCover.style.height = getDocHeight() + 'px'

        $('#BlackCover').animate({ opacity: 0.7 }, { duration: 1 });

        myWall = document.getElementById("wall")
        if (myWall) {
            //myWall.innerHTML = ""

            myBlackCover.style.display = "block"
            myColfertEspositori.style.display = "block"

        
            loadWall()
        }
    }
}

wallWidth = 0
wallHeight = 0
function loadWall() {
    myWall = document.getElementById("wall")
    var flashvars = {
        feed: "/Wall/CoolirisXML.asp",
        showTutorial: false,
        showChrome: true,
        tilt: 3,
        allowFullScreen: "false",
        //tutorial: "1000,/Wall/ClickAndDrag.png",
        showEmbed: false
    };
    var params = {
        allowFullScreen: "false",
        allowscriptaccess: "always",
        wmode: "transparent"
    };
    if (myWall.offsetWidth > 0) wallWidth = myWall.offsetWidth
    if (myWall.offsetHeight > 0) wallHeight = myWall.offsetHeight
    swfobject.embedSWF("/Wall/cooliris.swf", "wall", wallWidth, wallHeight, "9.0.0", "", flashvars, params);
}

function showTBWithoutFrameColfertWindow() {
    $(window).scroll(moveLyr)
    showHideFlash("none")
    myMainTable = document.getElementById("mainTable")
    if (myMainTable) {
        myColfertWindow = document.getElementById("ColfertWindow")
        myBlackCover = document.getElementById("BlackCover")

        myBlackCover.style.height = getDocHeight() + 'px'

        $('#BlackCover').animate({ opacity: 0.7 }, { duration: 1 });

        myBlackCover.style.display = "block"
        myColfertWindow.style.display = "block"
        document.getElementById("Valori0").style.display = "block"
        fColfertWindow.location = "/COLFERTwindowList.asp"
    }
}

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function showTBWithoutFrameValori() {
    showHideFlash("none")
    myMainTable = document.getElementById("mainTable")
    if (myMainTable) {
        myValoriColfert = document.getElementById("ValoriColfert")
        myBlackCover = document.getElementById("BlackCover")
        
        myBlackCover.style.height = getDocHeight() + 'px'

        $('#BlackCover').animate({ opacity: 0.7 }, { duration: 1 });
        $('#Valori0').animate({ opacity: 0, width: 1, height: 1 }, { duration: 1 });
        $('#Valori1').animate({ opacity: 0, width: 1, height: 1 }, { duration: 1 });
        $('#Valori2').animate({ opacity: 0, width: 1, height: 1 }, { duration: 1 });
        $('#Valori3').animate({ opacity: 0, width: 1, height: 1 }, { duration: 1 });
        $('#Valori4').animate({ opacity: 0, width: 1, height: 1 }, { duration: 1 });
        myBlackCover.style.display = "block"
        myValoriColfert.style.display = "block"
        document.getElementById("Valori0").style.display = "block"

        ShowValori(0)
    }
}

function ShowValori(quale) {
    if (quale < 5) {
        switch (quale) {
            case 0:
                mWidth = 266
                mHeight = 248
                break;
            case 1:
                mWidth = 207
                mHeight = 198
                break;
            case 2:
                mWidth = 213
                mHeight = 209
                break;
            case 3:
                mWidth = 205
                mHeight = 206
                break;
            case 4:
                mWidth = 197
                mHeight = 201
                break;
        }


        counter = quale
        counter++
        $('#Valori' + quale).animate(
                    {
                        opacity: 1,
                        width: mWidth,
                        height: mHeight
                    },
                    {
                        duration: 1500,
                        easing: "easeOutElastic",
                        complete: function () { ShowValori(counter) }
                    }
                );
    }
            }

            function showHideLeftMenu() {
                myBar = document.getElementById("LeftBar1")
                myBarImg = myBar.getElementsByTagName("IMG")[0]

                if (myBarImg.src.indexOf("Left") > -1) {
                    myTitle = "Nascondi Menu"
                    imgSrc = "frRight.png"
                    frameDisplay = "block"
                    divWidth = 180
                } else {
                    myTitle = "Mostra Menu"
                    imgSrc = "frLeft.png"
                    frameDisplay = "none"
                    divWidth = 0
                }

                myBarImg.src = "/images/" + imgSrc
                myBar.title = myTitle

                $('#LeftMenu1').animate(
        {
            width: divWidth
        },
        {
            duration: 200,
            complete: function () { ShowHideFrame("Sx", frameDisplay) }
        }
    );
}

function showHideRightMenu() {
    myBar = document.getElementById("RightBar1")
    myBarImg = myBar.getElementsByTagName("IMG")[0]

    if (myBarImg.src.indexOf("Right") > -1) {
        myTitle = "Nascondi Menu"
        imgSrc = "frLeft.png"
        frameDisplay = "block"
        divWidth = 180
    } else {
        myTitle = "Mostra Menu"
        imgSrc = "frRight.png"
        frameDisplay = "none"
        divWidth = 0
    }

    myBarImg.src = "/images/" + imgSrc
    myBar.title = myTitle

    $('#RightMenu1').animate(
        {
            width: divWidth
        },
        {
            duration: 200,
            complete: function () { ShowHideFrame("Dx", frameDisplay) }
        }
    );
}

function ShowHideFrame(quale, myDisplay) {
    myFrame = document.getElementById("fGalleryCol" + quale)
    if (myFrame) myFrame.style.display = frameDisplay
}
