var $jQ = jQuery.noConflict();
/*do bg*/
	$jQ(document).ready(function() {
   function sprawdzRozmiarOkna() {
	if ( $jQ(window).width() > 1000 ) {
		//alert($jQ(window).width());
		var poz,zm;
		poz=$jQ(window).width() - 1264  ;
		poz=poz/2;
		poz-=210;
		poz+='';
		poz+='px 0px';
		
		//alert(poz);
		
		document.getElementById('bodys').style.backgroundPosition =poz;
	}
	else {
		$jQ('body').removeClass('duzy');
	}
   }
	$jQ(window).resize(sprawdzRozmiarOkna);
	});
	function onloadbody(){
		var poz,zm;
		poz=screen.width - 1264  ;
		poz=poz/2;
		poz-=210;
		poz+='';
		poz+='px 0px';
		
		//alert(poz);
		
		document.getElementById('bodys').style.backgroundPosition =poz;		
	}
	;
/*do menu gornego*/
	
	$jQ(document).ready(function () {

		//transitions
		//for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
		var style = 'easeOutElastic';

		//Retrieve the selected item position and width
		var default_left = Math.round($jQ('#lava li.selected').offset().left - $jQ('#lava').offset().left);
		var default_width = $jQ('#lava li.selected').width();
		//Set the floating bar position and width
		$jQ('#box').css({left: default_left});
		$jQ('#box .head').css({width: default_width});

		//if mouseover the menu item
		$jQ('#lava li').hover(function () {
			
			//Get the position and width of the menu item
			left = Math.round($jQ(this).offset().left - $jQ('#lava').offset().left);
			width = $jQ(this).width();
			
		$jQ('#debug').html(left);
			//Set the floating bar position, width and transition
			$jQ('#box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
			$jQ('#box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});	
		
		//if user click on the menu
		}).click(function () {
			
			//reset the selected item
			$jQ('#lava li').removeClass('selected');	
			
			//select the current item
			$jQ(this).addClass('selected');
	
		});
		
		//If the mouse leave the menu, reset the floating bar to the selected item
		$jQ('#lava').mouseleave(function () {

			//Retrieve the selected item position and width
			default_left = Math.round($jQ('#lava li.selected').offset().left - $jQ('#lava').offset().left);
			default_width = $jQ('#lava li.selected').width();
			//Set the floating bar position, width and transition
			$jQ('#box').stop(false, true).animate({left: default_left},{duration:1000, easing: style});	
			$jQ('#box .head').stop(false, true).animate({width:default_width},{duration:1000, easing: style});		
			
		});
		
	});

