Shadowbox.loadSkin('classic', '/js/shadowbox/skin'); // use the "classic" skin

$(document).ready(function(){

var path
path = jQuery.url.attr('path') //get the path

$.cookie('testcookiesenabled', null); //test if cookies are enabled
$.cookie('testcookiesenabled', 'enabled');
if ($.cookie('testcookiesenabled')) { //if they're enabled, allow the faux-splash page to run
//alert('enabled');
var COOKIE_NAME = 'splash-page-cookie'; //check to see if the cookie has been set etc...
	$go = $.cookie(COOKIE_NAME);
	if ($go == null) {
		$.cookie(COOKIE_NAME, 'test', { path: '/', expires: 1 });
	
	if (path == '/' || path == '/de/' || path == '/es/') {	//if the cookie hasn't been set (or has expired) and we're on the homepage, then:
					  
	var options = {
        overlayOpacity:     '1',
		animate: 			false,
		animateFade:		false
    };

    Shadowbox.init(options);

Shadowbox.open({ //open the faux-splash page...
        player:     'img',
        content:    '/images/logo.jpg',
        height:     157,
        width:      475
    });

}


	}
	else {
	}
} else {

}

});

$(document).ready(function() {

$("a[rel^='prettyphoto']").prettyPhoto({
theme:'facebook',
default_width: 480,
default_height: 290
}); //set up prettyphoto for all links with a rel attribute of 'prettyphoto'

$('.small-panel-single span').prepend('&raquo; '); //just add in the chevrons to some links (as IE doesn't let CSS do it)

$('.captionhome, .caption').append('<div class=\"pause\">pause</div><div class=\"resume\">play</div>'); //set up the play and pause buttons on the slideshows

$('#footer address').defuscate(); //anti-spam email obfuscation

$('#homepage-slideshow').cycle({ //set up the slideshow using jquery cycle
    fx:    'fade',
	cleartype: 1,
    speed:  2500,
	random: 1
 });

$('#homepage-slideshow div.slide').addClass('playing'); //tell the slideshow it's playing

$('#boat-of-the-month ul').cycle({ //set up the boat of the month images (shuffle)
    fx:     'shuffle', 
    timeout: 0, 
    next:   '#forward', 
    prev:   '#back' 
});

$('.aftersales #slides, .about #slides').cycle({ //set up the slideshow on the aftersales and about us pages
    fx:     'fade', 
    //speed:  'slow', 
    timeout: 0, 
    next:   '#forward', 
    prev:   '#back' 
});

$('#boat-of-the-month ul').css('margin-left','28px'); //fix the boat of the month CSS

$('.aftersales #slides, .about #slides').css('margin-left','28px');

$('#homepage-slideshow .slide').toggle(function() { //this sets up the play/pause functionality

                $('#homepage-slideshow').cycle('pause');
                $('#homepage-slideshow div.slide').addClass('paused').removeClass('playing');
                }, function() {
                $('#homepage-slideshow').cycle('resume', true);
                $('#homepage-slideshow div.slide').addClass('playing').removeClass('paused');
        }); 

  $("div.slide").each(function () {
    $(this).children('.caption, .captionhome').prepend('<p>' + $(this).attr('title') + '</p>');
   });


// setting the height of the iframe for the external brokerage page, relative to the viewport height

var viewportHeight = $(window).height(); 
var iframeHeight
iframeHeight = Math.round(viewportHeight * 0.7);

if (iframeHeight < 300) {
iframeHeight = 300
}

$('.content-panel-triple iframe').css('height',iframeHeight);

var isie6
isie6 = 0
if ($.browser.msie && $.browser.version == 6 ) {
isie6 = 1
}

if (isie6 == 0) { //IE6 doesn't like this - oh well; we'll exclude it. Animate the hover functionality for the main navigation

$('#mainNav li').css({backgroundPosition: '0px 0px'});

$('#mainNav li.current').css({backgroundPosition: '0px -51px'});

$('#mainNav li.nav').hover(function(){

			      $(this).stop().animate({backgroundPosition: '(0px -51px)'}, 200 );
					//alert($(this));
			    }, function() {
			      $(this).stop().animate({backgroundPosition: '(0px 0px)'}, 400 );
			});

}

});


