function handleForgottenPWD(){hideLoginScreen();
window.location.href="//"+window.location.host+"/"+loginConfig.serverURL()+"passwordResetRequest.htm?returi="+encodeURI(window.location.href)
}function handleCreateProfile(){hideLoginScreen();
window.location.href="//"+window.location.host+"/"+loginConfig.serverURL()+"create.htm?returi="+encodeURI(window.location.href)
}function showLoginScreen(){var a=document.getElementById("loginOverlay");
a.style.display="block";var b=document.getElementById("loginFormOverlay");
b.style.display="block";document.getElementById("email").focus();
addProfileListener(changeFocus,"email");
addProfileListener(processEnterKeyPress,"password")
}function hideLoginScreen(){var b=document.getElementById("loginOverlay");
b.style.display="none";var a=document.getElementsByTagName("html")[0];
a.style.overflow="visible";var c=document.getElementById("loginFormOverlay");
c.style.display="none";document.getElementById("email").value="";
document.getElementById("password").value="";
clearLoginMessage("")}function showAnonMenu(){try{var e=document.getElementById("logout");
if(e!=undefined){e.style.display="none"
}var c=document.getElementById("login");
if(c!=undefined){c.style.display="block"
}var b=document.getElementById("logout2");
if(b!=undefined){b.style.display="none"
}var a=document.getElementById("logout3");
if(a!=undefined){a.style.display="none"
}var f=document.getElementById("login2");
if(f!=undefined){f.style.display="block"
}}catch(d){}}function showAuthMenu(){try{var h=interpretFirstName();
var e=document.getElementById("logout");
if(e!=undefined){e.style.display="block"
}var c=document.getElementById("login");
if(c!=undefined){c.style.display="none"
}var b=document.getElementById("logout2");
if(b!=undefined){b.style.display="block"
}var a=document.getElementById("logout3");
if(a!=undefined){a.style.display="block"
}var g=document.getElementById("login2");
if(g!=undefined){g.style.display="none"
}var f=document.getElementById("loginDisplayName");
f.style.display="inline";f.innerHTML=h
}catch(d){}}function addProfileListener(b,a){var c=document.getElementById(a);
c.onkeypress=b}function processEnterKeyPress(a){a=a||window.event;
if(a.keyCode==13){processLoginRequest();
return false}return true}function changeFocus(a){a=a||window.event;
if(a.keyCode==13){document.getElementById("password").focus();
return false}return true}function interpretFirstName(){var a="friend";
try{a=Encoder.decode(readCookie(loginConfig.userCookieName()))
}catch(d){try{var c=readCookie(loginConfig.authCookieName());
a=decodeDisplayName(c.split(":")[2])
}catch(b){a="friend"}}return a}function decodeDisplayName(e){var b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var f="nAwzLRWvhiobKSpxJaIUTeyHQcqBMtkXPZdgGfjCrFNYOEslVDmunAwzLRWvhiobKSpxJaIUTeyHQcqBMtkXPZdgGfjCrFNYOEslVDmu";
var a="";try{var g=e.length;var c="";
for(count=0;count<=g;count=count+1){c=e.charAt(count);
if(isLetter(c)){index=f.indexOf(c,46);
if(index>-1){a=a+b.charAt(index-count)
}else{a=a+c}}}}catch(d){a=""}return a
}function processLoginRequest(){var c=document.getElementById("email").value;
var a=document.getElementById("password").value;
var b="";if(document.getElementById("country")!=null){b=document.getElementById("country").value
}if(validateFields(c,a)){url=loginConfig.serverURL()+"login";
login(c,a,b,url,completeLoginRequest,handleLoginError)
}}function processLogoutRequest(){deleteCookie(loginConfig.userCookieName());
url=loginConfig.serverURL()+"logoff";
logoff(url,completeLogoffRequest,null)
}function validateFields(b,a){return true
}function displayLoginMessage(a){var b=document.getElementById("loginMessage");
b.innerHTML=a}function clearLoginMessage(){var a=document.getElementById("loginMessage");
a.innerHTML=""}function userProfileInit(){try{clearLoginMessage();
var b=readCookie(loginConfig.userCookieName());
if(b!=null&&b!=""&&b.charAt(0)!=":"){showAuthMenu()
}else{showAnonMenu()}}catch(a){}}try{YAHOO.util.Event.onDOMReady(userProfileInit)
}catch(error){}function login(c,j,b,a,f,e){var h="application/x-www-form-urlencoded";
var d="username="+c+"&password="+escape(j)+"&country="+b;
var g=new HTTPPost(d,a,h,f,e);g.doPost()
}function logoff(d,c,b){var f="application/x-www-form-urlencoded";
var e="";var a=new HTTPPost(e,d,f,c,b);
a.doPost()}function completeLogoffRequest(c){var b=c.responseText;
var a=c.status;if(a=="200"){showAnonMenu()
}else{if(a=="401"){displayLoginMessage("Invalid username/password combination")
}else{displayLoginMessage("Login service unavailable. Try again later")
}}window.location.href=window.location.href
}function completeLoginRequest(c){var b=c.responseText;
var a=c.status;if(a=="200"){displayLoginMessage("success");
hideLoginScreen();displayLoginMessage("");
showAuthMenu();window.location.href=window.location.href
}else{if(a=="401"){if(b!=""){displayLoginMessage(b)
}else{displayLoginMessage("Invalid username/password combination")
}}else{if(a=="403"){if(b!=""){displayLoginMessage(b)
}else{displayLoginMessage("Access to the login service has been denied. Try again later")
}}else{displayLoginMessage("Login service is down for maintenance")
}}}}function handleLoginError(a){displayLoginMessage("Login Server is down for Maintenance. Please try again later")
}function HTTPPost(g,j,b,a,f){var d=g;
var c=j;var h=b;var e=a;var k=f;
this.doPost=function(){var m;try{m=this.xmlHttpRequest();
m.open("POST",c,true);m.setRequestHeader("Content-type",h);
m.setRequestHeader("Content-length",d.length);
m.onreadystatechange=function(){if(m.readyState!=4){return
}if(e!==undefined){e(m)}};m.send(d)
}catch(l){if(k!==undefined){k(l)
}else{alert("an error occured"+l)
}}return true};this.xmlHttpRequest=function(){try{return new XMLHttpRequest()
}catch(l){try{return new ActiveXObject("Msxml2.XMLHTTP")
}catch(l){}}alert("XMLHttpRequest not supported");
return null}}var loginConfig={authCookieName:function(){host=document.location.host;
cookieName="et_iPlanetDirectoryPro";
var a=/prod/;if(host=="support.sas.com"||host=="www.sas.com"||a.test(host)){cookieName="ep_iPlanetDirectoryPro"
}return cookieName},userCookieName:function(){return"SASUserDisplayName"
},serverURL:function(){return"/profile/user/"
}};function createCookie(c,d,e){if(e){var b=new Date();
b.setTime(b.getTime()+(e*24*60*60*1000));
var a="; expires="+b.toGMTString()
}else{var a=""}document.cookie=c+"="+d+a+"; path=/"
}function deleteCookie(a){createCookie(a,"",-1)
}function readCookie(b){var a=document.cookie.split(";");
var e=b+"=";for(var d=0;d<a.length;
d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)
}if(f.indexOf(e)==0){return unescape(f.substring(e.length,f.length))
}}return null}function convertXMLStringToObject(c){var b=null;
if(c!=null){try{if(window.DOMParser){parser=new DOMParser();
b=parser.parseFromString(c,"text/xml")
}else{b=new ActiveXObject("Microsoft.XMLDOM");
b.async="false";b.loadXML(c)}}catch(a){alert("an error occurred"+a)
}}return b}function isLetter(b){var c=/^[a-zA-Z]+$/;
var a=c.test(b);return c.test(b)
}function openWindow(g,c,f,h,e,b,d){var a="top="+f+",left="+h+",width="+e+",height="+b;
if(d!=""){a+=","+d}win1=window.open(g,c,a)
}var Encoder={encode:function(b){var a=this._utf8_encode(b);
return escape(a)},decode:function(b){var a=unescape(b);
return this._utf8_decode(a)},_munge:function(c){var d=6;
var b="";var a="";for(i=0;i<c.length;
++i){a=String.fromCharCode(d^c.charCodeAt(i));
if(this._isAlpha(a)){b+=a}else{b+=String.fromCharCode(c.charCodeAt(i))
}}return b},_unmunge:function(c){var d=6;
var b="";var a="";for(i=0;i<c.length;
i++){a=String.fromCharCode(d^c.charCodeAt(i));
if(this._isAlpha(a)){b+=a}else{b+=String.fromCharCode(c.charCodeAt(i))
}}return b},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");
var a="";for(var e=0;e<b.length;
e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)
}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);
a+=String.fromCharCode((d&63)|128)
}else{a+=String.fromCharCode((d>>12)|224);
a+=String.fromCharCode(((d>>6)&63)|128);
a+=String.fromCharCode((d&63)|128)
}}}return a},_utf8_decode:function(a){var b="";
var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);
if(e<128){b+=String.fromCharCode(e);
d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);
b+=String.fromCharCode(((e&31)<<6)|(c2&63));
d+=2}else{c2=a.charCodeAt(d+1);
c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));
d+=3}}}return b},_isAlpha:function(b){var c=/^[a-zA-Z]+$/;
var a=c.test(b);return c.test(b)
}};
