$(document).ready(function() {

    $('.box:nth(2)').addClass('box3');
    $('.box:nth(5)').addClass('box6');
    $('.newsbox:nth(2)').addClass('newsbox3');

    $('#top_menu .menu-item:nth(0) a').html('<img src="/wp-content/themes/stouenborg/images/uk.png" alt="English" />');
    
    $('.sale-news:nth(0)').attr('id', 'sale1');
    $('.sale-news:nth(1)').attr('id', 'sale2');
    $('.sale-news:nth(2)').attr('id', 'sale3');
    
    //Default Action
	$(".sale-news").hide(); //Hide all content
	$("#sale-btn-1").addClass("active").show(); //Activate first tab
	$("#sale1").show(); //Show first tab content
	
	$("a.sale-btn").click(function() {
		$("a.sale-btn").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected link
		$(".sale-news").hide(); //Hide all tab content
		var activeTab = $(this).attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn('slow'); //Shows the active content
		return false;
	});
	$("a#sale-next").click(function() {
		var current = $("a.sale-btn.active");
		var next = current.parent().next().find(".sale-btn");
		if (next.size() == 0) {
			next = $("a.sale-btn:nth(0)");
		}
		next.click();
		return false;
	});
	$("a#sale-prev").click(function() {
		var current = $("a.sale-btn.active");
		var next = current.parent().prev().find(".sale-btn");
		if (next.size() == 0) {
			next = $("a.sale-btn").last();
		}
		next.click();
		return false;
	});
	
	$('.installation-news:nth(0)').attr('id', 'installation1');
    $('.installation-news:nth(1)').attr('id', 'installation2');
    $('.installation-news:nth(2)').attr('id', 'installation3');
    
    //Default Action
	$(".installation-news").hide(); //Hide all content
	$("#installation-btn-1").addClass("active").show(); //Activate first tab
	$("#installation1").show(); //Show first tab content
	
	$("a.installation-btn").click(function() {
		$("a.installation-btn").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected link
		$(".installation-news").hide(); //Hide all tab content
		var activeTab = $(this).attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn('slow'); //Shows the active content
	return false;
	});
	$("a#installation-next").click(function() {
		var current = $("a.installation-btn.active");
		var next = current.parent().next().find(".installation-btn");
		if (next.size() == 0) {
			next = $("a.installation-btn:nth(0)");
		}
		next.click();
		return false;
	});
	$("a#installation-prev").click(function() {
		var current = $("a.installation-btn.active");
		var next = current.parent().prev().find(".installation-btn");
		if (next.size() == 0) {
			next = $("a.installation-btn").last();
		}
		next.click();
		return false;
	});
	
	$('.udlejning-news:nth(0)').attr('id', 'udlejning1');
    $('.udlejning-news:nth(1)').attr('id', 'udlejning2');
    $('.udlejning-news:nth(2)').attr('id', 'udlejning3');
    
    //Default Action
	$(".udlejning-news").hide(); //Hide all content
	$("#udlejning-btn-1").addClass("active").show(); //Activate first tab
	$("#udlejning1").show(); //Show first tab content
	
	$("a.udlejning-btn").click(function() {
		$("a.udlejning-btn").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected link
		$(".udlejning-news").hide(); //Hide all tab content
		var activeTab = $(this).attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn('slow'); //Shows the active content
	return false;
	});
	$("a#udlejning-next").click(function() {
		var current = $("a.udlejning-btn.active");
		var next = current.parent().next().find(".udlejning-btn");
		if (next.size() == 0) {
			next = $("a.udlejning-btn:nth(0)");
		}
		next.click();
		return false;
	});
	$("a#udlejning-prev").click(function() {
		var current = $("a.udlejning-btn.active");
		var next = current.parent().prev().find(".udlejning-btn");
		if (next.size() == 0) {
			next = $("a.udlejning-btn").last();
		}
		next.click();
		return false;
	});
    
});

