//chiude finestra senza chiedere conferma (almeno per IE)
function closeWin(){
	opener=self;
	self.close(); 
}

//navigazione
function NextPage(frm,pageNr){	 
    var f=eval('window.document.'+frm);
    f.pagenr.value = pageNr;
    //alert(f.pagenr.value);
    f.submit();
}
//cambia pagina a secondo op1 e op2scarica modulo
function ChArtPage(frm,op1,op2,id_articolo){
	try{
		//alert(frm+"\n"+op1+"\n"+op2+"\n"+id_articolo); 
    	var f=eval('window.document.'+frm);
    	f.op1.value = op1;
    	f.op2.value = op2;
    	f.id_articolo.value = id_articolo;
    	f.submit();
    	return true;
    }catch(error){    	
		alert('errore in ecommerce_output.js: ChArtPage(): '+error.description);
	}    
}
//idem pagina offerte
function ChOffertePage(frm,op1,op2,id_offerta){
	try{
		//alert(frm+"\n"+op1+"\n"+op2+"\n"+id_offerta); 
    	var f=eval('window.document.'+frm);
    	f.op1.value = op1;
    	f.op2.value = op2;
    	f.id_offerta.value = id_offerta;
    	f.submit();
    }catch(error){    	
		alert('errore in ecommerce_output.js: ChOffertePage(): '+error.description);
	}    
}
//modificato categoria articolo in modifica.inc.php/html
function ResetRicerca(frm){	
	try{
		//alert(frm); 
    	var f=eval('window.document.'+frm);
    	f.id_categoria_ric.selectedIndex=0;
        f.id_sottocategoria_ric.selectedIndex=0;
        f.str_articolo_ric.value='';
    	f.submit();
        
    }catch(error){    	
		alert('errore in ecommerce_output.js: ResetRicerca(): '+error.description);
	}     
}
//modificato categoria articolo in modifica.inc.php/html
function CatClicked(frm){	
	try{
		//alert(frm); 
    	var f=eval('window.document.'+frm);
        f.id_sottocategoria_ric.selectedIndex=0;
        //alert(window.document.form2.id_sottocategoria_ric.value);
    	f.submit();
        
    }catch(error){    	
		alert('errore in ecommerce_output.js: CatClicked(): '+error.description);
	}     
}
function SottocatClicked(frm){	
	try{
		//alert(frm); 
    	var f=eval('window.document.'+frm);
    	f.submit();
        
    }catch(error){    	
		alert('errore in ecommerce_output.js: SottocatClicked(): '+error.description);
	}     
}
// parte per il caricamento delle categorie (menu sel cat/sottocat)
var lang="it";
var argstr=location.search.substring(1,location.search.length);
var args=argstr.split("&");
for(var i=0;i<args.length;i++){
	tmp_arr=args[i].split("=");
    if(tmp_arr[0]=='lang') lang = tmp_arr[1];	    
}

// da usare in <a href="... onMouseOut=\"RestoreImg( ...">xx</a>
// Esempio: echo '<a href="?modulo=prodotti&smodulo=&lang='.$lang.'&id_categoria_ric='.$id."&op1=datiric\" onMouseOut=\"RestoreImg()\" onMouseOver=\"SwitchImg('document.catimg".$id."','document.catimg".$id."','".$backdir."/dati/categorie/img/".$lang."/".$id."/".$img1."')\"><img src=\"".$backdir."/dati/categorie/img/".$lang."/".$id."/".$img."\" name=\"catimg".$id."\" alt=\"".htmlspecialchars(stripslashes($nome))."\" border=\"0\" vspace=\"3\"></a>";
function SwitchImg()
{ //start
  var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
    for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
    	store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
    if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
        (store.indexOf('document.all[')==0 && document.all==null))
         store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
         obj = eval(store);
    if (obj != null) {
   	   switcher[keep++] = obj;
      switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
      obj.src = SwitchImg.arguments[rem+2];
  } }
  document.Data = switcher;
} //end

// da usare in <a href="... onMouseOver=\"SwitchImg( ...">xx</a>
function RestoreImg()
{ //start
  if (document.Data != null)
    for (var rem=0; rem<(document.Data.length-1); rem+=2)
      document.Data[rem].src=document.Data[rem+1];
} //end

