/*
window._setInterval = window.setInterval;
window.setInterval = function(callback, interval) {
    if (console != undefined) {
        console.log('Interval started');
        console.log(arguments);
    }

    return window._setInterval(callback, interval);
}
window._setTimeout = window.setTimeout;
window.setTimeout = function(callback, interval) {
    if (console != undefined) {
        console.log('Timeout started');
        console.log(arguments);
    }

    return window._setTimeout(callback, interval);
}
*/
var isChildOf = function(obj, target) {
    var current = null;

    if (obj == target) {
        return false;
    }
    if (obj.parent == target) {
        //Just a shortcut
        return true;
    }

    current = obj.offsetParent;
    while(current != undefined && current != null) {
        if (current == target) {
            return true;
        }
        current = current.offsetParent;
    }

    return false;
}

var bindEvent = function(target, eventName, handler) {
    if (target.addEventListener) {
        target.addEventListener(eventName, handler, false);
    } else if (target.attachEvent) {
        target.attachEvent("on" + eventName, handler);
    } else {
        target["on" + eventName] = handler;
    }
}

/**
 * alternative to jQuery's mouseleave
 */
var bindMouseLeave = function(target, handler) {
    var interval = -1;
    var check    = function(e) {
        var eTarget = null;

        if( e.toElement ) {
            eTarget = e.toElement;
        } else if(e.relatedTarget) {
            eTarget = e.relatedTarget;
        }
        if( !isChildOf(eTarget, target)) {
            handler(e);
        }
    }

    bindEvent(target, 'mouseout', function(e) {
        window.clearInterval(interval);
        interval = window.setTimeout(function() {check(e);}, 100);
    });
}

Array.prototype.inArray = function(needle) {
    for(var i=0; i < this.length; i++) if(this[ i] === needle) return true;
    return false;
}
var cookiesOn = function() {
    return typeof document.cookie != 'undefined' && document.cookie != '';
}
var SevenTrendsRegistry = function() {
    return {
        has: function(k) {
            return typeof this[k] != 'undefined';
        },
        set: function(k, v) {
            this[k] = v;
        },
        get: function(k) {
            if (this.has(k)) {
                return this[k];
            } else {
                return null;
            }
        },
        remove: function(k) {
            if (this.has(k)) {
                delete this[k];
            }
        }
    }
}



function dcstormAddToCart()
{
    logOCPV('isconv=0|pover=/checkout/add-to-cart/');
}

function dcstormAddToWishlist()
{
    logOCPV('isconv=0|pover=/wishlist/add/');
}

/* add links to looks to track klicks */
jQuery(document).ready(function() {
    var currentUrl = window.location.pathname;
    
    $j('.outfit-content map').click(function(){
        var mapId = $j(this).attr('id');
        var dcstormName = '/look-click/' + mapId + currentUrl;
        logOCPV('isconv=0|pover=' + dcstormName);
        return true;
    });
    $j('.outfit-product-txt a').click(function(){
        var mapId = $j(this).attr('name');
        mapId = mapId.replace('_kl_', '_');
        var dcstormName = '/look-click/' + mapId + currentUrl;
        logOCPV('isconv=0|pover=' + dcstormName);
        return true;
    });
    
    
    
});

function feldLeeren(element, value) {
	if (element.value == 'Deine E-Mail-Adresse') {
		element.value = value;
	} else if (element.value == '') {
		element.value = value;
	}
}
function objectLength(obj) {
    var length = 0;
    var key    = null;

    for (key in obj) {
        if (obj.hasOwnProperty(key)) {
            length++
        }
    }
    return length;
};

function blanket_size(popUpDivVar) {
    if (typeof window.innerWidth != 'undefined') {
        viewportheight = window.innerHeight;
    } else {
        viewportheight = document.documentElement.clientHeight;
    }
    if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
        blanket_height = viewportheight;
    } else {
        if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
	        blanket_height = document.body.parentNode.clientHeight;
        } else {
	        blanket_height = document.body.parentNode.scrollHeight;
        }
    }
    var blanket = document.getElementById('blanket');
    blanket.style.height = blanket_height + 'px';
    
    var popUpDiv = document.getElementById(popUpDivVar);
    popUpDiv_height=blanket_height/2-150;//150 is half popup's height
    popUpDiv.style.top = popUpDiv_height + 'px';
}

function window_pos(popUpDivVar) {
    if (typeof window.innerWidth != 'undefined') {
        viewportwidth = window.innerHeight;
    } else {
        viewportwidth = document.documentElement.clientHeight;
    }
    if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
        window_width = viewportwidth;
    } else {
        if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
	        window_width = document.body.parentNode.clientWidth;
        } else {
	        window_width = document.body.parentNode.scrollWidth;
        }
    }
    var popUpDiv = document.getElementById(popUpDivVar);
    window_width=window_width/2-150;//150 is half popup's width
    popUpDiv.style.left = window_width + 'px';
}

var SiteLoaded = Class.create();
SiteLoaded.prototype = {
	initialize: function() {
		this.state = 'unload';
	}
}
siteLoaded = new SiteLoaded();

jQuery(window).load(function () {
	if ($('zoomwaiting')) {
		$('zoomwaiting').remove();
	}
	siteLoaded.state = 'loaded';
})

function auseinblenden(id, status) {
	$(id).style.visibility = status;
}

function changeSliderImage(id, groesse) {
	if (groesse == 1) {
		$(id+'-klein').hide();
		$(id+'-gross').show();
	}
	if (groesse == 0) {
		$(id+'-klein').show();
		$(id+'-gross').hide();
	}
}

var MiniCartSlideJQuery = function() {
    var slider        = null;
    var trigger       = null;
    var container     = null;
    var mouse         = {x:0, y:0};
    var cursorTimeout = -1;

    var showCartSlider = function(e) {
        if (slider == null) {
            return;
        }
        slider.stop();
        cursorTimeout = window.setTimeout(checkIsCursorInCart, 1000);

        slider.animate({
                marginTop: 0
            }
        );
    }

    var hideCartSlider = function() {
        window.clearTimeout(cursorTimeout);
        slider.stop();
        //For unknown reasons the slider does not disappear completely -> adding 20px
        slider.animate({
            marginTop: (slider.outerHeight(true) - parseInt(slider.css('margin-top')) + 1) * -1 -20
        });
    }

    var isCursorWithinSlider = function() {
        var pos     = slider.offset();
        var width   = slider.outerWidth(true);
        var height  = slider.outerHeight(true);

        var tPos    = trigger.offset();
        var tWidth  = trigger.outerWidth(true);
        var tHeight = trigger.outerHeight(true);

        var result =
                (mouse.y >= pos.top && mouse.y < pos.top + height
                &&
                mouse.x > pos.left && mouse.x < pos.left + width)
            ||
                (mouse.y >= tPos.top && mouse.y < tPos.top + tHeight
                &&
                mouse.x > tPos.left && mouse.x < tPos.left + tWidth);

        //without this variable the return value is undefined (At least in FF)
        return result;
    };

    var checkIsCursorInCart = function() {
        cursorTimeout = window.setTimeout(function() {
                if (!isCursorWithinSlider()) {
                    hideCartSlider();
                } else {
                    checkIsCursorInCart();
                }
            },
            100
        );
    }

    jQuery(document).mousemove(function(e) {
        mouse.x = e.clientX;
        mouse.y = e.clientY;
    });

    return {
        init: function() {
            jQuery('#warenkorb-hover').live('mouseover', showCartSlider);
        },
        update: function() {
            slider    = jQuery('#warenkorb-mini-komplett');
            trigger   = jQuery('#warenkorb-hover');
            container = jQuery('#anzahl-mini-warenkorb');

            //Hack, because sometimes the event seems to be not bound by init()
            jQuery('#warenkorb-hover').die('mouseover');
            jQuery('#warenkorb-hover').live('mouseover', showCartSlider);

            //For unknown reasons the slider does not disappear completely -> adding 20px
            slider.css({
                marginTop: (slider.outerHeight(true) - parseInt(slider.css('margin-top'))) * -20,
                visibility: 'visible'
            });

            jQuery(document.body).append(container);
            
            container.css('top', trigger.offset().top + trigger.outerHeight(true) - 2);
            container.css('left', trigger.offset().left);

            if (jQuery.browser.msie && (jQuery.browser.version == '7.0' || jQuery.browser.version == '6.0')) {
                container.css('left', parseInt(container.css('left')) - 16);
            }
        }
    }
}
var miniCartSlideJQuery = null;
jQuery(document).ready(function(e) {
    //miniCartSlideJQuery = new MiniCartSlideJQuery();
    //miniCartSlideJQuery.init();
    
});


function getHeader(){
	jQuery('#anzahl-mini-warenkorb').remove();
    $j.ajax({
	  url: '/mycustomer/ajax/getHeader/',
      cache: false,
	  success: function(data) {
		$j('.result').html(data);
	    
	  }
	});
	}

/* Looks Kategorien Anfang */
var Looks = Class.create();
Looks.prototype = {
	initialize: function() {
		this.status = 'READY';
		this.aktLookId = '';
		this.aktRubrik = '';
		this.sliderStatus = 'READY';
	},
	requestLook: function(blockid, catid) {
	  if (looks.status == 'READY'){
		 looks.status = 'LOADING';
		 looks.aktLookId = catid;
		 $j('#looks-content').fadeTo(500, 0.2, function() {
			 $j.ajax({
				url: "/blockcontent/ajax/getCMSBlock/"+blockid+'/'+catid,
				dataType: "json",
				success: function(responseText){
				 	$j('#looks-content').html(responseText.content);
					if(responseText.prev.link == undefined) {
						$j('#pfeil_l').html(
							'<img id="rueck_gross" height="43" width="15" title="Rückwärts blättern" alt="Rückwärts blättern" src="'+responseText.prev.imgsrc+'"/>'
						);
					} else {
						$j('#pfeil_l').html(
							'<a title="'+responseText.prev.title+'" href="'+responseText.prev.link+'"><img id="rueck_gross" height="43" width="15" onclick="return looks.requestLook(\''+responseText.prev.ajaxlink+'\', '+responseText.prev.ajaxid+')" title="'+responseText.prev.title+'" alt="'+responseText.prev.title+'" src="'+responseText.prev.imgsrc+'"/></a>'
						);
					}
					if(responseText.next.link == undefined) {
						$j('#pfeil_r').html(
							'<img id="vor_gross" height="43" width="15" title="Vorwärts blättern" alt="Vorwärts blättern" src="'+responseText.next.imgsrc+'"/>'
						);
					} else {
						$j('#pfeil_r').html(
							'<a title="'+responseText.next.title+'" href="'+responseText.next.link+'"><img id="vor_gross" height="43" width="15" onclick="return looks.requestLook(\''+responseText.next.ajaxlink+'\', '+responseText.next.ajaxid+')" title="'+responseText.next.title+'" alt="'+responseText.next.title+'" src="'+responseText.next.imgsrc+'"/></a>'
						);
					}
		      	},
		      	complete: function() {
		      		$j('#looks-content').fadeTo(2000, 1.00);
		      		looks.status = 'READY';
		      	}
			})
		});
	  }
	  return false;
	},
	requestSlider: function(aktLookId, aktRubrik) {
		if (looks.aktRubrik == '') {
			looks.aktRubrik = aktRubrik;
		}
		$j.ajax({
			url: "/blockcontent/ajax/getSlider/?rubrik="+looks.aktRubrik,
			dataType: "json",
			success: function(responseText){
				if (looks.aktLookId == '') {
					looks.aktLookId = aktLookId;
				}
				$j('#slider').html(responseText.content);
				looks.changeSliderArrows();
			}
		});
	},
	slide: function(element, direction) {
		if (direction == 'minus') {
			var left = parseInt( $j('#slider ul').css('left').replace('px', '') ) - 181;
		} else {
			var left = parseInt( $j('#slider ul').css('left').replace('px', '') ) + 181;
		}
		var position = $j('#slider .last').offset();
		if ( (looks.canSlide('plus') && direction == 'plus' || direction == 'minus' && looks.canSlide('minus') ) && looks.sliderStatus == 'READY' ) {
			looks.sliderStatus = 'LOADING';
			$j('#slider ul').animate({left: left+"px"}, {
				queue:false,
				duration:400,
				complete: function() {
					looks.sliderStatus = 'READY';
					looks.changeSliderArrows();
				}
			});
		}
	},
	changeSliderArrows: function() {
		var left = parseInt( $j('#slider ul').css('left').replace('px', '') );
		var position = $j('#slider .last').offset();
		if (looks.canSlide('plus') == false) {
			$j('#prevBtn').attr('src', '/skin/frontend/7trends/default/images/looks/kleiner_pfeil_g_l.jpg');
			$j('#prevBtn').css('cursor', 'default');
		} else {
			$j('#prevBtn').attr('src', '/skin/frontend/7trends/default/images/looks/kleiner_pfeil_s_l.jpg');
			$j('#prevBtn').css('cursor', 'pointer');
		}
		if (looks.canSlide('minus') == false) {
			$j('#nextBtn').attr('src', '/skin/frontend/7trends/default/images/looks/kleiner_pfeil_g_r.jpg');
			$j('#nextBtn').css('cursor', 'default');
		} else {
			$j('#nextBtn').attr('src', '/skin/frontend/7trends/default/images/looks/kleiner_pfeil_s_r.jpg');
			$j('#nextBtn').css('cursor', 'pointer');
		}
		$j('#prevBtn').css({'display' : 'block'});
		$j('#nextBtn').css({'display' : 'block'});
	},
	canSlide: function(direction) {
		var left = parseInt( $j('#slider ul').css('left').replace('px', '') );
		var position = $j('#slider .last').offset();
		if (direction == 'minus') {
			if (left + position.left < 177 || position.left < 940) {
				return false;
			} else {
				return true;
			}
		} else if (direction == 'plus') {
			if (left >= 0) {
				return false;
			} else {
				return true;
			}
		}
	}
}

looks = new Looks();
/* Looks Kategorien Ende */

