// This  javascript checks to see whether the url contains /sec/, if not it then checks the users cookie to see if there are logged in.
// If they are logged in then the page will redirect to the /sec/ verison of the page.
var currentURL = document.URL;
if (currentURL.indexOf("/sec/") == -1) //sec is not in the url
{  
    var cookies     = document.cookie;
    var strRoleKey  = cookies.indexOf("role_agilent_com=");
    var strUsrKey   = cookies.indexOf("usr_agilent_com=");
    var strExpiredRoleKey = cookies.indexOf("role_agilent_com=anakincookieookie");
    if((strRoleKey != -1 && strUsrKey != -1) && strExpiredRoleKey == -1) //check to see if user is logged in
    {
        var strRE       = /\/agilent\//gi;
        var secureURL   = currentURL.replace(strRE,"/sec/");		
 
 		if ( secureURL.indexOf("/sec/") != -1 ) //sec is in the updated url			
			location.replace(secureURL);   		
    } 	
}