
function calcolaspazioalto(){
var iHeight = window.screen.height;
var spazioalto=46;
	if(iHeight<900){
	spazioalto=16;
	document.write("<style type='text/css'>@import 'bg2.css';</style>");
	}
	else
	{
	document.write("<style type='text/css'>@import 'bg3.css';</style>");
	}
document.getElementById("spazioaltoimg").style.height=spazioalto+"px";
}



function changeBgImage (image, id) {
document.getElementById("bottone").src="img/bottone1.png";
}
function changeBgImage2 (image, id) {
document.getElementById("bottone").src="img/bottone3.png";
}

function changebb (image, id) {
document.getElementById("bb").src="img/bb-white2.jpg";
}
function changebb2 (image, id) {
document.getElementById("bb").src="img/bb-grey2.jpg";
}

function changetn (image, id) {
document.getElementById("tn").src="img/tn-yellow.gif";
}
function changetn2 (image, id) {
document.getElementById("tn").src="img/tn-white.gif";
}
		

function changeBgImageIntro1 (image, id) {
document.getElementById("bottoneintro1").src="intro/bgh2-over.jpg";
}
function changeBgImageIntro2 (image, id) {
document.getElementById("bottoneintro1").src="intro/bgh2.jpg";
}
function changeBgImageIntro3 (image, id) {
document.getElementById("bottoneintro2").src="intro/bgh3-over.jpg";
}
function changeBgImageIntro4 (image, id) {
document.getElementById("bottoneintro2").src="intro/bgh3.jpg";
}




