function buyItem(form) {   
		newQuantity = form.cantidad.value;
		code = form.codigo.value;
		newItem = form.nombre.value;
		
		
		if (form.disponible.value == '0') {
			rc = alert('Disculpenos! El producto no está disponible en la tienda.   ');
		return false;
		}
		
		if (form.tipo.length>1){
			for (i=0;i<form.tipo.length;i++) { 
				if (form.tipo[i].checked) {
					if (i == 0) {
					newPrice = form.precio1.value;
					}
					if (i == 1) {
					newPrice = form.precio2.value;
					}
					if (i == 2) {
					newPrice = form.precio3.value;
					}
					newTipo = form.tipo[i].value;	
				}
			}
		}else{
		newPrice = form.precio1.value;
		newTipo = form.tipo.value;
		}
		
		newItem = ' '+newItem+' / '+newTipo+' / '+form.color.value+' (Cod.'+code+')';
		if (confirm('¿Agregar '+newQuantity+' '+newItem+' ?')) {
			index = document.cookie.indexOf("TheBasket");
			countbegin = (document.cookie.indexOf("=", index) + 1);
        		countend = document.cookie.indexOf(";", index);
	        	if (countend == -1) {
        	    		countend = document.cookie.length;
        		}
	                document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+","+newPrice+"#"+newQuantity+"]";
					
		
		}
		form.submit();
		
	}

	function resetShoppingBasket() {
		index = document.cookie.indexOf("TheBasket");
		document.cookie="TheBasket=.";
	return true;
	}
	
	function CargarFoto(img, ancho, alto){
  derecha=(screen.width-ancho)/2;
  arriba=(screen.height-alto)/2;
  string="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";
  fin=window.open(img,"loooo",string);
    }

function show(tipo, codigo) {	
		if (tipo == 'foto') {
			document.writeln('<a href="javascript:CargarFoto( \'../fotos/'+codigo+'_JPG.jpg\',\'300\',\'300\')"><img src="../thumbnails/'+codigo+'_JPG.jpg" border="0" alt="Realice click para ampliar"></a>');
		}
				
										
}

function CargarProductos(form,N) {	
for(i=1; i<=N; i++){
eval('form.codigo'+i+'.value='+i);
eval('form.precio'+i+'.value='+price(i));
eval('form.nombre'+i+'.value=\''+Itemname(i)+'\'');
eval('form.descripcion'+i+'.value=\''+ItemDescription(i)+'\'');
}
}

