jQuery.noConflict();
if (jQuery('#shopping_cart').length != 0) {
	jQuery.ajax({
		url: 'http://www.lottiswelt.ch/item/shopping_cart/',
		success: function(data) {
			jQuery('#shopping_cart').replaceWith(data);
		}
	});
}

jQuery('img[src*="_off.jpg"]').mouseover(function() { 
	if (this.src.match('off')) {
		this.src = this.src.replace('_off.jpg', '_on.jpg');
	}
}).mouseout(function() {
    this.src = this.src.replace('_on.jpg', '_off.jpg');
});

jQuery('a[id*="cart_add"]').click(function() { 
	jQuery.ajax({
		url: this.href,
		success: function(data) {
			jQuery.ajax({
				url: 'http://www.lottiswelt.ch/item/shopping_cart/',
			  	success: function(data) {
					jQuery('#shopping_cart').replaceWith(data);
			  	}
			});
		}
	});
	return false;
});

jQuery('select[name*="length"]').change(function() {
	var link = this.name.replace('length', 'cart_add1');

	if (jQuery('#' + link).length != 0) {
		var tmpLink = jQuery('#' + link);
		var oldHref = tmpLink.attr('href');
		var newHref = oldHref.replace(/(_\S*)/g, '');
    		newHref = newHref + '_' + this.value
		tmpLink.attr('href', newHref);

    	var link = this.name.replace('length', 'cart_add2');
		var tmpLink = jQuery('#' + link);
		tmpLink.attr('href', newHref);
	}
}).change();
