jQuery(document).ready(function($) {
	$('a[rel*=facebox]').facebox();
	$.facebox.settings.opacity = 0.4;
})
/*
Shadowbox.init({
	players:    ["html","iframe"],
	handleOversize: "resize",
	showOverlay: false, 
	slideshowDelay: 4, 
	viewportPadding: 20, 
	skipSetup: false,
	language: 'es',
	autoplayMovies: true
});
*/

function anadeprod(cantidad,URL) {
	if (document.getElementById(cantidad).value <= 0 || !document.getElementById(cantidad).value) {
		alert('Debe indicar la cantidad a comprar');
		document.getElementById(cantidad).focus();
	} else {
		$('#toppanel').load(URL+'?cantidad='+document.getElementById(cantidad).value, function() {
			if (document.getElementById(cantidad).value < 2) 
				alert(document.getElementById(cantidad).value+' producto añadido a su cesta');
			else
				alert(document.getElementById(cantidad).value+' productos añadidos a su cesta');
		});		
	}
}

/* input_id is the ID of the input element */
/* container_class will let you control the text input background color and padding */
/* border_class will let you control the border color */
function roundInput(input_id, container_class, border_class) {
			var input = $('#'+input_id+'');
			var input_width = input.css("width"); //get the width of input
			var wrap_width = parseInt(input_width) + 10; //add 10 for padding
			wrapper = input.wrap("<div class='"+container_class+"'></div>").parent();
			wrapper.wrap("<div class='"+border_class+"' style='width: "+wrap_width+"px;'></div>"); //apply border
			wrapper.corner("round 8px").parent().css('padding', '2px').corner("round 10px"); //round box and border
}
$(document).ready(function() {
	$("form input.input_redondeado, form textarea.input_redondeado, form select.input_redondeado").each(function(){
		roundInput($(this).attr('id'),'contenido_redondeado','borde_redondeado');
	});
});

