    /*Global.js: sb: 6-12-10 
     *v 1.6 iACCOUNT = spcial =15 1.5 temp intro of forumlinksb..
     *v 1.4 move php forward here from reg.js
     **/

    //0. convenience variables used in registration.js and login.js home.js everywhere.. never change these indices
    var saluteIndex=0, firstNameIndex=1, lastNameIndex=2,accessIndex=3,expiryIndex=4, mediaIndex=5,emailIndex=6,  jumbleIndex=7; // what is number 8 then?

    //5. program constants - to publish set iFORUM = 5, and iDEBUG = 5; for dev: 10, 10
    //**before push, update versionControl.html, change iFORUM to 5 (test), iDEBUG (test) to 5. iAccount = 5 (cookie based myAccount). Also make sure that blogDiscuss.js has the correct servletpath (test not thermo)
    sVERSION = '10.209';
    var iFORUM = 5; // 5 for production, 10 for dev
    var iDEBUG = 5; // sets path to curl, 5 is production.., 10 for dev
    var iACCOUNT = 5; // 5 prod (legacy), 10 thermo, 15 no cookie?..
    //---------------------------decide on forum Remember BlogDiscuss.js has hardcoded ForumLink
    
    // iFORUM = 10;  //database and forum codes in thermo
    //iFORUM = 5; // databse and forum from test
    //iFORUM = 3; // databse and forum from enthalpy
    //iFORUM = 0;  //database and forum codes directed by baracuda

    //---------------------------decide on database/registration and testhome
    // iDEBUG = 10; //  All thermo: database:thermo; registration (SB + CPlegacy) in thermo/testcenterdev/registration; java ws: thermo/servlet; content: thermo/testcenterdev/testhome
    // variation a. Database & Registration in thermo + content sb: copy testhome to sb.sdsu.edu/testFolder using Samba.
    // variation b. Database & Registration in thermo + content sb + forwarding: copy testhome to sb.sdsu.edu/testFolder using Samba, also use www.thermohub.net to test forward issues.

    //iDEBUG = 5; //  Database & Registration in test (**need to ssh registration folder to test) + content anywhere: database:test; registration (SB + CPlegacy) in test/test.sdsu.edu/registration (alias: test.sdsu.edu/newregistration); java ws: test/servlet; content: thermo/testcenterdev/testhome;
    // variation a. Database & Registration in test + content sb: database:test; registration (SB + CPlegacy) in test/test.sdsu.edu/registration (alias: test.sdsu.edu/newregistration); java ws: test/servlet; content: sb/testFolder/testhome (www.thermohub.net);
    // variation b. Database & Registration in test + content sb + forwarding by thermohub:database:test; registration (SB + CPlegacy) in test/test.sdsu.edu/registration (alias: test.sdsu.edu/newregistration); java ws: test/servlet; content: test/test.dsu.edu/testhome (lined by test.sdsu.edu) (www.thermohub.net)
    // variation c. Database & Registration in test + content all hosts + forwarding by thermofluids:database:test; database:test; registration (SB + CPlegacy) in test/test.sdsu.edu/registration (alias: test.sdsu.edu/newregistration); java ws: test/servlet; content: baracuda (www.thermofluids.net)


    // iDEBUG = 3; //  Database & Registration in enthalpy (make automatically pushes registration to enthalpy and test, database is copied nightly);
    // iDEBUG = 0; //  baracuda determines the database+registration server: database:test/enthalpy; registration (SB + legacy) in test/test.sdsu.edu/registration (alias: test.sdsu.edu/newregistration); java ws: test/servlet; content: baracuda (www.thermofluids.net)

    //--------------------------myAccount access
    //iACCOUNT = 10; // try ajax
    //iACCOUNT = 5; // current practice with legacy code, handled in bottom.js


    var COOKIELIFE = 7200; // in seconds (for tabbing only),also change in server in MYSQLObj
    //
    //10. web default, values overwritten by login callback
    var GLOBALCOOKIEWDEFAULT = " : :Guest:0:12234567890:WEB:guest@guest.com:LUbZHz0HLUGsMi5zBP8W9_Hk_ohs6Ph35Xijfxamu@7";
    var GLOBALCOOKIE = GLOBALCOOKIEWDEFAULT; // set by web service in Home.js
    var asCOOKIEITEM = []; //Home.js evaluates
    var sSERVEREXP = ''; //server expiration time stored in online table used for logout token to identify individuals.
    var sREGYEAR = '1000'; //year registered, initialized as a sentinel for tabbed browsing message.
    var bLOGIN = false;  // set by Home.js used to control Logout at bottom panel
    var iWARNING = 0; //used when user is logged in from another ip. 

    // 15. deduced variables, many change with iDEBUG..
    var tEXPIRATION = 0; // ram cookie expiration time calculated from cookielife

    //20. deduced constants
    var bWEB = true;
    var sMEDIA = 'WEB';
    if(window.location.toString().substring(0,4) == "file") {
        bWEB = false;
        sMEDIA = 'LOCAL';
    }
    var sBROWSER = sGetBrowser();
    var bIE = (sBROWSER == 'IE');

    //25. no video in local cd based installation, introduce iVEDEO?
    if(!bWEB) {
        VIDEOLINK = 'http://test.sdsu.edu/testhome/visualtour/index.html';
    }

    //25. important paths..
    //var absRegPath="http://energy.sdsu.edu/registrationdev/" // used in inviting people in home.html; DEPRECATE?
    var VIDEOLINK = "visualtour/index.html";
    var ACCOUNTPHP, FORUMLINK, SERVLETPATH, PHPSERVLETPATH, SIGNUPURL, FORGOTURL, CHANGEURL, INVITEURL, ADMINURL, MANSOLPROBSURL;

    //var oPOPUP = new PopupT('globalWindow');

    //30. forumlink myblog.html and serveletpath and phppath must be from the same server..
    // Note that SERVLETPATH and PHPPATH are hardcoded in MyBlog.html...
    switch (iFORUM){ // 5 for current production...
        case 0: //to be implemented, production in test
            FORUMLINK = 'http://test.sdsu.edu/testhome/blog/MyBlog.html';
            break;
        case 3: //to be implemented, backup production
            FORUMLINK = 'http://enthalpy.sdsu.edu/testhome/blog/MyBlog.html';
            break;
        case 5: // databaase in test but forum codes in thermo (will not work due to absence of curl in java world)
            FORUMLINK = 'http://test.sdsu.edu/testhome/blog/MyBlog.html';
            break;
        case 10: //true development : database and forum codes in thermo - real development
            FORUMLINK = 'http://thermo.sdsu.edu/testcenterdev/testhome/blog/MyBlog.html';
            break;
        default :
            FORUMLINK = 'blog/MyBlog.html'; //passed on to bottom.js
    }
    //30. set forum path independently, perhaps database too..
    switch (iACCOUNT){ // 5 for current production..., 5 tablecookie..
        case 0: // final production: to be replaced by baracuda
            MYACCOUNTURL = 'http://test.sdsu.edu/testcenter/newregistration/tomyaccount.html' //linked path by chris, newreg is actually a shortcut created by chris
            break;
        case 3: // backup production: enthalpy, baracuda take over?
            MYACCOUNTURL = 'http://enthalpy.sdsu.edu/testcenter/newregistration/tomyaccount.html' //linked path by chris for backup
            break;
        case 5:  //current production: database+reg in test/enthalpy; testhome at thermo/testcenterdev or anywhere else
            MYACCOUNTURL = 'http://test.sdsu.edu/newregistration/tomyaccount.html'; // current cookie method...forwared by chris to /htdocs/test.sdsu.edu/registration
            break;
        case 10: //current development database+reg and testhome at thermo/testcenterdev
            MYACCOUNTURL = 'http://thermo.sdsu.edu/testcenterdev/registration/tomyaccount.html';  //current cookie method
            break;
//        case 15: //currently linked from logo...
//            MYACCOUNTURL = 'http://thermo.sdsu.edu/testcenterdev/registration/phpserver/myaccount/tomyaccount.html';  //cookieless method
//            break;
        default:
            MYACCOUNTURL = 'http://thermo.sdsu.edu/testcenterdev/registration/tomyaccount.html';
    }


    MYACCOUNTURLTEMP = 'http://thermo.sdsu.edu/testcenterdev/registration/phpserver/myaccount/tomyaccount.html';
    //ACCOUNTPHP =registrationURL +"myaccount.php";

    //35. set php ws and java web service locations
    var registrationURL;
    switch (iDEBUG){ // 5 is production currently
        case 0: // final production: to be replaced by baracuda
            registrationURL = 'http://test.sdsu.edu/newregistration/' //linked path by chris, newreg is actually a shortcut created by chris
            break;
        case 3: // backup production: enthalpy, baracuda take over?
            registrationURL = 'http://enthalpy.sdsu.edu/newregistration/' //linked path by chris for backup
            break;
        case 5:  //current production: database+reg in test/enthalpy; testhome at thermo/testcenterdev or anywhere else
            registrationURL = 'http://test.sdsu.edu/newregistration/'; //forwared by chris to /htdocs/test.sdsu.edu/registration
            break;
        case 10: //current development database+reg and testhome at thermo/testcenterdev
            registrationURL = 'http://thermo.sdsu.edu/testcenterdev/registration/';  //abs path
            break;
        default:
            registrationURL = 'http://thermo.sdsu.edu/testcenterdev/registration/';
    }

    // these could all go to ajaxcodes/phpcurl...
    PHPSERVLETPATH = registrationURL + 'phpserver/' //test or thermo path? based on idebug
    SIGNUPURL = registrationURL + "signup.php";
    FORGOTURL = registrationURL + "forgot.php";
    CHANGEURL = registrationURL + "change.php";
    INVITEURL = registrationURL + "invite.php";
    ADMINURL = registrationURL + "admin.php";
    MANSOLPROBSURL = registrationURL + "mansolProbs.php";//used by frameDisplay.js AFTER forwarded by reg.js


    // 40. constants that requires calculations
    setGlobalVars();


    //set RAM cookie based on local/web and create array, called by home.js after cookie arrives...
    function setGlobalVars(){
        if (!bWEB) GLOBALCOOKIE = ThermoCookieLocalDefault; //local from license
        else if (!bLOGIN) GLOBALCOOKIE = GLOBALCOOKIEWDEFAULT; //no call back yet
        asCOOKIEITEM = asGetCOOKIEITEM(GLOBALCOOKIE); //split into global array
    }

    function sGetBrowser(){
        var NUA = navigator.userAgent.toLowerCase();
        var sBrowser = 'FIREFOX';
        if(NUA.indexOf("chrome") != -1) sBrowser = 'CHROME';
        if(NUA.indexOf("firefox") != -1) sBrowser = 'FIREFOX';
        if(NUA.indexOf("opera") != -1) sBrowser = 'OPERA';
        var bOpera = NUA.indexOf("opera") != -1;
        if(NUA.indexOf("safari") != -1) sBrowser = 'SAFARI';
        if(NUA.indexOf("konqueror") != -1) sBrowser = 'KONQUEROR';
        //if((NUA.indexOf('MSIE') != -1) && !bOPERA) return 'IE';
        if((NUA.indexOf('msie') != -1) && !bOpera) sBrowser = 'IE';
        return sBrowser;
    }
    // jumble is made of 7th and 8th strings separated by ':'
    function asGetCOOKIEITEM(cookieString){
        var jumbleIndex = 7;
        var cookieList=cookieString.split (/:/);
        var i=jumbleIndex; var newJumble=cookieList[jumbleIndex];

        i=i+1;
        while (cookieList[i]!=null) {
            newJumble=newJumble+":"+cookieList[i];
            i=i+1;
        }
        cookieList[jumbleIndex]=newJumble;

        return cookieList;
    }


    function getEmail(){
        return asCOOKIEITEM[emailIndex];
    }

    //is user logged in as a site license holder? Used in myAccount navigation..blog..
    function bSiteLogin(){
        if (GLOBALCOOKIE.indexOf('@site.edu') != -1) return true;
        else return false;
    }


    function getLastName(){
        return asCOOKIEITEM[lastNameIndex];
    }

