$(document).ready(function() {

    $('#primaryNavOuter').supersleight();
    $('#leftPanel .quoteFooter').supersleight();
    $('#contentFooter').supersleight();

    //$('body').append('<div id="debug" style="position:fixed;top:0px;right:0px;width:200px;height:100px;background:#fff;color:#000;border:1px solid #000;padding:10px;"></div>');
    //$('#debug').html("");
    //$('#debug').html($('#debug').html() + '<br />' + document.referrer.split("/")[2]);
    //$('#debug').html($('#debug').html() + '<br />' + location.href.split("/")[2]);

    if (document.referrer.split("/")[2] != location.href.split("/")[2]) {
        $('#header h1').hide().fadeIn(2000);
    }





});  

// ------------------------------------------------------------------------------------
function _buildLightbox() {
	$('body').append('<div id="lightboxOverlay"></div>');
	$('body').append('<div id="lightboxContentWrap"><div id="lightboxContent"><a class="close" href="javascript:_destroyLightbox()">Close</a><div></div></div></div>');
	$('#lightboxOverlay').click(function() {
		_destroyLightbox()
	});
	$('#lightboxContentWrap').click(function() {
		_destroyLightbox()
	});
};

// ------------------------------------------------------------------------------------
function _destroyLightbox() {
	$('#lightboxOverlay').remove();
	$('#lightboxContentWrap').remove();
};

// ------------------------------------------------------------------------------------
function goToIdOnReady(id) {
    $(document).ready(function(){    
        var target = $('#' + id)
        target = target.size() && target;
        if (target.size()) {
            var targetOffset = target.offset().top;
            $('html').animate({ scrollTop: targetOffset }, 0);
        };
    });
};
// ------------------------------------------------------------------------------------
function goToId(id) {
    var target = $('#' + id)
    target = target.size() && target;
    if (target.size()) {
        var targetOffset = target.offset().top;
        $('html').animate({ scrollTop: targetOffset }, 0);
    };
};
// ------------------------------------------------------------------------------------

Cufon.replace('#header h1', { fontFamily: 'Aero' });
Cufon.replace('#primaryNav a', { fontFamily: 'Aero', hover: true, hoverables: { a: true }});
Cufon.replace('#rightPanel #synopsis h2, #rightPanel #content h2, #rightPanel .downloadLink a, #call h2, #call p, #downloads h2', { fontFamily: 'RockwellBold' });
Cufon.replace('#call p', { fontFamily: 'Rockwell' });

