﻿/*
created by: Brian Gaines
created on: 9/26/2007
filename: _gblimg.js
comments:   
    This javascript file contains client scripts specific to the 
    standalone pages. Make sure you reference the _fw.js file as it contains
    functions this script file needs.
    
    The functions contained in this file are specifically geared 
    on image preloading to enhance page peformance.
    
    **Make sure to use the variable rootpath to obtain the correct path
    of where the files are referenced in development mode vs. 
    production mode. Read more info in App_Themes/Default/Global/Scripts/_fw.js

*/

// -------------------------------------
//      INITIALIZATIONS
// -------------------------------------
var isFacilityLanding = checkCurrentPage('Home.aspx');
var isHome = (checkCurrentPage('Default.aspx') || location.href == 'http://fieldwork.newleafhosting.com/' || location.href == 'http://www.fieldwork.com/');
var isAbout = checkCurrentPage('About.aspx');
var isBio = checkCurrentPage('Bio.aspx');
var isContact = checkCurrentPage('Contact.aspx');
var isEntrepreneurs = checkCurrentPage('Entrepreneurs.aspx');
var isGuestServices = checkCurrentPage('GuestServices.aspx');
var isTechnology = checkCurrentPage('Technology');
var isSurvey = checkCurrentPage('Survey');
var isParticipants = checkCurrentPage('Participants.aspx');
var isJoinDb = checkCurrentPage('Join.aspx');
var isManagement = checkCurrentPage('Management.aspx');
var isNews = checkCurrentPage('News.aspx');

function Init() {
  
    preloadImages();
    
}

function setThemedDivisionNav(theme) {

    //divisional navigation
/*
    facnav_fachome_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_home_stat.jpg");
    facnav_fachome_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_home_over.jpg");

    facnav_nethome_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_network_static.jpg");
    facnav_nethome_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_network_over.jpg");
    
    facnav_quanthome_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_quant_static.jpg");
    facnav_quanthome_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_quant_over.jpg");            
*/
    facnav_landing_off=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_facilities_home_'+theme+'_a.jpg');
    facnav_landing_on=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_facilities_home_'+theme+'_b.jpg'); 
    
    facnav_fachome_off=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_home_'+theme+'_a.jpg');
    facnav_fachome_on=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_home_'+theme+'_b.jpg');

    facnav_nethome_off=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_network_'+theme+'_a.jpg');
    facnav_nethome_on=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_network_'+theme+'_b.jpg');
    
    facnav_quanthome_off=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_quantwork_'+theme+'_a.jpg');
    facnav_quanthome_on=newImage(rootpath + 'App_Themes/Default/Global/Navigation/fieldwork_quantwork_'+theme+'_b.jpg');

}

// -------------------------------------
//      IMAGE PRELOADS
// -------------------------------------

function preloadImages() {

	if (document.images) {
	
	    // ---------------------------------
	    //      NAVIGATION PRELOADS
	    // ---------------------------------
	
	    //top navigation
        topnav_home_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_01.gif");
        topnav_home_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_01b.gif");

        topnav_about_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_02.gif");
        topnav_about_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_02b.gif");

        topnav_news_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_03.gif");
        topnav_news_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_03b.gif");

        topnav_tech_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_04.gif");
        topnav_tech_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_04b.gif");

        topnav_contact_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_05.gif");
        topnav_contact_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_05b.gif");

        topnav_submit_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_06.gif");        
        topnav_submit_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fieldwork_nav_home_06b.gif");  
            
        if (isHome==false) {        
                
            //divisional navigation


/*            facnav_fachome_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_home_stat.jpg");
            facnav_fachome_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_home_over.jpg");

            facnav_nethome_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_network_static.jpg");
            facnav_nethome_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_network_over.jpg");
            
            facnav_quanthome_off=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_quant_static.jpg");
            facnav_quanthome_on=newImage(rootpath + "App_Themes/Default/Facility/Navigation/fac_quant_over.jpg");            
*/        
        }        
            
	    // ---------------------------------
	    //      PAGE SPECIFIC PRELOADS
	    // ---------------------------------

        switch(true){
            case isFacilityLanding:
            
                setThemedDivisionNav('blue');

                break;
            case isHome:
                
                home_gsvc_off=newImage(rootpath + "App_Themes/Default/Global/Page/Default/guest_services_a.gif");
                home_gsvc_on=newImage(rootpath + "App_Themes/Default/Global/Page/Default/guest_services_b.gif");
                
                break;
            case isAbout:
                
                setThemedDivisionNav('blue');
            
                about_mgmt_off=newImage(rootpath + "App_Themes/Default/Global/Page/About/fw_about_manage_a.jpg");
                about_mgmt_on=newImage(rootpath + "App_Themes/Default/Global/Page/About/fw_about_manage_b.jpg");

                about_ent_off=newImage(rootpath + "App_Themes/Default/Global/Page/About/fw_about_entrep_a.jpg");
                about_ent_on=newImage(rootpath + "App_Themes/Default/Global/Page/About/fw_about_entrep_b.jpg");
                
                break;
            case isBio:

                setThemedDivisionNav('blue');
                                
                //nothing at this time;            
                break;
            case isContact:
                
                setThemedDivisionNav('blue');
                                
                //nothing at this time;            
                break;
            case isEntrepreneurs:
            
                setThemedDivisionNav('blue');
                            
                //nothing at this time;            
                break;
            case isTechnology:
            
                setThemedDivisionNav('blue');
                            
                //nothing at this time;            
                break;
            case isSurvey:
                
                setThemedDivisionNav('blue');
                            
                //nothing at this time;            
                break;
            case isParticipants:
                
                setThemedDivisionNav('red');
                            
                //nothing at this time;            
                break;
            case isJoinDb:
            
                setThemedDivisionNav('blue');
                
                //nothing at this time;            
                break;
            case isManagement:
            
                setThemedDivisionNav('blue');
                            
                //nothing at this time;            
                break;
            case isNews:

                setThemedDivisionNav('blue');
                
                //nothing at this time;            
                break;
            case isGuestServices:
                
                setThemedDivisionNav('yellow');
                break;
        }
        
        preloadFlag = true;
        
    }
}


