$(function(){
	
	// Cufon replacements
	
	Cufon.replace('#logo, h1, #footer', {
		color: '-linear-gradient(#555, #000)'
	})('#nav a', {
		hover: true
	})('.cwSLVehicle h3 a');
	
	
	// Nivo slider transition
	
	$('#trans').randomize('img');
	$('#trans').nivoSlider({
		controlNav: false,
		keyboardNav: false,
		pauseTime: 6000,
		pauseOnHover: false,
		directionNav: false
	});
	
	
	// Blank links
	
	$('a.blank').unbind().bind('click', function(){
		window.open(this.href);
		return false;
	});
	
	
	// Form inputs
	
	$('form.generalform ul li input, form.generalform ul li textarea').unbind().bind('focusin', function(){
		$(this).addClass('active');
	}).bind('focusout', function(){
		$(this).removeClass('active');
	});
	
	
	// "Was" in was price
	
	$('.SLWasPrice').prepend('Was ');
	
	
	// Stocklist paging
	
	$('.SLPagingBar .SLNext a').html('&raquo;');
	$('.SLPagingBar .SLPrev a').html('&laquo;');
	
	
	// VD page buttons
	
	$('.VDbuts a').append('<span></span>');

	
});

(function($) {

	$.fn.randomize = function(childElem) {
	  return this.each(function() {
		  var $this = $(this);
		  var elems = $this.children(childElem);
	
		  elems.sort(function() { return (Math.round(Math.random())-0.5); });  
	
		  $this.remove(childElem);  
	
		  for(var i=0; i < elems.length; i++)
			$this.append(elems[i]);      
	
	  });    
	}
	
})(jQuery);
