function goToAnchor(v_strAnchorID){
	document.location.href = "#" + v_strAnchorID
}


function OpenCredits(){		
		window.open("/credits.htm","credits","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=140");
	}
	
function OpenContacts(){		
		window.open("/contacts.htm","contacts","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=260,height=209");
	}

function loadInOpener(v_strUrl){
	window.opener.location = v_strUrl;
	window.focus()
}



function openResources(v_strResourceType, v_strIdProduct, v_strPpc){
	window.open("tools/prodotti/productDwnlPopUp.aspx?type=" + v_strResourceType + "&idp=" + v_strIdProduct + "&ppc=" + v_strPpc,"DoqnloadPage","dependent=yes,Height=300,Width=450,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no");
}

function OpenZoomWindow(strImg,strText){
	window.open("tools/zoomWindow.aspx?img=" + strImg,"zoomWindow",'height=30,width=30,status=0,scrollbars=0')
}

function OpenGalleryZoomWindow(strText,v_strZoomImagesList,v_strCurrImgVarName){
	
	//indice dell'immagine corrente
	var intCurrImgIndex = eval(v_strCurrImgVarName);
	var pattern = /<!--slash-->/gi;
	var strZoomImagesList = "";
	var arrZoomImagesList = new Array();
	strZoomImagesList = v_strZoomImagesList.replace(pattern, "\\");
	arrZoomImagesList = strZoomImagesList.split(",");
	
	if (arrZoomImagesList[intCurrImgIndex-1]!="" && arrZoomImagesList[intCurrImgIndex-1]!=null)
		window.open("tools/zoomWindow.aspx?img=" + arrZoomImagesList[intCurrImgIndex-1],"zoomWindow",'height=30,width=30,status=0,scrollbars=0');
	
}

function BoxImagesChanger(v_strNumImage, v_strFgImagesList, v_strZoomImagesList, v_strCurrImgVarName, v_flStep, v_strImageID, v_strIDZoomButton){
	var strFgImagesList = "";
	var strZoomImagesList = "";
	var arrFgImagesList = new Array();
	var arrZoomImagesList = new Array();
	var pattern = /<!--slash-->/gi;
	var intCurrImgIndex = 0;
	var objImage; //immagine da cambiare
	var objZoomButton = getObject(v_strIDZoomButton); //pulsante zoom
	
	//indice dell'immagine corrente
	intCurrImgIndex = eval(v_strCurrImgVarName);
	
	//stringhe conl'elenco delle immagini
	strFgImagesList = v_strFgImagesList.replace(pattern, "\\");
	strZoomImagesList = v_strZoomImagesList.replace(pattern, "\\");
	
	//array conl'elenco delle immagini
	arrFgImagesList = strFgImagesList.split(",");
	arrZoomImagesList = strZoomImagesList.split(",");
		
	//incremento, decremento l'indice corrente
	if(v_flStep < 0 && intCurrImgIndex <= 1){
		intCurrImgIndex = v_strNumImage;
	}else if(v_flStep > 0 && intCurrImgIndex >= v_strNumImage){
		intCurrImgIndex = 1;
	}else{
		intCurrImgIndex += v_flStep;
	}
		
	//riferimenti agli oggetti client (image e td)
	objImage = getObject(v_strImageID);
		
	//cambio l'src all'immagine e il background alla cella
	objImage.src = arrFgImagesList[intCurrImgIndex-1];
	
	eval(v_strCurrImgVarName + "=" + intCurrImgIndex);
	
	//verifico se l'immagine ha lo zoom altrimenti nascondo il pulsante per aprirlo
	if (arrZoomImagesList[intCurrImgIndex-1]!="" && arrZoomImagesList[intCurrImgIndex-1]!=null)
		objZoomButton.style.visibility = "visible";
	else
		objZoomButton.style.visibility = "hidden";
		
}


