$(document).ready(function() {
	$('a[rel="fancy"]').fancybox({
		        'padding': 0,
				'overlayOpacity': 0.8
	});
	$("a#fancy_shipping").fancybox({
		        'padding': 0,
				'frameWidth': 450,
				'frameHeigth': 650
			});
	$("a#fancy_privacy").fancybox({
		        'padding': 0,
				'frameWidth': 450,
				'frameHeigth': 650
			});
	$("a#fancy_conditions").fancybox({
		        'padding': 0,
				'frameWidth': 450,
				'frameHeigth': 650
			});
	$("a#fancy_contact").fancybox({
		        'padding': 0,
                'frameWidth': 550, 
                'frameHeight': 650
    });
    $("a.group").fancybox({
				'padding': 0,
				'hideOnContentClick': false,
				'frameWidth': 640,
				'frameHeight': 505
	});

	var globals = {		  
		//	az_cart_image_width: 	image_width,
		//	az_cart_image_height: 	image_height,
			az_cart_opacity: 		0.9,
			az_box_status: 			false,
			az_timer: 				"",
			az_speed: 				"fast"
		//	text_cart_quantity: 	text_cart_quantity,
		//	text_cart_subtotal:	 	text_cart_subtotal,
		//	text_cart_empty:		text_cart_empty,
		//	cart_text:				cart_text,
		//	cart_link:				cart_link
        };
	
	$("span.cart").hover(					
					function(){						
						
						clearTimeout(globals.az_timer);
						animatedbox("show");	   					
	 				},
					function(){							
	   					globals.az_timer = setTimeout('animatedbox("hide")',400);
	 				}
		);
	$("#shopping_cart_fade").hover(					
					function(){clearTimeout(globals.az_timer);animatedbox("show");},
					function(){globals.az_timer = setTimeout('animatedbox("hide")',400);
	 				}
		);	  
	animatedbox = function(action){	
	  		if(action=="show") $("#shopping_cart_fade").animate({height: "show", opacity: "show"}).animate({opacity:0.9});	
			else $("#shopping_cart_fade").animate({height: "hide", opacity: "hide"});
	  }
});
function findPosition(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return [valueL, valueT];
} 
function setPosition(element, left, top) {
    element.style.left = left + "px";
    element.style.top = top + "px";
}