var ActiveAgent_PageName="https://www.alaskaair.com/Alaskawebui/Agent.aspx";function ActiveAgent_LaunchJenn(question){var AgentUrl=ActiveAgent_PageName;if(question&&question.length>0)AgentUrl=ActiveAgent_PageName+"?q="+encodeURIComponent(question);var options="scrollbars=no,menubar=no,resizable=yes,location=no,status=yes,titlebar=no,toolbar=no";PopupScript.LaunchChildWindow(AgentUrl,"AlaskaExternalAgent","right",255,680,50,0,true,null,null,options);RefreshParentInHttps()}function RefreshParentInHttps(){var urlprotocol="https:";if(location.protocol.toLowerCase()=="http:")location.href=location.href.replace("http:",urlprotocol)}function Cookie(name,sVals,exp){this.Name=name;this.Value=null;this.Values={};this.Expires=exp?exp:null;this.Path="/";this.Secure=false;this.Domain=GetDomain();if(sVals!=null){var nvc=typeof sVals=="string"?sVals.split("&"):null;if(nvc!=null&&nvc.length>0&&nvc[0].indexOf("=")>-1)for(var i=0;i<nvc.length;i++){var nv=nvc[i].split("=");this.Values[nv[0]]=nv[1]}else this.Value=sVals}this.Save=function(){var v="";for(var n in this.Values)v+="&"+n+"="+escape(this.Values[n]);if(v=="")v=escape(this.Value);else v=v.substr(1);var me=this.Name+"="+v+(this.Expires==null?"":";expires="+this.Expires.toGMTString())+";path="+this.Path+(this.Domain==null?"":";domain="+this.Domain)+(this.Secure?";secure;":";");document.cookie=me};this.Delete=function(){this.Expires=new Date(1970,0,2);this.Save()}}function GetCookies(){var all={};if(document.cookie!=""){var cookies=document.cookie.split("; ");for(i=0;i<cookies.length;i++){var c=cookies[i],idx=c.indexOf("="),N=c.substr(0,idx),V="";if(c.length>idx+1)V=unescape(c.substring(idx+1,c.length));all[N]=new Cookie(N,V)}}return all}function GetCookie(name){return GetCookies()[name]}function ShowCookies(){var cookies=GetCookies(),sCookie="";for(var crumb in cookies){sCookie+="Name: "+cookies[crumb].Name+"\n";sCookie+="Value: "+cookies[crumb].Value+"\n";for(var values in cookies[crumb].Values){sCookie+="    "+values+": ";sCookie+=cookies[crumb].Values[values]+"\n"}}alert(sCookie)}function GetDomain(){var url=document.domain,end="",s=url.indexOf(".");if(url.indexOf(".")>-1){end=url.substr(url.lastIndexOf("."));url=url.substring(0,url.lastIndexOf("."))}if(url.indexOf(".")>-1)url=url.substr(url.lastIndexOf(".")+1);url=url+end;if(url.indexOf(".")==-1)url=null;return url}function AreCookiesEnabled(){var AA_Cookie=new Cookie("ActiveAgent_TestCookie","test");AA_Cookie.Save();return document.cookie==""?false:true}var version="6.2";function PopupScript(){}PopupScript.ApplyParentTop=false;PopupScript.PerfectWindowSize=false;PopupScript.IsAgentOpenCookieName="IsAgentOpen";PopupScript.LaunchChildWindow=function(url,agentWindowName,align,width,height,top,left,layoutParent,parentWidth,parentHeight,options){align=!align||align.toLowerCase()!="left"?"right":"left";width=width?width:250;height=height?height:"100%";top=top?top:0;left=left?left:0;layoutParent=layoutParent?true:false;parentWidth=parentWidth?parentWidth:"100%";parentHeight=parentHeight?parentHeight:"100%";options=options?options:"scrollbars=no,menubar=no,resizable=no,location=no,status=yes,titlebar=no,toolbar=no";width=PopupScript.WidthToScreen(width);height=PopupScript.HeightToScreen(height,top);top=PopupScript.WidthToScreen(top);left=PopupScript.HeightToScreen(left,top);parentWidth=PopupScript.WidthToScreen(parentWidth);var pTop=PopupScript.ApplyParentTop?top:0;parentHeight=PopupScript.HeightToScreen(parentHeight,pTop);var parentLeft=align=="left"?width:0;if(parentWidth<=0||parentWidth+width>screen.availWidth)parentWidth=screen.availWidth-width;if(parentHeight<=0||parentHeight+pTop>screen.availHeight)parentHeight=screen.availHeight-pTop;if(height+top>screen.availHeight)height=screen.availHeight-top;if(align=="right")left=parentWidth;var allOptions="width="+width+"px,height="+height+"px,left="+left+",top="+top+","+options,agentOpenCookie=GetCookie(this.IsAgentOpenCookieName),win;if(agentOpenCookie){win=window.open("",agentWindowName,allOptions);win.focus()}else{win=window.open(url,agentWindowName,allOptions);if(win){if(PopupScript.PerfectWindowSize){win.resizeTo(width,height);win.moveTo(left,top)}layoutParent&&PopupScript.PositionWindow(window,parentWidth,parentHeight,pTop,parentLeft);win.focus()}}return win};PopupScript.PositionWindow=function(win,width,height,top,left){try{win.moveTo(0,0);win.resizeTo(width,height);win.moveTo(left,top)}catch(e){if(GetErrorMessage(e).indexOf("denied")==-1)throw e;}};PopupScript.WidthToScreen=function(w){if(!IsNumeric(w)&&w.indexOf("%")>-1){w=w.substring(0,w.indexOf("%"));w=screen.availWidth*w/100}return parseInt(w)};PopupScript.HeightToScreen=function(h,top){if(!IsNumeric(h)&&h.indexOf("%")>-1){h=h.substring(0,h.indexOf("%"));h=screen.availHeight*h/100-top}return parseInt(h)};function IsNumeric(o){return typeof o=="number"&&isFinite(o)}function IsWindowClosed(win){var closed=false;try{closed=win==null||win.closed||typeof win.self=="undefined"}catch(e){closed=true}return closed}function GetErrorMessage(e){if(e.message)return e.message;else return e.toString()}var _AA_PageInfo=new ActiveAgent_PageInfo;function ActiveAgent_SetPageInfo(formName,viewID){var url=_ActiveAgent_GetPageURL();IsAgentAssociatedParentWindow()&&_ActiveAgent_SetPageInfo(url,formName,viewID)}function ActiveAgent_SetPageInfoAndURL(url,formName,viewID){_ActiveAgent_SetPageInfo(_ActiveAgent_GetPageURL(url),formName,viewID)}function ActiveAgent_SetPageError(errorCode){if(IsAgentAssociatedParentWindow())!isNaN(errorCode)&&errorCode!=0&&_AA_PageInfo.SetPageError(errorCode)}function ActiveAgent_GetPageInfo(userInput){var pageInfo=_AA_PageInfo.GetPageInfo();userInput.push(new KeyValueOfStringString("CurrentPage",pageInfo))}ActiveAgent_PageInfo.prototype.PollingInterval=1e3;ActiveAgent_PageInfo.prototype.CookieName="ActiveAgent_PageInfo";ActiveAgent_PageInfo.prototype.ErrorCookieName="ActiveAgent_PageError";ActiveAgent_PageInfo.prototype.URLProperty="URL";ActiveAgent_PageInfo.prototype.FormNameProperty="FormName";ActiveAgent_PageInfo.prototype.ViewIDProperty="ViewID";ActiveAgent_PageInfo.prototype.ErrorCodeProperty="ErrorCode";ActiveAgent_PageInfo.prototype.DateTimeProperty="DateTime";ActiveAgent_PageInfo.prototype.UserInfoCookieName="AS%5FACNT";var ParentWindowNameCookie="ActiveAgent_ParentWindowName";function ActiveAgent_PageInfo(){this.URL="";this.FormName="";this.ViewID="";this.DateTime=new Date;this.PageInView="";this.SetInfoTimerID=0;this.GetErrorTimerID=0;this.SetPageInfo=function(){var now=new Date,cookieValue=this.URLProperty+"="+encodeURIComponent(this.URL)+"&";cookieValue+=this.FormNameProperty+"="+encodeURIComponent(this.FormName)+"&";cookieValue+=this.ViewIDProperty+"="+encodeURIComponent(this.ViewID)+"&";cookieValue+=this.DateTimeProperty+"="+now.getTime();var cookie=new _ActiveAgent_Cookie(this.CookieName,cookieValue);cookie.Save()};this.GetPageInfo=function(){var PageInfoCookie,CookiesEnabled=AreCookiesEnabled(),UserInfoCookie=GetCookie(this.UserInfoCookieName),UserID="",UserUID="";this.PageInView="";if(UserInfoCookie!=null)if(UserInfoCookie.Values.ID!=null&&UserInfoCookie.Values.UID!=null){UserID=UserInfoCookie.Values.ID;UserUID=UserInfoCookie.Values.UID}try{PageInfoCookie=GetCookie(this.CookieName)}catch(ex){_ActiveAgent_HandleError(ex)}var now=new Date,rtn='<PageInfo CookiesEnabled="'+CookiesEnabled+'" AS_ACNT_ID="'+decodeURIComponent(UserID)+'" AS_ACNT_UID="'+decodeURIComponent(UserUID)+'" ';if(PageInfoCookie!=null){this.URL=PageInfoCookie.Values[this.URLProperty];this.FormName=PageInfoCookie.Values[this.FormNameProperty];this.ViewID=PageInfoCookie.Values[this.ViewIDProperty];this.DateTime=PageInfoCookie.Values[this.DateTimeProperty];if(IsCookieValid()){rtn+='URL="'+decodeURIComponent(this.URL)+'" FormName="'+decodeURIComponent(this.FormName)+'" ViewID="'+decodeURIComponent(this.ViewID)+'" ';this.PageInView=this.URL}else rtn+='URL="" FormName="" ViewID=""'}else rtn+='URL="" FormName="" ViewID=""';rtn+=" />";return rtn};this.SetPageError=function(errorCode){var now=new Date,cookieValue=this.ErrorCodeProperty+"="+errorCode+"&";cookieValue+=this.DateTimeProperty+"="+now.getTime();var cookie=new _ActiveAgent_Cookie(this.ErrorCookieName,cookieValue);cookie.Save()};this.GetPageError=function(){var errorCode=this.GetErrorCookieValue();errorCode!=0&&Agent.DoAppEvent("PageError")};this.GetErrorCookieValue=function(){var PageErrorCookie;try{PageErrorCookie=GetCookie(this.ErrorCookieName)}catch(ex){_ActiveAgent_HandleError(ex)}var now=new Date,rtn=0;if(PageErrorCookie!=null){var ErrorCode=PageErrorCookie.Values[this.ErrorCodeProperty],ErrorDateTime=PageErrorCookie.Values[this.DateTimeProperty];if(IsCookieValid())rtn=ErrorCode}return rtn}}function _ActiveAgent_Cookie(name,sVals){var exp=new Date;exp.setDate(exp.getDate()+1);this.Name=name;this.Value=null;this.Values={};this.Expires=exp;this.Path="/";this.Secure=false;this.Domain=_ActiveAgent_GetDomain();if(sVals!=null){var nvc=typeof sVals=="string"?sVals.split("&"):null;if(nvc!=null&&nvc.length>0&&nvc[0].indexOf("=")>-1)for(var i=0;i<nvc.length;i++){var nv=nvc[i].split("=");this.Values[nv[0]]=nv[1]}else this.Value=sVals}this.Save=function(){var v="";for(var n in this.Values)v+="&"+n+"="+escape(this.Values[n]);if(v=="")v=escape(this.Value);else v=v.substr(1);var me=this.Name+"="+v+(this.Expires==null?"":";expires="+this.Expires.toGMTString())+";path="+this.Path+(this.Domain==null?"":";domain="+this.Domain)+(this.Secure?";secure;":";");document.cookie=me};this.Delete=function(){this.Expires=new Date(1970,0,2);this.Save()}}function _ActiveAgent_GetDomain(){var url=document.domain,end="",s=url.indexOf(".");if(url.indexOf(".")>-1){end=url.substr(url.lastIndexOf("."));url=url.substring(0,url.lastIndexOf("."))}if(url.indexOf(".")>-1)url=url.substr(url.lastIndexOf(".")+1);url=url+end;return url}function _ActiveAgent_GetPageURL(url){var rtnURL="";if(url!=undefined)rtnURL=url;else rtnURL=document.URL;if(rtnURL.indexOf("?")>0)rtnURL=rtnURL.substring(0,rtnURL.indexOf("?"));if(rtnURL.indexOf("#")>0)rtnURL=rtnURL.substring(0,rtnURL.indexOf("#"));return rtnURL}function _ActiveAgent_SetPageInfo(url,formName,viewID){if(url!=undefined)_AA_PageInfo.URL=url;if(formName!=undefined)_AA_PageInfo.FormName=formName;if(viewID!=undefined)_AA_PageInfo.ViewID=viewID;_AA_PageInfo.SetPageInfo()}function IsAgentAssociatedParentWindow(){var returnValue=false,windowName=window.name,windowNameCookie=GetCookie(ParentWindowNameCookie);if(windowNameCookie!=null){var expectedWindowName=windowNameCookie.Value;if(expectedWindowName==windowName)returnValue=true}return returnValue}function IsCookieValid(){var cookieIsValid=false;try{var win=PopupTemplate.ParentWindow;if(win==undefined||win==null)win=agentWindowReference.opener;var url=win.document.location.href;if(url!=""&&url!=undefined)cookieIsValid=true}catch(e){cookieIsValid=false}return cookieIsValid}
