/****************Cufon********************/
Cufon.replace('div.column-left h1', {hover: true});
Cufon.replace('div.content-block h2', {hover: true});
Cufon.replace('div.column-right h2', {hover: true});
Cufon.replace('div.footer-wrap h3', {hover: true});
Cufon.replace('a#btn', {hover: true});
Cufon.replace('a#btn-2', {hover: true});
Cufon.replace('a#btn-3', {hover: true});
Cufon.replace('a.btn-4', {hover: true});
Cufon.replace('div.inner-title h1', {hover: true});
Cufon.replace('div.inner-column h2', {hover: true});
Cufon.replace('div.right-box h2', {hover: true});
Cufon.replace('div.right-box-kunder h2', {hover: true});
Cufon.replace('div.right-box h3', {hover: true});
Cufon.replace('div.inner-page-2 h1', {hover: true});
/**************form text***********/
jQuery(function($) {
	$('#text')
	.focus(function(){if ($(this).val() == 'Sing your song...') {$(this).val('');} })
	.blur(function(){if ($(this).val() == '') {$(this).val('Sing your song...');} })
	/*--*/
	$('#name')
	.focus(function(){if ($(this).val() == 'Ditt namn') {$(this).val('');} })
	.blur(function(){if ($(this).val() == '') {$(this).val('Ditt namn');} })
	/*--*/
	$('#subject')
	.focus(function(){if ($(this).val() == 'Ämne') {$(this).val('');} })
	.blur(function(){if ($(this).val() == '') {$(this).val('Ämne');} })
	/*--*/
	$('#email')
	.focus(function(){if ($(this).val() == 'E-post') {$(this).val('');} })
	.blur(function(){if ($(this).val() == '') {$(this).val('E-post');} })
/***************Buttons******************/
	$("a#btn").hover(
		function() {
			$(this).animate({opacity:0.5}, 200);
			$(this).animate({backgroundPosition: '0 -31px'}, 0);
			$(this).animate({opacity:1}, 200);
		},
		function() {
			$(this).animate({opacity:0.5}, 200);
			$(this).animate({backgroundPosition: '0 0'}, 0);
			$(this).animate({opacity:1}, 200);
		}
	);
	$("a#btn-2").hover(
		function() {
			$(this).animate({opacity:0.5}, 200);
			$(this).animate({backgroundPosition: '0 -32px'}, 0);
			$(this).animate({opacity:1}, 200);
		},
		function() {
			$(this).animate({opacity:0.5}, 200);
			$(this).animate({backgroundPosition: '0 0'}, 0);
			$(this).animate({opacity:1}, 200);
		}
	);
	$("div.submit-element").hover(
		function() {
			$(this).animate({opacity:0.75}, 200);
			$(this).animate({backgroundPosition: '0 -31px'}, 0);
			$(this).animate({opacity:1}, 200);
		},
		function() {
			$(this).animate({opacity:0.75}, 200);
			$(this).animate({backgroundPosition: '0 0'}, 0);
			$(this).animate({opacity:1}, 200);
		}
	);
	$("a#btn-3").hover(
		function() {
			$(this).animate({opacity:0.75}, 200);
			$(this).animate({backgroundPosition: '0 -32px'}, 0);
			$(this).animate({opacity:1}, 200);
		},
		function() {
			$(this).animate({opacity:0.75}, 200);
			$(this).animate({backgroundPosition: '0 0'}, 0);
			$(this).animate({opacity:1}, 200);
		}
	);
	$("a.btn-4").hover(
		function() {
			$(this).animate({opacity:0.5}, 200);
			$(this).animate({backgroundPosition: '0 -32px'}, 0);
			$(this).animate({opacity:1}, 200);
		},
		function() {
			$(this).animate({opacity:0.5}, 200);
			$(this).animate({backgroundPosition: '0 0'}, 0);
			$(this).animate({opacity:1}, 200);
		}
	);
	$("ul.main-menu li a").hover(
		function() {
			$(this)
			.animate({opacity:0.75}, 200)
			.css({backgroundPosition : '0 -68px', color: '#ffffff'})
			.animate({opacity:1}, 200);
			$("span", this)
			.animate({opacity:0.75}, 200)
			.css('backgroundPosition', '100% -102px')
			.animate({opacity:1}, 200);
		},
		function() {
			$(this)
			.animate({opacity:0.75}, 200)
			.css({backgroundPosition : '0 0', color: '#6f6f6f'})
			.animate({opacity:1}, 200);
			$("span", this)
			.animate({opacity:0.75}, 200)
			.css('backgroundPosition', '100% -34px')
			.animate({opacity:1}, 200);
		}
	);
	$("ul.main-menu li.active a").hover(
		function() {
			$(this)
			.css({backgroundPosition : '0 -68px', color: '#ffffff'})
			$("span", this)
			.css('backgroundPosition', '100% -102px')
		},
		function() {
			$(this)
			.css({backgroundPosition : '0 -68px', color: '#ffffff'})
			$("span", this)
			.css('backgroundPosition', '100% -102px')
		}
	);
/************************Top Link******************************/
var topYloc = null;

$(window).scroll(function () { 
	var scrollTop = $(document).scrollTop();
	scrollTop = parseInt(scrollTop);
	
	var offset = topYloc+scrollTop+180+"px";  
	$("#toplink").animate({top:offset},{duration:500,queue:false});
});

$(document).ready(function(){
	//back to top scroll function. Any link with a hash (#) will scroll to that id on the page
	$('a[href*=#top]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				targetOffset = targetOffset - 35;
				$('html,body').animate({scrollTop: targetOffset}, 500);
				return false;
			}
		}
	});
});
/*************************Carousel***********************/
	$('#carousel').infiniteCarousel({
		transitionSpeed : 1000,
		displayTime : 3000,
		textholderHeight : 64,
		displayProgressBar : 0,
		displayThumbnailNumbers : 0,
		displayThumbnails : 0
	});
});
