(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)


function enableScroll(){
if(true) {
jQuery('.scrollMe').removeClass('scrollMe').jScrollPane({
			 		scrollbarWidth: 18,
			 		showArrows: true
			 	});
}
}

		jQuery.preLoadImages("media/episodeGuideTanks.jpg", "media/featuresScreens.jpg", "media/greatestTankBattles.jpg", "images/bg_overlay_top.png", "images/bg_overlay_bottom.png" );

$(document).ready(function(){


			
			jQuery('.overlayTrigger').livequery('click', function(e) { 
			
        			e.preventDefault();
        			jQuery(jQuery(this).attr('target')).click();
        		
    		});

		
		
		   jQuery('.overlay').each(function()
		   {

		      jQuery(this).qtip({
		      
		        content: {	
		        	title: {text: "",
           			button: '<span class="ir">Close</span>'},
           			prerender: false,
 				url: jQuery(this).attr("href") },
		         position: {
         			target: $(document.body), // Position it via the document body...
         			   corner: 'center'

      			},
      			show: {
         			when: {target: false, event: 'click'}, // Show it on click
         			solo: true, // And hide all other tooltips
         			effect: {
					   type: 'fade',
					   duration: 1000,
					   threshold: 500
					}
      			},
      			
      			hide: false,
      			api: {
			         beforeShow: function()
			         {
						
			            $('#qtip-blanket').stop(false, true).fadeIn(this.options.show.effect.duration);

			         },
			         onShow: function(){
			         
			         	setTimeout('enableScroll()', 1000);
			         
			         }
			      },
			      style: { width: 785, 'background': 'none', 'border': '0',
			      	title: {'background': 'none', 'border': '0'}
			      }

      			         

		      });
		      
		    jQuery(this).click(function(e) {  e.preventDefault(); jQuery(this).qtip('show') })
		      
		   });

		   jQuery('.qtip-button').livequery("click", function(){$('#qtip-blanket').fadeOut();});
		   
		      // Create the modal backdrop on document load so all modal tooltips can use it
   $('<div id="qtip-blanket">')
      .css({
         position: 'fixed',
         top: 0, // Use document scrollTop so it's on-screen even if the window is scrolled
         left: 0,
         height: '100%', // Span the full document height...
         width: '100%', // ...and full width

         opacity: 0.7, // Make it slightly transparent
         backgroundColor: 'black',
         zIndex: 5000  // Make sure the zIndex is below 6000 to keep it below tooltips!
      })
      .appendTo('#theBody') // Append to the document body
      .hide(); // Hide it initially

$(function(){
	$.fn.supersized.options = {
		startwidth: 1024,
		startheight: 512,
		minsize: .25,
		slideshow: 0,
		slideinterval: 5000
	};
        $('#supersize').supersized();
});

});


