var curentPage='home';
var cB=1;
$(document).ready(function(){
	
	$('#navigation').find('ul').find('li').bind('mouseover',function(){
		$(this).find('a').animate({'padding':'6px 3px','margin':'6px 3px'});
	});
	$('#navigation').find('ul').find('li').bind('mouseout',function(){
		$(this).find('a').animate({'padding':'3px 3px','margin':'3px 3px'});
	});
	$('#navigation').find('ul').find('li').each(function(){
		$(this).bind('click',function(){
			curentPage=$(this).find('a').attr('page');;
			setPage(curentPage);
		});
	});
	
	$('#slideshowHolder').jqFancyTransitions({ width: 600, height: 220 });

	//setTimeout(function(){
		changebg(cB);
	//},10000);
	
	$('#pagebottom').find('a img').hover(function() {
		// hover in
		$(this).parent().parent().css("z-index", 1);
		$(this).animate({
			height: "31",
		//	width: "250",
			left: "-=5",
			top: "-=5"
		}, "fast");
	}, function() {
		// hover out
		$(this).parent().parent().css("z-index", 0);
		$(this).animate({
			height: "21",
			//width: "150",
			left: "+=5",
			top: "+=5"
		}, "fast");
	});
	
	animatefavicon();
});

function changebg(a){
	switch(cB){
		//case 0:$('body').css({'background':'url("img/if/bg3.png")','background-color': '#252525','background-repeat': 'no-repeat','background-size':'100%'});window.cB+=1;break;
		case 1:$('body').css({'background':'url("img/if/bg4.png")','background-color': 'black','background-repeat': 'no-repeat','background-size':'79%'});window.cB+=1;break;
		//case 2:$('body').css({'background':'url("img/if/bg.png")','background-color': '#252525','background-repeat': 'no-repeat','background-size':'100%'});window.cB+=1;break;
		//case 3:$('body').css({'background':'url("img/if/bg2.png")','background-color': '#252525','background-repeat': 'no-repeat','background-size':'100%'});window.cB+=1;break;
		//case 4:$('body').css({'background':'url("img/if/bg5.jpg")','background-color': '#252525','background-repeat': 'no-repeat','background-size':'100%'});window.cB=0;break;
	}
/*	setTimeout(function(){
		changebg(cB);
	},10000);*/
}

function setPage(a){
	if(a!='contact'){
		$('#contact_p').fadeOut('slow',function(){
			$('body').css('overflow','auto');
			$('#home_p').fadeIn('slow');
		});
	}else{
		$('body').css('overflow','hidden');
		$('#home_p').hide( "fold", /*{pieces: 4 },*/ 2000);
		$('#contact_p').find('iframe').attr('src','map.html');
		$('#contact_p').find('iframe').css('overflow','hidden');
		$('#contact_p').show('fold');
		$('body').css('overflow','auto');
		/*$('#home_p').fadeOut('slow',function(){
			$('#contact_p').find('iframe').attr('src','map.html');
			$('#contact_p').find('iframe').css('overflow','hidden');
			$('#contact_p').fadeIn('slow');
		});*/
//		$('#contact_p').fadeIn('slow');
//		//$('#cnt').find('div^[id="'+a+'_p"]').fadeIn('slow');
//		$('#contact_p').find('iframe').attr('src','map.html');
//		$('#contact_p').find('iframe').css('overflow','hidden');
		//var cx=parseInt($('#contact_p').css('left'));
		//var cy=parseInt($('#contact_p').css('top'));
		//var cw=parseInt($('#contact_p').css('width'));
		//$('#contact_p').find('iframe').css('position','absolute');//.detach();
		/*$('#contact_p').find('iframe').animate({
			top:cy-20,
			left:cx-20,
			width:cw+20
		});*/
		//$(document).append($('#contact_p'));
	}
}



