/* Dropdown menu */
Ext.onReady(function() {
  new Ext.ux.Menu('navigation', {
	  transitionType: 'slide',
	  direction: 'horizontal', // default
	  delay: 0.2,              // default
	  autoWidth: true,         // default
	  transitionDuration: 0.3, // default
	  animate: true,           // default
	  currentClass: 'current'  // default
  });
});
Ext.ux.Lightbox.register('a[rel^=lightbox]',true);

/* jQuery */
$(document).ready(function() {
						   
	// Floating box
	var $floatingbox = $('#content_offerte');
	
	if($('#column_right').length > 0){
		var bodyY = parseInt($('#column_right').offset().top) + 30;
		var originalX = $floatingbox.css('margin-left');
		
		$(window).scroll(function () {
			var scrollY = $(window).scrollTop();
			var isfixed = $floatingbox.css('position') == 'fixed';
			
			if($floatingbox.length > 0) {
				
				if (scrollY > bodyY && !isfixed) {
					$floatingbox.stop().css({
			  			position: 'fixed',
			  			left: '685',
			  			top: 15
					});
					
					$floatingbox.addClass("isfixed");
				
				} else if (scrollY < bodyY && isfixed) {
					$floatingbox.css({
			  			position: 'relative',
			  			/*left: 0,*/
			  			top: 0,
			  			/*marginLeft: originalX*/
					});
					
			  		$floatingbox.removeClass("isfixed");
				}		
			}
		});
	}
});


/* Google Analytics */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-27238843-1']);
_gaq.push(['_trackPageview']);
(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

