$().ready(function(){
	
	var currentSite = "" + window.location;
	
	if (currentSite.indexOf('ozespole.html') > 0){
		onBandLoad();	
	} else if (currentSite.indexOf('demo.html') > 0){
		onDemoLoad();	
	} else if (currentSite.indexOf('sprzet.html') > 0){
		onDemoLoad();	
	} else if (currentSite.indexOf('rider.html') > 0){
		onRiderLoad();	
	} else if (currentSite.indexOf('kontakt.html') > 0){
		onContactLoad();
	} else if (currentSite.indexOf('linki.html') > 0){
		onContactLoad();	
	} else {
		onHomeLoad();
	}
		
	
	initMenu(); 
});

function onContactLoad(){
	$('#left').fadeIn('slow').queue(function(){
		$('#szescio').animate({
			opacity:'toggle',
			height:'toggle'
			}, 'slow');
	});
}

function onRiderLoad(){
	$('#left').fadeIn('slow').queue(function(){
		$('#szescio').animate({
			opacity:'toggle',
			height:'toggle'
			}, 'slow');
	});
}


function onDemoLoad(){
	$('#left').fadeIn('slow').queue(function(){
		$('#szescio').animate({
			opacity:'toggle',
			height:'toggle'
			}, 'slow');
	});
}

function initMenu(){
//	$("#menu li").hover(function(){
//			$(this).addClass('selected-item');
//		}
//		,
//		function(){
//			$(this).removeClass('selected-item');
//		});
}

function onBandLoad(){
	$('#left').fadeIn('slow').queue(function(){
		$('#szescio').animate({
			opacity:'toggle',
			height:'toggle'
			}, 'slow');
	});
	
	$(".sklad h3").click(function(){
		$("#t" + this.id).animate({
			opacity:'toggle',
			height:'toggle'
			}, 
			'slow');
	});
	
	$('#showall').click(function(){
		var images = ['tbeata', 'tdorota', 'tandrzej', 'tpiotr', 'tfilip', 'trobert', 'tzibi', 'tlukasz', 'trobert2'];
		var show = $('#showall').text() == '+';
		$.each(images, function(){
			if (show){
				$('#showall').text('-');
				if ($("#" + this).is(":hidden")){
					$("#" + this).animate({
						opacity:'show',
						height:'show'
						}, 
						'slow');
				}
			} else {
				$('#showall').text('+');
				if (!$("#" + this).is(":hidden")){
					$("#" + this).animate({
						opacity:'hide',
						height:'hide'
						}, 
						'slow');
				}
			}
		});
	});
}

function onHomeLoad(){
	var $welcome = $('#witamy');
	$welcome.fadeIn('normal')
	.queue(function(){
		$('#koncerty').fadeIn('normal')
		.queue(function(){
			$('#firmowe').fadeIn('normal')
			.queue(function(){
				$('#wesela').fadeIn('normal')
				.queue(function(){
					$('#szescio').animate({
						opacity:'toggle',
						height:'toggle'
						}, 'slow'); 
				});
			});
		});
	});
}




