function  changePicture(id, onWhich) {
  var point = document.getElementById(id);
  if(onWhich != "")
	point.src = onWhich;
}

function showInfo(id) {
	var point = document.getElementById(id);
	point.style.display = (point.style.display=="block" ? "none" : "block");
}

function goToProjekt(form) {
	var target = form.projekty.selectedIndex;
	var id = form.projekty.options[target].value;
	if(id != "") {
		var href = id;
		parent.location=(href);
	}
}

function showGroup(form) {
	var target = form.projekty.selectedIndex;
	var id = form.projekty.options[target].value;
	if(id != "") {
		var href = "?module=groups&type=" + id;
		parent.location=(href);
	}
}

/*************************************************************************************/


/*********************************************************************************/
function przesuwaj(_div, _ul){
	//Get our elements for faster access and set overlay width
	var div = $(_div),
		ul = $(_ul),
		ulPadding = 15;		
		
	//Get menu width
	var divWidth = div.width();

	//Remove scrollbars	
	div.css({overflow: 'hidden'});
		
	//Find last image container
	var lastLi = ul.find('li:last-child');
		
	//When user move mouse over menu
	div.mousemove(function(e){
		//As images are loaded ul width increases,
		//so we recalculate it each time
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;	
		var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
		div.scrollLeft(left);		
	});		
};

	
/* Whenever DOM is ready */
$(document).ready(function(){

	$(".baner").ready(function(){$(".baner-loading").css("display", "none");$(".baner").css("display", "block");});
	$(".nav").ready(function(){$(".nav-loading").css("display", "none");$(".nav").css("display", "block");});
	
	$("div.shadow div p").hover( function(){$(this).css("background-color", "#eee")}, function(){$(this).css("background-color", "#fff")});
	$("div.shadow div h1").hover( function(){$(this).css("background-color", "#eee")}, function(){$(this).css("background-color", "#fff")});
	$("div.shadow img").hover( function(){$(this).css("background-color", "#eee")}, function(){$(this).css("background-color", "#fff")});	
    
	przesuwaj("div.nav", "ul.nav-ul");
});