/*function active (chi) {
	chi.id="scuroa";
	};
	
function unactive (chi) {
	chi.id="scuro";
	};
*/

function getGET() {
url=location.search ;
str=url.slice(1);
var strs=str.split("&");
var _GET = new Array();
for (i in strs)
	{ 
	vals=strs[i].split("=",2);
	ind=vals[0];
	_GET[ind]=vals[1];
	};
return _GET;
}
 _GET=getGET();
 
function openlink(nome,open) {
	try{ if (logged!=1) { logged=0 };	}
	catch(err){ logged=0; }

	if (nome.slice(0,4)=="http") {
		window.open(nome);
		}
	else if (nome.indexOf(".php")!=-1)
		{ window.open(nome,'_self'); }
	else { 
		var text="&open="+open;
		//if(open=="") {text=''; }
			if ((document.location.href.indexOf("scheda.php")!=-1)) {
				window.open('?scheda='+nome+text,'_self'); }
			else if (document.location.href.indexOf("/privata.php")!=-1 || logged==1)
				{window.open('privata_scheda.php?scheda='+nome+text,'_self');}
			else {
				window.open('scheda.php?scheda='+nome+text,'_self');}
			
	}

}


$(document).ready(function() {
$(".divmin").hide();
$("."+_GET['open']).show(500);
$(".open").next().show(500);
	
 $(".buttmain").click(function() {
 	$(this).next().toggle(500);

 	if (this.name!='') {
 		openlink(this.name,this.id);
 
		}
  	})//.next().hide();
  
	$(".buttmainsf").click(function() {
		openlink(this.name);

		})
	 $(".buttmin").click(function() {
	 		openlink(this.name,this.parentNode.id);

		})	
 
	$(".scurosf").click(function() {
		openlink(this.name);
	
	})
	
	
	
	
	
	
	$(".scurosf").mouseover(function () { 
	     this.className="scurosf scuroasf";
	});
    $(".scurosf").mouseout(function () { 
      this.className="scurosf"; 
    });
 
 	$(".buttmain").mouseover(function () { 
      this.className="buttmain buttmaina";
    });
    $(".buttmain").mouseout(function () { 
      this.className="buttmain"; 
    });
    
    $(".buttmainsf").mouseover(function () { 
    this.className="buttmain buttmainasf";
    });
    $(".buttmainsf").mouseout(function () { 
      this.className="buttmainsf"; 
    });

 	$(".buttmin").mouseover(function () { 
      this.className="buttmin buttmina";
    });
    $(".buttmin").mouseout(function () { 
      this.className="buttmin"; 
    });
    $(".buttmina").unbind('mouseout');
    
 
 });

 function apriFinestra(cod)
	{
	window.open('/privato/agg_pref.php?cod='+cod, 'agg_pref', 'width=380,height=50,status=1,resizable=1,scrollbars=1');
	}
function apriFinestrapromo(cod, tipo)
	{
	window.open('/privato/vedi_promo.php?cod='+cod+'&tipo='+tipo, 'promo', 'width=380,height=50,status=1,resizable=1,scrollbars=1');
	}
function apriFinestracarrello(cod)
	{
	window.open('/privato/agg_carr.php?cod='+cod, 'carrello', 'width=380,height=50,status=1,resizable=1,scrollbars=1');
	}		