/* Produktdetailseite */
var Produktdetails = Class.create();
Produktdetails.prototype = {
		initialize: function() {
			this.status = 'READY';
			this.aktLookId = '';
			this.aktRubrik = '';
			this.sliderStatus = 'READY';
		},
		changeDefaultOption: function(selectId, value, aValues) {
			var select = document.getElementById(selectId);
			var json_values = $j.secureEvalJSON(aValues);
		    var kids = select.childNodes; 
		    var numkids = kids.length;
		    for (var i = 0; i < numkids; i++) {
		        if (kids[i].value == value) {
		        	if ( selectId.endsWith(json_values.groesse.id) ) {
		        	} else if ( selectId.endsWith(json_values.farbe.id) ) {
		        		kids[i].innerHTML = json_values.farbe.label;
		        	}
		            break;
		        }
		    }
		},
		changeHinweisBox: function(class_to_show_head, id_to_show){
			jQuery('.product_info').removeClass().addClass('product_info product_info_'+class_to_show_head+' product_sprite');
			jQuery('.product-textboxen .product-textbox-text').hide();
            jQuery('#'+id_to_show).css('display', 'block');
		},
		showDelivery: function(value) {
			if(value == '' && jQuery('#availability_txt').length > 0) {
				jQuery('#availability_txt').css({'visibility':'hidden'});
			} else {
				jQuery('#availability_txt').css({'visibility':'visible'});
			}
		},
		includeFacebookLike: function(adresse) {
			//jQuery('#fbl').replaceWith('<iframe src="http://www.facebook.com/plugins/like.php?href='+adresse+'&amp;layout=standard&amp;show_faces=false&amp;width=350&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:35px; padding-left:10px;padding-top:15px;" allowTransparency="true"></iframe>');
		},
		startOutfitSlider: function() {
			// Größe von outfit_slider div anpassen, Slider starten/bauen
			var height_all = 0;
			var count = 0;
			jQuery('.outfit-table').each(function(index) {
				if(index < 5) {
					height_all += jQuery(this).height();
				}
				count++;
			});
			if(height_all > 0) {
				jQuery('.outfit_slider').height(height_all);
				if(count > 5) {
					jQuery('.outfit-slider-inner').SevenTrendsCarousel({
				        vertical: true,
				        itemsClass: 'outfit-table',
				        nextBtn: jQuery('#outfit-scroll-down'),
				        prevBtn: jQuery('#outfit-scroll-up')
				    });
				    jQuery('.outfit-slider-inner').data('7eCarousel').reload();
			    } else {
			    	jQuery('#outfit-scroll-down-div, #outfit-scroll-up-div').hide();
			    }
			}
		},
		selectsize: function(element) {
			jQuery('.size-hidden select option').removeAttr('selected');
			jQuery('.size_label_box button').removeClass('size_label_box_active');
			var new_selected = jQuery('.size-hidden select option[value="'+jQuery(element).attr('size_id')+'"]');
			new_selected.attr("selected", true);
			jQuery(element).addClass('size_label_box_active');
			this.showDelivery(new_selected.val());
			jQuery('.size-box-availability').show();
		}
}

function countOutfits(styleguide_id) {
	$j.ajax({
		url: "/magento_includes/_init.php?f=product/count_outfit&sid="+styleguide_id
	});
}
function showBigStyleguide(styleguide_id, hash) {
	tb_show('', '#TB_inline?height=466&width=800&inlineId=outfit-layer&headlinetext= ', '');
	var products_el = jQuery('#outfit_txt_'+styleguide_id+' div a');
	var products_price = jQuery('#outfit_txt_'+styleguide_id+' div div.outfit-price');
	var products_txt = '';
	products_el.each(function(key, value) {
		if(value.title.length <= 31) {
			var title = value.title;
		} else {
			var title = value.title.substring(0,31)+'...';
		}
		products_txt += '<div class="outfit-product-txt outfit-product-txt-layer"><span class="product_sprite upsell_pfeil_rechts floatright"></span><a href="'+value+'" title="'+value.title+'" name="outfit_gr_'+styleguide_id+'">'+title+'</a><div class="outfit-price">'+products_price[key].innerHTML+'</div></div>';
	});
			
	var outfit_title = jQuery('#outfit_title_'+styleguide_id).html();
	var author_img = jQuery('#outfit_author_'+styleguide_id).get(0);
	var map = jQuery('#imagemap_gr_'+styleguide_id).html();
	if(map != null) {
		var img = '<img src="http://static.7trends.de/media/looks/'+styleguide_id+'_538x425.jpg?v='+hash+'" width="538" height="425" class="outfit-image" usemap="#outfit_'+styleguide_id+'_gr" />'+map;
	} else {
		var img = '<img src="http://static.7trends.de/media/looks/'+styleguide_id+'_538x425.jpg?v='+hash+'" width="538" height="425" class="outfit-image" />';
	}
	var layer = '<div>&nbsp;</div><div class="outfit_layer_img">'+img+'</div>'+
		'<div class="floatright product_sprite styleguide-layer-close" onclick="tb_remove()"></div>'+
		'<div class="outfit_title">'+outfit_title+'</div>'+
		'<div class="'+author_img.className+'"></div>'+
		'<div class="floatright">'+products_txt+'</div><div class="clearall">&nbsp;</div>';
			
	jQuery('#TB_ajaxContent').html(layer);
	countOutfits(styleguide_id);
	return false;
}
function showTBOnly(url) {
    tb_show('', '#TB_inline?height=466&width=800&inlineId=outfit-layer&headlinetext= ', '');
    var orgBg = jQuery('#TB_ajaxContent').css('background');
    jQuery('#TB_ajaxContent').css('background', 'url(/skin/frontend/7trends/default/images/ajax-loader_large_white.gif) no-repeat center center');
    jQuery.ajax({
        url: url,
        success: function(rsp) {
            jQuery('#TB_ajaxContent').css('background', orgBg);
            jQuery('#TB_ajaxContent').html(rsp + '<div class="teaser_close_button_ajax" onclick="tb_remove()"></div>');
            var teaser = jQuery('#TB_ajaxContent .category-teaser');
            teaser.css('visibility', 'hidden');
            teaser.css({
                position: 'absolute',
                left: '50%',
                top: '50%',
                'margin-left': teaser.width()/2*-1,
                'margin-top': teaser.height()/2*-1,
                visibility: 'visible'
            });
        }
    });
}
function showBigStyleguideOverview(styleguide_id, hash) {
    tb_show('', '#TB_inline?height=466&width=800&inlineId=outfit-layer&headlinetext= ', '');
    var dataEl = jQuery('#content-outfit-' + styleguide_id);

    var img = dataEl.find('img.large').attr('src');
    var stylistClass = dataEl.find('#stylist' + styleguide_id).attr('class');
    var imageMap = dataEl.find('map').html();
    var title = dataEl.find('.title').html();
    var productList = dataEl.find('.products').html();

    var layer =
    '<div style="position: absolute; right: 28px; top: 34px; font-family: Georgia; font-size: 28px; line-height: 24px; text-align: right; width: 240px;">' + title + '</div>' +
    '<img style="margin: 15px 0px 0px 15px; border: 1px solid #E5E5E5;" src="' + img + '" usemap="#bigStyleguide_map_' + styleguide_id + '" />'+
    '<map name="bigStyleguide_map_' + styleguide_id + '">' + imageMap + '</map>' +
    '<div class="' + stylistClass + '" style="position: absolute; right: 15px; top: 74px; height: 100px; width: 101px;"></div>' +
	'<div style="cursor: pointer; position: absolute; top: 15px; right: 15px; height: 17px; width: 18px; background: url(/skin/frontend/7trends/default/images/product/product_sprite.jpg) no-repeat 0 -10px;" onclick="tb_remove()"></div>' +
    '<ul style="top: 200px;" class="teaser-product-list">' + productList + '</ul>';

	jQuery('#TB_ajaxContent').html(layer);
}
function initProductImgCarousel(product_count) {
	jQuery('#product_img_caruosel-prev, #product_img_caruosel-next').addClass('product_sprite');
	jQuery('ul#product_img_caruosel').height(product_count * 135);
	jQuery('ul#product_img_caruosel').jcarousel({
	      scroll: 1,
	      vertical: true,
	      initCallback: productImgCarousel_initCallback,
	      buttonNextHTML: null,
	      buttonPrevHTML: null
	});
}
/* Produktdetailseite Ende */
/* an Freundin senden */
var Freundin = Class.create();
Freundin.prototype = {
	send: function() {
		$('product_sendtofriend_form').request({
		  onComplete: function(){alert('Form data saved!')}
		})
	}
}
/* Freundin Ende */

/* Filter-Funktionen Begin */
function updatePriceFilterLabels()
{
	var priceFrom = $j('#catalog_filter_price_slider_from').val();
	var priceTo = $j('#catalog_filter_price_slider_to').val();
	$j('#catalog_filter_price_slider_from_label').html(priceFrom + ' &euro;');
	$j('#catalog_filter_price_slider_to_label').html(priceTo + ' &euro;');
}

jQuery(document).ready(function($) {
	
	var arrow_down = $('<img />').attr('src', '/skin/frontend/7trends/default/images/filter/pfeil_u.jpg');
	var arrow_right = $('<img />').attr('src', '/skin/frontend/7trends/default/images/filter/pfeil_r.jpg');
	
	
	$('.filter-box-header').click(function() {
		var img_src = $(this).children("img").attr('src');
		if(img_src.indexOf('pfeil_u') == -1) {
	        $(this).children("img").attr('src', '/skin/frontend/7trends/default/images/filter/pfeil_u.jpg');
		} else {
	        $(this).children("img").attr('src', '/skin/frontend/7trends/default/images/filter/pfeil_r.jpg');
		}
		
		$(this).next().toggle();
		return false;
	});
	
	$('.custom-checkbox').click(function () {
		if($(this).attr('checked')) {
			$(this).next().removeClass("filter-unchecked");
			$(this).next().addClass("filter-checked");
		} else {
			$(this).next().removeClass("filter-checked");
			$(this).next().addClass("filter-unchecked");
		}
		
		$('#form-catalog-filter').submit();
	});
	
	if ($('#form-catalog-filter').length > 0) {
		$('#form-catalog-filter').ajaxForm({
			target: '#response_catalog_result',
			beforeSubmit: eval_request_catalogfilter,
			success: eval_response_catalogfilter
		});
	}

	function eval_request_catalogfilter(formData, jqForm, options) {
		
		$('#response_catalog_result, #catalog-filter').loading(true, 
		{
			img: '/skin/frontend/7trends/default/images/7trends/spacer.gif',
			mask:true,
			maskCss: {position:'absolute', opacity:.5, background:'#fff',
				zIndex:1000, display:'block', cursor:'wait'}
		});
		
		return true;
	}

	function eval_response_catalogfilter(responseText, statusText) {
		$('#response_catalog_result, #catalog-filter').loading(false);
		$('.loading-mask').remove();
	}
	
	if ($('.catalog_filter_price_slider').length > 0) {
		$('.catalog_filter_price_slider').selectToUISlider({tooltip: false, labels: 0, sliderOptions: {change: 
			function(event, ui) {
				updatePriceFilterLabels();
				$('#form-catalog-filter').submit();
			}
		}});
	}
	
	if ($("#filter-price-box").length > 0) {
		$("#filter-price-box").bind("mousemove", function(e){
			window.setTimeout('updatePriceFilterLabels()', 20);
	    });
	}
	
});

function loadCatalogFilterPage(url) {

	$j('#catalog-filter, #response_catalog_result').loading(true, 
	{
		img: '/skin/frontend/7trends/default/images/7trends/spacer.gif',
		mask:true,
		maskCss: {position:'absolute', opacity:.5, background:'#fff',
			zIndex:1000, display:'block', cursor:'wait'}
	});
	$j("#response_catalog_result").load(url, function(){
		$j('#catalog-filter, #response_catalog_result').loading(false);
	 });
}

/* Filter-Funktionen Ende */

function versandvorrausberechnung(wert) {
	var anhang = ' &euro;';
	var newstring = jQuery('#subtotal span').html();
	var subtotal = newstring.replace(',', '.');
	if (parseFloat(subtotal) < 100) {
		wert = parseFloat(wert);
		var mwst_zusatz = wert / 119 * 19;
		mwst_zusatz = mwst_zusatz.toFixed(2);
		if (jQuery('#discount').length > 0) {
			var discountstring = jQuery('#discount span').html();
			var discount = discountstring.replace(',', '.');
			var mwst = (parseFloat(subtotal) + parseFloat(discount)) / 119 * 19;
		}
		else {
			var mwst = parseFloat(subtotal) / 119 * 19;
			var discount = 0;
		}
		mwst = mwst.toFixed(2);
		var new_mwst = parseFloat(mwst) + parseFloat(mwst_zusatz);
		new_mwst = new_mwst.toFixed(2);
		if (document.getElementById('tax')) {
			new_mwst = new_mwst.replace('.', ',') + '';
			jQuery('#tax').html(new_mwst + anhang);
		}
		wert = wert.toString();
		var total_string = parseFloat(subtotal.replace(',','.')) + parseFloat(wert) + parseFloat(discount);
		jQuery('#grand_total').html('<span class="price">' + total_string.toFixed(2) + anhang + '</span>');
		wert.replace('.', ',');
		if (wert == 0) {
			jQuery('#versand-vorrausschau').html('<span class="lila">kostenlos *</span>');
		}
		else {
			jQuery('#versand-vorrausschau').html(wert + anhang);
		}
	}
}

function sss(wert) {
	var anhang = ' &euro;';
	var newstring = $('subtotal').innerHTML.stripTags();
	var subtotal = newstring.substring(21, newstring.length - 14);
	if (parseFloat(subtotal) < 100) {
		wert = parseFloat(wert);
		var mwst_zusatz = wert / 119 * 19;
		mwst_zusatz = mwst_zusatz.toFixed(2);
		if ($('discount')) {
			var discountstring = $('discount').innerHTML.stripTags();
			var discount = discountstring.substring(21, discountstring.length - 14);
			var mwst = (parseFloat(subtotal) + parseFloat(discount)) / 119 * 19;
			discount = discount.replace(',','.');
		} else {
			var mwst = parseFloat(subtotal) / 119 * 19;
			var discount = 0;
		}
		mwst = mwst.toFixed(2);
		var new_mwst = parseFloat(mwst) + parseFloat(mwst_zusatz);
		new_mwst = new_mwst.toFixed(2);
		if ( document.getElementById('tax') ) {
			new_mwst = new_mwst.replace('.', ',') + '';
			$('tax').innerHTML = new_mwst + ' &euro;';
		}
		wert = wert.toString();
		var total_string = parseFloat(subtotal.replace(',','.')) + parseFloat(wert) + parseFloat(discount);
		$('grand_total').innerHTML = '<span class="price">' + total_string.toFixed(2) + anhang + '</span>';
		wert.replace('.', ',');
		if (wert == 0) {
			wert = '<span class="lila">kostenlos *</span>';
			$('versand-vorrausschau').innerHTML = wert;
		} else {
			$('versand-vorrausschau').innerHTML = wert + anhang;
		}
	}
}

var processingFee = Class.create();
processingFee.prototype = {
	initialize: function() {
		this.fee = '0,00';
		this.orgFee = 0.00;
		this.orgtax = '0,00';
		this.gradtotal = '0,00';
		this.subtotal = '0,00';
		this.discount = '0,00';
		this.anhang = ' &euro;';
		this.method = '';
	},
	setFee: function(method, fee) {
		if (fee == '') {
			fee = '0.00';
		}
		fee = fee.replace(',','.');
		this.fee = parseFloat(this.orgFee) + parseFloat(fee);
		this.method = method;
		this.overwriteFee();
	},
	setOrgFee: function() {
		var fee_old = $('processingfee').innerHTML.stripTags();
		this.orgFee = fee_old.replace(',','.');
		this.orgFee = this.orgFee.substring(0, this.orgFee.indexOf(".")+3);
		var tax_old = $('tax').innerHTML.stripTags();
		this.orgtax = tax_old.replace(',','.');
		this.orgtax = this.orgtax.substring(0, this.orgtax.indexOf(".")+3);
		var grandtotal_old = $('grand_total').innerHTML.stripTags();
		this.gradtotal = grandtotal_old.substring(21, grandtotal_old.length - 14).replace(',','.');
		var subtotal_old = $('subtotal').innerHTML.stripTags();
		this.subtotal = subtotal_old.replace(',','.');
		this.subtotal = this.subtotal.substring(0, this.subtotal.indexOf(".")+3);
		if ($('discount')) {
			var discount = $('discount').innerHTML.stripTags();
			this.discount = discount.substring(21, discount.length - 14).replace(',','.');
		}
	},
	overwriteFee: function() {
		var fee = this.fee;
		var grand_total = parseFloat(this.subtotal)+ parseFloat(this.fee)+parseFloat(this.discount);
		grand_total = Math.round(grand_total*100)/100;
		grand_total = grand_total.toFixed(2);
		grand_total = grand_total.toString();
		var tax = (grand_total / 119 * 19);
		tax = Math.round(tax*100)/100;
		tax = tax.toFixed(2);
		tax = tax.toString();
		if (this.subtotal < 100 || this.method == 'payone_recapi' || this.method == 'sevene_billpay_rec') {
			fee = fee.toString();
			fee = fee.replace('.',',');
			$('processingfee').innerHTML = '<span class="price">' + fee + this.anhang + '</span>';
			$('grand_total').innerHTML = '<span class="price">' + grand_total.replace('.',',') + this.anhang + '</span>';
			$('tax').innerHTML = '<span class="price">' + tax.replace('.',',') + this.anhang + '</span>';
		} else {
			if (fee == 0) {
				fee = '0,00';
			}
			fee = fee.toString();
			fee = fee.replace('.',',');
			$('processingfee').innerHTML = '<span class="price">' + fee + this.anhang + '</span>';
			$('grand_total').innerHTML = '<span class="price">' + grand_total.replace('.',',') + this.anhang + '</span>';
			$('tax').innerHTML = '<span class="price">' + tax.replace('.',',') + this.anhang + '</span>';
		}
	}
}
processingfee = new processingFee();

