$(document).ready(function(){

/*CUFON*/
Cufon.replace('h3, h4, h1, h6, .twocols span, .entry_index h2, p.price span, .campaign h2, .before span, .campaign a.now', {
				hover: true,
				hoverables: { span: true } 
});

/*MENU*/
$('#menu li a').hover(function(){
		$('.submenu').css("zIndex", "100");
		var p = $(this).parent();
		var position = p.position();
		$('#menu_container .'+this.id).css('left', position.left-20).show();	
	}, function() {
		$('#menu_container .'+this.id).hide();
	});
	
	$('.submenu').hover(function(){
		$(this).show();
	}, function() {
		$(this).hide();
	});
	
if ($('#slider').length != 0) {
$('#slider').before('<div id="controller"><div id="prev"></div><span id="nav"></span><div id="next"></div></div>').cycle({ 
    fx:     'scrollHorz', 
    speed:  'slow', 
    timeout: 5000, 
    pager:  '#nav',
    prev:   '#prev', 
    next:   '#next' 

});
}

if ($('#slider_nocontrols').length != 0) {
$('#slider_nocontrols').cycle({ 
    fx:     'scrollHorz', 
    speed:  'slow', 
    timeout: 5000
});
}

if ($('#slider_omoss').length != 0) {
$('#slider_omoss').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 5000

});
}

if ($('#mini_slider').length != 0) {
$('#mini_slider').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 8000

});
}

if ($('#news').length != 0) {
/*NYHETER FÖRSTASIDAN*/
    $('#news').load("../blogg/senaste-nyheter/ #news", function() {
            	$('#loader').hide();	
    });
}

if ($('#news_v').length != 0) {
/*NYHETER VOLVO*/
    $('#news_v').load("../blogg/senaste-volvo/ #news", function() {
            	$('#loader').hide();	
            });
}


if ($('#news_r').length != 0) {
/*NYHETER RENAULT*/

    $('#news_r').load("../blogg/senaste-nyheter-renault/ #news", function() {
            	$('#loader').hide();	
            });

}


if ($('#news_h').length != 0) {
/*NYHETER HUSBILAR*/ 
   
            $('#news_h').load("../blogg/senaste-nyheter-husbilar/ #news_husbilar", function() {
            	$('#loader').hide();	
            });

}

/* LADDAR IN KAMPANJER/NYHETER */

	if ($('.load').length != 0) {
		var load_url = $(this).children("a").attr('url');
		$(this).append(load_url);
		
	}


/* ACTIVE PAGE MENU */
	var activePage = $(".col_menu").attr('id');
	$(".col_menu li a").each( function() {
		if ( this.id == activePage ) { $(this).addClass("active"); }
	});
	
	
// Tar bort p-taggar i posten p&Aring; f&ouml;rstasidan
	$(".entry_index img + br").remove();
	
	//L&auml;gger till en klass med margin-top p&Aring; "L&auml;s mer"-l&auml;nkens p
	$(".entry_index .more-link").parent().addClass("p-more-link");

});



