// JavaScript Document
function cerca()
{  
    document.f1.submit();
}


function al_cistell(accio,article,descr,preu,quants,es,qtatestoc)
{ 
	
  var verb    = '';
  var prepart = '';
  
  var textestoc = new Array();
  textestoc['ca'] = '';
  textestoc['es'] = '';
  
  // Diem com va d'estoc
  if(qtatestoc == null) qtatestoc = 0;  
  switch(true)
  {
	case (qtatestoc == 0):
		textestoc['ca'] = "Actualment no hi ha estoc d'aquest article.\n";
		textestoc['es'] = "Actualmente no hay estoc de este artículo.\n";		
		break;
	case (qtatestoc < 3):
		textestoc['ca'] = "L'estoc disponible d'aquest article és baix.\n";
		textestoc['es'] = "El estoc disponible de este artículo es bajo.\n";		
		break;
  }
  
	if (accio == 'afegir')   
  	{
  		verb ='afegir';
  		prepart = 'al';
  		if(es == 'es')
  		{
  			var agree=confirm(textestoc[es]+ "Se agregará este artículo a la cesta de la compra.");
  		}
  		else
  		{
  			var agree=confirm(textestoc[es]+"S'afegirà aquest article al cistell de la compra.");
  		}
  	}
  	if (accio == 'esborra')
  	{
  		verb ='treure';
  		prepart = 'del';
  		if(es == 'es')
  		{
  			var agree=confirm("Se quitará este artículo de la cesta de la compra.");
  		}
  		else
  		{
  			var agree=confirm("Es treurà aquest article del cistell de la compra.");
  		} 
  	}
  // var agree=confirm("Està segur que vol " + verb + " aquest article " + prepart + " cistell?");
	  
  if (agree)
  {
	  f=document.forms['cistell'];
	  f.accio.value=accio;
	  f.codi.value=article;
	  f.preu.value=preu;
	  f.descripcio.value=descr;
	  f.unitats.value=quants;
	  f.action = 'carro.php';
//	  f.action = 'vol_info.php';
	  f.submit();  
  }	  
}


function al_cistell_nopopup(accio,article,descr,preu,quants)
{ 
  f=document.forms['cistell'];
  f.accio.value=accio;
  f.codi.value=article;
  f.preu.value=preu;
  f.descripcio.value=descr;
  f.unitats.value=quants;
  f.action = 'carro.php';
  f.submit();  
}

function nou_enviament()
{ f=document.forms['cistell'];
  f.accio.value='enviament';
  f.action = 'carro.php';
  f.submit();    
}

function nou_pagament()
{ f=document.forms['cistell'];
  f.accio.value='pagament';
  f.action = 'carro.php';
  f.submit();    
}