/* menu */
function menuShow(parent, id) {
	//alert(parent+' '+id);
	//alert(menuid.length);
	
	for (i=0; i<menuid.length; i++){
		//alert(menuid[i][1]+' '+menuid[i][0]+' '+id);
		if (menuid[i][0] == id) {
			$(menuid[i][0]).slideDown(500);
			$(menuid[i][1]).addClass('active')
		}
		else {
			//$(menuid[i][0]).hide();
			$(menuid[i][0]).slideUp(200);
			$(menuid[i][1]).removeClass('active')
		}
	}
	
}

function showMenuMaria(parent, id){
	//alert(parent+' '+id);
	
	$('#menuMariaOferr1Child').slideUp(200);	
	$('#menuMariaOferr1').removeClass('active');
	$('#menuMariaOferr2Child').slideUp(200);	
	$('#menuMariaOferr2').removeClass('active');
	$('#menuMariaOferr3Child').slideUp(200);	
	$('#menuMariaOferr3').removeClass('active');
	$('#menuMariaOferr4Child').slideUp(200);	
	$('#menuMariaOferr4').removeClass('active');
	$('#menuMariaOferr5Child').slideUp(200);	
	$('#menuMariaOferr5').removeClass('active');
	$('#menuMariaOferr6Child').slideUp(200);	
	$('#menuMariaOferr6').removeClass('active');
	$('#menuMariaOferr7Child').slideUp(200);	
	$('#menuMariaOferr7').removeClass('active');
	
	$(id).slideDown(500);
	$(parent).addClass('active')
}

function showNextPage(id){
	var menuPositions=new Array("/","aktualnosci","firma","oferta","kontakt","partnerzy","audiobooki");	
	//alert(id);	
	menuActive = id;	
	if (menuPositions[0]==menuActive) location.href=''+menuPositions[1];
	//if (menuPositions[1]==menuActive) location.href=''+menuPositions[2];
	if (menuPositions[1]==menuActive) location.href=''+menuPositions[6];
	if (menuPositions[2]==menuActive) location.href=''+menuPositions[3];
	if (menuPositions[3]==menuActive) location.href=''+menuPositions[4];	
	//if (menuPositions[4]==menuActive) location.href='nasi partnerzy';
	if (menuPositions[4]==menuActive) location.href=''+menuPositions[1];
	if (menuPositions[5]==menuActive) location.href=''+menuPositions[1];	
	if (menuPositions[6]==menuActive) location.href=''+menuPositions[3];
	if (menuActive > 1 && menuActive <25) location.href=''+menuPositions[4];		
}

/* menu */

/* gallery */

function galleryRight() {
	//alert('page: '+page+' pageMax: '+pageMax+' '+$("#photoItems").position().left);
	if (page < pageMax) {
	 	//$("#galleryRight").show();
		$("#galleryLeft").show();
		newPostion = newPostion - positionChange;
	 	//alert('newPostion: '+newPostion);
		newPostionPx = newPostion + "px";
		$("#photoItems").animate({'marginLeft': "" + newPostionPx + ""}, {queue: false,duration: 1000});
		page++;
	} 
	
	if (page == (pageMax )) $("#galleryRight").hide();			
}

/*				
function galleryRight() {
	//alert('page: '+page+' pageMax: '+pageMax+' '+$("#photoItems").position().left);
	if (page < pageMax) {
	 	newPostion = newPostion - positionChange;
	 	//alert('newPostion: '+newPostion);
		newPostionPx = newPostion + "px";
		$("#photoItems").animate({left: "" + newPostionPx + ""}, {queue: false,duration: 1000});
		page++;
	} 				
}
*/
				
function galleryLeft() {
	//alert('page: '+page+' pageMax: '+pageMax+' '+$("#photoItems").position().left);
	if (page >= 2) {
	 	$("#galleryRight").show();
		//alert($("#photoItems").position().left);
		newPostion = newPostion + positionChange;
		//alert(newPostion);
		newPostionPx = newPostion + "px";
		$("#photoItems").animate({marginLeft: "" + newPostionPx + ""}, {queue: false,duration: 1000	});
		page--;
	} 
	
	if (page == 1) $("#galleryLeft").hide();				 				
}
/* gallery */	



/* news */
function newsNext(id) {
	
	$("#newses").html('<div style="width:600px; height:362px; text-align:center; padding-top:165px;"> <img src="img/loading.gif" alt="" /> </div>');
	
	$("#newses").load("news/view/"+id);
	
}

function newsPrevious(id) {
	
	$("#newses").html('<div style="width:600px; height:362px; text-align:center; padding-top:165px;"> <img src="img/loading.gif" alt="" /> </div>');	
	$("#newses").load("news/view/"+id);
	
}

/* news */

$(function() {
	$('.tooltip').tooltip({
		showURL: false,
		track:	true
	});
});


function openShadowbox(content, player, title, width, height){
	Shadowbox.open({
        content:    content,
        player:     player,
        title:      title,
        width:      width,
		height:     height
    });
}

	
