/* Ftr */
$('h1').ftr("../../swf/ftr/ftrFont.swf",
	{
		size:34,
		transform:"uppercase",
		color: "#333333",
		topOffset:4,
		multiline: true
	}
);

$('body#links-page h1, body#chat-page h1').ftr("../../swf/ftr/ftrFont.swf", 
	{
		size:34,
		transform:"uppercase",
		color: "#333333",
		width:115,
		multiline: true
	}
);

$('ul.liftings li.wide-lift h2').ftr("../../swf/ftr/ftrFont.swf", 
	{
		size:24,
		transform:"uppercase",
		color: "#333333",
		width:255,
		leading: 25,
		topOffset:4,
		extendHeight:4,
		multiline: true
	}
);

$('body#frontpage ul.liftings li h2').ftr("../../swf/ftr/ftrFont.swf", 
	{
		size:18,
		transform:"uppercase",
		color: "#34709E",
		width:170,
		topOffset:4,
		extendHeight:4,
		multiline: true
	}
);

$('h2').ftr("../../swf/ftr/ftrFont.swf", 
	{
		size:20,
		transform:"uppercase", 
		color: "#333333", 
		topOffset:4,
		extendHeight:4
	}
);


/* FAQ sulku/avaus + pikku saatoo */
$(document).ready(function(){
// viimeisesta kappaleesta alamarginaali pois
$('dl.faq dd p:last-child').css({marginBottom:"0"})

// jos kysymyksia enemmän kuin 1 kpl, tehaan avaa/sulje juttu
if ($('dl.faq dd').length > 1) {
	// nuoli ikoni dynkysti kysymykseen
	$('<span class="icon">&nbsp;</span>').appendTo("dl.faq dt");
	// piilotetaan vastaukset
	$('dl.faq dd').hide();
	// FAQ kysymyksen avaus/sulku + 'hover' & nuolen kaanto
	$('dl.faq dt').each(function(){
		$(this).hover(
			function(){
				$(this).toggleClass('hover');
			}, function(){
				$(this).toggleClass('hover');
			});
		$(this).click(
			function(){

				if(!$(this).next("dd").is(":visible")){
					
					var title=$(this).text()
					if (title.length>40){
						title="/"+title.substring(0,37)+"..."
						}
						pathArray = window.location.pathname.split( '/' );
						pathArray.pop()
						pageTracker._trackPageview(pathArray.join("/")+"/"+title);
					};
	
				$(this).next("dd").slideToggle(75);
				

				$(this).find("span.icon").toggleClass('open');
			}, function(){		
				$(this).find("span.icon").toggleClass('open');
			});
		});
		
		// FAQ sivun sisainen ankkuri siirtyminen
		$('dl.faq dd a[href^="#"]').click(function(event){
			var $obj = $($(this).attr('href'))
			if ($obj.next("dd").is(':hidden'))
			{
				setTimeout(function(){$obj.trigger('click')},500)
			}
		});
		
		// FAQ sivulta siirtyminen toiseen FAQ sivuun			
		if (window.location.hash)
		{
			var position = $(window.location.hash).offset();
			$('html,body').scrollTop(position.top);
			$(window.location.hash).trigger('click')
		}
	}
});


/* Header:n linkki logo opasiteetti */
$(document).ready(function(){
	$('#header p.logo a').hover(
		function(){
			$(this).find("img").animate({opacity: 0.8},100);
		}, 
		function(){
			$(this).find("img").animate({opacity: 1},100);
		});
});

