/**
 * @author Kovacs Gabriel
 */

// Quantity spin buttons
function increase_by_one(field) {
	nr = parseInt(document.getElementById(field).value);
	document.getElementById(field).value = nr + 1;
}

function decrease_by_one(field) {
	nr = parseInt(document.getElementById(field).value);
	if (nr > 0) {
		if( (nr - 1) > 0) {
			document.getElementById(field).value = nr - 1;
		}
	}
}

// on page load complete, fire off a jQuery 
$(document).ready(function() {
	
	// external links
	$("a[rel='external']").click(function() {
		return !window.open($(this).attr("href"));
	});

	// Set the transparent pixel
	jQuery.ifixpng('images/spacer.gif');
	jQuery(' #featured-product .but-buy-now, #product-showcase , #content-products, #featured-product .featured-product-image , #featured-product .homepage-set-image ').ifixpng();


	
	$(".arrow-up").click( function() {
		$("#qty").hide();
		increase_by_one('qty')
		$("#qty").fadeIn(500);
	}
	);
	
	$(".arrow-down").click( function() {
		$("#qty").hide();
		decrease_by_one('qty');
		$("#qty").fadeIn(500);
	}
	);
	
	
	$("#but-ingredients").click( function() {
		$("#ingredients").slideToggle(200);
		return false;
	});
	$("#but-ingredients2").click( function() {
		$("#ingredients2").slideToggle(200);
		return false;
	});
	
	
	// captcha
	$("#captcha-block #reload").click( function() {
		return false;
	});
	
});