jQuery(document).ready(function(){ 	 
(function($) {
  $('.richtext span').each(function(){ 
		if($(this).text() == "" && !$(this).html().match(/br/ig)) {
			$(this).remove();
		}
	}); 
  $('.richtext p span.jalustaH1, .richtext p span.jalustaH2, .richtext p span.jalustaH3').each(function(){ 
		$(this).parent().replaceWith($(this).parent().html());
	}); 
	$('a').each(function() {
		if(!$(this).attr("href")) {
			$(this).remove();
		}
	});

	$('.maintitle span').sifr({
	font:gotham,
	build: 436,
	version: 3,
	tuneWidth: 20,
	save: true,
	fontWeight: 'normal'
	});
	$('.sectiontitle span').sifr({
	font:gotham,
	build: 436,
	version: 3,
	tuneWidth: 20,
	save: true,
	fontWeight: 'normal'
	});
	$('.offerstitle span').sifr({
	font:gotham,
	build: 436,
	version: 3,
	tuneWidth: 20,
	save: true,
	fontWeight: 'normal'
	});
	$('.tabtitle').sifr({
	font:gotham,
	build: 436,
	version: 3,
	save: true,
	fontWeight: 'normal'
	});
	if(typeof contentAreas == 'undefined') {
	$('.jalustaH1').sifr({
	font:gotham,
	build: 436,
	version: 3,
	tuneWidth: 20,
	save: true,
	fontWeight: 'normal'
	});
	$('.jalustaH2').sifr({
	font:gotham,
	build: 436,
	version: 3,
	save: true,
	tuneWidth: 20,
	fontWeight: 'normal'
	});
	$('.jalustaH3').sifr({
	font:gotham,
	build: 436,
	version: 3,
	tuneWidth: 20,
	save: true,
	fontWeight: 'normal'
	});
	}
  $('.frontcontent a').each(function(){ 
		if($(this).text() == "Matkakohteet") {
			$(this).parent().addClass('frontbutton');
			$(this).addClass('imagebutton');
			$(this).addClass('matkakohteet');
			$(this).html('<span>'+$(this).html()+'</span>');
		}
	}); 
	$("a.toggler").click(function () {
		$("#hiddenform").toggle();
		$(this).toggleClass('selected');
		return false;
	});
	$('.subcontent .formtr .nappi').parent().html('<input width="23" type="image" height="16" src="/layout/pohjolanmatka09/images/shim.png" class="sendbutton" name="j_submit" value="Lähetä"/>');
	$('.continuebutton').attr({value:""});
  $('.richtext table tr:even').removeClass('row_a row_b').addClass("row_a");   
  $('.richtext table tr:odd').removeClass('row_a row_b').addClass("row_b");
	$('.richtext table').each(function(){
		var sp = $(this).attr("border");
		if(sp) $(this).attr("cellspacing",2);
		else $(this).attr("cellspacing",0);
	});
	$('.richtext strong table').each(function(){
		$(this).parent().replaceWith($(this).parent().html());
	});

	$('a.imagebutton').blend({speed:300});
	$('div.hilitemore a').blend({speed:300});
	$('div.hilitebook a').blend({speed:300});
	$('div.alloffers a').blend({speed:300});
	$('div.reservebutton a').blend({speed:300});
})(jQuery)
	
});
