
function guardarJoyaColeccion(obj, id_form)
{
	var id_producto = document.getElementById('form_'+id_form).id_producto.value;

	if(obj.checked)
	{
		var precio = document.getElementById('form_'+id_form).precio.value;
		var cant = document.getElementById('form_'+id_form).cant.value;
		var nombre = document.getElementById('form_'+id_form).nombre.value;
		
		if( document.getElementById('form_'+id_form).talla)
		{
			var talla = document.getElementById('form_'+id_form).talla.value;
	
		}			
		else{
			var talla =0;
		}	
	
		url = "/modulos/cesta/include/ajax.php?action=cesta_guardarCestaAjax&id_producto="+id_producto+"&cant="+cant+"&precio="+precio+"&nombre="+nombre+"&talla="+talla;
	
		if(document.getElementById('joya_no_guardada_label'))
			document.getElementById('joya_no_guardada_label').className = "none";
		if(document.getElementById('joya_guardada_label'))
			document.getElementById('joya_guardada_label').className = "";
	
	}
	else{
		
		url = "/modulos/cesta/include/ajax.php?action=cesta_eliminarProductoGuardadoAjax&id_producto="+id_producto;
		if(document.getElementById('joya_no_guardada_label'))
			document.getElementById('joya_no_guardada_label').className = "";
		if(document.getElementById('joya_guardada_label'))
			document.getElementById('joya_guardada_label').className = "none";
		
	}	
	ajax=objetoAjax();
	ajax.open("POST",url);
	
	ajax.onreadystatechange=function() {
	  if (ajax.readyState==4) 
	  {
		   rta = ajax.responseText;
		   arreglo = rta.split("#");
		   
		   cambiar_cesta(arreglo[0], arreglo[1]);
		   
	  	}
	  	
	  	
	 }
	ajax.send(null);

}	


function comprarJoyaGuardada(id_producto, idioma)
{
	
	
	url = "/modulos/cesta/include/ajax.php?action=cesta_comprareliminarProductoAjax&id_producto="+id_producto;
	
	ajax=objetoAjax();
	ajax.open("POST",url);
	//
	ajax.onreadystatechange=function() {
	  if (ajax.readyState==4) 
	  {	  	
	  	     
		   rta = ajax.responseText;
		   arreglo = rta.split("#");
		    if(arreglo[0] == "0")
		   {
		   		mostrarStockInsuficiente(arreglo[1]);
		   }
		   else{
		   	cambiar_cesta(arreglo[0], arreglo[1]);
		   	Pagina(1, idioma,10,'/modulos/usuario/include/ajax.php' ,'paginarGuardados','buscadorDer','',10);
		   	}
		   
	  	}
	  	
	  	
	 }
	ajax.send(null);

}