var checkoutProcessing = Class.create();
checkoutProcessing.prototype = {
	initialize: function() {
		this.fee = '0,00';
		this.orgFee = 0.00;
		this.orgtax = '0,00';
		this.gradtotal = '0,00';
		this.subtotal = '0,00';
		this.discount = '0,00';
		this.anhang = ' &euro;';
		this.method = '';
		this.billingChanged = false;
		this.shippingChanged = false;
		this.shippingSameAsBilling = true;
		this.useCountry = 'billing';
		this.countryId = '';
		this.isNetto = false;
	},
	setPaymentMethod: function(method, fee) {
		this.checkUseCountry();
		this.getShippingCountryId();
		var subtotal = this.getSubtotal();
		
		if (this.countryId != 'DE') {
			fee = this.getShippingCosts(subtotal, this.countryId, method);
		}
		
		if (fee == '') {
			fee = '0.00';
		}
		fee = fee.replace(',','.');
		this.fee = parseFloat(this.orgFee) + parseFloat(fee);
		this.method = method;
		this.overwriteTotals();
	},
	changeCountry: function(type) {
		/* set billingChanged or shippingChanged */
		if (type == 'shipping') {
			this.setShippingChanged();
		} else if (type == 'billing') {
			this.setBillingChanged();
		}
		
		/* check if need to use billing or shipping-country */
		this.checkUseCountry();
		
		/* get subtotal */
		var subtotal = this.getSubtotal();

		/* get country id */
		this.getShippingCountryId();

		/* set field validation for plz based on country and billing or shipping */
		/* this.handlePostcodeValidation(this.countryId, type); */

		/* (de)activate payment methods
		 if payment method that is deactivated is active, set to not active
		*/
		this.handlePaymentTypes(this.countryId);
		
		/* get shipping costs for country and subtotal */
		var shippingCost = this.getShippingCosts(subtotal, this.countryId, this.method);
		
		/* set new shipping costs */
		this.overwriteTotals();
		
	},
	getShippingCountryId: function() {
		type = this.useCountry;
		this.countryId = $(type + ':country_id').getValue();
	},
	getShippingCosts: function(subtotal, countryId, method) {
		if (countryId == 'DE') {
			if (method == 'payone_recapi' || method == 'sevene_billpay_rec') {
				this.fee = '4.95';
			} else {
				this.fee = '0,00';
			}
		} else {
			if (subtotal < 100) {
				this.fee = '4.95';
			} else {
				this.fee = '0,00';
			}
		}
	},
	handlePostcodeValidation: function(countryId, type) {
		if (countryId == 'DE') {
			$(type + ':postcode').addClassName('validate-zip-de');
			$(type + ':postcode').removeClassName('validate-zip-international');
		} else {
			$(type + ':postcode').removeClassName('validate-zip-de');
			$(type + ':postcode').addClassName('validate-zip-international');
			$(type + ':postcode').removeClassName('validation-failed');
			if ($('advice-validate-zip-de-'+type+':postcode')) {
				$('advice-validate-zip-de-'+type+':postcode').hide();
			}
		}
	},
	checkUseCountry: function() {
		if ($('checkbox_free_shipping').getValue() == '1') {
			this.useCountry = 'shipping';
		} else {
			this.useCountry = 'billing';
		}
	},
	setBillingChanged: function() {
		$('billing:hasChanged').setValue(1);
		if ($('checkbox_free_shipping').getValue() == '1') {
			this.billingChanged = true;
			this.checkShippingSameAsBilling();
			$('shipping:same_as_billing').setValue('0');
		}
	},
	setShippingChanged: function() {
		this.shippingChanged = true;
		$('shipping:same_as_billing').setValue('0');
		$('shipping:hasChanged').setValue(1);
		this.checkShippingSameAsBilling();
	},
	resetChanged: function() {
		this.shippingChanged = false;
		this.billingChanged = false;
		$('shipping:same_as_billing').setValue('1');
	},
	checkShippingSameAsBilling: function() {
		if ($('checkbox_free_shipping').getValue() == '1') {
			if (this.billingChanged || this.shippingChanged) {
				this.shippingSameAsBilling = false;
			} else {
				this.shippingSameAsBilling = true;
			}
		} else {
			this.shippingSameAsBilling = true;
		}
		this.handlePaymentTypes(this.countryId);
	},
	getSubtotal: function() {
		/* get original subtotal - must be brutto! */
		var subtotal_old = $('original_subtotal').getValue();
		this.subtotal = subtotal_old.replace(',','.');
		return this.subtotal;
	},
	getDiscount: function() {
		/* get original discount - must be brutto! */
		var discount_old = $('original_discount').getValue();
		this.discount = discount_old.replace(',','.');
		return this.subtotal;
	},	
	setOrgFee: function() {
		var fee_old = $('processingfee').innerHTML.stripTags();
		this.orgFee = fee_old.replace(',','.');
		this.orgFee = this.orgFee.substring(0, this.orgFee.indexOf(".")+3);
		var tax_old = $('tax').innerHTML.stripTags();
		this.orgtax = tax_old.replace(',','.');
		this.orgtax = this.orgtax.substring(0, this.orgtax.indexOf(".")+3);
		var grandtotal_old = $('grand_total').innerHTML.stripTags();
		this.gradtotal = grandtotal_old.substring(21, grandtotal_old.length - 14).replace(',','.');
		this.getSubtotal();
		if ($('discount')) {
			var discount = $('discount').innerHTML.stripTags();
			this.discount = discount.substring(21, discount.length - 14).replace(',','.');
		}
	},
	overwriteTotals: function() {
		var isNetto = this.isNettoCountry();

		var fee = parseFloat(this.fee);
		var subtotal = parseFloat(this.subtotal);
		var discount = parseFloat(this.discount);
		
		if (isNetto) {
			subtotal = subtotal / 119 * 100;
			if (fee > 0) {
				fee = fee / 119 * 100;
			}
			if (discount > 0) {
				discount = discount / 119 * 100;
			}
		}
		
		var grand_total = subtotal+ fee+discount;
		grand_total = Math.round(grand_total*100)/100;
		grand_total = grand_total.toFixed(2);
		grand_total = grand_total.toString();

		var tax = 0;
		if (isNetto) {
			tax = 0;
		} else {
			tax = (grand_total / 119 * 19);
			tax = Math.round(tax*100)/100;
		}
		tax = tax.toFixed(2);
		tax = tax.toString();

		if (fee == 0) {
			fee = '0,00';
		} else {
			fee = Math.round(fee*100)/100;
		}
		fee = fee.toString();
		fee = fee.replace('.',',');
		
		subtotal = Math.round(subtotal*100)/100;
		subtotal = subtotal.toFixed(2);
		subtotal = subtotal.toString();
		subtotal = subtotal.replace('.', ',');

		$('subtotal').innerHTML = '<span class="price">' + subtotal + this.anhang + '</span>';
		$('processingfee').innerHTML = '<span class="price">' + fee + this.anhang + '</span>';
		$('grand_total').innerHTML = '<span class="price">' + grand_total.replace('.',',') + this.anhang + '</span>';
		$('tax').innerHTML = '<span class="price">' + tax.replace('.',',') + this.anhang + '</span>';

	},
	isNettoCountry: function() {
		this.checkUseCountry();
		this.getShippingCountryId();
		if (this.countryId == 'CH' || this.countryId == 'NO') {
			this.isNetto = true;
		} else {
			this.isNetto = false;
		}
		return this.isNetto;
	},
	handlePaymentTypes: function(countryId) {
		if (countryId == 'DE') {
			/* DE AND shipping same as billing - means all payment types */
			if (this.shippingSameAsBilling) {
				if ($('payment_method_box_payone_recapi'))
					$('payment_method_box_payone_recapi').show();
				if ($('payment_method_box_payone_elvapi'))
					$('payment_method_box_payone_elvapi').show();
				if ($('payment_method_box_sevene_billpay_elv'))
					$('payment_method_box_sevene_billpay_elv').show();
				if ($('payment_method_box_sevene_billpay_rec'))
					$('payment_method_box_sevene_billpay_rec').show();
			} else {
				if ($('payment_method_box_payone_recapi'))
					$('payment_method_box_payone_recapi').hide();
				if ($('payment_method_box_payone_elvapi'))
					$('payment_method_box_payone_elvapi').hide();
				if ($('payment_method_box_sevene_billpay_elv'))
					$('payment_method_box_sevene_billpay_elv').hide();
				if ($('payment_method_box_sevene_billpay_rec'))
					$('payment_method_box_sevene_billpay_rec').hide();
			}
		} else {
			/* all other countries do not have Invoice and ELV; first check, if one of these payment methods is selected */
			if ($('payment_method_box_payone_elvapi')) {
				if ($('p_method_payone_elvapi').getValue() == 'payone_elvapi') {
					$('p_method_payone_elvapi').setValue('');
				}
				$('payment_method_box_payone_elvapi').hide();
			}
			if ($('payment_method_box_payone_recapi')) {
				if ($('p_method_payone_recapi').getValue() == 'payone_recapi') {
					$('p_method_payone_recapi').setValue('');
				}
				$('payment_method_box_payone_recapi').hide();
			}
			if ($('payment_method_box_sevene_billpay_elv')) {
				if ($('p_method_sevene_billpay_elv').getValue() == 'sevene_billpay_elv') {
					$('p_method_sevene_billpay_elv').setValue('');
				}
				$('payment_method_box_sevene_billpay_elv').hide();
			}
			if ($('payment_method_box_sevene_billpay_rec')) {
				if ($('p_method_sevene_billpay_rec').getValue() == 'sevene_billpay_rec') {
					$('p_method_sevene_billpay_rec').setValue('');
				}
				$('payment_method_box_sevene_billpay_rec').hide();
			}
		}
	}
}

function datenschutzactiv(elementnr, aktiv) {
	var bild = $$('.datenschutz-table-pfeil');
	var menue = $$('.datenschutz-menue-pfeil');
	var menue2 = $$('.datenschutz-menue-text');
	var text = $$('span.text');
	if (aktiv == 1) {
		bild[elementnr].src = bild[elementnr].src.gsub('pfeil_grau.jpg', 'pfeil_weiss.jpg');
		menue[elementnr].style.backgroundColor = '#7d5d9f';
		menue2[elementnr].style.backgroundColor = '#7d5d9f';
		text[elementnr].style.color = '#fff';
	} else {
		bild[elementnr].src = bild[elementnr].src.gsub('pfeil_weiss.jpg', 'pfeil_grau.jpg');
		menue[elementnr].style.backgroundColor = '#fff';
		menue2[elementnr].style.backgroundColor = '#fff';
		text[elementnr].style.color = '#000';
	}
}

function jobsactiv(elementnr, aktiv) {
	var elemente = $$('.bild');
	var menue = $$('.jobs-menue');
	var text = $$('span.text');
	if (aktiv == 1) {
		elemente[elementnr].src = elemente[elementnr].src.gsub('pfeil_grau.jpg', 'pfeil_weiss.jpg');
		menue[elementnr].style.backgroundColor = '#7d5d9f';
		text[elementnr].style.color = '#fff';
	} else {
		elemente[elementnr].src = elemente[elementnr].src.gsub('pfeil_weiss.jpg', 'pfeil_grau.jpg');
		menue[elementnr].style.backgroundColor = '#fff';
		text[elementnr].style.color = '#000';
	}
}

function leerzeichenLoeschen(elementid) {
	 var newValue = $(elementid).value.gsub(' ','');
	 $(elementid).value = newValue;
	}

function paymentHinweisLayer(show, windowname) {
	var _overlay = $('payment-hinweis-inhalt').innerHTML;
	if (show == 1) {
		$(document.body).insert({top: _overlay});
	} else if(show == 0) {
		$('blanket').hide();
		$('paymentHinweis').hide();
	}
	if (show != 0) {
		blanket_size(windowname);
		window_pos(windowname);
		$('blanket').toggle();
	}
}

function popup(windowname) {
	var _overlay = '<!-- POPUP Blanket -->'
		+ '<div id="MyPopup" class="commentContainer">'
		+ '<div style="position:absolute; top:50%;left:50%;text-align: center;margin-left:-35px; margin-top:-10px;">'  
		+ '<table style="margin-left: -20px;"><tr><td><img src="/skin/frontend/7trends/default/images/checkout/opc-ajax-loader.gif" alt="" />&nbsp;</td>'
		+ '<td><span style="padding-top: 10px;"><b>Bitte warten...</b></span></td></tr></table>'
		+ '</div>'
		+ '</div>';

	$(document.body).insert({top: _overlay});
	
    blanket_size(windowname);
    window_pos(windowname);
    $('blanket').toggle();
}

