function feldLeeren(element, value) {
	if (element.value == 'Deine E-Mail-Adresse') {
		element.value = value;
	} else if (element.value == '') {
		element.value = value;
	}
}

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 () {
	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();
	}
}

/* Helper class to manage mini-cart state */
var MiniCartSlide = Class.create();
MiniCartSlide.prototype = {
	initialize: function() {
		this.state = '';
		this.closing = false;
		this.hoehe = 0;
	},

	setStateOpen: function() {
		this.state = 'OPEN';
	},

	setStateClosed: function() {
		this.state = 'CLOSED';
	},

	setStateLoading: function() {
		this.state = 'LOADING';
	},
	
	setStateOpening: function() {
		this.state = 'OPENING';
	},
	
	isLoading: function() {
		return this.state == 'LOADING';
	},
	
	isOpening: function() {
		return this.state == 'OPENING';
	},
	
	isOpen: function() {
		return this.state == 'OPEN';
	},
	
	isClosed: function() {
		return this.state == 'CLOSED';
	},
	
	isClosing: function() {
		return this.state == 'CLOSING';;
	},
	
	setClosing: function() {
		this.state = 'CLOSING';
	},
	
	hideCart: function() {
		if(miniCartSlide.isClosing())
			return;
		
		if(miniCartSlide.isOpen()) {
			miniCartSlide.setClosing();
			$('warenkorb-mini-komplett').style.height = miniCartSlide.hoehe+'px';
			new Effect.SlideUp('warenkorb-mini-komplett', { duration: 0.7, afterFinish:
				function () {
			   		$('warenkorb-hover').removeClassName('hover');
			   		$('warenkorb-mini-komplett').style.height = '0px';
			   		$('warenkorb-mini-komplett').style.bottom = '0px';
			   		$('mini-cart-mouseover-cart').style.height = '0px';
			   		miniCartSlide.setStateClosed();
			    }}
			)
		} else {
			window.setTimeout('miniCartSlide.hideCart()', 2000);
		}
	},
	
	observeCart: function() {
		Event.observe(document.body, 'mouseover', function(event) {
			if (!miniCartSlide.isOpen() || Event.element(event).hasClassName('warenkorb-hoverelement') == true ){
				Event.stopObserving(document.body, 'mouseover');
				window.setTimeout('miniCartSlide.observeCart()', 2000);
		    } else {
				miniCartSlide.hideCart();
				Event.stopObserving(document.body, 'mouseover');
		    }
		 })
	},
	
	showCart: function() {
		if (!miniCartSlide.isOpening() && !miniCartSlide.isClosing() && !miniCartSlide.isOpen() && !miniCartSlide.isLoading() ) {
			  miniCartSlide.setStateOpening();
			  if (miniCartSlide.hoehe == 0 && $('warenkorb-mini-komplett')) {
	    		  miniCartSlide.hoehe = $('warenkorb-mini-komplett').getHeight();
	    	  }
			  if ( $('warenkorb-mini-komplett').getHeight() > 0 ) {
		    	  $('warenkorb-mini-komplett').style.height = miniCartSlide.hoehe+'px';
		    	  new Effect.SlideDown('warenkorb-mini-komplett', { duration: 0.7, 
		    	    beforeStart: function() {
		    		  $('mini-cart-mouseover-cart').style.height = miniCartSlide.hoehe+18+'px';
		    	  	},
		    		afterFinish: 
		    		  function () {		  
		    		  	  miniCartSlide.setStateOpen();
		    		  	  $('warenkorb-hover').addClassName('hover');
			              //miniCartSlide.observeCart();
		    	  	  }
		   		  });
			  }
		 }
	}
}
miniCartSlide = new MiniCartSlide();

/* 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) ) {
		        		kids[i].innerHTML = json_values.groesse.label;
		        	} else if ( selectId.endsWith(json_values.farbe.id) ) {
		        		kids[i].innerHTML = json_values.farbe.label;
		        	}
		            break;
		        }
		    }
		},
		changeHinweisBox: function(id){
			var oInhalt = $$('div.hinweis-box-inhalt-all');
			for(var i = 0; i < oInhalt.size(); i++) {
				inhalt = oInhalt[i].inspect();
				if ( !inhalt.include('hidden') ) {
					oInhalt[i].addClassName('hidden');
				}
				var id_old = oInhalt[i].identify().sub('-inhalt', '');
				if ( $(id_old+'-top').hasClassName('rahmen') ) {
					$(id_old+'-top').removeClassName('rahmen');
					$(id_old+'-top').addClassName('rahmen-inaktiv');
					$(id+'-top').removeClassName('rahmen-inaktiv');
					$(id+'-top').addClassName('rahmen');
				}
			}
			$(id+'-inhalt').removeClassName('hidden');
		}
}
/* Produktdetailseite Ende */


/* Passforms */
var Passforms = Class.create();
Passforms.prototype = {
	initialize: function() {
		this.status = 'READY';
		this.aktLookId = '';
		this.aktRubrik = '';
		this.sliderStatus = 'READY';
	},
	changeActivPassform: function(id)
		{
			//show selected table hide the rest
			var divIds = new Array("passform_body", "passform_kleidung", "passform_hosen", "passform_accessoires", "passform_schuhe");
			
			for(var i=0; i < divIds.length; i++){
				if(divIds[i] == id){
					$(divIds[i]).removeClassName('hidden');
					if(id == 'passform_body'){
						$('nav_sub').addClassName('hidden');
						$('passform_container').removeClassName('bg_masstabelle');
						$('passform_container').addClassName('bg_body_guide');
					}
					if(id != 'passform_body'){
						$('nav_sub').removeClassName('hidden');
						$('passform_container').removeClassName('bg_body_guide');
						$('passform_container').addClassName('bg_masstabelle');
					}
				}else {
					$(divIds[i]).addClassName('hidden');
				}
			}
			
			//set arrow for activ sub_nav
			var liIds = new Array("kleidung", "hosen", "accessoires", "schuhe");
			var _id = id.sub('passform_', '');
			
			for(var i=0; i<liIds.length; i++){
				if(liIds[i] == _id){
					$('li_' + liIds[i]).removeClassName('sub_inactiv');
					$('li_' + liIds[i]).addClassName('sub_activ');
				}else {
					$('li_' + liIds[i]).removeClassName('sub_activ');
					$('li_' + liIds[i]).addClassName('sub_inactiv');
				}
			}
			
		},
		changeHosen: function(id)
		{
			if(id == 'passform_hosen_1'){
				$(id).removeClassName('hidden');
				$('passform_hosen_2').addClassName('hidden');
			}else {
				$(id).removeClassName('hidden');
				$('passform_hosen_1').addClassName('hidden');
			}
		}
}
/* Passform Ende */


/* an Freundin senden */
var Freundin = Class.create();
Freundin.prototype = {
	send: function() {
		$('product_sendtofriend_form').request({
		  onComplete: function(){ alert('Form data saved!') }
		})
	}
}

//freundin = new Freundin();
/* 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);
	}
	
	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 = $('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.replace(',','.')) + parseFloat(discount);
		$('grand_total').innerHTML = '<span class="price">' + total_string.toFixed(2) + anhang + '</span>';
		wert.replace('.', ',');
		if (wert == 0) {
			wert = '0,00';
		}
		$('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') {
			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();

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');
	}
}