function changeDivImage(whatc){

        var imgPath1 = new String();
		var imgPath2 = new String();
		var imgPath3 = new String();
		var imgPath4 = new String();
		var imgPath5 = new String();
		var imgPath6 = new String();
		var imgPath7 = new String();
		var imgPath8 = new String();
		var imgPath9 = new String();
		var imgPath10 = new String();
		var imgPath11 = new String();
		var imgPath12 = new String();
		var imgPath13 = new String();
		var imgPath14 = new String();
        imgPath1 = document.getElementById("c1").style.backgroundImage;
		imgPath2 = document.getElementById("c2").style.backgroundImage;
		imgPath3 = document.getElementById("c3").style.backgroundImage;
		imgPath4 = document.getElementById("c4").style.backgroundImage;
		imgPath5 = document.getElementById("c5").style.backgroundImage;
		imgPath6 = document.getElementById("c6").style.backgroundImage;
		imgPath7 = document.getElementById("c7").style.backgroundImage;
		imgPath8 = document.getElementById("c8").style.backgroundImage;
		imgPath9 = document.getElementById("c9").style.backgroundImage;
		imgPath10 = document.getElementById("c10").style.backgroundImage;
		imgPath11 = document.getElementById("c11").style.backgroundImage;
		imgPath12 = document.getElementById("c12").style.backgroundImage;
		imgPath13 = document.getElementById("c13").style.backgroundImage;
		imgPath14 = document.getElementById("c14").style.backgroundImage;
		
    if (whatc=='1'){
        if(imgPath1 == "url(img/bg_arrow.gif)" || imgPath1 == "url(\"img/bg_arrow.gif\")" || imgPath1 == "")
        {
		document.getElementById("c1").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==1){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='2'){
		if(imgPath2 == "url(img/bg_arrow.gif)" || imgPath2 == "url(\"img/bg_arrow.gif\")" || imgPath2 == "")
        {
		document.getElementById("c2").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==2){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='3'){
		if(imgPath3 == "url(img/bg_arrow.gif)" || imgPath3 == "url(\"img/bg_arrow.gif\")" || imgPath3 == "")
        {document.getElementById("c3").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==3){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
		
	 if (whatc=='4'){
		if(imgPath4 == "url(img/bg_arrow.gif)" || imgPath4 == "url(\"img/bg_arrow.gif\")" || imgPath4 == "")
        {
		document.getElementById("c4").style.backgroundImage = "url(img/bg_arrow2.gif)";
			for (i=1;i<15;i++){
				if (i==4){}
				else
				{	
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}

	if (whatc=='5'){
		if(imgPath5 == "url(img/bg_arrow.gif)" || imgPath5 == "url(\"img/bg_arrow.gif\")" || imgPath5 == "")
        {document.getElementById("c5").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==5){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='6'){
		if(imgPath6 == "url(img/bg_arrow.gif)" || imgPath6 == "url(\"img/bg_arrow.gif\")" || imgPath6 == "")
        {document.getElementById("c6").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==6){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='7'){
		if(imgPath7 == "url(img/bg_arrow.gif)" || imgPath7 == "url(\"img/bg_arrow.gif\")" || imgPath7 == "")
        {document.getElementById("c7").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==7){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='8'){
		if(imgPath8 == "url(img/bg_arrow.gif)" || imgPath8 == "url(\"img/bg_arrow.gif\")" || imgPath8 == "")
        {document.getElementById("c8").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==8){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='9'){
		if(imgPath9 == "url(img/bg_arrow.gif)" || imgPath9 == "url(\"img/bg_arrow.gif\")" || imgPath9 == "")
        {document.getElementById("c9").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==9){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='10'){
		if(imgPath10 == "url(img/bg_arrow.gif)" || imgPath10 == "url(\"img/bg_arrow.gif\")" || imgPath10 == "")
        {document.getElementById("c10").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==10){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='11'){
		if(imgPath11 == "url(img/bg_arrow.gif)" || imgPath11 == "url(\"img/bg_arrow.gif\")" || imgPath11 == "")
        {document.getElementById("c11").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==11){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='12'){
		if(imgPath12 == "url(img/bg_arrow.gif)" || imgPath12 == "url(\"img/bg_arrow.gif\")" || imgPath12 == "")
        {document.getElementById("c12").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==12){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='13'){
		if(imgPath13 == "url(img/bg_arrow.gif)" || imgPath11 == "url(\"img/bg_arrow.gif\")" || imgPath13 == "")
        {document.getElementById("c13").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==13){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='14'){
		if(imgPath14 == "url(img/bg_arrow.gif)" || imgPath11 == "url(\"img/bg_arrow.gif\")" || imgPath14 == "")
        {document.getElementById("c14").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<15;i++){
				if (i==14){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	
}













function changeDivImage_sr(whatc){

        var imgPath1 = new String();
		var imgPath2 = new String();
		var imgPath3 = new String();
        imgPath1 = document.getElementById("c1").style.backgroundImage;
		imgPath2 = document.getElementById("c2").style.backgroundImage;
		imgPath3 = document.getElementById("c3").style.backgroundImage;
		
    if (whatc=='1'){
        if(imgPath1 == "url(img/bg_arrow.gif)" || imgPath1 == "url(\"img/bg_arrow.gif\")" || imgPath1 == "")
        {
		document.getElementById("c1").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<14;i++){
				if (i==1){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='2'){
		if(imgPath2 == "url(img/bg_arrow.gif)" || imgPath2 == "url(\"img/bg_arrow.gif\")" || imgPath2 == "")
        {
		document.getElementById("c2").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<14;i++){
				if (i==2){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}
	
	if (whatc=='3'){
		if(imgPath3 == "url(img/bg_arrow.gif)" || imgPath3 == "url(\"img/bg_arrow.gif\")" || imgPath3 == "")
        {document.getElementById("c3").style.backgroundImage = "url(img/bg_arrow2.gif)";
		for (i=1;i<14;i++){
				if (i==3){}
				else
				{
					document.getElementById("c"+i).style.backgroundImage = "url(img/bg_arrow.gif)";
				}
			}
		}
	}

	
	
}









// allert cancella
function elimina(){
	return confirm("Sei certo di voler eliminare questo elemento?");
}


//correggi PNG
function correggiPNG() 
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

//aggiungi ai preferiti
function aggiungiPreferiti(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}


//rollover per stelle voto
function rolloverVoto() {
	if (!document.getElementById) return
	var imgOriginSrc;
	var imgTemp = new Array();
	var imgarr = document.getElementsByTagName('img');
	for (var i = 0; i < imgarr.length; i++) {
	if (imgarr[i].getAttribute('hsrc')) {
	imgTemp[i] = new Image();
	imgTemp[i].src = imgarr[i].getAttribute('hsrc');
	imgarr[i].onmouseover = function() {
	imgOriginSrc = this.getAttribute('src');
	this.setAttribute('src',this.getAttribute('hsrc'))
	}
	imgarr[i].onmouseout = function() {
	this.setAttribute('src',imgOriginSrc)
	}
	}
	}
}

// ridimensiona immagini
function resize_img(contenitoreIMG, immagine, w_max, h_max) {
	img=document.getElementById(immagine)
	contenitoreIMG=document.getElementById(contenitoreIMG)
	var img1 = new Image;
	img1.src = img.src;

if (img1.width > w_max || img1.height > h_max) {
		var scale_w = w_max / parseInt(img1.width);
		var scale_h = h_max / parseInt(img1.height);
		var h = img1.height * scale_w;
		if (h > h_max) {
			img.width = img1.width * scale_h;
			img.height = (img1.height > h_max) ? h_max : img1.height;
		}
		else {
			img.width = (img1.width > w_max) ? w_max : img1.width;
			img.height = h;
		}
	}
	img.style.display = "inline";
	img.style.visibility = "visible";
	contenitoreIMG.style.background = "none";
}




function Aggiorna()
{
var nome;
nome = document.forms.cerca.categoria_nome.options[document.forms.cerca.categoria_nome.options.selectedIndex].value;
//alert(nome);
location=nome;
}


function Aggiorna1()
{
var sc;
var nome;
nome=document.forms.cerca.categoria_nome.options[document.forms.cerca.categoria_nome.options.selectedIndex].value;
sc = document.forms.cerca.sc.options[document.forms.cerca.sc.options.selectedIndex].value;
var idc = document.forms.cerca.id_categoria.value;
location=nome+"&sc="+sc+"&id_categoria="+idc;
}


function Aggiorna2()
{
var sc;
var sc2="0";
var sc22="0";
var sc3="0";
var sc4="0";
var nome;
nome=document.forms.cerca.categoria_nome.options[document.forms.cerca.categoria_nome.options.selectedIndex].value;
sc = document.forms.cerca.sc.options[document.forms.cerca.sc.options.selectedIndex].value;
var idc = document.forms.cerca.id_categoria.value;
location=nome+"&sc="+sc+"&id_categoria="+idc;
}


function Aggiorna3()
{
var sc;
var sc2;
var sc22;
var sc3="0";
var sc4="0";
var nome;
nome=document.forms.cerca.categoria_nome.options[document.forms.cerca.categoria_nome.options.selectedIndex].value;
sc = document.forms.cerca.sc.options[document.forms.cerca.sc.options.selectedIndex].value;
sc2 = document.forms.cerca.sc2.options[document.forms.cerca.sc2.options.selectedIndex].value;
if (document.forms.cerca.sc22){
sc22 = document.forms.cerca.sc22.options[document.forms.cerca.sc22.options.selectedIndex].value;
}
var idc = document.forms.cerca.id_categoria.value;
document.forms.cerca.submit();
//location=nome+"&sc="+sc+"&sc2="+sc2+"&id_categoria="+idc;
}





function Aggiorna4()
{
var sc;
var sc2;
var sc22;
var sc3;
var nome;
nome=document.forms.cerca.categoria_nome.options[document.forms.cerca.categoria_nome.options.selectedIndex].value;
sc = document.forms.cerca.sc.options[document.forms.cerca.sc.options.selectedIndex].value;
sc2 = document.forms.cerca.sc2.options[document.forms.cerca.sc2.options.selectedIndex].value;
if (document.forms.cerca.sc22){
sc22 = document.forms.cerca.sc22.options[document.forms.cerca.sc22.options.selectedIndex].value;
}
sc3 = document.forms.cerca.sc3.options[document.forms.cerca.sc3.options.selectedIndex].value;
var idc = document.forms.cerca.id_categoria.value;
document.forms.cerca.submit();
//location=nome+"&sc="+sc+"&sc2="+sc2+"&sc3="+sc3+"&id_categoria="+idc;
}


function Aggiorna5()
{
var sc;
var sc2;
var sc22;
var sc3;
var sc4;
var nome;
nome=document.forms.cerca.categoria_nome.options[document.forms.cerca.categoria_nome.options.selectedIndex].value;
sc = document.forms.cerca.sc.options[document.forms.cerca.sc.options.selectedIndex].value;
sc2 = document.forms.cerca.sc2.options[document.forms.cerca.sc2.options.selectedIndex].value;
if (document.forms.cerca.sc22){
sc22 = document.forms.cerca.sc22.options[document.forms.cerca.sc22.options.selectedIndex].value;
}
sc3 = document.forms.cerca.sc3.options[document.forms.cerca.sc3.options.selectedIndex].value;
sc4 = document.forms.cerca.sc4.options[document.forms.cerca.sc4.options.selectedIndex].value;
var idc = document.forms.cerca.id_categoria.value;
document.forms.cerca.submit();
//location=nome+"&sc="+sc+"&sc2="+sc2+"&sc3="+sc3+"&id_categoria="+idc;
}

