function oculta(obj){
	if(document.getElementById){
		var el = document.getElementById(obj);
		el.style.display = "none";
	}
}

function muestra(obj){
	if(document.getElementById){
		var el = document.getElementById(obj);
		el.style.display = "block";
	}
}

function poner_cesta(id_producto,extracapa) {
	var extra_identificador, cantidad_value ;
	
	extra_identificador = extracapa+"_"+id_producto;
	var cantidad = document.getElementById('cantidad_'+extra_identificador);

	cantidad_value = cantidad.value;
	
		
	var html = $.ajax({
			url: "ajax/ajax_poncesta.php",
			data: "ok=1&producto="+id_producto+"&cantidad="+cantidad_value,
			async: false,
			beforeSend: function(objeto){
					var hoverText = "<center><img src='img/cargando.gif' alt='cargando' /></center>";
					$('#etiqprod_'+extra_identificador).html(hoverText);
			}
			}).responseText;

		$('#etiqprod_'+extra_identificador).html(html);	
		

		var html_resp = $.ajax({
			url: "ajax/ajax_pontotal.php",
			data: "ok=1",
			async: false
			}).responseText;

		$('#gastos_carrito').html(html_resp);	
}

	$(document).ready(function(){

		$(function(){
			
	
			$("select#b_marca").change(function(){
				var id_escala = $("select#b_escala").val();
				var selected = '';

				$.getJSON("ajax/ajax_escalas.php",{id: $(this).val(), ajax: 'true'}, function(j){
				var options = '';
	
				for (var i = 0; i < j.length; i++) {
					if( id_escala == j[i].optionValue) 	selected = 'selected="selected";'
					else					selected = '';

					options += '<option value="' + j[i].optionValue + '" '+ selected+' >' + j[i].optionDisplay + '</option>';
				}
				$("select#b_escala").html(options);
				})
			})
		})

	function init() {	
		$("select#b_marca").change();
					// Use this example, or...
			
				$('#gallery a').lightBox({fixedNavigation:true});
		
	}
		$(document).ready(init);



	});


