var CROSSFADE_IN_SPEED = 500;
var CROSSFADE_OUT_SPEED = 300;
var TRANSITION_SPEED = 500;


jQuery(window).bind('load', function () 
               {  
                   jQuery("#prepage_loading").hide();
                   jQuery("#content").fadeIn( TRANSITION_SPEED );
                   jQuery("img.crossfade").crossfade({ delay: CROSSFADE_IN_SPEED }, { delay: CROSSFADE_OUT_SPEED });
               });



// OLD Splash page - NOT USED -----------------------------------------------------------------------------------
jQuery(document).ready( function() {

    jQuery("#splash_jiffy_logo").mouseover( animate_jiffy );
    jQuery("#splash_ferry_morse_logo").mouseover( animate_ferry_morse );
    jQuery("#splash_tref_logo").mouseover( animate_tref );
    jQuery("#splash_mcfayden_logo").mouseover( animate_mcfayden );
    jQuery("#splash_mckenzie_logo").mouseover( animate_mckenzie );

});

var target_shown = false;

function animate_jiffy() {       animate_target( 180, 280, "jiffy_address" ) };
function animate_ferry_morse() { animate_target( 220, 120, "ferry_morse_address" ) };
function animate_tref() {        animate_target( 195, 265, "tref_address" ) };
function animate_mcfayden() {    animate_target( 204, 104, "mcfayden_address" ) };
function animate_mckenzie() {    animate_target( 206, 106, "mckenzie_address" ) };
var current_address_box = "";


function animate_target( top, left, address_box_id )
{
	if ( jQuery.browser.msie )
	{
		animate_target_ie(top, left, address_box_id);
	}
	else
	{
		animate_target_ff(top, left, address_box_id);
	}	
}

function animate_target_ff(top, left, address_box_id)
{
    
    if ( !target_shown ) 
    { 
        jQuery("#splash_globe_target").css({ top: top, left: left }).fadeIn( TRANSITION_SPEED );
        target_shown = true; 
        //fade in the address box
        jQuery("#" + address_box_id).css({top: top + 25, left: left + 25}).fadeIn(TRANSITION_SPEED) ;
        current_address_box = address_box_id;
    } 
    else
    {
       
     	if(current_address_box != "")
        {
           	jQuery("#"+ current_address_box).fadeOut(TRANSITION_SPEED);
         }
  		jQuery("#splash_globe_target").stop().animate({ top: top, left: left }, 
  											TRANSITION_SPEED, 
  												function(){ 
  						jQuery("#" + address_box_id).css({top: top + 25, left: left + 25}).fadeIn(TRANSITION_SPEED) } );
  			//set the flag
  			current_address_box = address_box_id;
                                  
    }
    
    
}

function animate_target_ie(top, left, address_box_id)
{
    
    if ( !target_shown ) 
    { 
        jQuery("#splash_globe_target").css({ top: top, left: left }).show();
        target_shown = true; 
        //fade in the address box
        jQuery("#" + address_box_id).css({top: top + 25, left: left + 25}).show() ;
        current_address_box = address_box_id;
    } 
    else
    {
       
     	if(current_address_box != "")
        {
           	jQuery("#"+ current_address_box).hide();
         }
  		jQuery("#splash_globe_target").stop().animate({ top: top, left: left }, 
  											TRANSITION_SPEED, 
  												function(){ 
  						jQuery("#" + address_box_id).css({top: top + 25, left: left + 25}).show() } );
  			//set the flag
  			current_address_box = address_box_id;
                                  
    }
    
    
}
