/* Zeichenkodierung: UTF-8 */

$(document).ready(function () {

});

$.fn.selectText = function () {
	var elem = this.get(0);
	if (!elem) return this;
	if (document.selection && document.selection.createRange) {
		var textRange = document.selection.createRange();
		textRange.moveToElementText(elem);
		textRange.select();
	} else if (document.createRange && window.getSelection) {
		var range = document.createRange();
		range.selectNode(elem);
		var selection = window.getSelection();
		selection.removeAllRanges();
		selection.addRange(range);
	}
	return this;
}

$.fn.iePngFix = (!$.browser.msie || $.browser.version >= 7) ?
	(function () {
		return this;
	}) : (function () {
		return this.each(function () {
			var imageUri = this.currentStyle.backgroundImage.replace(/^url\(["']?([^"']*)["']?\)$/, "$1");
			if (imageUri == "none") return;
			//alert(this.nodeName + " " + this.id + "\n" + imageUri);
			this.style.backgroundImage = "none";
			this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='" + imageUri + "')";
			$(this).children().children().each(function () {
				if (this.currentStyle.position != "absolute") {
					this.style.position = "relative";
				}
			});
		});
	});

function refreshMinicart() {
	$.get('/cart', function(data){
        window.setTimeout(function () {
            $('#warenkorb').replaceWith(data);
            var el = $('#warenkorb');
            el.addClass("highlight");
            window.setTimeout(function () {
                el.removeClass("highlight");
            }, 1000);
        }, 200);
	})
}

