    /*Global.js: sb:
     * 10-13-11: global var for slides
     *v 1.9: keep track of reg server
     *v 1.8: 4-15-2011: Include chapter names to be uniform across platform? Done through menu.js in Problems..
     *v 1.7 forward to myAccout
     *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), iDEBUGac (test) to 5. iAccount = 5 (cookie based myAccount).
    //Note that PHPSERVLETPATH has been hardcoded in HomeLicense.js (used for myAccount login).
    //Also make sure that blogDiscuss.js has the correct servletpath (test not thermo)
    sVERSION = '10.303a'; //make sure you change the message in Home.js too.
    //var iPublish = 10;
    var iPublish = 5;
    // these can be independently set too
    var iFORUM = iPublish; // 5 for production (from test), 7 for beta testing  in romulus, 10 for dev (from thermo)
    var iDEBUG = iPublish; // sets path to curl, 7 for beta testing  in romulus,  5 is production.., 10 for dev
    var iACCOUNT = iPublish; // 5 prod (legacy),7 for beta testing  in romulus,  10 thermo, 15 no cookie?..
    //---------------------------decide on forum Remember BlogDiscuss.js has hardcoded ForumLink
    
   
    //6.  for problems module - shubhangi
    var oProblemBuffer = new Object;
    var oDeletedProblem = new Object;
    var iUserPermission = 0;
    var asModified = new Array();
    var sUpdatedKey = '';

    //6.  for animation global count
    var nSlideLicenseCount = 0;



    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 bVISITED = false;  // used for message of the day...in Home.js
    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, REGISTRATIONPATH, SIGNUPURL, FORGOTURL, CHANGEURL, INVITEURL, ADMINURL, MANSOLPROBSURL;

    //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 7: //true development : database and forum codes in thermo - real development
            FORUMLINK = 'http://beta.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. Forumpath is no longer set here; instead in blog/BlogDiscuss.js it is set to abs. address


    MYACCOUNTURL = "ajaxcodes/license/homelicense.html"; //Clicking on myAccount takes you there


    //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
            this.SERVLETPATH = 'http://test.sdsu.edu/servlet';
            break;
        case 7: //current development database (copied from test) + reg to romulus(beta or alpha)/var/apache/htdocs/testcenter/registraton..
            registrationURL = 'http://beta.sdsu.edu/registration/';  //abs path
            SERVLETPATH = 'http://beta.sdsu.edu/servlet';
            break;
        case 10: //current development database+reg and testhome at thermo/testcenterdev
            registrationURL = 'http://thermo.sdsu.edu/testcenterdev/registration/';  //abs path
            this.SERVLETPATH = 'http://thermo.sdsu.edu/servlet';
            break;
        default:
            registrationURL = 'http://thermo.sdsu.edu/testcenterdev/registration/';
    }
    REGISTRATIONPATH = registrationURL; //used in Home.js, we could get rid of many other global vars below
    // 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
    }


    // browser id modified for chrome...
    function sGetBrowser(){
        var NUA = navigator.userAgent.toLowerCase();
        var sBrowser = 'FIREFOX';
        if(NUA.indexOf("chrome") != -1) sBrowser = 'CHROME';
        var bChrome = NUA.indexOf("chrome") != -1;
        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 && !bChrome) sBrowser = 'SAFARI'; // chrome has safari in its NUA
        if(NUA.indexOf("konqueror") != -1) sBrowser = 'KONQUEROR';
        if((NUA.indexOf('msie') != -1) && !bOpera) sBrowser = 'IE';
        //alert("nua = "+ NUA);
        //alert ("browser = "+ sBrowser);
        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];
    }