//Dies ist eine Openx Function zum einbinden von den Promoboxen von Openx
function openx(zoneid, n)
{
   var m3_u = (location.protocol=='https:'?'https://visions.enamora.de/delivery/ajs.php':'http://visions.enamora.de/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid="+ zoneid);
   document.write ('&amp;n='+ n);
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}

function notrequierfilds() {
	var value = '';
	if ($('billing:country_id')) {
		var value = $('billing:country_id').options[$('billing:country_id').selectedIndex].value;
	} else if ($('shipping:country_id')) {
		var value = $('shipping:country_id').options[$('shipping:country_id').selectedIndex].value;
	}
	if (value == 'IE') {
		if ($('billing:postcode')) {
			$('billing:postcode').removeClassName('required-entry');
			$('billing:postcode').removeClassName('validation-failed');
		} else if ($('shipping:postcode')) {
			$('shipping:postcode').removeClassName('required-entry');
			$('shipping:postcode').removeClassName('validation-failed');
		}
		if ($('advice-required-entry-billing:postcode')) {
			$('advice-required-entry-billing:postcode').remove();
		}
		if ($('advice-required-entry-shipping:postcode')) {
			$('advice-required-entry-shipping:postcode').remove();
		}
	} else if($('billing:postcode') && $('billing:postcode').hasClassName('required-entry') == false) {
		$('billing:postcode').addClassName('required-entry');
	} else if($('shipping:postcode') && $('shipping:postcode').hasClassName('required-entry') == false) {
		$('shipping:postcode').addClassName('required-entry');
	}
}

function unsetadressrequierfields() {
	if ($('country').options[$('country').selectedIndex].value == 'IE') {
		$('zip').removeClassName('required-entry');
		$('zip').removeClassName('validation-failed');
		if ($('advice-required-entry-zip')) {
			$('advice-required-entry-zip').remove();
		}
	} else if($('zip').hasClassName('required-entry') == false) {
		$('zip').addClassName('required-entry');
	}
}

function switchAddToCartButton(select) {
	   var selectedOptions = $(select).getElementsBySelector('option');
	   var selection  = null;
	   for (var i = 0; i < selectedOptions.length; i++)
	   {
	      if (selectedOptions[i].selected)
	      {
	         selection = selectedOptions[i];
	         break;
	      }
	   }
	if(selection.value == ''){
		if(jQuery('#warenkorb-add-button').length) {
			$('warenkorb-add-button').hide();
			$('warenkorb-add-button-groesse').show();
		} else {
			jQuery('#form-button-neu').css({'backgroundPosition':'-364px -30px'});
		}
	}
} 
function switchBackAddToCartButton(imgsrc) {
	if(jQuery('#warenkorb-add-button').length) {
		$('warenkorb-add-button-groesse').hide();
		$('warenkorb-add-button').show();
	} else {
		jQuery('#form-button-neu').css({'backgroundPosition':'-364px 0'});
	}
}

function switchAddToCartButtonDetail() {
	if(jQuery('#size_val').val() == ''){
		if(jQuery('#warenkorb-add-button').length) {
			$('warenkorb-add-button').hide();
			$('warenkorb-add-button-groesse').show();
		} else {
			jQuery('#form-button-neu').css({'backgroundPosition':'-364px -30px'});
		}
	}
} 

function changeTrendsLooksImage(element, out) {
	$j('img.trends-looks-img-unten').each(function(index, s) {
		if (s.src.indexOf('_over') == -1 && s.src != element.src) {
			s.src = s.src.replace('.jpg', '_over.jpg');
		} else if(out == 'out') {
			s.src = s.src.replace('_over.jpg', '.jpg');
		} else {
			s.src = s.src.replace('_over.jpg', '.jpg');
		}
	});
}

var LooksTrends = Class.create();
LooksTrends.prototype = {
	initialize: function() {
		this.lastBlock = $j("#a1");
	    this.maxWidth = 276;
	    this.minWidth = 75;
	    this.activeBox = 'a1';
	    this.changeImages();
	},
	hoverEvent: function(element) {
		var _self = this;
		if (element.id != _self.activeBox) {
			setTimeout(function(){_self.animateEvent(element);}, 500);
			_self.activeBox = element.id;
		}
	},
	animateEvent: function(element) {
		var _self = this;
		// aufhellen, um einen Verlauf zu erzeugen, der der Maus folgt
		$j('#'+element.id+' div.inactive-area').fadeTo(500, 0);
		if (_self.activeBox == element.id) {
			$j(this.lastBlock).animate({width: this.minWidth+"px"},  {easing: "easeInSine", queue:false, duration:500} );
			$j(element).animate({width: this.maxWidth+"px"}, {easing: "easeInSine", queue:false, duration:500, complete:_self.completeFunction(element)});		
			this.lastBlock = $j(element);
		} else {
			// Verlauf wieder abdunkeln
			$j('#'+element.id+' div.inactive-area').fadeTo(200, 0.65);
		}
	},
	completeFunction: function(element) {
		var _self = this;
		_self.changeImageBig(element.id);
		// graue Fläche aus-/einblenden
		$j('#'+this.lastBlock.attr('id')+' a div').fadeTo(500, 0.65, function() {
			_self.changeImages();
		});
		$j('#'+element.id+' a div').fadeTo(500, 0);
		// senkrechten Text aus-/einblenden
		$j('#'+element.id+' a img').fadeTo(250, 0);
		$j('#'+this.lastBlock.attr('id')+' a img').fadeTo(250, 1);
		// Linkfläche anpassen
		$j('#'+element.id+' a').removeClass('minwidth');
		$j('#'+element.id+' a').addClass('maxwidth');
		$j('#'+_self.lastBlock.attr('id')+' a').removeClass('maxwidth');
		$j('#'+_self.lastBlock.attr('id')+' a').addClass('minwidth');
	},
	changeImages: function() {
		// alle Hintergrundbilder wechseln
		var _self = this;
		$j('.looks-trends-accordion li').each(function(index, s) {
			if(s.id != _self.activeBox) {
				// Bild tauschen
				document.getElementById(s.id).style.backgroundImage = "url(/static_content/looks/uebersicht/trend_klein_"+(index+1)+".jpg)";
			} else {
				document.getElementById(s.id).style.backgroundImage = "url(/static_content/looks/uebersicht/trend_"+(index+1)+".jpg)";
			}
		});
	},
	changeImageBig: function(id) {
		document.getElementById(id).style.backgroundImage = "url(/static_content/looks/uebersicht/trend_"+id.replace('a', '')+".jpg)";
	}
};

// replace Links, SEO-Optimization
jQuery(document).ready(function(){
	var links = new Array();
	links[0] = new Object();
	links[0]['js-aboutus'] = '<a href="/about-us/" class="font11px" style="color:#929191">Über uns</a>';
	links[0]['js-faq'] = '<a href="/hilfe/" class="font11px" style="color:#929191">FAQ</a>';
	links[0]['js-datenschutz'] = '<a href="/datenschutz/" class="font11px" style="color:#929191">Datenschutz</a>';
	links[0]['js-kontakt'] = '<a href="/kontakt/" class="font11px" style="color:#929191">Kontakt</a>';
	links[0]['js-presse'] = '<a href="http://presse.7trends.com/" class="font11px" target="_blank" style="color:#929191">Presse</a>';
	
	$j('.footer-js-link').each(function(index, s) {
		$j('#'+s.id).replaceWith(links[0][s.id]);
	});
});

var CustomEvent = function() {
	//name of the event
	this.eventName = arguments[0];
	var mEventName = this.eventName;

	//function to call on event fire
	var eventAction = null;

	//subscribe a function to the event
	this.subscribe = function(fn) {
		eventAction = fn;
	};

	//fire the event
	this.fireThickboxremove = function(sender, eventArgs) {
		if(eventAction != null) {
			eventAction();
		}
	};
};

var myEvent = new CustomEvent("Thickbox remove Event");
/* Styleguide Anfang */
var Styleguide = Class.create();
Styleguide.prototype = {
	initialize: function() {
		this.status = 'READY';
		this.aktRubrik = '';
		this.sliderStatus = 'READY';
		if(typeof(CookieJar) !== 'undefined') {
			styleguide_cookie = new CookieJar({
				expires:3600, // 1h in Sekunden
				path: '/'
			});
		}
		this.showhinweis = 1;
	},
	showstyle: function(categoryid,parentid,firstview) {
	  if (styleguide.status == 'READY'){
		  styleguide.status = 'LOADING';
		  	if(typeof firstview == 'undefined') {
		   		//$j('#styleguide').fadeTo(500, 0.2, function() { });
		   	} else {
		   		myEvent.subscribe(function() {
					jQuery('#styleguide-content').html('<div class="styleguide-loading-center"><img src="/skin/frontend/7trends/default/images/jqzoomloader.gif" /><br />Styleguide wird geladen...</div>');
					jQuery('#styleguide-next').html('');
					jQuery('#styleguide-pre').html('');
				});
				looks.showhinweis = 0;
		   	}
		   	var _self = this;
			 $j.ajax({
				url: "/mystyleguide/index/showAjaxStyle/category/"+categoryid+'/',
				dataType: "json",
				success: function(responseText){
				 	jQuery('#landing_info').remove();
			 		$j('#styleguide-content').html(responseText.content);
					if(responseText.pre_link != undefined) {
						$j('#styleguide-pre').html(
							responseText.pre_link
						);
					}
					if(responseText.next_link != undefined) {
						$j('#styleguide-next').html(
							responseText.next_link
						);
					}
					if(responseText.text != undefined) {
						$j('#styleguide-text').html(
								responseText.text
						);
					}
					//pagination
					if(responseText.pagination_pre != undefined) {
						$j('#sgpagination_content').empty();
						$j('#sgpagination_content').html(
								responseText.pagination_content
						);
					    _self.showStyleguideCarousel(responseText.count);
					}
					$j('.model-hinweis').remove();
					if(looks.showhinweis == undefined) {
				 		$j('#sgpagination').after(responseText.hinweis);
				 	}
					
					styleguide_cookie.put('styleguide', {category:categoryid,product_page:false,parentid:parentid});
                    if(typeof logOCPV !== 'undefined') {
						logOCPV('isconv=0|pover=/'+responseText.request_path);
					}
		      	},
		      	complete: function() {
		      		//$j('#styleguide').fadeTo(2000, 1.00);
		      		styleguide.status = 'READY';
		      	}
			});
	  }
	  return false;
	},
	showStyleguideCarousel: function(count) {
		if(count > 8) {
		   jQuery('#styleguide-slider-inner').SevenTrendsCarousel({
		        vertical: false,
		        itemsClass: 'sgpagination',
		        nextBtn: jQuery('#styleguide-scroll-right'),
		        prevBtn: jQuery('#styleguide-scroll-left')
			});
		    jQuery('#styleguide-scroll-right, #styleguide-scroll-left').show();
		} else {
		   	jQuery('#styleguide-scroll-right, #styleguide-scroll-left').hide();
		}
	},
	loadoldstyle: function(parentid) {
		var style_cookie = styleguide_cookie.get('styleguide');
		if(style_cookie != null){
			if (style_cookie.product_page == true && parentid == style_cookie.parentid) {
				styleguide.showstyle(style_cookie.category);
			}
		}
	},	
	setProductP: function(is_product_page) {
		var style_cookie = styleguide_cookie.get('styleguide');
		if(style_cookie != null){
			styleguide_cookie.put('styleguide', {category:style_cookie.category,product_page:is_product_page,parentid:style_cookie.parentid});
		}
	}
};

styleguide = new Styleguide();
/* Styleguide Ende */


function addLastCategoryUrl() {
    var lastUrl = Mage.Cookies.get('__catalog.lastCategoryUrl');
    if (lastUrl && lastUrl.length > 0) {
        var data = wt.customEcommerceParameter;
        data[14] = lastUrl;
        wt.customEcommerceParameter = data;
    }
}

function getSelectedProduct()
{
    if (typeof spConfig == 'undefined' || typeof spConfig.config == 'undefined') {
        return;
    }
    var selectedProductId;
	Object.keys(spConfig.config.attributes).each(
		function(element)
		{
			for(i=0;i<spConfig.config.attributes[element].options.length;i++)
			{
				if(spConfig.config.attributes[element].options[i].id == spConfig.state[element])
				{
					for(y=0;y<spConfig.config.attributes[element].options[i].allowedProducts.length;y++)
					{
						//guess :| that the last attribute/dropdown specifies the selected product
						//so after looping over all the last should be the selected productId :|
						selectedProductId = spConfig.config.attributes[element].options[i].allowedProducts[y];
					}
				}
			}
		}
	);
    return selectedProductId;
}

function updateQuantityCart(price, qty, total) {
	var cart_total = jQuery('#grand_total').children().text().replace(' €', '').replace('.', '').replace(',', '.');
	if (cart_total - parseFloat(total) + (qty * price) <= 1500) {
		document.getElementById('form_warenkorb').submit();
	} else {
		document.location.href = '/checkout/cart/';
	}	
}
/* Breadcrumbs Anfang */
var Breadcrumbs = Class.create();
Breadcrumbs.prototype = {
	initialize: function() {
		this.site = new Array();
		this.site["brand_url"] = '/marken/';
		this.site["brand_name"] = 'Marken';
		this.site["fashionguide_url"] = '/fashion-guide/';
		this.site["fashionguide_name"] = 'Fashion von A-Z';
		this.site["premium_url"] = '/designer/';
		this.site["premium_name"] = 'Premium';
		this.site["sale_url"] = '/sale/';
		this.site["sale_name"] = 'Outlet';
		this.site["damen_url"] = '/damenmode/';
		this.site["damen_name"] = 'Damen';
		this.site["herren_url"] = '/herrenmode/';
		this.site["herren_name"] = 'Herren';
		this.site["default_url"] = '/';
		this.site["default_name"] = '7trends';
		this.site["trendsstyles_url"] = '/trends-styles/';
		this.site["trendsstyles_name"] = 'Trends & Styles';
		this.site["shopbytrend_url"] = '/trendshopping/';
		this.site["shopbytrend_name"] = 'Shop by Trend';
		this.cookie_name = 'crumbs_info';
		this.cookie_lastsite = 'lastsite';
		this.cookie_product_skip = 'productskip';
		this.akt_index = '';
		
		if(typeof(CookieJar) !== 'undefined') {
			this.crumbs = new CookieJar({
				expires:3600, // 1h in Sekunden
				path: '/'
				});
			this.lastsite = new CookieJar({
				expires:600, // 10min in Sekunden
				path: '/'
				});
			product_skip = new CookieJar({
				expires:7200, // 2h in Sekunden
				path: '/'
				});
		}
	},
	storeBreadcrumbs: function(var_url, var_name, var_site, var_category_id, var_parentname, var_parenturl) {
		var last_sites = this.crumbs.get(this.cookie_name);
		var new_last_sites = new Array();
		var site_set = false;
		
		if(typeof(var_category_id) != 'undefined') {
			product_skip.put(this.cookie_product_skip, var_category_id);
		} else {
			var_category_id = 0;
		}
		var last_site_cookie = this.lastsite.get(this.cookie_lastsite);
		var site = new Array();
		if(last_site_cookie == null) {
			site[0] = var_url;
		} else {
			var c_lastsite = last_site_cookie;
			site[0] = var_url;
			site[1] = c_lastsite[0];
		}
		if(last_sites == null){
			//noch kein Cookie gesetzt
			new_last_sites[0]= {url:var_url, name:var_name, site:var_site, category_id:var_category_id, parent_n:var_parentname, parent_u:var_parenturl};		
			this.crumbs.put(this.cookie_name, new_last_sites);
			this.lastsite.put(this.cookie_lastsite, site);
		} else {
			//Cookie bereits gesetzt
			if (last_sites[0].site != var_site) {
				// anderer Ausgangspunkt, Cookie zurücksetzen
				last_sites = new Array();
				new_last_sites[0] = {url:var_url, name:var_name, site:var_site, category_id:var_category_id, parent_n:var_parentname, parent_u:var_parenturl};
			} else {
				// der selbe Ausgangspunkt
				for(var index=0; index < last_sites.length; index++){
					if (var_site == 'fashionguide' && var_url != '/fashion-guide/' && var_name.length > 1) {
						// Cookie erweitern
						new_last_sites[index] = {url:last_sites[index].url, name:last_sites[index].name, site:last_sites[index].site, category_id:last_sites[index].var_category_id};
					}
					if (last_sites[index].url == var_url) {
						site_set = true;
					}
				}
				if (site_set == false) {
					new_last_sites[last_sites.length] = {url:var_url, name:var_name, site:var_site, category_id:var_category_id, parent_n:var_parentname, parent_u:var_parenturl};
				}
			}
			if (new_last_sites.length > 0) {
				this.crumbs.put(this.cookie_name, new_last_sites);
			}
			this.lastsite.put(this.cookie_lastsite, site);
		}
		
		last_sites = this.crumbs.get('crumbs_info');
	},
	getBreadcrumbs: function(department, productname) {
		var last_sites = this.crumbs.get(this.cookie_name);
		var html_start = "<ul>";
		var html_li = '';
		var html_end = "</ul>";
		var length = 0;
		var html = html_start.concat(html_li);
		// Startseite und Oberkategorie werden fest gesetzt
		var html_fixcategory = '';
		if (last_sites != null && last_sites[0].site == 'suchergebnis') {
			html_fixcategory = this.getDefaultBreadcrumb(html_fixcategory, department);
			html = html.concat(html_fixcategory);
		} else if(last_sites != null){
			// Cookie vorhanden
			// Oberkategorie wird fest gesetzt
			if (typeof(this.site[last_sites[0].site+"_url"]) != 'undefined') {
				html_fixcategory += "<li>" +
				"<a href='"+this.site[last_sites[0].site+"_url"]+"' title='"+this.site[last_sites[0].site+"_name"]+"' name='text-breadcrumb'>" +
				this.site[last_sites[0].site+"_name"]+
				"</a>" +
				this.getArrowImage() +
				"</li>";
				length = length + this.site[last_sites[0].site+"_name"].length+3;
			}
			if(typeof(last_sites[0].parent_n) != 'undefined' && last_sites[0].parent_n != 'Marken' && typeof(last_sites[0].parent_u) != 'undefined')  {
				html_fixcategory += "<li>" +
				"<a href='"+last_sites[0].parent_u+"' title='"+last_sites[0].parent_n+"' name='text-breadcrumb'>" +
				last_sites[0].parent_n+
				"</a>" +
				this.getArrowImage() +
				"</li>";
				length = length + last_sites[0].parent_n.length+3;
			}
			html_li = html_li.concat(html_fixcategory);
			for(var i=0; i<last_sites.length; i++){
				// Oberkategorie nicht noch einmal setzen
				if( typeof(last_sites[i].url) != 'undefined' && last_sites[i].url != this.site[last_sites[0].site+"_url"] && last_sites[i].url != '/') {
					if(last_sites[i].name.length + productname.length - 57 > 0) {
						// Breadcrumbs kürzen
						var limit = last_sites[i].name.length + productname.length - 57;
						if(last_sites[i].name.length - limit > 0) {
							last_sites[i].name = last_sites[i].name.substr(0, last_sites[i].name.length - limit)+'...';
						}
					}
					var html_tmp = "<li>" +
					"<a href='"+last_sites[i].url+"' title='"+last_sites[i].name+"' name='text-breadcrumb'>" +
					last_sites[i].name+
					"</a>" +
					this.getArrowImage() +
					"</li>";
					html_li = html_li.concat(html_tmp);
					length = length + this.site[last_sites[0].site+"_name"].length+3;
				}
			}
			var html = html_start.concat(html_li);
		} else {
			// kein Cookie vorhanden, Default Breadcrumbs generieren
			html_fixcategory = this.getDefaultBreadcrumb(html_fixcategory, department);
			html = html.concat(html_fixcategory);
		}
		var last_site_cookie = this.lastsite.get(this.cookie_lastsite);
		var site = new Array();
		if(last_site_cookie == null) {
			site[0] = location.href;
		} else {
			var c_lastsite = last_site_cookie;
			site[0] = location.href;
			site[1] = c_lastsite[0];
		}
		this.lastsite.put(this.cookie_lastsite, site);
		var html_name = this.getProductNameHtml(productname, length);
		html = html.concat(html_name);
		html = html.concat(html_end);
		jQuery('.breadcrumbs').html(html);
	},
	getProductSkip: function(productid) {
		var _self = this;
		var category_id;
		var produkte_array;
		var products = product_skip.get(this.cookie_product_skip);
		
		if (products != null) {
			var produkte = products.split("|");
			jQuery.each(produkte, function(index, s) {
				if (index==0) {
					category_id = s;
				}				
			  });
			// vorherige Seiten vorhanden
			if(produkte.length == 1) {
				// noch keine Produkte im Cookie
				// die nächsten und vorherigen 5 Produkte holen
				this.loadDataToCookie(productid, category_id);
			} else {
				// Produkte enthalten, in Array umwandeln
				produkte_array = this.convertToArray(produkte);
				jQuery.each(produkte_array, function(index, s) {
					if (s.entityid == productid) {
						  _self.akt_index = parseInt(index);
					}
				  });
				if (typeof _self.akt_index == 'string' || (typeof(produkte_array[_self.akt_index+1]) == 'undefined' && produkte_array[_self.akt_index].pos < produkte_array[_self.akt_index].anzahl) || (typeof(produkte_array[_self.akt_index-1]) == 'undefined' && produkte_array[_self.akt_index].pos > 1)) {
					this.loadDataToCookie(productid, category_id);
				} else {
					_self.showSkipHtml(produkte_array);
				}
			}
			jQuery('div.productskip').live('mouseover', function(){
	            jQuery('div.skip_image',this).css('display','block');
	            jQuery('a',this).css('text-decoration','underline');
			});
			jQuery('div.productskip').live('mouseout', function(){
            	jQuery('div.skip_image',this).css('display','none');
            	jQuery('a',this).css('text-decoration','none');
			});
		}
	},
	convertToArray: function(produkte) {
		var count = 0;var categoryid;var entity_id;var var_name;var var_url;var var_image_url;var var_pos;var gesamtanzahl;
		var new_products = new Array();
		jQuery.each(produkte, function(index, s) {
			if (index==0) {
				categoryid = parseInt(s);
			} else if(index == 1 || index == count*8+1) {
				entity_id = parseInt(s);
			} else if(index == 2 || index == count*8+2) {
				var_name = s;
			} else if(index == 3 || index == count*8+3) {
				var_url = s;
			} else if(index == 4 || index == count*8+4) {
				var_image_url = s;
			} else if(index == 5 || index == count*8+5) {
				var_pos = parseInt(s);
			} else if(index == 6 || index == count*8+6) {
				gesamtanzahl = parseInt(s);
			} else if(s == '#') {
				new_products[count] = {category_id:categoryid, entityid:entity_id, name:var_name, url:var_url, image_url:var_image_url, pos:var_pos, anzahl:gesamtanzahl};
				count++;
			}
		  });
		return new_products;
	},
	showSkipHtml: function(products) {
		var img_ers1 = '/media/catalog/product/cache/resized';
		var img_ers2 = '/media/images';
		var img_ers3 = '/media/catalog/product/cache/1/thumbnail/82x129';
		var html = '';
		if(this.akt_index > 0) {
			// Vorgänger
			products[this.akt_index-1].image_url = products[this.akt_index-1].image_url.replace('i_ers1', img_ers1);
			products[this.akt_index-1].image_url = products[this.akt_index-1].image_url.replace('i_ers2', img_ers2);
			products[this.akt_index-1].image_url = products[this.akt_index-1].image_url.replace('i_ers3', img_ers3);
			html += '<div class="floatleft productskip">';
			html += '<div class="skip_imagel skip_image"><a href="'+products[this.akt_index-1].url+'" name="image-productskip"><img src="'+products[this.akt_index-1].image_url+'" alt="'+products[this.akt_index-1].name+'" title="'+products[this.akt_index-1].name+'" class="product-skip-image" /></a></div>';
			html += '<a href="'+products[this.akt_index-1].url+'" name="text-productskip"><span class="product_sprite skip_image-left"></span> vorheriges Produkt</a>';
			html += '</div>';
		}
		html += '<div class="floatleft product-skip-anzahl">&nbsp;'+(products[this.akt_index].pos)+' von '+products[this.akt_index].anzahl+'&nbsp;</div>';
		if (typeof(products[this.akt_index+1]) != 'undefined') {
			// Nachfolger
			products[this.akt_index+1].image_url = products[this.akt_index+1].image_url.replace('i_ers1', img_ers1);
			products[this.akt_index+1].image_url = products[this.akt_index+1].image_url.replace('i_ers2', img_ers2);
			products[this.akt_index+1].image_url = products[this.akt_index+1].image_url.replace('i_ers3', img_ers3);
			html += '<div class="floatleft productskip">';
			html += '<a href="'+products[this.akt_index+1].url+'" name="text-productskip" class="floatleft">nächstes Produkt </a><span class="product_sprite skip_image-right"></span>';
			html += '<div class="skip_imager skip_image"><a href="'+products[this.akt_index+1].url+'" name="image-productskip"><img src="'+products[this.akt_index+1].image_url+'" alt="'+products[this.akt_index+1].name+'" title="'+products[this.akt_index+1].name+'" class="product-skip-image" /></a></div>';
			html += '</div>';
		}
		jQuery('.product_skip').html(html);
	},
	loadDataToCookie: function(productid, categoryid) {
		var _self = this;
		if (jQuery.browser.msie) {
			var number_get = 3;
		} else {
			var number_get = 5;
		}
		jQuery.ajax({
			url: "/mycatalog/index/getPrevNextProducts/",
			data: "category_id="+categoryid+"&product_id="+productid+"&number_get="+number_get,
			dataType: "json",
			success: function(responseText){
				if(responseText.status == 'ok') {
				  var productdata = responseText.product_data;
				  var new_products = '';
				  var produkte_array;
				  jQuery.each(productdata, function(index, s) {
					  if (s.entityid == productid) {
						  _self.akt_index = index;
					  }
					  //new_products[index] = {category_id:categoryid, entityid:s.entityid, name:s.name, url:s.url, image_url:s.image_url, pos:s.pos, anzahl:responseText.anzahl};
					  new_products += categoryid + '|' + s.entityid + '|' + s.name + '|' + s.url + '|' + s.image_url + '|' + s.pos + '|' + responseText.anzahl + '|#|';
				  });
				  // Produkte ins Cookie schreiben
				  product_skip.put(_self.cookie_product_skip, new_products);
				  var produkte = new_products.split("|");
				  produkte_array = _self.convertToArray(produkte);
				  _self.showSkipHtml(produkte_array);
			  } else {
				 // Cookie löschen
				  product_skip.remove(_self.cookie_product_skip);
			  }
	      	}
		});
	},
	remove: function() {
		this.crumbs.remove(this.cookie_name);
	},
	getArrowImage: function() {
		var arrowimage = '<span class="span_breadcrumb product_sprite"></span>';
		return arrowimage;
	},
	getDefaultBreadcrumb: function(html_fixcategory, department) {
		if (department == 'damen' || department == 'herren') {
			html_fixcategory += this.getStartseiteHtml();
			html_fixcategory += "<li>" +
			"<a href='"+this.site[department+"_url"]+"' title='"+this.site[department+"_name"]+"' name='text-breadcrumb'>" +
			this.site[department+"_name"]+
			"</a>" +
			this.getArrowImage() +
			"</li>";
		}
		return html_fixcategory;
	},
	getProductNameHtml: function(productname, length) {
		if(length + productname.length - 91 > 0) {
			// Breadcrumbs kürzen
			var limit = length + productname.length - 91;
			if(productname.length - limit > 0) {
				productname = productname.substr(0, productname.length - limit)+'...';
			}
		}
		var html_name = "<li><span class='last-breadcrumb'>"+productname+"</span></li>";
		return html_name;
	},
	getStartseiteHtml: function() {
		var html_startseite = "<li>" +
		"<a href='/' title='7trends Startseite' name='text-breadcrumb'>Startseite</a>" +
		this.getArrowImage() +
		"</li>";
		return html_startseite;
	}
};

var breadcrumbs = new Breadcrumbs();
/* Breadcrumbs Ende */

// Video Detailseite
function toggleVideo(filename, link) {
	jQuery('#imageResWeb').toggle();
	jQuery('.lupe-produktdetail').toggle();
	showVideo("video_container", filename, 260, 420, true, link);
	if( jQuery('#imageResWeb').is(':visible') ) {
		jQuery('#video_container').hide();
		jQuery('.img_gallery_front, .img_gallery_back').show();
		jQuery('.video_switch').attr({src:'/skin/frontend/7trends/default/images/product/bt_laufstegvideo_ansehen.jpg', alt:'Laufstegvideo ansehen', title:'Laufstegvideo ansehen'});
	} else {
		wt.sendinfo({linkId:'productvideo_'+filename});
        logOCPV('isconv=0|pover=/product/video/');
		jQuery('.img_gallery_front, .img_gallery_back').hide();
		jQuery('.video_switch').attr({src:'/skin/frontend/7trends/default/images/product/bt_zurueck_zum_foto.jpg', alt:'Zurück zum Foto', title:'Zurück zum Foto'});
	}
}

function showVideo(div_id, filename, width, height, autostart, link) {
	if(typeof jwplayer != 'undefined') {
		jwplayer(div_id).setup({
			id: filename,
			flashplayer: "/static_content/video/player.swf",
			file: "/static_content/video/flv/"+filename+".flv",
			height: height,
			width: width,
			image: "/static_content/video/jpg/"+filename+".jpg",
			screencolor: 'ffffff',
			autostart: autostart/*,
			plugins: "fbit-1",
			dock: true,
			link: link*/
		});
	}
}
function video_play() {
	jwplayer('video_layer_flv').play(true);
}
// Video Detailseite Ende
function show_info_layer(menuitem,advicediv, left, top, show) {
	if ( jQuery(menuitem).length)
 	{
	 	if(typeof show =='undefined') {
	 		show = 1;
	 	}
	 	var position = jQuery(menuitem).position();
		jQuery(advicediv).css('left',position['left'] +left);
	 	jQuery(advicediv).css('top',position['top'] - top);
	 	if(jQuery(advicediv).is(':visible') && show == 0) {
	    	jQuery(advicediv).fadeOut("slow", function () {});
	    } else {
	    	jQuery('.info_layer').fadeOut("slow", function(){});
	    	jQuery(advicediv).fadeIn("slow", function () {});
	    }
 	}
}

function close_info_layer(menuitem,advicediv) {
	if ( jQuery(menuitem).length)
 	{
	   	jQuery(advicediv).fadeOut("slow", function(){});
 	}
}

function mycarousel_initCallback(carousel) {
	    jQuery('.jcarousel-control a').bind('click', function() {
	        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
	        return false;
	    });
	    jQuery('.jcarousel-scroll select').bind('change', function() {
	        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
	        return false;
	    });
	    jQuery('#mycarousel-next').bind('click', function() {
	        carousel.next();
	        return false;
	    });
	    jQuery('#mycarousel-prev').bind('click', function() {
	        carousel.prev();
	        return false;
	    });    
};
function productImgCarousel_initCallback(carousel) {
	var intervall;
	jQuery('#product_img_caruosel-next').bind('mouseover', function() {
	    intervall = window.setInterval(function() {
	    	carousel.next();
	    }, 1000);
	    return false;
	});
	jQuery('#product_img_caruosel-prev').bind('mouseover', function() {
	    intervall = window.setInterval(function() {
	    	carousel.prev();
	    }, 1000);
	    return false;
	});
	jQuery('#product_img_caruosel-next').bind('mouseleave', function() {
		window.clearInterval(intervall);
	});
	jQuery('#product_img_caruosel-prev').bind('mouseleave', function() {
		window.clearInterval(intervall);
	});
}
function pclose(){
	if(jQuery(document).find('.super-attribute-select').length && jQuery.browser.msie && parseFloat(jQuery.browser.version) < 7)
	{
         if(selectbox_display){
			jQuery(document).find('.super-attribute-select').show();
		}
	}
	var lastsite = Mage.Cookies.get('__7Trends_lastsite');
	if(lastsite != null) {
		var last = (unescape(lastsite)).evalJSON();
		if(last[1] != null) {
		
		}
	}
	closeCartLayer();
}
function formstvFootersubmit(redirect, referrer, success_element, mail_element){
  var aid = 16761;
  if(referrer == 'Footer') {
	  var aid = 32025;
  }
  if(referrer == 'undefined') {
  	var referrer = 'Footer';
  }
  if(success_element == 'undefined') {
  	var success_element = 'erfolgFooter1';
  }
  if(typeof mail_element == 'undefined') {
  	var mail_element = 'newsletterfooter';
  }
  var req = new Ajax.Request('/utils/newsletteranmeldung/stv.php', { 
		method:'get',
		parameters: {
			par: 'AID='+aid+'&ACTION=NEW&RED='+redirect+'&referrer1='+referrer+'&is_custome=0&is_subscriber=1',
			email: $(mail_element).value,
			gender: $('newsletter-gender').value
		},
		onLoading: function() {
            jQuery('#mailanmeldung_submit_footer').hide();
			$(success_element).innerHTML = ' Bitte warten...';
		},
		onSuccess: function(){
			jQuery('#newsletter-text').hide();
			if(success_element == 'erfolgFooter1') {
				$(success_element).innerHTML = 'Du erhältst in Kürze einen Bestätigungslink per E-Mail.';
			} else {
				$(success_element).innerHTML = 'Anmeldung erfolgreich';
			}
		}
	});
return false;
}
var SimpleSelector = function(settings) {
    if (typeof settings.productId == 'undefined') {
        throw 'Product ID not defined';
    }
    if (typeof settings.sizeSelector == 'undefined') {
        throw 'Size selector not defined';
    }
    if (typeof settings.colorSelector == 'undefined') {
        throw 'Color selector not defined';
    }
    if (typeof settings.colorKey == 'undefined') {
        throw 'Color key not defined';
    }
    if (typeof settings.basePrice == 'undefined') {
        throw 'Base price not defined';
    }
    if (typeof settings.simples == 'undefined' && typeof settings.simples != 'object') {
        throw 'Simples not defined';
    }

    var connections   = {};
    var attributeData = {};
    var currentPrice  = 0;
	var hasColors     = false;

    (function() {
        //process all super attributes
        for (var attributeId in settings.simples) {
            if (attributeId != settings.colorKey) {
                //sets the super attribute-id for size because this can differ
                //depending on attribute set
                settings.sizeKey = attributeId;
            }
            for (var optionI = 0; optionI < settings.simples[attributeId].options.length; ++optionI) {
                var option = settings.simples[attributeId].options[optionI];
                if (typeof attributeData[attributeId] == 'undefined') {
                    attributeData[attributeId] = {};
                }
                attributeData[attributeId][option.id] = option;
                for (var productI = 0; productI < option.products.length; ++productI) {
                    //creates a field for each field, super attribute and option
                    if (typeof connections[option.products[productI]] == 'undefined') {
                        connections[option.products[productI]] = {};
                    }
                    if (typeof connections[option.products[productI]][attributeId] == 'undefined') {
                        connections[option.products[productI]][attributeId] = {};
                    }
                    if (typeof connections[option.products[productI]][attributeId][option.id] == 'undefined') {
                        connections[option.products[productI]][attributeId][option.id] = parseFloat(option.price);
                    }
                }
            }
        }
    })(); //end generating simple-connections

    var renderColorOptions = function() {
        var availableColors = [];
        for (var i in connections) {
            if (typeof connections[i][settings.colorKey] != 'undefined') {
                for (var optionId in connections[i][settings.colorKey]) {
                    if (!availableColors.inArray(optionId)) {
                        availableColors[availableColors.length] = optionId;
                    }
                }
            }
        }
		if (availableColors.length == 0) {
			hasColors = false;
		} else {
			hasColors = true;
		}
        settings.colorSelector.html('<option value="0">Farbe wählen...</option>');
        for (var i = 0; i < availableColors.length; ++i) {
            settings.colorSelector.append(jQuery('<option value="' + attributeData[settings.colorKey][availableColors[i]].id + '">' + attributeData[settings.colorKey][availableColors[i]].label + '</option>'));
        }
    }
    renderColorOptions();

    var renderSizeOptions = function() {
        var options      = settings.sizeSelector.find('option');
        options.each(function(i, obj) {
            var option = jQuery(obj);
            var diff = parseFloat(option.attr('priceDifference'));

            var finalPrice = settings.basePrice + diff;
            var diffLabel  = '';
            if (finalPrice != currentPrice) {
                if (finalPrice > currentPrice) {
                    diffLabel += '(+';
                } else {
                    diffLabel += '(';
                }
                diffLabel += (finalPrice - currentPrice).toFixed(2) + ' €)';
            }
            if (i == 0) {
                //Bitte auswählen..
                option.html(option.attr('_label'));
            } else {
                option.html(option.attr('_label') + (diffLabel != '' ? ' ' + diffLabel : ''));
            }
        });

        if (typeof settings.renderCallback == 'function') {
            settings.renderCallback(settings.productId, currentPrice, settings.basePrice);
        }
    }

    var getSizeOptionsByColor = function(color) {
        var availableSizes = [];
        if (!hasColors) {
			color = -1;
		}
        
        for (var i in connections) {
            if ((typeof connections[i][settings.colorKey] != 'undefined' && typeof connections[i][settings.colorKey][color] != 'undefined') || !hasColors) {
				if (typeof connections[i][settings.sizeKey] != 'undefined') {
                    for (var sizeOptionId in connections[i][settings.sizeKey]) {
                        availableSizes[availableSizes.length] = sizeOptionId;
                    }
                }
            }
        }
        var out = [];
        for (var i = 0; i < availableSizes.length; ++i) {
            if (typeof attributeData[settings.sizeKey][availableSizes[i]] != 'undefined') {
                out[out.length] = {
                    label: attributeData[settings.sizeKey][availableSizes[i]].label,
                    id: attributeData[settings.sizeKey][availableSizes[i]].id,
                    price: parseFloat(attributeData[settings.sizeKey][availableSizes[i]].price),
                    order: parseInt(attributeData[settings.sizeKey][availableSizes[i]].order)
                }
            }
        }

        out.sort(function(a, b) {
            return a.order > b.order ? 1 : -1;
        });
        return out;
    } //end getSizeOptionsByColor

    var selectSizeOption = function() {
        if (settings.sizeSelector.val() == '') {
            return;
        }
        var newOption       = settings.sizeSelector.find('option[value="' + settings.sizeSelector.val() + '"]');

        currentPrice = settings.basePrice + (newOption.attr('priceDifference') != undefined ? parseFloat(newOption.attr('priceDifference')) : 0);
        renderSizeOptions();
    } //end selectSizeOption

    var loadSizeOptions = function() {
        var color    = settings.colorSelector.val();
        var options  = getSizeOptionsByColor(color);
        currentPrice = settings.basePrice;

        settings.sizeSelector.html('<option selected="selected" label="Größe wählen..." priceDifference="0" value="0">Größe wählen...</option>');
        for (var i = 0; i < options.length; ++i) {
            settings.sizeSelector.append(jQuery('<option _label="' + options[i].label + '" priceDifference="' + options[i].price + '" value="' + parseInt(options[i].id) + '">' + options[i].label + '</option>'));
        }

        selectSizeOption();
        settings.sizeSelector.removeAttr('disabled');
    } //end loadSizeOptions

    settings.colorSelector.change(loadSizeOptions);
    settings.sizeSelector.change(selectSizeOption);
    loadSizeOptions();

    return {
        selectColor: function(colorId) {
            settings.colorSelector.find('option[value="' + colorId + '"]').attr('selected', 'selected');
            loadSizeOptions();
        }
    }
    
}

function selectProductSize(element) {
	jQuery('#size_val').val(element.attr('val'));
	jQuery('.size_option').removeClass('size_selected');
	jQuery(element).addClass('size_selected');
	jQuery('.warenkorb_box .regular-price').text(element.attr('price')+' €');
	if(element.attr('val') == '' && jQuery('#availability_txt').length > 0) {
		jQuery('#availability_txt').css({'visibility':'hidden'});
	} else {
		jQuery('#availability_txt').css({'visibility':'visible'});
	}
}

function showColorSizes(value) {
	jQuery('.sizeboxes').hide();
	jQuery('#color_'+value+', #size_boxes_text').show();
	jQuery('.sizeboxes .size_selected').removeClass('size_selected');
	if(value== '') {
		jQuery('#size_boxes_text').hide();
		jQuery('#availability_txt').css({'visibility':'hidden'});
	}
}

function showPassformlayer(layer_height, layer_width) {
	// Korrektur der Höhe vom Passformlayer
	tb_show('', '#TB_inline?height='+layer_height+'&width='+layer_width+'&inlineId=produktmass_guide&headlinetext= ', '');
	var korrektur = 0;
	if (jQuery.browser.msie && (jQuery.browser.version == '7.0' || jQuery.browser.version == '6.0')) {
		var korrektur = -20
	}
	if(jQuery('.passform-layer-passform-hinweise').height() < 103) {
		jQuery('.produktmass_guide #TB_ajaxContent').css('height', layer_height + 103 + korrektur);
	} else {
		jQuery('.produktmass_guide #TB_ajaxContent').css('height', layer_height + jQuery('.passform-layer-passform-hinweise').height() + korrektur);
	}
}

function changeCheckbox(event) {
        /* get checkbox */
        var labelFor = jQuery(event).attr('for');

        if (jQuery('#'+labelFor).attr('checked')) {
            /* uncheck */
            jQuery(event).removeClass('filter-checked-new');
            jQuery(event).addClass('filter-unchecked-new');
            if(jQuery.browser.msie) {
            	jQuery('#'+labelFor).attr('checked', '');
            }
        } else {
            /* check */
            jQuery(event).removeClass('filter-unchecked-new');
            jQuery(event).addClass('filter-checked-new');
            if(jQuery.browser.msie) {
            	jQuery('#'+labelFor).attr('checked', 'checked');
            }
        }
}

/**
 * Category-Teasers
 */
var teaserData = {};

var teaserItemPrev = function(key) {
    var data = teaserData[key];
    if (data.index == 0) {
        data.index = data.items.size() - 1;
    } else {
        --data.index;
    }
    data.items.css('display', 'none');
    data.items.get(data.index).style.display = 'block';
}

var teaserItemNext = function(key) {
    var data = teaserData[key];
    if (data.index == data.items.size() - 1) {
        data.index = 0;
    } else {
        ++data.index;
    }
    data.items.css('display', 'none');
    data.items.get(data.index).style.display = 'block';
}
var categoryTeasercarousels = {};

var categoryTeasercarousels = {};

/**
 * filtering via url
 */
var useStaticBehavior = true;

var usePagination     = true;

if (typeof usePagination == 'undefined' || !usePagination) {
    document.write('<style type="text/css">.pagination_box {display: none !important;}</style>');
}

var categoryTeaserPrev = function(key) {
    if (categoryTeasercarousels[key].current == 0) {
        categoryTeasercarousels[key].current = categoryTeasercarousels[key].items.length - 1;
    } else {
        --categoryTeasercarousels[key].current;
    }
    var map = jQuery('map[name="imagemap-' + key + '-' + categoryTeasercarousels[key].items[categoryTeasercarousels[key].current] + '"]');
    jQuery('#teaser-carousel-' + key).attr('src', categoryTeasercarousels[key].path + categoryTeasercarousels[key].items[categoryTeasercarousels[key].current] + '.jpg');

    if (map.length > 0) {
        jQuery('#teaser-carousel-' + key).attr('usemap', '#' + map.attr('name'));
    }

};

var categoryTeaserNext = function(key) {
    if (categoryTeasercarousels[key].current == categoryTeasercarousels[key].items.length - 1) {
        categoryTeasercarousels[key].current = 0;
    } else {
        ++categoryTeasercarousels[key].current;
    }
    var map = jQuery('map[name="imagemap-' + key + '-' + categoryTeasercarousels[key].items[categoryTeasercarousels[key].current] + '"]');
    jQuery('#teaser-carousel-' + key).attr('src', categoryTeasercarousels[key].path + categoryTeasercarousels[key].items[categoryTeasercarousels[key].current] + '.jpg');


    if (map.length > 0) {
        jQuery('#teaser-carousel-' + key).attr('usemap',  '#' + map.attr('name'));
    }
};
/**
 * Category-Teasers end
 */
function loadNewsletterlayerBig(referrer) {
	var layer = '<div id="nllayer" style="position:absolute;display:none;z-index:10002;width:620px;height:545px">'+
			'<form onsubmit="return sendNLRegistration(\''+referrer+'\')" id="nl-validate-detail-layer" name="layer_frmMailSolution" method=\'get\' action=\'/utils/newsletteranmeldung/stv.php\'>'+
			'<input type=\'hidden\' name=\'AID\' value=\'32025\'>'+
			'<input type=\'hidden\' name=\'ACTION\' value=\'NEW\'>'+
			'<input type=\'hidden\' name=\'RED\' value=\'http://www.7trends.de/\'>'+
			'<input type=\'hidden\' name=\'referrer1\' value='+referrer+'>'+
			'<input type=\'hidden\' name=\'is_customer\' value=\'0\'>'+
			'<input type=\'hidden\' name=\'is_subscriber\' value=\'1\'>'+
		'<div class="newsletterlayer_box" style="position:absolute;margin:343px 0 0 22px;font-family:verdana;font-size:9px; color: #454444">'+
			 '<span id="nl_layer_box">'+
				 '<div style="position:absolute;margin-top:-2px"><input type="text" value="Deine E-Mail-Adresse" onclick="if(this.value == \'Deine E-Mail-Adresse\') {this.value=\'\';}" id="newsletterfooter_layer" class="required-entry validate-email input-text" name="email" /></div>'+
				 '<div class="nl_layer_damen_txt" onclick="jQuery(\'#nl-w-big\').click()" style="margin: -3px 0 0 163px"></div>'+
				 '<div class="nl_layer_herren_txt" onclick="jQuery(\'#nl-m-big\').click()" style="margin: -3px 0 0 280px"></div>'+
				 '<div class="checkbox_haken_active" id="nl-w-big" style="position: absolute;margin: -2px 0 0 260px;cursor:pointer" onclick="if(jQuery(this).hasClass(\'checkbox_haken_active\')) { jQuery(this).removeClass(\'checkbox_haken_active\').addClass(\'checkbox_haken_inactive\'); jQuery(\'#nl_radio_w\').attr(\'checked\', \'\'); } else { jQuery(this).removeClass(\'checkbox_haken_inactive\').addClass(\'checkbox_haken_active\'); jQuery(\'#nl_radio_w\').attr(\'checked\', \'checked\'); }"></div>'+
				'<div class="checkbox_haken_inactive" id="nl-m-big" style="position: absolute;margin: -2px 0 0 359px;cursor:pointer" onclick="if(jQuery(this).hasClass(\'checkbox_haken_active\')) { jQuery(this).removeClass(\'checkbox_haken_active\').addClass(\'checkbox_haken_inactive\'); jQuery(\'#nl_radio_m\').attr(\'checked\', \'\'); } else { jQuery(this).removeClass(\'checkbox_haken_inactive\').addClass(\'checkbox_haken_active\'); jQuery(\'#nl_radio_m\').attr(\'checked\', \'checked\'); }"></div>'+
				'<input type="checkbox" id="nl_radio_w" name="geschlecht" value="w" style="display:none" checked="checked">'+
				'<input type="checkbox" id="nl_radio_m" name="geschlecht" value="m" style="display:none">'+
				 '<br /><button type="submit" style="margin-left:10px;cursor: pointer;position:absolute;margin:13px 0 0 -3px;text-align:left"><img src="/static_content/simplepages/simple_7trends/homepage/bt_anmelden.jpg" /></button>'+
			 '</span>'+
			'</div>'+
		'</form>'+
		'<img src="/static_content/newsletter/layer/newsletter.jpg" USEMAP="#nl_layerBig_map1" />'+
		'<MAP NAME="nl_layerBig_map1">'+
			'<AREA SHAPE="RECT" COORDS="565,0,620,56" href="javascript:;" onclick="hideNewsletterLayer()" TITLE="">'+
			'<AREA SHAPE="RECT" COORDS="10,480,260,465" href="javascript:;" onclick="nlShowbedingungen()" TITLE="">'+
		'</MAP>'+
	'</div>'+
	'<div id="nllayer_bedingungen" style="position:absolute;display:none;z-index:10002;width:630px;height:545px">'+
		'<img src="/static_content/newsletter/layer/teilnahmebedingungen.jpg" USEMAP="#nl_layerBig_map2" />'+
		'<MAP NAME="nl_layerBig_map2">'+
			'<AREA SHAPE="RECT" COORDS="50,385,131,405" href="javascript:;" onclick="jQuery(\'#nllayer\').show();jQuery(\'#nllayer_bedingungen\').hide();" TITLE="">'+
			'<AREA SHAPE="RECT" COORDS="565,0,620,56" href="javascript:;" onclick="hideNewsletterLayer()" TITLE="">'+
		'</MAP>'+
	'</div>'+
	'<div id="nl_layer_success" style="position:absolute;display:none;z-index:10002">'+
		'<img src="/static_content/newsletter/layer/success.jpg" USEMAP="#nl_layerBig_map3" />'+
		'<MAP NAME="nl_layerBig_map3">'+
			'<AREA SHAPE="RECT" COORDS="565,0,620,56" href="javascript:;" onclick="hideNewsletterLayer()" TITLE="">'+
			'<AREA SHAPE="RECT" COORDS="80,515,190,500" href="mailto:service@7trends.de" TITLE="">'+
		'</MAP>'+
	'</div>';
	jQuery('body').prepend(layer);
	jQuery('#nllayer').show().center();
}

function loadNewsletterlayer(referrer) {
	if (jQuery('#blanket').length == 0) {
		jQuery(document.body).append('<div id="blanket"></div>');
    }
	jQuery('#blanket').css({
        width: jQuery(document.body).outerWidth(true),
        height: jQuery(document.body).outerHeight(true)
    });
    jQuery('#blanket').css('display', 'block');
    jQuery('#blanket').live('click', function () {
    	hideNewsletterLayer();
    });
	var layer = '<div id="nllayer" style="position:absolute;display:none;z-index:10002;width:681px;height:309px">'+
			'<form onsubmit="return sendNLRegistration(\''+referrer+'\')" id="nl-validate-detail-layer" name="layer_frmMailSolution" method=\'get\' action=\'/utils/newsletteranmeldung/stv.php\'>'+
			'<input type=\'hidden\' name=\'AID\' value=\'32025\'>'+
			'<input type=\'hidden\' name=\'ACTION\' value=\'NEW\'>'+
			'<input type=\'hidden\' name=\'RED\' value=\'http://www.7trends.de/\'>'+
			'<input type=\'hidden\' name=\'referrer1\' value='+referrer+'>'+
			'<input type=\'hidden\' name=\'is_customer\' value=\'0\'>'+
			'<input type=\'hidden\' name=\'is_subscriber\' value=\'1\'>'+
		'<div class="newsletterlayer_box" style="position:absolute;margin:236px 0 0 22px;font-family:verdana;font-size:9px; color: #454444">'+
			 '<span id="nl_layer_box">'+
				 '<div style="position:absolute;margin-top:-2px"><input type="text" value="Deine E-Mail-Adresse" onclick="if(this.value == \'Deine E-Mail-Adresse\') {this.value=\'\';}" id="newsletterfooter_layer" class="required-entry validate-email input-text" name="email" /></div>'+
				 '<div class="nl_layer_damen_txt" onclick="jQuery(\'#nl-w\').click()"></div>'+
				 '<div class="nl_layer_herren_txt" onclick="jQuery(\'#nl-m\').click()"></div>'+
				 '<div class="checkbox_haken_active" id="nl-w" style="position: absolute;margin: -2px 0 0 269px;cursor:pointer" onclick="if(jQuery(this).hasClass(\'checkbox_haken_active\')) { jQuery(this).removeClass(\'checkbox_haken_active\').addClass(\'checkbox_haken_inactive\'); jQuery(\'#nl_radio_w\').attr(\'checked\', \'\'); } else { jQuery(this).removeClass(\'checkbox_haken_inactive\').addClass(\'checkbox_haken_active\'); jQuery(\'#nl_radio_w\').attr(\'checked\', \'checked\'); }"></div>'+
				'<div class="checkbox_haken_inactive" id="nl-m" style="position: absolute;margin: -2px 0 0 368px;cursor:pointer" onclick="if(jQuery(this).hasClass(\'checkbox_haken_active\')) { jQuery(this).removeClass(\'checkbox_haken_active\').addClass(\'checkbox_haken_inactive\'); jQuery(\'#nl_radio_m\').attr(\'checked\', \'\'); } else { jQuery(this).removeClass(\'checkbox_haken_inactive\').addClass(\'checkbox_haken_active\'); jQuery(\'#nl_radio_m\').attr(\'checked\', \'checked\'); }"></div>'+
				'<input type="checkbox" id="nl_radio_w" name="geschlecht" value="w" style="display:none" checked="checked">'+
				'<input type="checkbox" id="nl_radio_m" name="geschlecht" value="m" style="display:none">'+
				 '<br /><button type="submit" style="margin-left:10px;cursor: pointer;position:absolute;margin:13px 0 0 -3px;text-align:left"><img src="/static_content/simplepages/simple_7trends/homepage/bt_anmelden.jpg" /></button>'+
			 '</span>'+
			'</div>'+
		'</form>'+
		'<img src="/static_content/simplepages/simple_7trends/homepage/anmelden_1.jpg" USEMAP="#nl_layer_map1" />'+
		'<MAP NAME="nl_layer_map1">'+
			'<AREA SHAPE="RECT" COORDS="661,1,678,25" href="javascript:;" onclick="hideNewsletterLayer()" TITLE="">'+
			'<AREA SHAPE="RECT" COORDS="10,360,250,345" href="javascript:;" onclick="nlShowbedingungen()" TITLE="">'+
		'</MAP>'+
	'</div>'+
	'<div id="nllayer_bedingungen" style="position:absolute;display:none;z-index:10002;width:681px;height:350px">'+
		'<img src="/static_content/simplepages/simple_7trends/homepage/teilnahmebedingungen.jpg" USEMAP="#nl_layer_map2" />'+
		'<MAP NAME="nl_layer_map2">'+
			'<AREA SHAPE="RECT" COORDS="1,160,21,180" href="javascript:;" onclick="jQuery(\'#nllayer\').show();jQuery(\'#nllayer_bedingungen\').hide();" TITLE="">'+
			'<AREA SHAPE="RECT" COORDS="661,1,678,25" href="javascript:;" onclick="hideNewsletterLayer()" TITLE="">'+
		'</MAP>'+
	'</div>'+
	'<div id="nl_layer_success" style="position:absolute;display:none;z-index:10002">'+
		'<img src="/static_content/simplepages/simple_7trends/homepage/anmelden_2.jpg" USEMAP="#nl_layer_map3" />'+
		'<MAP NAME="nl_layer_map3">'+
			'<AREA SHAPE="RECT" COORDS="661,1,678,25" href="javascript:;" onclick="hideNewsletterLayer()" TITLE="">'+
			'<AREA SHAPE="RECT" COORDS="80,345,190,330" href="mailto:service@7trends.de" TITLE="">'+
		'</MAP>'+
	'</div>';
	jQuery(layer).insertAfter('#blanket');
	jQuery('#nllayer').show().center();
}
function sendNLRegistration(referrer){
	var nl_validator = new Validation('nl-validate-detail-layer');
	var validate = nl_validator.validate();	
	if( jQuery('#nl_radio_w').attr('checked') && jQuery('#nl_radio_m').attr('checked') ) {
		var gender = 'n';
	} else if( jQuery('#nl_radio_w').attr('checked') ) {
		var gender = 'w';
	} else if( jQuery('#nl_radio_m').attr('checked') ) {
		var gender = 'm';
	} else {
		validate = false;
	}
	
	if(validate){
		  var raster = '';
		  var req = new Ajax.Request('/utils/newsletteranmeldung/stv.php', { 
				method:'get',
				parameters: {
					par: 'AID=32025&ACTION=NEW&RED=http://www.7trends.de&referrer1='+referrer+'&is_customer=0&is_subscriber=1',
					email: jQuery('#newsletterfooter_layer').val(),
					gender: gender
				},
				onSuccess: function(){
				    jQuery('#nllayer').html( jQuery('#nl_layer_success').html() );
				}
			});
	}
	return false;
}
function hideNewsletterLayer() {
	jQuery('#blanket').hide();
	jQuery('#nllayer, #nllayer_bedingungen').remove();
}
function nlShowbedingungen() {
	jQuery('#nllayer').hide();
	jQuery('#nllayer_bedingungen').show().center();
}
/* MySeventrends */
function setHearts(_mst) {
	if(_mst.detail == 1) {
		jQuery('.product-like').removeClass('w-full-heart w-heart m-full-heart m-heart offline-heart');
		if(_mst.customer == 1 && _mst.gender == 'w') {
			if(_mst.like == 1) {
				jQuery('.product-like').addClass('w-full-heart');
				jQuery('.product-like').attr('title', 'Produkt nicht mehr liken');
			} else {
				jQuery('.product-like').addClass('w-heart');
				jQuery('.product-like').attr('title', 'Produkt liken');
			}
		} else if(_mst.customer == 1 && _mst.gender == 'm') {
			if(_mst.like == 1) {
				jQuery('.product-like').addClass('m-full-heart');
				jQuery('.product-like').attr('title', 'Produkt nicht mehr liken');
			} else {
				jQuery('.product-like').addClass('m-heart');
				jQuery('.product-like').attr('title', 'Produkt liken');
			}
		} else {
			jQuery('.product-like').addClass('offline-heart');
			jQuery('.product-like').attr('title', 'Produkt liken');
		}
		jQuery('.product-like').addClass('product-like-detail');
	} else {
		if(typeof _mst.like.total != 'undefined') {
			jQuery('.product-like').removeClass('w-full-heart w-heart m-full-heart m-heart offline-heart');
			if(_mst.customer == 1 && _mst.gender == 'w') {
				jQuery('.product-like').addClass('w-heart');
			} else if(_mst.customer == 1 && _mst.gender == 'm') {
				jQuery('.product-like').addClass('m-heart');
			}
			if(_mst.customer == 1) {
				_mst.like.ids.each(function(index) {
					if(_mst.gender == 'w') {
						jQuery('#pl-'+index.product_id).addClass('w-full-heart').removeClass('w-heart');
						jQuery('#pl-'+index.product_id).attr('title', 'Produkt nicht mehr liken');
					} else if(_mst.gender == 'm') {
						jQuery('#pl-'+index.product_id).addClass('m-full-heart').removeClass('m-heart');
						jQuery('#pl-'+index.product_id).attr('title', 'Produkt nicht mehr liken');
					}
				});
			}
		} else {
			if(_mst.customer == 1) {
				jQuery('#pl-'+_mst.product).removeClass('w-full-heart w-heart m-full-heart m-heart offline-heart');
				if(_mst.customer == 1 && _mst.gender == 'w') {
					if(_mst.like == 1) {
						jQuery('#pl-'+_mst.product).addClass('w-full-heart');
						jQuery('#pl-'+_mst.product).attr('title', 'Produkt nicht mehr liken');
					} else {
						jQuery('#pl-'+_mst.product).addClass('w-heart');
						jQuery('#pl-'+_mst.product).attr('title', 'Produkt liken');
					}
				} else if(_mst.customer == 1 && _mst.gender == 'm') {
					if(_mst.like == 1) {
						jQuery('#pl-'+_mst.product).addClass('m-full-heart');
						jQuery('#pl-'+_mst.product).attr('title', 'Produkt nicht mehr liken');
					} else {
						jQuery('#pl-'+_mst.product).addClass('m-heart');
						jQuery('#pl-'+_mst.product).attr('title', 'Produkt liken');
					}
				} else {
					jQuery('#pl-'+_mst.product).addClass('offline-heart');
					jQuery('#pl-'+_mst.product).attr('title', 'Produkt liken');
				}
			} else {
				jQuery('.product-like').addClass('offline-heart');
				jQuery('#pl-'+_mst.product).attr('title', 'Produkt liken');
			}
		}
		jQuery('.product-like').addClass('product-like-catalog');
	}
}

function myseventrendsLogin(form_id, next_action, reload) {
	var addaddressFormDetail = new VarienForm('myseventrendslogin');
	var validator = new Validation('myseventrendslogin');
	var validate = validator.validate(true);
	if(validate == false) {
		
	} else {
		var protokoll = 'https';
		if(document.domain.indexOf('.local') > -1) {
			var protokoll = 'http';
		}
		var request_url = protokoll+"://"+document.domain+"/customer/account/loginPostAjax/";
		jQuery.ajax({
	        type: "POST",
	        url: request_url,
	        dataType: "jsonp",
	        jsonp: 'jsonp_callback',
	        data: "login[username]=" + jQuery("#"+form_id+" #login_email").val() + "&login[password]=" + jQuery("#"+form_id+" #login_password").val().replace('&', '%26'),
	        success: function(msg)
	        {
				if(typeof msg.success != 'undefined') {
					if(typeof reload != 'undefined' && reload == true && typeof next_action != 'undefined') {
	            		window.location = next_action;
	            	} else if(typeof next_action != 'undefined') {
	            		jQuery.getJSON(next_action, function(data) {
	            			if(data.customer == 1) {
			            		setHearts(data);
			            		if(typeof data.detail != 'undefined' && data.detail == 1) {
			            			setBrands(data);
			            		}
			            		jQuery('#loginlayer').remove();
			            		jQuery('#blanket').hide();
							} else {
								jQuery('#mst-error-space').html('<div class="error">Das hat leider nicht geklappt. Versuche es noch einmal oder lass dir dein Passwort zusenden.</div>');
							}
			            });
	            		/* Header aktualisieren */
	            		getHeader();
	            	}
	            } else {
	            	jQuery('#mst-error-space').html('<div class="error">Das hat leider nicht geklappt. Versuche es noch einmal oder lass dir dein Passwort zusenden.</div>');
	            }
	        }
	    });
	}
	
	return false;
}

function myseventrendsCreateaccount(form_id, next_action, reload) {
	var addaddressFormDetail = new VarienForm('myseventrendscreate');
	var validator = new Validation('myseventrendscreate');
	var validate = validator.validate(true);
	if(validate == false) {
		
	} else {
		var protokoll = 'https';
		if(document.domain.indexOf('.local') > -1) {
			var protokoll = 'http';
		}
		var request_url = protokoll+"://"+document.domain+"/customer/account/createpostajax/";
		jQuery.ajax({
	        type: "POST",
	        url: request_url,
	        dataType: "jsonp",
	        jsonp: 'jsonp_callback',
	        data: "prefix=" + jQuery("#"+form_id+" #mst_prefix").val() + "&firstname=" + jQuery("#"+form_id+" #mst_firstname").val()+"&lastname=" + jQuery("#"+form_id+" #mst_lastname").val()+"&email=" + jQuery("#"+form_id+" #mst_email").val()+"&password=" + jQuery("#"+form_id+" #mst_password").val()+"&confirmation=" + jQuery("#"+form_id+" #mst_passwordconfirm").val(),
	        success: function(msg)
	        {
				if(typeof msg.success != 'undefined') {
	            	if(typeof reload != undefined && reload == true && typeof next_action != 'undefined') {
	            		window.location = next_action;
	            	} else if(typeof next_action != 'undefined') {
	            		jQuery.getJSON(next_action, function(data) {
							if(data.customer == 1) {
			            		setHearts(data);
			            		if(typeof data.detail != 'undefined' && data.detail == 1) {
			            			setBrands(data);
			            		}
			            		jQuery('#loginlayer').remove();
			            		jQuery('#blanket').hide();
							} else {
								
								jQuery('#mst-error-space').html('<div class="error">Es ist ein Fehler aufgetreten. Bitte versuchen sie es noch einmal.</div>');
							}
			            });
	            		/* Header aktualisieren */
	            		getHeader();
	            	}
	            } else {
	            	if(typeof msg.error_msg != 'undefined') {
	            		jQuery('#mst-error-space').html('<div class="error">'+msg.error_msg+'</div>');
	            	} else {
	            		jQuery('#mst-error-space').html('<div class="error">Es ist ein Fehler aufgetreten. Bitte versuchen sie es noch einmal.</div>');
	            	}
	            }
	        }
	    });
	}
	
	return false;
}

function showLoginScreen(next_action, reload) {
	if (jQuery('#blanket').length == 0) {
		jQuery(document.body).append('<div id="blanket"></div>');
    }
	jQuery('#blanket').css({
        width: jQuery(document.body).outerWidth(true),
        height: jQuery(document.body).outerHeight(true)
    });
    jQuery('#blanket').css('display', 'block');
    jQuery('#blanket').live('click', function () {
    	
    });
    if(typeof reload == 'undefined') {
    	reload = false;
    }
	var layer = '<div id="loginlayer" style="position:absolute;display:none;z-index:10002;width:625px;height:435px">'+
			'<span id="mst-error-space" style="position:absolute;margin:67px 0 0 44px;font-family:Georgia;font-size:11px;width:533px"></span>'+
		'<div style="position:absolute;margin:135px 0 0 42px;font-family:Georgia">'+
			'<form id="myseventrendslogin" class="mystrends" onsubmit="return myseventrendsLogin(\'myseventrendslogin\', \''+next_action+'\', '+reload+')" method=\'post\' action=\'/customer/account/loginPost/\'>'+
			 '<table>'+
					'<colgroup>'+
					   '<col width="250px">'+
					'</colgroup>'+
					'<tbody>'+
					'<tr>'+
						'<td>E-Mail-Adresse</td>'+
					'</tr>'+
					'<tr>'+
						'<td><input type="text" style="width: 200px;" tabindex="1" value="" name="login[username]" id="login_email" class="input-text required-entry validate-email"></td>'+
					'</tr>'+
			    	'<tr>'+
			    		'<td>Passwort</td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><input type="password" style="width: 200px;" tabindex="2" name="login[password]" id="login_password" class="input-text required-entry"></td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><span style="text-decoration:underline;cursor:pointer" onclick="jQuery(\'#password-reminder-box\').show()">Passwort vergessen ?</span></td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><button name="send" type="submit" style="margin-top:5px"><img src="/skin/frontend/7trends/default/images/myseventrends/bt_login.gif" class="mst-login-button" /></button></td>'+
			    	'</tr>'+
			    '</tbody></table>'+
			    '</form>'+
			    '<table>'+
			    	'<tr><td>&nbsp;</td></tr>'+
			    	'<tr id="password-reminder-box" class="mystrends" style="display:none">'+
			    		'<td><div style="border: 1px solid #E5E5E5;padding:5px 5px 5px 9px;width:198px">'+
			    		'<div class="input-box">'+
			    		'<div style="margin-bottom:2px">E-Mail-Adresse</div>'+
			    		'<div>'+
			    		'<form class="customer-form" id="forgotpassword-form" method="post" onsubmit="return forgotpasswordrequest(\'forgotpassword-form\')" action="/customer/account/forgetpasswordajax/">'+
			    		'<input type="text" value="" class="input-text required-entry validate-email" id="email_address" alt="email" name="email" style="width:188px">'+
			    		'<div style="margin: 10px 0">'+
			    		'<input type="image" src="/skin/frontend/7trends/default/images/myseventrends/bt_neuespasswort.gif">'+
			    		'</div>'+
				        '</form>'+
			    		'</div>'+
			    		'</div>'+
			    		'<div class="back-link" style="text-decoration: underline;cursor:pointer" onclick="jQuery(\'#password-reminder-box\').hide()">< zurück</div>'+
			    	'</div></td>'+
			    	'</tr>'+
				'</table>'+
			'</div>'+
		'<form id="myseventrendscreate" class="mystrends" onsubmit="return myseventrendsCreateaccount(\'myseventrendscreate\', \''+next_action+'\', '+reload+')" method=\'post\' action=\'/customer/account/createpost/\'>'+
		'<div style="position:absolute;margin:135px 0 0 346px;font-family:Georgia">'+
			 '<table>'+
					'<colgroup>'+
					   '<col width="250px">'+
					'</colgroup>'+
					'<tbody>'+
					'<tr>'+
						'<td>Anrede</td>'+
					'</tr>'+
					'<tr>'+
						'<td><select class="required-entry" size="1" name="prefix" id="mst_prefix" style="width:206px"><option value="Frau">Frau</option><option value="Herr">Herr</option></select></td>'+
					'</tr>'+
			    	'<tr>'+
			    		'<td>Vorname</td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><input type="text" class="required-entry input-text" id="mst_firstname" title="Vorname" value="" id="register-firstname" name="firstname" style="width:200px"></td>'+
			    	'</tr>'+
			    	'<tr>'+
		    			'<td>Nachname</td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><input type="text" class="required-entry input-text" id="mst_lastname" title="Nachname" value="" id="register-lastname" name="lastname" style="width:200px"></td>'+
			    	'</tr>'+
			    	'<tr>'+
		    			'<td>E-Mail Adresse</td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><input type="text" class="validate-email required-entry input-text" id="mst_email" title="E-Mail Adresse" value="" id="email_address" name="email" style="width:200px"></td>'+
			    	'</tr>'+
			    	'<tr>'+
		    			'<td>Passwort</td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><input type="password" class="required-entry validate-password input-text" id="mst_password" title="Passwort" id="password" name="password" style="width:200px"></td>'+
			    	'</tr>'+
			    	'<tr>'+
	    				'<td>Passwort bestätigen</td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><input type="password" class="required-entry validate-cpassword input-text" id="mst_passwordconfirm" id="confirmation" title="Passwort bestätigen" name="confirmation" style="width:200px"></td>'+
			    	'</tr>'+
			    	'<tr>'+
			    		'<td><button name="send" type="submit" style="margin-top: 9px"><img src="/skin/frontend/7trends/default/images/myseventrends/bt_anmelden.gif" class="mst-createaccount-button" /></button></td>'+
			    	'</tr>'+
				'</tbody></table>'+
			'</div>'+
		'</form>'+
		'<div class="mst-close-layer-icon" onclick="jQuery(\'#loginlayer, #blanket\').remove()"><img src="/skin/frontend/7trends/default/images/myseventrends/bt_schliessen.gif" /></div>'+
		'<img src="/skin/frontend/7trends/default/images/myseventrends/anmelden_layer.gif" />'+
	'</div>';
	jQuery(layer).insertAfter('#blanket');
	jQuery('#loginlayer').show().center();
}

function forgotpasswordrequest(form_id) {
	var addaddressFormDetail = new VarienForm('forgotpassword-form');
	var validator = new Validation('forgotpassword-form');
	var validate = validator.validate(true);
	if(validate == false) {
		
	} else {
		jQuery.ajax({
	        type: "POST",
	        url: "/customer/account/forgetpasswordajax/",
	        data: "email=" + jQuery("#"+form_id+" #email_address").val(),
	        success: function(msg)
	        {
				if(typeof msg != 'undefined' && msg == 'Wir haben dir soeben ein neues Passwort zugesendet.') {
					jQuery('#password-reminder-box .input-box').html('Dein Passwort wurde soeben an deine E-Mail-Adresse gesendet.<br />');
	            } else {
	            	if(typeof msg != 'undefined') {
	            		jQuery('#password-reminder-box .back-link').after('<div>'+msg+'</div>');
	            	} else {
	            		jQuery('#password-reminder-box .back-link').after('<div>Es ist ein Fehler aufgetreten. Bitte versuchen sie es noch einmal.</div>');
	            	}
	            }
	        }
	    });
	}
	
	return false;
}

function setBrands(_mst) {
	if(_mst.detail == 1) {
		if(_mst.brand.brand_id >= 0 && _mst.brand.brand_id.length > 0) {
			jQuery('.brand-like').removeClass('w-full-brand w-brand m-full-brand m-brand offline-brand');
			if(_mst.customer == 1 && _mst.gender == 'w') {
				if(_mst.brand.brand_like == 1) {
					jQuery('.brand-like').addClass('w-full-brand');
					jQuery('.brand-like').attr('title', 'Designer nicht mehr liken');
				} else {
					jQuery('.brand-like').addClass('w-brand');
					jQuery('.brand-like').attr('title', 'Designer liken');
				}
			} else if(_mst.customer == 1 && _mst.gender == 'm') {
				if(_mst.brand.brand_like == 1) {
					jQuery('.brand-like').addClass('m-full-brand');
					jQuery('.brand-like').attr('title', 'Designer nicht mehr liken');
				} else {
					jQuery('.brand-like').addClass('m-brand');
					jQuery('.brand-like').attr('title', 'Designer liken');
				}
			} else {
				jQuery('.brand-like').addClass('offline-brand');
				jQuery('.brand-like').attr('title', 'Designer liken');
			}
			if(typeof _mst.brand.brand_id != 'undefined') {
				jQuery('.brand-like').addClass('brand-like-detail');
			}
		}
	} else {
		if(typeof _mst.brand.total != 'undefined') {
			jQuery('.brand-like').removeClass('w-full-brand w-brand m-full-brand m-brand offline-brand');
			if(_mst.customer == 1 && _mst.gender == 'w') {
				jQuery('.brand-like').addClass('w-brand');
				jQuery('.brand-like').attr('title', 'Designer liken');
			} else if(_mst.customer == 1 && _mst.gender == 'm') {
				jQuery('.brand-like').addClass('m-brand');
				jQuery('.brand-like').attr('title', 'Designer liken');
			}
			if(_mst.customer == 1) {
				_mst.brand.ids.each(function(index) {
					if(_mst.gender == 'w') {
						jQuery('[rel=bl-'+index.brand_id+'-'+index.department_id+']').addClass('w-full-brand').removeClass('w-brand');
						jQuery('[rel=bl-'+index.brand_id+'-'+index.department_id+']').attr('title', 'Designer nicht mehr liken');
					} else if(_mst.gender == 'm') {
						jQuery('[rel=bl-'+index.brand_id+'-'+index.department_id+']').addClass('m-full-brand').removeClass('m-brand');
						jQuery('[rel=bl-'+index.brand_id+'-'+index.department_id+']').attr('title', 'Designer nicht mehr liken');
					}
				});
			}
		} else {
			if(_mst.customer == 1) {
				jQuery('#pl-'+_mst.product).removeClass('w-full-brand w-brand m-full-brand m-brand offline-brand');
				if(_mst.customer == 1 && _mst.gender == 'w') {
					if(_mst.like == 1) {
						jQuery('#pl-'+_mst.product).addClass('w-full-brand');
						jQuery('#pl-'+_mst.product).attr('title', 'Designer nicht mehr liken');
					} else {
						jQuery('#pl-'+_mst.product).addClass('w-brand');
						jQuery('#pl-'+_mst.product).attr('title', 'Designer liken');
					}
				} else if(_mst.customer == 1 && _mst.gender == 'm') {
					if(_mst.like == 1) {
						jQuery('#pl-'+_mst.product).addClass('m-full-brand');
						jQuery('#pl-'+_mst.product).attr('title', 'Designer nicht mehr liken');
					} else {
						jQuery('#pl-'+_mst.product).addClass('m-brand');
						jQuery('#pl-'+_mst.product).attr('title', 'Designer liken');
					}
				} else {
					jQuery('#pl-'+_mst.product).addClass('offline-brand');
					jQuery('#pl-'+_mst.product).attr('title', 'Designer liken');
				}
			} else {
				jQuery('.brand-like').addClass('offline-brand');
				jQuery('.brand-like').attr('title', 'Designer liken');
			}
		}
		jQuery('.brand-like').addClass('brand-like-catalog');
	}
}

function showErrorLayer(data) {
    if (jQuery('#blanket').length == 0) {
                    jQuery(document.body).append('<div id="blanket"></div>');
        }
            jQuery('#blanket').css({
            width: jQuery(document.body).outerWidth(true),
            height: jQuery(document.body).outerHeight(true)
        });
        jQuery('#blanket').css('display', 'block');
        if(typeof(data.error_msg) != 'undefined' && data.error_msg.length > 0) {
            var error_msg = data.error_msg;
        } else {
             var error_msg = '<span class="bold">Es ist leider ein Fehler aufgetreten. Bitte versuche es später noch einmal.</span>';
        }

        var layer = '<div id="errorlayer" style="position:absolute;display:none;z-index:10002;width:400px;height:200px;background-color:#fff">'+
		'<div class="mst-close-layer-icon" onclick="jQuery(\'#errorlayer\').remove();jQuery(\'#blanket\').hide();" style="margin-left:376px"><img src="/skin/frontend/7trends/default/images/myseventrends/bt_schliessen.gif" /></div>'+
		'<div style="margin-top: 20px;text-align:left;padding:10px">'+error_msg+'</div>'+
		'</div>';
        
        var gender = 'w';
        if(typeof data.gender != 'undefined') {
        	gender = data.gender;
        }
        var layer = '<div id="errorlayer" class="myseventrends-hinweis-layer" style="display:none">'+
        '<div class="mst-close-layer-icon" onclick="jQuery(\'#errorlayer\').remove();jQuery(\'#blanket\').hide();" style="margin-left:376px"><img src="/skin/frontend/7trends/default/images/myseventrends/bt_schliessen_layer.gif" /></div>'+
		'<div style="margin: 10px 0 0 40px; width:330px">'+
        '<div style="text-align:left">'+error_msg+'</div>'+
        '</div>'+
        '</div>';

        jQuery(layer).insertAfter('#blanket');
	jQuery('#errorlayer').show().center();
}

function delAllHearts(ids, reload) {
    jQuery.ajax({
        url: '/mycustomer/myseventrends/deletefavorites/',
        dataType: "json",
        data: "ids="+ids,
        cache: false,
        success: function(data) {
		if(data.error == 0) {
            if(reload == 1) {
            	window.location.href = "/meine-favoriten/";
            } else {
            	jQuery('.product-like-catalog').removeClass(data.gender+'-full-heart').addClass(data.gender+'-heart');
            	jQuery('#delfavlayer').remove();
            	jQuery('#blanket').hide();
            }
        } else {
        	showErrorLayer(data);
        }
	  }
    });
}
