//Method to return the https url corresponding to the environment
function returnHttpsUrl(){
    var secureurl = document.URL;
    var index = secureurl.indexOf('https');
    var index1 = secureurl.indexOf('dev');
    var index2 = secureurl.indexOf('localhost');
    var index3 = secureurl.indexOf('/', 8);
    if (index > -1)
     {secureurl = "";}
    else if (index1 > 0)
     {secureurl = "";}
    else if (index2 > 0)
     {secureurl = "";} 
    else 
     {secureurl = secureurl.replace("http", "https");
      secureurl = secureurl.substring(0, index3+1);
     }
    return secureurl;  
}


//Method to submit Global Login form when enter key is pressed in password field

function checkEnter(e){ //e is event object passed from function invocation
    var characterCode; //literal character code will be stored in this variable

    if(e && e.which){ //if which property of event object is supported (NN4)
        e = e
        characterCode = e.which //character code is contained in NN4's which property
    }
    else{
        e = event
        characterCode = e.keyCode //character code is contained in IE's keyCode property
    }

    if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
        submitGlobalLoginForm(); //submit the form
        return false; 
    }
    else{
        return true; 
    }
}


// This method returns flag true if cookie exists and false vice versa
function GetCookie(name) {
    //reading and splitting the whole cookie
    var allCookies = unescape(document.cookie);
    var eachCookie = allCookies.split(";");
    var flag = "false";
    for (i = 0; i < eachCookie.length; i++){
        if (eachCookie[i].indexOf(name) > -1) {
            flag = "true";
            break;
        }
        else {
            flag = "false";
        }
    }//ends FOR
    return flag;
}

// This method returns the value of the cookie
function GetCookieValue(name) {
    //reading and splitting the whole cookie
    var allCookies = unescape(document.cookie);
    var eachCookie = allCookies.split(";");
    //sorting loop
    for (i = 0; i < eachCookie.length; i++){
        if (eachCookie[i].indexOf(name) > -1) {
            var cookieString = eachCookie[i];
            var cookieData = cookieString.split("=");
            return cookieData[1];
        }
    }//ends FOR
}

// This method deletes a cookie
function DeleteCookie(cookie_name)
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString() + "; path=/";
}

// Omniture variables for logged in users
var s_prop8 = "";
var s_prop9 = "";
var s_prop10 = "";
var s_prop11 = "";
var s_prop15 = "";
var s_prop16 = "";
var s_prop17 = "";
var s_prop18 = "";
var s_prop19 = "";
var s_prop20 = "";

var s_eVar1 = "";
var s_eVar2 = "";
var s_eVar3 = "";
var s_eVar4 = "";
var s_eVar10 = "";
var s_eVar11 = "";
var s_eVar12 = "";
var s_eVar13 = "";
var s_eVar14 = "";
var s_eVar15 = "";

