function deleteReviewBasketItem(obj) {
	var el = jQuery(obj);

	var _href = el.attr('href');

	if (_href) {
		jQuery.ajax({
			type: 'GET',
			url: _href,
			cache: false,
			data: {noredirect: 1},
			success: function(data) {
				var _count = jQuery('#checkout-review-table-wrapper a.remove').size();
				if (_count <=1) {
					jQuery(window.location).attr('href', checkouturl);
					return false;
				} else {
					jQuery.ajax({
						url: previewurl,
						cache: false,
						success: function(data) {
							if (data) {
								jQuery('#checkout-review-load').html(data);
							}
						}
					});
				}
			}
		});
	}
	
	return false;
}

var mTop = 220;
var mLeft = 0;
var mouseTop = 0;
var mouseLeft = 0;
	
function setPosition(e) {
	var container = jQuery('#tab-container').offset();
	mouseTop = e.pageY - container.top - mTop;
	mouseLeft = e.pageX - container.left - mLeft;
	
	if (mouseTop < (container.top * -1)) {
		mouseTop = container.top * -1;
	}
	//Debugline
	//jQuery('.col1-content-header').html('PageX: '+mouseLeft+' PageY: '+mouseTop+' Left: '+container.left+' Top: '+container.top);
}


function closeAllFlyouts() {
	jQuery('.jsmaps div').addClass('hidden');
}

function setFloaterPosition() {
	if (jQuery('.page').length) {
		var _pos = jQuery('.page').offset();
		jQuery('.floater-right').css('position','fixed');
		jQuery('.floater-right').css('left',_pos.left+979);
	}
}




jQuery(document).ready(function(){

	if (jQuery('.floater-right').length) {
		setFloaterPosition();
		
		jQuery(window).resize(function() {
			setFloaterPosition();
		});
		
	}
	setTimeout(function() {
		setFloaterPosition();
	},500);
	setTimeout(function() {
		setFloaterPosition();
	},1000);

	if (jQuery('#checkout-step-review #reviewform').length) {
		jQuery('#reviewform').ajaxForm(function() {
			jQuery.ajax({
				type: 'POST',
				url: previewurl,
				success: function(data) {
					if (data) {
						jQuery('#checkout-review-load').html(data);
					}
				}
			});
		});
	}
	
	if (jQuery('.cms-home').length && jQuery('.jsmaps').length) {
		
		jQuery('.startseite-top #tab-container li div map area').mouseover(function(e) {

			var obj = jQuery(this);
			var _id = jQuery(this).attr('href');
			//close all ausser aktuelle id ist offen
			if (jQuery(obj).parent().parent().parent().find('.jsmaps '+_id).hasClass('hidden')) {
				//close all
				closeAllFlyouts();
				
				setPosition(e);
				jQuery(obj).parent().parent().parent().find('.jsmaps '+_id).css('cssText','left: '+mouseLeft+'px !important'+';top: '+mouseTop+'px !important; z-index: 1000;');
				

				jQuery(obj).parent().parent().parent().find('.jsmaps '+_id).removeClass('hidden');
			}
		});
		jQuery('.startseite-top #tab-container').bind('mouseleave', function () {
			closeAllFlyouts();
		});
		jQuery('.jsmaps div a.close').click(function() {
			jQuery('.jsmaps div').addClass('hidden');
		});
	}
});




