jQuery(document).ready(function($){

	$('.read_more a').click(function(){
		if($(this).hasClass('less')){
			$(this).text('Läs mer');
			$(this).removeClass('less');
		}else{
			$(this).text('Stäng');
			$(this).addClass('less');
		}
		
		$(this).parent('p').parent('div').next('.bottom').slideToggle();
		
		return false;
	});
	
	$('.totop a').click(function(){
		$(this).parent('p').parent('.bottom').slideUp();
		
		return false;
	});
	
	$('.scroller').mousedown(function(){
		var apa = $(this).attr('href');
		goToByScroll(apa);
		
	});
	
			changeImg2();	
	
});

function expander(trig, expand){

	$(trig).click(function(){
		if($(this).hasClass('less')){
			$(this).removeClass('less');
		}else{
			$(this).addClass('less');
		}

		$(this).parent('p').next('.bottom').slideToggle();
		return false;
	});

}

function goToByScroll(id){
	jQuery('html,body').animate({scrollTop: jQuery(id).offset().top + -30},'slow');
}

function changeImg2() {
	var slash2 = "http://"+window.location.hostname;
	var myImages2 = [
		slash2+"/wp-content/themes/claremont/img/header_bg/header1.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header2.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header3.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header4.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header5.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header6.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header7.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header8.jpg",
		slash2+"/wp-content/themes/claremont/img/header_bg/header9.jpg"
	];
	var imgShown2 = myImages2[Math.floor(Math.random() * myImages2.length)];
		jQuery('.change_img').css('background','url('+ imgShown2 +')');
		jQuery('.change_img').css('background-repeat','no-repeat');

}
