(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeTo = function(speed,to,callback) {
		return this.animate({opacity: to}, speed, function() {
			if (to == 1 && jQuery.browser.msie)
				this.style.removeAttribute('filter');
			if (jQuery.isFunction(callback))
				callback();
		});
	};
})(jQuery);



$(document).ready(function(){
	$(".defaultText").focus(function(srcc){
		if ($(this).val() == $(this)[0].title){
			$(this).removeClass("defaultTextActive");
			$(this).val("");
		}
	});
	$(".defaultText").blur(function(){
		if ($(this).val() == ""){
			$(this).addClass("defaultTextActive");
			$(this).val($(this)[0].title);
		}
	});
	$(".defaultText").blur();
});

function addToCart(itemUri,quantity){
	
	$.ajax({
		data: 'itemUri='+itemUri+'&quantity='+quantity,
		dataType: 'json',
		success: function(data){
			$.fancybox(data.message,{'autoDimensions': false,height:160,padding:0,width:384});
			if(data.basket != null)
				$('#siteHeaderBasket').replaceWith(data.basket);
			//alert(data.basket);
			//$('#siteHeaderBasket').replaceWith(data.basket);
		},
		type: "POST",
		url:'/ajax/ajout-panier/'
	});
	return false;
}//End addToCart()