$(document).ready(function()
{
    // Wrap the contents of any .watchvideo links with a span
    $("a.watchvideo").each(
        function(i)
        {
            $(this).html('<span>' + $(this).text() + '</span>');
        }
    );
});

jQuery.preloadImages = function()
{
    for(var i = 0; i<arguments.length; i++)
    {
        jQuery("<img>").attr("src", arguments[i]);
    }

//    setTimeout(slideShowHeader, 5000);
    setTimeout(slideShowHeader, 10000);
}

function slideShowHeader()
{
    if (headers.length < 2) return;

    var obj = null;

    if ($('#header img').get(0))
        obj = $('#header img');

    obj.fadeOut('slow', function()
	{
		var im = obj.get(0);
		if (++j >= headers.length) j = 0;

//		obj.get(0).onload = function() { obj.fadeIn("slow"); };
		obj.get(0).onload = function() { obj.fadeIn( ); };
		obj.attr("src", headers[j]);//.fadeIn("slow");

//		setTimeout(slideShowHeader, 5000);
		setTimeout(slideShowHeader, 10000);
	});
}
