///////////////////////////////////////////////////////////
///	NUOVO FILE PER LA COMPATIBILITA' FIREFOX
///	BY CPANE@EMAIL.IT
///	WWW.ESSE.IT
///////////////////////////////////////////////////////////

var  Menu_Aperto='';


function  Sopra(IDScat){
	document.getElementById("M_"+IDScat).style.color="#000000";
}

function Fuori(IDScat){
	document.getElementById("M_"+IDScat).style.color="#990000";
}


function Chi_Menu(){
	document.getElementById("S_"+Menu_Aperto).style.display="None";
}

function Chiudi_Menu(){
	document.getElementById("S_"+Menu_Aperto).style.display="None";
	document.getElementById("C_"+Menu_Aperto).style.color ="Green";
}

function  Smenu(x){

	if (Menu_Aperto.length != 0 ){
		this.Chiudi_Menu();
	}	
	document.getElementById("S_"+x).style.filter='BlendTrans(duration=2)';
	//Controllo per IE Explore
	if(document.all){		
		document.getElementById("S_"+x).filters.BlendTrans.Apply();	
	}
	document.getElementById("S_"+x).style.display="";
	document.getElementById("C_"+x).style.color ="#990000";
	document.getElementById("S_"+x).filters.BlendTrans.play();
	Menu_Aperto=x;
}

function Apri(x){
	window.open ('Art.asp?Id_Scat='+x ,'_self');	
}

function Apri1(){
	parent.RicA() ;
 }
 
function CercaArt(){	
	try{
		var cerca = document.getElementById("Cerca_index").value;
		if ( cerca.length == 0 ) {			
			alert("Attenzione!!! Manca l'articolo da cercare.");		
			return;
		}
		window.open("Search.asp?Art="+document.getElementById("Cerca_index").value,"_self");
	}catch(E){
		alert(E);
	}
}

function Go(x){
	window.open(x,'_self');
}
 
function  CarrelloAssemblati(x){
		var rit='';
		try{
			if(window.showModalDialog){
				rit = window.showModalDialog('Ordine_Computers.asp?Id_Computer=' + x , null , 'help:0;Status:0;dialogheight:520px;dialogwidth:620px' );	 
			}else{
				rit = window.open('Ordine_Computers.asp?Id_Computer=' + x , null , 'height=520,width=620,status=yes,toolbar=no,menubar=no,location=no' );	 
			}				
			if (rit.length==0){ return};
			window.open ("EmailSender.asp?Page=Computers.asp"+"&Dati="+ Rit,"_self");			
		}catch(e){
			alert(e.message);
		}
	}

function BannerStop(Str){
	document.getElementById(Str).stop();
}

function BannerStart(Str){
	document.getElementById(Str).start();
}
		

function DesCo(StrDesc,StrTb,StrCa){
	window.open ('Descomp.asp?Id='+ StrDesc +'&Tb='+ StrTb +'&Ca='+ StrCa ,null,'status=0,width=300,height=280,scrollbars=1');
}

function Carrello(x){
			 			    			
	var DataToSend = 'Id_Art='+x;
	var xmlhttp,risultato;
	try{
	// carica l'oggetto se il browser è FIREFOX
		if (window.XMLHttpRequest) {
  			xmlhttp = new XMLHttpRequest();
		}
	// carica l'oggetto se il browser è IE
		else if (window.ActiveXObject) {
  			xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
		}	 	
		xmlhttp.open("POST","Web_Services/Add_Carrello.asp",false);
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlhttp.send(DataToSend);		
	}
	catch(E)
	{
	alert(E.message);
	}				
	risultato = xmlhttp.responseText;		
	var result = risultato.indexOf("SI");
	var result2 = risultato.indexOf("NO");
//	alert("result "+ result+ " result2 "+result2 +" risultato "+ risultato  );	
	if( result > 1){
		var conf;
		conf=confirm("Il prodotto è stato aggiunto nel carrello .                 "+
		"\n \n \n" + 
		" Ok !          Per continuare ad acquistare." + "\n" +
		" Annulla !   Per visionare il Carrello .");		
		if (conf==false){
			window.open('carrello.asp','Index');
		}				  
	}else{
		if (result2 > 1){
			window.open("index.htm","_self","");
		}else{
			alert("Il prodotto è già nel carrello.");
		}
	}
}
				