window.Granite=window.Granite||{};
Granite.Sling={SELECTOR_INFINITY:".infinity",CHARSET:"_charset_",STATUS:":status",STATUS_BROWSER:"browser",OPERATION:":operation",OPERATION_DELETE:"delete",OPERATION_MOVE:"move",DELETE_SUFFIX:"@Delete",TYPEHINT_SUFFIX:"@TypeHint",COPY_SUFFIX:"@CopyFrom",MOVE_SUFFIX:"@MoveFrom",ORDER:":order",REPLACE:":replace",DESTINATION:":dest",SAVE_PARAM_PREFIX:":saveParamPrefix",IGNORE_PARAM:":ignore",REQUEST_LOGIN_PARAM:"sling:authRequestLogin",LOGIN_URL:"/system/sling/login.html",LOGOUT_URL:"/system/sling/logout.html"};
(function(d,c){d.Util=(function(){var a={patchText:function(b,g){if(g){if(!c.isArray(g)){b=b.replace("{0}",g)
}else{for(var h=0;
h<g.length;
h++){b=b.replace(("{"+h+"}"),g[h])
}}}return b
},getTopWindow:function(){var b=window;
if(this.iFrameTopWindow){return this.iFrameTopWindow
}try{while(b.parent&&b!==b.parent&&b.parent.location.href){b=b.parent
}}catch(f){}return b
},setIFrameMode:function(b){this.iFrameTopWindow=b||window
},applyDefaults:function(){var j,b=arguments[0]||{};
for(var k=1;
k<arguments.length;
k++){j=arguments[k];
for(var l in j){var i=j[l];
if(j.hasOwnProperty(l)&&i){if(typeof i==="object"&&!(i instanceof Array)){b[l]=a.applyDefaults(b[l],i)
}else{if(i instanceof Array){b[l]=i.slice(0)
}else{b[l]=i
}}}}}return b
},getKeyCode:function(b){return b.keyCode?b.keyCode:b.which
}};
return a
}())
}(Granite,jQuery));
(function(Granite,util,sling,$){Granite.HTTP=(function(){var contextPath=null,SCRIPT_URL_REGEXP=/^(?:http|https):\/\/[^\/]+(\/.*)\/(?:etc(\/.*)*\/clientlibs|libs(\/.*)*\/clientlibs|apps(\/.*)*\/clientlibs).*\.js(\?.*)?$/,ENCODE_PATH_REGEXP=/[^1\w-\.!~\*'\(\)\/%;:@&=\$,]/,loginRedirected=false,self={};
self.getSchemeAndAuthority=function(url){var end;
try{if(url.indexOf("://")==-1){return""
}end=url.indexOf("/",url.indexOf("://")+3);
return(end==-1)?url:url.substring(0,end)
}catch(e){return""
}};
self.getContextPath=function(){return contextPath
};
self.detectContextPath=function(){try{if(window.CQURLInfo){contextPath=CQURLInfo.contextPath||""
}else{var scripts=document.getElementsByTagName("script");
for(var i=0;
i<scripts.length;
i++){var result=SCRIPT_URL_REGEXP.exec(scripts[i].src);
if(result){contextPath=result[1];
return
}}contextPath=""
}}catch(e){}};
self.externalize=function(url){try{if(url.indexOf("/")==0&&contextPath&&url.indexOf(contextPath+"/")!=0){url=contextPath+url
}}catch(e){}return url
};
self.internalize=function(url,doc){if(url.charAt(0)=="/"){if(contextPath&&url.indexOf(contextPath)==0){return url.substring(contextPath.length)
}else{return url
}}if(!doc){doc=document
}var docHost=self.getSchemeAndAuthority(doc.location.href);
var urlHost=self.getSchemeAndAuthority(url);
if(docHost==urlHost){return url.substring(urlHost.length+(contextPath?contextPath.length:0))
}else{return url
}};
self.getPath=function(url){if(!url){if(window.CQURLInfo&&CQURLInfo.requestPath){return CQURLInfo.requestPath
}else{url=window.location.pathname
}}else{url=self.removeParameters(url);
url=self.removeAnchor(url)
}url=self.internalize(url);
var i=url.indexOf(".",url.lastIndexOf("/"));
if(i!=-1){url=url.substring(0,i)
}return url
};
self.removeAnchor=function(url){if(url.indexOf("#")!=-1){return url.substring(0,url.indexOf("#"))
}return url
};
self.removeParameters=function(url){if(url.indexOf("?")!=-1){return url.substring(0,url.indexOf("?"))
}return url
};
self.encodePathOfURI=function(url){var parts,delim;
if(url.indexOf("?")!=-1){parts=url.split("?");
delim="?"
}else{if(url.indexOf("#")!=-1){parts=url.split("#");
delim="#"
}else{parts=[url]
}}if(ENCODE_PATH_REGEXP.test(parts[0])){parts[0]=self.encodePath(parts[0])
}return parts.join(delim)
};
self.encodePath=function(path){path=encodeURI(path).replace(/%5B/g,"[").replace(/%5D/g,"]");
path=path.replace(/\+/g,"%2B");
path=path.replace(/\?/g,"%3F");
path=path.replace(/;/g,"%3B");
path=path.replace(/#/g,"%23");
path=path.replace(/=/g,"%3D");
path=path.replace(/\$/g,"%24");
path=path.replace(/,/g,"%2C");
path=path.replace(/'/g,"%27");
path=path.replace(/"/g,"%22");
return path
};
self.handleLoginRedirect=function(){if(!loginRedirected){loginRedirected=true;
alert(Granite.I18n.get("Your request could not be completed because you have been signed out."));
var l=util.getTopWindow().document.location;
l.href=self.externalize(sling.LOGIN_URL)+"?resource="+l.pathname+encodeURIComponent(l.search)+l.hash
}};
self.getXhrHook=function(url,method,params){method=method||"GET";
if(window.G_XHR_HOOK&&$.isFunction(G_XHR_HOOK)){var p={url:url,method:method};
if(params){p.params=params
}return G_XHR_HOOK(p)
}return null
};
self.eval=function(response){if(typeof response!="object"){response=$.ajax({url:response,type:"get",async:false})
}try{return eval("("+(response.body?response.body:response.responseText)+")")
}catch(e){}return null
};
return self
}())
}(Granite,Granite.Util,Granite.Sling,jQuery));
(function(document,Granite,util,http,$){Granite.I18n=(function(){var dicts={},urlPrefix="/libs/cq/i18n/dict.",urlSuffix=".json",manualLocale=undefined,pseudoTranslations=false,languages=null,self={},manualDictionary=false,getDictionaryUrl=function(locale){if(manualDictionary){return urlPrefix+locale+urlSuffix
}var dictionarySrc=$("html").attr("data-i18n-dictionary-src");
if(!dictionarySrc){return urlPrefix+locale+urlSuffix
}return dictionarySrc.replace("{locale}",encodeURIComponent(locale)).replace("{+locale}",locale)
};
self.LOCALE_DEFAULT="en";
self.PSEUDO_LANGUAGE="zz";
self.PSEUDO_PATTERN_KEY="_pseudoPattern_";
self.init=function(config){config=config||{};
this.setLocale(config.locale);
this.setUrlPrefix(config.urlPrefix);
this.setUrlSuffix(config.urlSuffix)
};
self.setLocale=function(locale){if(!locale){return
}manualLocale=locale
};
self.getLocale=function(){if($.isFunction(manualLocale)){manualLocale=manualLocale()
}return manualLocale||document.documentElement.lang||self.LOCALE_DEFAULT
};
self.setUrlPrefix=function(prefix){if(!prefix){return
}urlPrefix=prefix;
manualDictionary=true
};
self.setUrlSuffix=function(suffix){if(!suffix){return
}urlSuffix=suffix;
manualDictionary=true
};
self.getDictionary=function(locale){locale=locale||self.getLocale();
if(!dicts[locale]){pseudoTranslations=(locale.indexOf(self.PSEUDO_LANGUAGE)==0);
try{var response=$.ajax(getDictionaryUrl(locale),{async:false,dataType:"json"});
dicts[locale]=$.parseJSON(response.responseText)
}catch(e){}if(!dicts[locale]){dicts[locale]={}
}}return dicts[locale]
};
self.get=function(text,snippets,note){var dict,newText,lookupText;
dict=self.getDictionary();
lookupText=pseudoTranslations?self.PSEUDO_PATTERN_KEY:note?text+" (("+note+"))":text;
if(dict){newText=dict[lookupText]
}if(!newText){newText=text
}if(pseudoTranslations){newText=newText.replace("{string}",text).replace("{comment}",note?note:"")
}return util.patchText(newText,snippets)
};
self.getVar=function(text,note){if(!text){return null
}return self.get(text,null,note)
};
self.getLanguages=function(){if(!languages){try{var json=http.eval("/libs/wcm/core/resources/languages.overlay.infinity.json");
$.each(json,function(name,lang){lang.title=self.getVar(lang.language);
if(lang.title&&lang.country&&lang.country!="*"){lang.title+=" ("+self.getVar(lang.country)+")"
}});
languages=json
}catch(e){languages={}
}}return languages
};
self.parseLocale=function(langCode){if(!langCode){return null
}var pos=langCode.indexOf("_");
if(pos<0){pos=langCode.indexOf("-")
}var language,country;
if(pos<0){language=langCode;
country=null
}else{language=langCode.substring(0,pos);
country=langCode.substring(pos+1)
}return{code:langCode,language:language,country:country}
};
return self
}())
}(document,Granite,Granite.Util,Granite.HTTP,jQuery));
(function(d,f){var e=function(){var b={visibility:"hidden",position:"absolute",width:"30px",height:"30px","-webkit-border-radius":"20px","border-radius":"20px",border:"5px solid orange","-webkit-user-select":"none","user-select":"none",opacity:"0.5","z-index":"2000","pointer-events":"none"};
var a={};
var c=[];
return{debugWithMouse:false,init:function(){var h=this;
f(document).on("touchstart.touchindicator touchmove.touchindicator touchend.touchindicator",function(g){var j=g.originalEvent.touches;
h.update(j);
return true
});
if(this.debugWithMouse){f(document).on("mousemove.touchindicator",function(g){g.identifer="fake";
h.update([g]);
return true
})
}},update:function(o){var q={};
for(var p=0;
p<o.length;
p++){var i=o[p];
var n=i.identifier;
var r=a[n];
if(!r){r=c.pop();
if(!r){r=f("<div></div>").css(b);
f("body").append(r)
}}q[n]=r;
r.offset({left:i.pageX-20,top:i.pageY-20});
r.css("visibility","visible")
}for(n in a){if(a.hasOwnProperty(n)&&!q[n]){r=a[n];
r.css("visibility","hidden");
c.push(r)
}}a=q
}}
};
d.TouchIndicator=new e()
}(Granite,jQuery));
(function(h,f,e,g){h.OptOutUtil=(function(){var c={};
var b=[];
var a=[];
c.init=function(d){if(d){b=d.cookieNames?d.cookieNames:b;
a=d.whitelistCookieNames?d.whitelistCookieNames:a
}};
c.getCookieNames=function(){return b
};
c.getWhitelistCookieNames=function(){return a
};
c.isOptedOut=function(){var i=document.cookie.split(";");
for(var m=0;
m<i.length;
m++){var n=i[m];
var d=g.trim(n.split("=")[0]);
if(g.inArray(d,c.getCookieNames())>-1){return true
}}return false
};
c.maySetCookie=function(d){return !(c.isOptedOut()&&g.inArray(d,c.getWhitelistCookieNames())===-1)
};
return c
}())
}(Granite,Granite.Util,Granite.HTTP,jQuery));
Granite.OptOutUtil.init(window.GraniteOptOutConfig);
Granite.HTTP.detectContextPath();
(function(h,e,g){var f;
e.Granite=e.Granite||{};
e.Granite.$=e.Granite.$||h;
e._g=e._g||{};
e._g.$=e._g.$||h;
f=Granite.HTTP;
h.ajaxSetup({externalize:true,encodePath:true,hook:true,beforeSend:function(b,c){if(typeof G_IS_HOOKED=="undefined"||!G_IS_HOOKED(c.url)){if(c.externalize){c.url=f.externalize(c.url)
}if(c.encodePath){c.url=f.encodePathOfURI(c.url)
}}if(c.hook){var a=f.getXhrHook(c.url,c.type,c.data);
if(a){c.url=a.url;
if(a.params){if(c.type.toUpperCase()=="GET"){c.url+="?"+h.param(a.params)
}else{c.data=h.param(a.params)
}}}}},statusCode:{403:function(a){if(a.getResponseHeader("X-Reason")==="Authentication Failed"){f.handleLoginRedirect()
}}}});
h.ajaxSettings.traditional=true
}(jQuery,this));
window.$CQ=_g.$;
window._g=window._g||{};
_g.shared={};
if(window.console===undefined){window.console={log:function(b){}}
}_g.shared.HTTP=new function(){var createResponse=function(){var response=new Object();
response.headers=new Object();
response.body=new Object();
return response
};
var getResponseFromXhr=function(request){if(!request){return null
}var response=createResponse();
response.body=request.responseText;
response.headers[_g.HTTP.HEADER_STATUS]=request.status;
response.responseText=request.responseText;
response.status=request.status;
return response
};
return{EXTENSION_HTML:".html",EXTENSION_JSON:".json",EXTENSION_RES:".res",HEADER_STATUS:"Status",HEADER_MESSAGE:"Message",HEADER_LOCATION:"Location",HEADER_PATH:"Path",PARAM_NO_CACHE:"cq_ck",get:function(url,callback,scope,suppressForbiddenCheck){url=_g.HTTP.getXhrHookedURL(_g.HTTP.externalize(url,true));
if(callback!=undefined){return _g.$.ajax({type:"GET",url:url,externalize:false,encodePath:false,hook:false,complete:function(request,textStatus){var response=getResponseFromXhr(request);
if(!suppressForbiddenCheck){_g.HTTP.handleForbidden(response)
}callback.call(scope||this,this,textStatus=="success",response)
}})
}else{try{var request=_g.$.ajax({type:"GET",url:url,async:false,externalize:false,encodePath:false,hook:false});
var response=getResponseFromXhr(request);
if(!suppressForbiddenCheck){_g.HTTP.handleForbidden(response)
}return response
}catch(e){return null
}}},post:function(url,callback,params,scope,suppressErrorMsg,suppressForbiddenCheck){url=_g.HTTP.externalize(url,true);
var hook=_g.HTTP.getXhrHook(url,"POST",params);
if(hook){url=hook.url;
params=hook.params
}if(callback!=undefined){return _g.$.ajax({type:"POST",url:url,data:params,externalize:false,encodePath:false,hook:false,complete:function(request,textStatus){var response=_g.HTTP.buildPostResponseFromHTML(request.responseText);
if(!suppressForbiddenCheck){_g.HTTP.handleForbidden(request)
}callback.call(scope||this,this,textStatus=="success",response)
}})
}else{try{var request=_g.$.ajax({type:"POST",url:url,data:params,async:false,externalize:false,encodePath:false,hook:false});
var response=_g.HTTP.buildPostResponseFromHTML(request.responseText);
if(!suppressForbiddenCheck){_g.HTTP.handleForbidden(request)
}return response
}catch(e){return null
}}},getParameter:function(url,name){var params=_g.HTTP.getParameters(url,name);
return params!=null?params[0]:null
},getParameters:function(url,name){var values=[];
if(!name){return null
}name=encodeURIComponent(name);
if(url.indexOf("?")==-1){return null
}if(url.indexOf("#")!=-1){url=url.substring(0,url.indexOf("#"))
}var query=url.substring(url.indexOf("?")+1);
if(query.indexOf(name)==-1){return null
}var queryPts=query.split("&");
for(var i=0;
i<queryPts.length;
i++){var paramPts=queryPts[i].split("=");
if(paramPts[0]==name){values.push(paramPts.length>1?decodeURIComponent(paramPts[1]):"")
}}return values.length>0?values:null
},addParameter:function(url,name,value){if(value&&value instanceof Array){for(var i=0;
i<value.length;
i++){url=_g.HTTP.addParameter(url,name,value[i])
}return url
}var separator=url.indexOf("?")==-1?"?":"&";
var hashIdx=url.indexOf("#");
if(hashIdx<0){return url+separator+encodeURIComponent(name)+"="+encodeURIComponent(value)
}else{var hash=url.substring(hashIdx);
url=url.substring(0,hashIdx);
return url+separator+encodeURIComponent(name)+"="+encodeURIComponent(value)+hash
}},setParameter:function(url,name,value){url=_g.HTTP.removeParameter(url,name);
return _g.HTTP.addParameter(url,name,value)
},removeParameter:function(url,name){var pattern0="?"+encodeURIComponent(name)+"=";
var pattern1="&"+encodeURIComponent(name)+"=";
var pattern;
if(url.indexOf(pattern0)!=-1){pattern=pattern0
}else{if(url.indexOf(pattern1)!=-1){pattern=pattern1
}else{return url
}}var indexCutStart=url.indexOf(pattern);
var begin=url.substring(0,indexCutStart);
var indexCutEnd=url.indexOf("&",indexCutStart+1);
var end="";
if(indexCutEnd!=-1){end=url.substring(indexCutEnd);
if(end.indexOf("&")==0){end=end.replace("&","?")
}}return begin+end
},removeParameters:Granite.HTTP.removeParameters,addSelector:function(url,selector,index){if(!index){index=0
}var post="";
var pIndex=url.indexOf("?");
if(pIndex==-1){pIndex=url.indexOf("#")
}if(pIndex!=-1){post=url.substring(pIndex);
url=url.substring(0,pIndex)
}var sIndex=url.lastIndexOf("/");
var main=url.substring(sIndex);
if(main.indexOf("."+selector+".")==-1){var path=url.substring(0,sIndex);
var obj=main.split(".");
var newMain="";
var delim="";
if(index>obj.length-2||index==-1){index=obj.length-2
}for(var i=0;
i<obj.length;
i++){newMain+=delim+obj[i];
delim=".";
if(index==i){newMain+=delim+selector
}}return path+newMain+post
}else{return url
}},setSelector:function(url,selector,index){var post="";
var pIndex=url.indexOf("?");
if(pIndex==-1){pIndex=url.indexOf("#")
}if(pIndex!=-1){post=url.substring(pIndex);
url=url.substring(0,pIndex)
}var selectors=_g.HTTP.getSelectors(url);
var ext=url.substring(url.lastIndexOf("."));
url=url.substring(0,url.lastIndexOf("."));
var fragment=(selectors.length>0)?url.replace("."+selectors.join("."),""):url;
if(selectors.length>0){for(var i=0;
i<selectors.length;
i++){if(index==i){fragment+="."+selector
}else{fragment+="."+selectors[i]
}}}else{fragment+="."+selector
}return fragment+ext+post
},addSelectors:function(url,selectors){var res=url;
if(url&&selectors&&selectors.length){for(var i=0;
i<selectors.length;
i++){res=_g.HTTP.addSelector(res,selectors[i],i)
}}return res
},getAnchor:function(url){if(url.indexOf("#")!=-1){return url.substring(url.indexOf("#")+1)
}return""
},setAnchor:function(url,anchor){return _g.HTTP.removeAnchor(url)+"#"+anchor
},removeAnchor:Granite.HTTP.removeAnchor,noCaching:function(url){return _g.HTTP.setParameter(url,_g.HTTP.PARAM_NO_CACHE,new Date().valueOf())
},buildPostResponseFromNode:function(node,response){if(!node){return null
}if(response==undefined){response=createResponse()
}for(var i=0;
i<node.childNodes.length;
i++){var child=node.childNodes[i];
if(child.tagName){if(child.id){if(child.href){response.headers[child.id]=child.href
}else{response.headers[child.id]=child.innerHTML
}}response=_g.HTTP.buildPostResponseFromNode(child,response)
}}return response
},buildPostResponseFromHTML:function(html){var response=createResponse();
try{if(html.responseText!=undefined){html=html.responseText
}else{if(typeof html!="string"){html=html.toString()
}}var div=document.createElement("div");
div.innerHTML=html;
response=_g.HTTP.buildPostResponseFromNode(div,response);
div=null
}catch(e){}return response
},getCookie:function(name){var cname=encodeURIComponent(name)+"=";
var dc=document.cookie;
if(dc.length>0){var begin=dc.indexOf(cname);
if(begin!=-1){begin+=cname.length;
var end=dc.indexOf(";",begin);
if(end==-1){end=dc.length
}return decodeURIComponent(dc.substring(begin,end))
}}return null
},setCookie:function(name,value,path,days,domain,secure){if(typeof(days)!="number"){days=7
}var date;
if(days>0){date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000))
}else{date=new Date(0)
}document.cookie=encodeURIComponent(name)+"="+encodeURIComponent(value)+"; "+(days!=0?"expires="+date.toGMTString()+"; ":"")+(domain?"domain="+domain+"; ":"")+(path?"path="+path:"")+(secure?"; secure":"");
return value
},clearCookie:function(name,path,domain,secure){_g.HTTP.setCookie(name,"null",path||"",-1,domain||"",secure||"")
},getSchemeAndAuthority:Granite.HTTP.getSchemeAndAuthority,getContextPath:Granite.HTTP.getContextPath,externalize:function(url,encode){if((typeof G_IS_HOOKED!="undefined")&&G_IS_HOOKED(url)){return url
}if(encode){url=_g.HTTP.encodePathOfURI(url)
}url=Granite.HTTP.externalize(url);
return url
},internalize:Granite.HTTP.internalize,getPath:Granite.HTTP.getPath,getSuffix:function(){if(window.CQURLInfo&&CQURLInfo.suffix){return CQURLInfo.suffix
}return null
},getSelectors:function(url){if(!url&&window.CQURLInfo){if(CQURLInfo.selectors){return CQURLInfo.selectors
}}var selectors=[];
url=url||window.location.href;
url=_g.HTTP.removeParameters(url);
url=_g.HTTP.removeAnchor(url);
var fragment=url.substring(url.lastIndexOf("/"));
if(fragment){var split=fragment.split(".");
if(split.length>2){for(var i=0;
i<split.length;
i++){if(i>0&&i<split.length-1){selectors.push(split[i])
}}}}return selectors
},getExtension:function(url){if(!url&&window.CQURLInfo){if(CQURLInfo.extension){return CQURLInfo.extension
}}url=url||window.location.href;
url=_g.HTTP.removeParameters(url);
url=_g.HTTP.removeAnchor(url);
var pos=url.lastIndexOf(".");
if(pos<0){return""
}url=url.substring(pos+1);
pos=url.indexOf("/");
if(pos<0){return url
}return url.substring(0,pos)
},encodePathOfURI:Granite.HTTP.encodePathOfURI,encodePath:Granite.HTTP.encodePath,eval:Granite.HTTP.eval,isOkStatus:function(status){try{return(new String(status).indexOf("2")==0)
}catch(e){return false
}},isOk:function(response){try{return _g.HTTP.isOkStatus(response.headers[_g.HTTP.HEADER_STATUS])
}catch(e){return false
}},handleForbidden:function(response,suppressLogin){try{if(response[_g.HTTP.HEADER_STATUS.toLowerCase()]==403){Granite.HTTP.handleLoginRedirect();
return true
}return false
}catch(e){return false
}},getXhrHook:Granite.HTTP.getXhrHook,getXhrHookedURL:function(url,method,params){var hook=_g.HTTP.getXhrHook(url,method,params);
if(hook){return hook.url
}return url
},reloadHook:function(url){if(typeof G_RELOAD_HOOK!="undefined"&&_g.$.isFunction(G_RELOAD_HOOK)){if(CQURLInfo.selectorString!=""){url=_g.HTTP.addSelector(url,CQURLInfo.selectorString)
}url=G_RELOAD_HOOK(url)||url
}return url
}}
};
_g.HTTP=_g.shared.HTTP;
_g.shared.Util=new function(){return{reload:function(win,url,preventHistory){if(!win){win=window
}if(!url){url=_g.HTTP.noCaching(win.location.href)
}url=_g.HTTP.reloadHook(url);
if(preventHistory){win.location.replace(url)
}else{win.location.href=url
}},load:function(url,preventHistory){_g.Util.reload(window,url,preventHistory)
},open:function(url,win,name,options){if(!win){win=window
}if(!url){return
}url=_g.HTTP.reloadHook(url);
if(!name){name=""
}if(!options){options=""
}return win.open(url,name,options)
},htmlEncode:function(value){return !value?value:String(value).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")
},htmlDecode:function(value){return !value?value:String(value).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&")
},ellipsis:function(value,length,word){if(value&&value.length>length){if(word){var vs=value.substr(0,length-2);
var index=Math.max(vs.lastIndexOf(" "),vs.lastIndexOf("."),vs.lastIndexOf("!"),vs.lastIndexOf("?"),vs.lastIndexOf(";"));
if(index==-1||index<(length-15)){return value.substr(0,length-3)+"..."
}else{return vs.substr(0,index)+"..."
}}else{return value.substr(0,length-3)+"..."
}}return value
},patchText:Granite.Util.patchText,eval:function(response){return _g.HTTP.eval(response)
},getTopWindow:Granite.Util.getTopWindow,setIFrameMode:Granite.Util.setIFrameMode}
};
_g.Util=_g.shared.Util;
_g.shared.Sling=function(){return{SELECTOR_INFINITY:Granite.Sling.SELECTOR_INFINITY,CHARSET:Granite.Sling.CHARSET,STATUS:Granite.Sling.STATUS,STATUS_BROWSER:Granite.Sling.STATUS_BROWSER,OPERATION:Granite.Sling.OPERATION,OPERATION_DELETE:Granite.Sling.OPERATION_DELETE,OPERATION_MOVE:Granite.Sling.OPERATION_MOVE,DELETE_SUFFIX:Granite.Sling.DELETE_SUFFIX,TYPEHINT_SUFFIX:Granite.Sling.TYPEHINT_SUFFIX,COPY_SUFFIX:Granite.Sling.COPY_SUFFIX,MOVE_SUFFIX:Granite.Sling.MOVE_SUFFIX,ORDER:Granite.Sling.ORDER,REPLACE:Granite.Sling.REPLACE,DESTINATION:Granite.Sling.DESTINATION,SAVE_PARAM_PREFIX:Granite.Sling.SAVE_PARAM_PREFIX,IGNORE_PARAM:Granite.Sling.IGNORE_PARAM,REQUEST_LOGIN_PARAM:Granite.Sling.REQUEST_LOGIN_PARAM,LOGIN_URL:Granite.Sling.LOGIN_URL,LOGOUT_URL:Granite.Sling.LOGOUT_URL,processBinaryData:function(d){if(d&&d[":jcr:data"]!=undefined){var c=new Object();
c.size=d[":jcr:data"];
c.type=d["jcr:mimeType"];
c.date=d["jcr:lastModified"];
d=c
}return d
},getContentPath:function(h,f,e){var g=f;
if(g.lastIndexOf(".")>g.lastIndexOf("/")){g=g.substr(0,g.indexOf(".",g.lastIndexOf("/")))
}if(h){if(h.indexOf("/")==0){g=h
}else{if(e){while(h.indexOf("../")==0){h=h.substring(3);
g=g.substring(0,g.lastIndexOf("/"))
}}h=h.replace("./","");
g=g+"/"+h
}}return g
}}
}();
_g.Sling=_g.shared.Sling;
_g.shared.XSS=new function(){return{getXSSPropertyName:function(b){if(!b){return""
}if(_g.XSS.KEY_REGEXP.test(b)){return b
}return b+=_g.XSS.KEY_SUFFIX
},getXSSRecordPropertyValue:function(h,j,g){var i="";
if(h&&j){var f=h.get(this.getXSSPropertyName(j));
if(f){i=f
}else{i=h.get(j)
}if(g&&!isNaN(g)){i=_g.Util.ellipsis(i,g,true)
}}return i
},getXSSTablePropertyValue:function(i,j,g){var h="";
if(i&&j){var f=i[this.getXSSPropertyName(j)];
if(f){h=f
}else{h=i[j]
}if(g&&!isNaN(g)){h=_g.Util.ellipsis(h,g,true)
}}return h
},getXSSValue:function(b){if(b){return _g.Util.htmlEncode(b)
}else{return""
}},updatePropertyName:function(d,c){if(!d||!c||!d[c]){return
}if(d.xssProtect&&!d.xssKeepPropName){d[c]=this.getXSSPropertyName(d[c])
}},xssPropertyRenderer:function(g,e,h,f){if(f&&f.dataIndex&&h&&h.data&&h.data[this.getXSSPropertyName(f.dataIndex)]){g=h.data[this.getXSSPropertyName(f.dataIndex)];
if(f.ellipsisLimit&&!isNaN(f.ellipsisLimit)){g=_g.Util.ellipsis(g,f.ellipsisLimit,true)
}return g
}else{if(g){return g
}else{return""
}}}}
};
_g.XSS=_g.shared.XSS;
_g.XSS.KEY_SUFFIX="_xss";
_g.XSS.KEY_REGEXP=new RegExp(_g.XSS.KEY_SUFFIX+"$");
_g.shared.I18n=Granite.I18n;
_g.I18n=_g.shared.I18n;
_g.shared.I18n.getMessage=Granite.I18n.get;
_g.shared.I18n.getVarMessage=Granite.I18n.getVar;
_g.shared.String=new function(){return{startsWith:function(g,e){if(g==null||e==null){return g==null&&e==null
}if(e.length>g.length){return false
}var f=g.toString();
var h=e.toString();
return(f.indexOf(h)==0)
},endsWith:function(c,d){if(c==null||d==null){return c==null&&d==null
}if(d.length>c.length){return false
}c=c.toString();
d=d.toString();
return(c.lastIndexOf(d)==(c.length-d.length))
},contains:function(c,d){if(c==null||d==null){return false
}c=c.toString();
d=d.toString();
return(c.indexOf(d)>=0)
}}
};
_g.String=_g.shared.String;
_g.shared.ClientSidePersistence=function(d){var c={PERSISTENCE_NAME:_g.shared.ClientSidePersistence.decoratePersistenceName("ClientSidePersistence"),config:{},cache:null,getMode:function(){return this.config.mode
},getWindow:function(){return this.config.window||_g.shared.Util.getTopWindow()
},debug:function(){if(console){var r=this.getMap();
var p="[ClientSidePersistence -> mode="+this.getMode().name+", container="+(this.config.container||"")+"]\n";
var q=0;
var o=new RegExp("^"+this.config.container+"/");
for(var m=0,a=Object.keys(r).sort(),l=null;
m<a.length;
m++){var b=a[m];
if(this.config.container&&(typeof(b)=="string")&&!b.match(o)){continue
}var n=r[b];
p+="-["+ ++q+"]-> '"+b.replace(o,"")+"' = '"+decodeURIComponent(n)+"'\n"
}if(!q){p+="(container is empty)"
}console.log(p)
}},keyName:function(a){return(this.config.container?(this.config.container+"/"):"")+a
},getKeys:function(){var a=this.getMap();
var b=[];
if(a){for(var h in a){if(this.config.container){if(h.indexOf(this.config.container+"/")==0){var g=h.substring(this.config.container.length+1);
b.push(g)
}}else{b.push(h)
}}}return b
},get:function(b){var a=this.getMap()[this.keyName(b)];
return a?decodeURIComponent(a):a
},set:function(k,b){k=(typeof k==="string")?k.replace(/:=/g,""):"";
var i={key:k};
k=this.keyName(k);
if(!k.length){return
}var l=[];
var a=this.getMap();
i.action=a[k]?"update":"set";
if(b){a[k]=encodeURIComponent(b)
}else{i.action="remove";
delete a[k]
}for(var j in a){l.push(j+":="+a[j])
}this.cache=a;
this.write(l.join("|"));
_g.$.extend(i,{value:b,mode:this.getMode().name,container:this.config.container});
_g.$(_g.shared.ClientSidePersistence).trigger(_g.shared.ClientSidePersistence.EVENT_NAME,i)
},getMap:function(){if(!this.cache||!this.config.useCache){var b=this.read().split("|");
var i={};
for(var j=0;
j<b.length;
j++){var a=b[j].split(":=");
var h=a[0];
if(h&&h.length){i[h]=a[1]||""
}}this.cache=i
}return this.cache
},remove:function(a){this.set(a)
},clearMap:function(){this.write()
},read:function(){return this.config.mode.read(this)||""
},write:function(a){this.config.mode.write(this,a||"")
}};
_g.$.extend(c.config,_g.shared.ClientSidePersistence.getDefaultConfig(),d);
if(c.config.useContainer===false){c.config.container=null
}if((c.config.mode===_g.shared.ClientSidePersistence.MODE_SESSION)&&(!window.sessionStorage||!window.sessionStorage.getItem||!window.sessionStorage.setItem)){c.config.mode=_g.shared.ClientSidePersistence.MODE_LOCAL
}if((c.config.mode===_g.shared.ClientSidePersistence.MODE_LOCAL)&&(!window.localStorage||!window.localStorage.getItem||!window.localStorage.setItem)){c.config.mode=_g.shared.ClientSidePersistence.MODE_WINDOW
}return c
};
_g.shared.ClientSidePersistence.EVENT_NAME="ClientSidePersistence";
_g.shared.ClientSidePersistence.MODE_SESSION={name:"session",read:function(b){return b.getWindow().sessionStorage.getItem(b.PERSISTENCE_NAME)
},write:function(e,f){if(Granite.OptOutUtil.isOptedOut()){return
}try{e.getWindow().sessionStorage.setItem(e.PERSISTENCE_NAME,f)
}catch(d){return
}}};
_g.shared.ClientSidePersistence.MODE_LOCAL={name:"local",read:function(b){return b.getWindow().localStorage.getItem(b.PERSISTENCE_NAME)
},write:function(e,f){if(Granite.OptOutUtil.isOptedOut()){return
}try{e.getWindow().localStorage.setItem(e.PERSISTENCE_NAME,f)
}catch(d){return
}}};
_g.shared.ClientSidePersistence.decoratePersistenceName=function(b){return b
};
_g.shared.ClientSidePersistence.MODE_WINDOW={name:"window",read:function(b){return b.getWindow().name
},write:function(d,c){if(Granite.OptOutUtil.isOptedOut()){return
}d.getWindow().name=c
}};
_g.shared.ClientSidePersistence.MODE_COOKIE={COOKIE_NAME:_g.shared.ClientSidePersistence.decoratePersistenceName("SessionPersistence"),name:"cookie",read:function(b){return _g.shared.ClientSidePersistence.CookieHelper.read(this.COOKIE_NAME)
},write:function(d,c){if(Granite.OptOutUtil.isOptedOut()&&!Granite.OptOutUtil.maySetCookie(this.COOKIE_NAME)){return
}if(!c){_g.shared.ClientSidePersistence.CookieHelper.erase(this.COOKIE_NAME)
}else{_g.shared.ClientSidePersistence.CookieHelper.set(this.COOKIE_NAME,c,365)
}}};
_g.shared.ClientSidePersistence.getDefaultConfig=function(){return{window:_g.shared.Util.getTopWindow(),useCache:false,container:null,mode:_g.shared.ClientSidePersistence.MODE_LOCAL}
};
_g.shared.ClientSidePersistence.CookieHelper={set:function(j,i,h){var g="";
if(h){var f=new Date();
f.setTime(f.getTime()+(h*24*60*60*1000));
g="; expires="+f.toGMTString()
}if(i){i=encodeURIComponent(i)
}document.cookie=j+"="+i+g+"; path=/"
},read:function(c){var j=c+"=";
var h=document.cookie.split(";");
for(var l=0;
l<h.length;
l++){var i=h[l];
while(i.charAt(0)==" "){i=i.substring(1,i.length)
}if(i.indexOf(j)==0){var k=i.substring(j.length,i.length);
return k?decodeURIComponent(k):null
}}return null
},erase:function(b){_g.shared.ClientSidePersistence.CookieHelper.set(b,"",-1)
}};
_g.shared.ClientSidePersistence.clearAllMaps=function(){var b=[_g.shared.ClientSidePersistence.MODE_COOKIE,_g.shared.ClientSidePersistence.MODE_LOCAL,_g.shared.ClientSidePersistence.MODE_SESSION,_g.shared.ClientSidePersistence.MODE_WINDOW];
_g.$.each(b,function(e,f){var a=new _g.shared.ClientSidePersistence({mode:f});
a.clearMap()
})
};
_g.I18n.init();
window.CQ=window.CQ||{};
CQ.shared=_g.shared;
CQ.Sling=CQ.shared.Sling;
CQ.I18n=CQ.shared.I18n;
G_XHR_HOOK=typeof CQ_XHR_HOOK!="undefined"?CQ_XHR_HOOK:undefined;
G_RELOAD_HOOK=typeof CQ_RELOAD_HOOK!="undefined"?CQ_RELOAD_HOOK:undefined;
G_IS_HOOKED=typeof CQ_IS_HOOKED!="undefined"?CQ_IS_HOOKED:undefined;
G_CONTENT_PATH=typeof CQ_CONTENT_PATH!="undefined"?CQ_CONTENT_PATH:undefined;
CQ.shared.Form=function(){var j=function(){var b=new Object();
var a=document.getElementsByTagName("label");
for(var c=0;
c<a.length;
c++){var d=a[c].htmlFor;
if(d){b[d]=a[c]
}}return b
};
var i=function(b){var a="";
var c=function(d){if(d.nodeType==3){a+=d.nodeValue
}if(d.nodeName.toLowerCase()=="select"||d.nodeName.toLowerCase()=="input"||d.nodeName.toLowerCase()=="textarea"||d.nodeName.toLowerCase()=="button"){return
}for(var e=0;
d.childNodes&&e<d.childNodes.length;
e++){c(d.childNodes[e])
}};
c(b);
return a
};
var l=function(a){return a.replace(/-\d+$/,"")
};
var g=function(a,b){if(!b){b=j()
}if(b[a]){return i(b[a])
}return null
};
var h=function(b){var c;
var a=b.nodeName.toLowerCase();
var d=k(b,"type")?b.getAttribute("type"):undefined;
if(a=="input"){if(d=="radio"||d=="checkbox"){if(k(b,"checked")){c=b.getAttribute("value")
}}else{if(b.type=="text"){c=b.defaultValue
}else{c=b.value
}}}else{if(a=="textarea"){c=b.value
}else{if(a=="option"&&k(b,"selected")){c=b.getAttribute("value")
}}}return c
};
var k=function(a,b){if(a==null){return false
}return($CQ(a).attr(b)!=undefined)
};
return{searchArray:function(c,d,a){for(var b=0;
b<c.length;
b++){if(c[b][d]&&c[b][d]==a){return c[b]
}}return null
},getLabelForField:function(d,b){if(!b){b=j()
}var a=d.getAttribute("id");
if(a&&b[a]){return i(b[a])
}var c=d.parentNode;
while(c){if(c.nodeName.toLowerCase()=="label"){return i(c)
}c=c.parentNode
}return d.getAttribute("name")
},getFields:function(){var a=j();
var d=[];
var c=function(x,w){var y=x.getAttribute("name");
var v=x.nodeName.toLowerCase();
var e;
if(v=="input"||v=="textarea"){var z=k(x,"type")?x.getAttribute("type").toLowerCase():"text";
if(z=="button"||z=="submit"||z=="reset"){return
}e=CQ.shared.Form.searchArray(d,"value",y);
if(!e){d.push({text:CQ.shared.Form.getLabelForField(x,a),value:y,name:y,enumeration:undefined,local:w,type:v,defaultValue:h(x),node:x});
e=d[d.length-1]
}if(z=="radio"||(e.local&&z=="checkbox")){if(!e.enumeration){var D=x.getAttribute("id");
if(D){var B=l(D);
var C=g(B,a);
e.text=(C?C:y)
}else{e.text=y
}e.enumeration=[]
}e.enumeration.push({text:CQ.shared.Form.getLabelForField(x,a),value:x.getAttribute("value"),defaultValue:h(x),node:x})
}}else{if(v=="select"){d.push({text:CQ.shared.Form.getLabelForField(x,a),value:y,name:y,enumeration:[],local:w,type:v,defaultValue:undefined,node:x});
e=d[d.length-1];
var A=x.getElementsByTagName("option");
for(var f=0;
f<A.length;
f++){e.enumeration.push({text:A[f].innerHTML,value:A[f].getAttribute("value"),defaultValue:h(A[f]),node:A[f]})
}}}};
var b=function(e,f){if(e.nodeName.toLowerCase()=="div"&&$CQ(e).hasClass("section")){f=true
}if(e.getAttribute&&e.getAttribute("name")){c(e,f)
}for(var o=0;
e.childNodes&&o<e.childNodes.length;
o++){var p=e.childNodes[o];
if(p.nodeType==1){b(p,f)
}}};
b(document,false);
return d
}}
}();
CQ.shared.User=function(infoData){return{data:null,language:null,userPropsPath:null,getUserPropsUrl:function(){if(!this.userPropsPath){this.userPropsPath=CQ.shared.User.PROXY_URI
}return this.userPropsPath
},load:function(){var url=this.getUserPropsUrl();
url=CQ.shared.HTTP.noCaching(url);
var response=CQ.shared.HTTP.get(url);
if(CQ.shared.HTTP.isOk(response)){this.data=CQ.shared.Util.eval(response)
}},init:function(infoData,force){if(!this.initialized||force){if(infoData){this.data=infoData
}else{this.load()
}this.initialized=true
}return this.data
},lazyInit:function(){this.lazyLoad=function(){this.load();
this.initialized=true
}
},isInitialized:function(){return this.initialized
},getLanguage:function(){if(!this.isInitialized()&&this.lazyLoad){this.lazyLoad.call(this)
}this.language=this.data&&this.data.preferences&&this.data.preferences.language?this.data.preferences.language:"en";
return this.language
}}
}();
CQ.shared.User.PROXY_URI=CQ.shared.HTTP.externalize("/libs/cq/security/userinfo"+CQ.shared.HTTP.EXTENSION_JSON);
CQ.shared.User.lazyInit();
CQ.shared.I18n.init({locale:function(){return CQ.shared.User.getLanguage()
},urlPrefix:"/libs/cq/i18n/dict."});