function BoxImagesGoTo(v_strLinkList, v_strCurrImgVarName){
	var arrLinkList = new Array();
	var intCurrImgIndex = 0;
	
	//indice dell'immagine corrente
	intCurrImgIndex = eval(v_strCurrImgVarName) - 1;
	
	arrLinkList = v_strLinkList.split(",");
	
	//alert(v_strLinkList);
	if(arrLinkList[intCurrImgIndex] != null && arrLinkList[intCurrImgIndex] != ""){
		document.location.href = arrLinkList[intCurrImgIndex];
	}else{
		return(false);
	}
}

function BoxImagesNext(v_strNumImage, v_strFgImagesList){
	var arrFgImagesList = v_strFgImagesList.split(",")


	alert(v_strNumImage);
}



function getObject(v_strIdImage){
	var strBrowserName = "";
	var vObj;
	
	strBrowserName = whatbrowser();
	
	switch(strBrowserName){
		case "NN6":{
			vObj = document.getElementById(v_strIdImage);
			break;
		}
		case "NN4":{
			vObj = document.getElementById(v_strIdImage);
			break;
		}
		case "ie4":
		case "ie6":
		case "ieMac":{
			vObj = document.all(v_strIdImage);
			break;
		}
		default:{
			vObj = document.all(v_strIdImage);
		}
	}
	
	return(vObj);
}


//whatbrowser()
//
//determina con quale browser l'utente è collegato e restituisce la sigla corrispondente
//
//argomenti:
//	nessuno
//
//valore di ritorno:
//	stringa	=	sigla corrispondente al browser con cui l'utente è collegato
//				NN4	=	netscape4
//				NN6	=	netscape6
//				ie	=	internet explorer
function whatbrowser(){
	var thisbrowser = "";	//sigla del browser utilizzato dall'utente
	var strAppVersion = navigator.appVersion;

	var blnIsIe4 = (strAppVersion.indexOf("MSIE 4") == -1) ? 0 : 1;
	var blnIsIe5 = (strAppVersion.indexOf("MSIE 5") == -1) ? 0 : 1;
	var blnIsIe6 = (strAppVersion.indexOf("MSIE 6") == -1) ? 0 : 1;
	var blnIsMac = (strAppVersion.indexOf("Macintosh") == -1) ? 0 : 1;
	
	//interrogo l'oggetto document per capire quale broeser sta utilizzando l'utente
    if(document.layers){
        thisbrowser="NN4";
    }
    if(document.all){
         if(blnIsIe4 == 1 || blnIsIe5==1) thisbrowser="ie4";
         else if(blnIsIe6 == 1) thisbrowser="ie6";
         else if(blnIsMac == 1) thisbrowser="ieMac";
         else thisbrowser="ie";
         
         //alert(thisbrowser);
    }
    if(!document.all && document.getElementById){
         thisbrowser="NN6";
    }
    
    return(thisbrowser);
}

function printPage(){
	var strPage = "";
	var intStartIndex = 0;
	var intEndIndex = 0;
	
	strPage = document.location.href;
		
	intStartIndex = strPage.lastIndexOf("/") + 1;
	intEndIndex = strPage.indexOf("?", intStartIndex);
	
	strPage = strPage.substring(intStartIndex, intEndIndex);
	
	window.open("printSmatPage.aspx?page=" + strPage,"printPage","dependent=yes,Height=400,Width=440,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no");
}

function openPage(v_strPage, v_intWidth, v_intHeight){
	window.open(v_strPage,"popuppage","dependent=yes,Height=" + v_intHeight + ",Width=" + v_intWidth + ",location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=no");
}

function WriteSpace(v_intWidth){
	alert("v_intWidth: " + v_intWidth);
	
	var strSpace = "";
	
	strSpace = "<td width=\"" + v_intWidth + "\"><img src=\"img/shared/np.gif\" border=\"0\" width=\"" + v_intWidth + "\" height=\"1\"></td>";
	
	if(v_intWidth > 0){
		document.write(strSpace);
	}
}

//npwidthmax()
//
//calcola width della pagina, toglie larghezza menu sinistra e larghezza menu 
//destra return (la differenza)
function npwidthmax(){
	size = parseInt(window.innerWidth) - 161;
	return size;
}