﻿
/***************************************************************************************/

function KillEnter()
{
    var isEnter=false;

    if (window.event) 
    {
      if (event.keyCode == 13) isEnter= true;
    }
    else if(e.which == 13) isEnter= true;
   
    if( isEnter )
    {
       return false;
    }
    
    
    return true;
}


function isIE6()
{
    if ($.browser.msie && $.browser.version.substr(0,1)<7) return true;
    else return false;
}
function isIE()
{
    return $.browser.msie;
}

/***************************************************************************************/


var fadeInterval;
var overrideKillFadeDone=false;
                    
function fadeContents() 
{
    
    fadeBG();
    fadeHeading();
    fadeBodyBG();
    fadeBodyBG();
}


function fadeBG() {
    //alert( jQuery );
    $(".inner_body").fadeOut(2000);
    
    //alert( $(".inner_body").queue().length );
}


function fadeHeading() 
{
    //alert( jQuery );
    $(".header_image_container_fade").fadeOut(2000);
}

function fadeBodyBG()
{
    $("body").animate( {backgroundColor: "#606060"}, 2000 );
}

function initialiseFade() 
{
    if( overrideKillFadeDone||document.cookie.indexOf( "fadeDone=true" ) < 0 ) 
    {
        $(".inner_body").css("display", "block" );
        $(".header_image_container_fade").css("display", "block" );
        $("body").css("background-color", "#780000" );
        
        fadeInterval = setTimeout( fadeContents, 6750 )
        
        
        
    } else {
    
    }
    document.cookie = 'fadeDone=true; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
}

/********************************************************************************/

function doGoogleSearch() 
{
    window.location = searchPagePath + "?q=" + escape( document.getElementById( "q" ).value );
}

/********************************************************************************/

function initMasterPage()
{           


    if( Exists('a.lightbox') ) $('a.lightbox').lightBox(); // make any anchor link that is class='lightbox' a lightbox!
if( Exists('.console') )
    {
        var consoleObj = $('.console');
        var consoleText = consoleObj.text().replace(" ", "").replace("\n","");
        if( consoleText=="" )  consoleObj.hide();
        else consoleObj.draggable();
    }
                 
             
    initialiseFade(); 
  

}


function initMasterPageSub()
{
    if( Exists('a.lightbox') ) $('a.lightbox').lightBox(); // make any anchor link that is class='lightbox' a lightbox!
    if( Exists('.console') )
    {
        var consoleObj = $('.console');
        var consoleText = consoleObj.text().replace(" ", "").replace("\n","");
        if( consoleText=="" )  consoleObj.hide();
        else consoleObj.draggable();
    }

}

// We need this because of IE
function Exists( jquerySelector )
{
    var exists = false; 
    try
    {
       exists = ( $(jquerySelector).length>0 );
    }
    catch(err)
    {
    
    }
    
    return exists;
}

//load a flash video
function loadVideo( filePath ) { 
    // #videoDiv is the selector 
    $('#videoDiv').flash( 
	    { 
		    // test.swf is the flash document 
		    swf: '../flash/test.swf',
		    width: 320,
		    height: 240 + 37,
		    flashvars: { 

			    moviePath: filePath

		    }				

	    } 
    ); 
} 