$(document).ready(function() {
	Cufon.replace("#navigation li.item a");
	Cufon.replace("#secondary-navigation li a");
	Cufon.replace("h1");
	Cufon.replace("h2");
	Cufon.replace("h3");
	Cufon.replace("h4");
	
	var bb  = new brandBox();
	
	var temp;
	
	$("#navigation > .item").children("a").mouseover(function(){
		$(this).parent(".item").css("background", 'url("/focus2011/themes/focusflow/images/navigationitemarrow.png") no-repeat center 32px');
	}).mouseout(function (){
		if(!$(this).parent(".item").hasClass("current") && !$(this).parent(".item").hasClass("section"))
			$(this).parent(".item").css("background", "none");
	});
	
	$("#mailingList .text").focusin(function(){
		if($(this).val() == 'Sähköpostisi')
		{
			$(this).val('');
		}
	});
	$("#mailingList .text").focusout(function(){
		if($(this).val() == '')
		{
			$(this).val('Sähköpostisi');
		}
	});
	
	$(".tweetToggle").click(function(){
		if($(this).hasClass("closed"))
		{
			$(this).removeClass("closed");
			$(".tweetToggle img").attr("src", "/focus2011/themes/focusflow/images/closetweets.png");
			temp = $(".tweet1").outerHeight()+$(".tweet2").outerHeight()+$(".tweet3").outerHeight()+40;
			$("#tweets").stop().animate({
				height: temp
			}, 500);
		}
		else
		{
			$(this).addClass("closed");
			$(".tweetToggle img").attr("src", "/focus2011/themes/focusflow/images/opentweets.png");
			$("#tweets").stop().animate({
				height: "77px"
			}, 500);
		}
	});
});
