
var TPM=(function(name){return name;}(TPM||{}));TPM.Performance={};TPM.Performance.TimeLog=(function(){var logger={log:function(msg){}};var toLog=[];var openTimers=[];var closedTimers=[];var labels=[];var timeStamp=function(){return new Date().getTime();};var enterLabel=function(label){labels[label]=label;if(openTimers[label]===undefined){openTimers[label]=[];}
if(closedTimers[label]===undefined){closedTimers[label]=[];}};var logStart=function(label,timeEntry){if(toLog[label]!==undefined){var meta="";if(timeEntry.meta!=null){meta=" ("+timeEntry.meta+")";}
logger.log("TIME: "+label+meta+" started: "+timeEntry.start);}};var logStop=function(label,timeEntry){if(toLog[label]!==undefined){var diff=timeEntry.stop-timeEntry.start;var meta="";if(timeEntry.meta!=null){meta=" ("+timeEntry.meta+")";}
logger.log("TIME: "+label+meta+" stopped: "+timeEntry.stop+", duration: "+diff);}};var logTimeEntry=function(label,timeEntry){var diff;if(timeEntry.stop!=null&&timeEntry.start!=null){diff=timeEntry.stop-timeEntry.start;}else{diff="n/a";}
var meta="";if(timeEntry.meta!=null){meta=" ("+timeEntry.meta+")";}
logger.log(label+meta+", duration: "+diff);};return{init:function(o){if(o.console!==undefined){if(console!==undefined){logger=console;}else{var d=document.createElement('div');document.body.appendChild(d);logger={log:function(msg){d.innerHTML=d.innerHTML+msg+'<br/>';}};}
for(var i=0;i<o.console.length;i++){toLog[o.console[i]]=true;}}
if(o.beforeUnload!==undefined){var handler=o.beforeUnload;var oldFunc=window.onbeforeunload;if(typeof window.onbeforeunload!='function'){window.onbeforeunload=function(e){handler(TPM.Performance.TimeLog.getLoggedData());};}else{window.onbeforeunload=function(e){handler(TPM.Performance.TimeLog.getLoggedData());oldFunc();};}}},start:function(label,meta){var ts=timeStamp();enterLabel(label);if(meta===undefined){meta=null;}
var timeEntry={start:ts,stop:null,meta:meta};openTimers[label].push(timeEntry);logStart(label,timeEntry);},stop:function(label){var ts=timeStamp();var timeEntry;enterLabel(label);if(openTimers[label]!==undefined&&openTimers[label].length>0){timeEntry=openTimers[label].pop();timeEntry.stop=ts;closedTimers[label].push(timeEntry);logStop(label,timeEntry);}},getLoggedData:function(){var data={};for(var label in labels){data[label]=new Array().concat(closedTimers[label],openTimers[label]);}
return data;},report:function(label){for(var i=0;i<closedTimers[label].length;i++){logTimeEntry(label,closedTimers[label][i]);}
for(i=0;i<openTimers[label].length;i++){logTimeEntry(label,openTimers[label][i]);}}};})();if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());(function(window,undefined){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context);},_jQuery=window.jQuery,_$=window.$,document=window.document,rootjQuery,quickExpr=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/,rnotwhite=/\S/,rtrim=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,userAgent=navigator.userAgent,browserMatch,readyBound=false,readyList=[],DOMContentLoaded,toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,indexOf=Array.prototype.indexOf;jQuery.fn=jQuery.prototype={init:function(selector,context){var match,elem,ret,doc;if(!selector){return this;}
if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}
if(selector==="body"&&!context){this.context=document;this[0]=document.body;this.selector="body";this.length=1;return this;}
if(typeof selector==="string"){match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]){doc=(context?context.ownerDocument||context:document);ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true);}else{selector=[doc.createElement(ret[1])];}}else{ret=buildFragment([match[1]],[doc]);selector=(ret.cacheable?ret.fragment.cloneNode(true):ret.fragment).childNodes;}
return jQuery.merge(this,selector);}else{elem=document.getElementById(match[2]);if(elem){if(elem.id!==match[2]){return rootjQuery.find(selector);}
this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context&&/^\w+$/.test(selector)){this.selector=selector;this.context=document;selector=document.getElementsByTagName(selector);return jQuery.merge(this,selector);}else if(!context||context.jquery){return(context||rootjQuery).find(selector);}else{return jQuery(context).find(selector);}}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.makeArray(selector,this);},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length;},toArray:function(){return slice.call(this,0);},get:function(num){return num==null?this.toArray():(num<0?this.slice(num)[0]:this[num]);},pushStack:function(elems,name,selector){var ret=jQuery();if(jQuery.isArray(elems)){push.apply(ret,elems);}else{jQuery.merge(ret,elems);}
ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector;}else if(name){ret.selector=this.selector+"."+name+"("+selector+")";}
return ret;},each:function(callback,args){return jQuery.each(this,callback,args);},ready:function(fn){jQuery.bindReady();if(jQuery.isReady){fn.call(document,jQuery);}else if(readyList){readyList.push(fn);}
return this;},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},end:function(){return this.prevObject||jQuery(null);},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options,name,src,copy;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(length===i){target=this;--i;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||jQuery.isArray(copy))){var clone=src&&(jQuery.isPlainObject(src)||jQuery.isArray(src))?src:jQuery.isArray(copy)?[]:{};target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery;}
return jQuery;},isReady:false,ready:function(){if(!jQuery.isReady){if(!document.body){return setTimeout(jQuery.ready,13);}
jQuery.isReady=true;if(readyList){var fn,i=0;while((fn=readyList[i++])){fn.call(document,jQuery);}
readyList=null;}
if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");}}},bindReady:function(){if(readyBound){return;}
readyBound=true;if(document.readyState==="complete"){return jQuery.ready();}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null;}catch(e){}
if(document.documentElement.doScroll&&toplevel){doScrollCheck();}}},isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},isPlainObject:function(obj){if(!obj||toString.call(obj)!=="[object Object]"||obj.nodeType||obj.setInterval){return false;}
if(obj.constructor&&!hasOwnProperty.call(obj,"constructor")&&!hasOwnProperty.call(obj.constructor.prototype,"isPrototypeOf")){return false;}
var key;for(key in obj){}
return key===undefined||hasOwnProperty.call(obj,key);},isEmptyObject:function(obj){for(var name in obj){return false;}
return true;},error:function(msg){throw msg;},parseJSON:function(data){if(typeof data!=="string"||!data){return null;}
if(/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return window.JSON&&window.JSON.parse?window.JSON.parse(data):(new Function("return "+data))();}else{jQuery.error("Invalid JSON: "+data);}},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data));}else{script.text=data;}
head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break;}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break;}}}}else{if(isObj){for(name in object){if(callback.call(object[name],name,object[name])===false){break;}}}else{for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}}
return object;},trim:function(text){return(text||"").replace(rtrim,"");},makeArray:function(array,results){var ret=results||[];if(array!=null){if(array.length==null||typeof array==="string"||jQuery.isFunction(array)||(typeof array!=="function"&&array.setInterval)){push.call(ret,array);}else{jQuery.merge(ret,array);}}
return ret;},inArray:function(elem,array){if(array.indexOf){return array.indexOf(elem);}
for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i;}}
return-1;},merge:function(first,second){var i=first.length,j=0;if(typeof second.length==="number"){for(var l=second.length;j<l;j++){first[i++]=second[j];}}else{while(second[j]!==undefined){first[i++]=second[j++];}}
first.length=i;return first;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++){if(!inv!==!callback(elems[i],i)){ret.push(elems[i]);}}
return ret;},map:function(elems,callback,arg){var ret=[],value;for(var i=0,length=elems.length;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}
return ret.concat.apply([],ret);},guid:1,proxy:function(fn,proxy,thisObject){if(arguments.length===2){if(typeof proxy==="string"){thisObject=fn;fn=thisObject[proxy];proxy=undefined;}else if(proxy&&!jQuery.isFunction(proxy)){thisObject=proxy;proxy=undefined;}}
if(!proxy&&fn){proxy=function(){return fn.apply(thisObject||this,arguments);};}
if(fn){proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;}
return proxy;},uaMatch:function(ua){ua=ua.toLowerCase();var match=/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||!/compatible/.test(ua)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"};},browser:{}});browserMatch=jQuery.uaMatch(userAgent);if(browserMatch.browser){jQuery.browser[browserMatch.browser]=true;jQuery.browser.version=browserMatch.version;}
if(jQuery.browser.webkit){jQuery.browser.safari=true;}
if(indexOf){jQuery.inArray=function(elem,array){return indexOf.call(array,elem);};}
rootjQuery=jQuery(document);if(document.addEventListener){DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready();};}else if(document.attachEvent){DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready();}};}
function doScrollCheck(){if(jQuery.isReady){return;}
try{document.documentElement.doScroll("left");}catch(error){setTimeout(doScrollCheck,1);return;}
jQuery.ready();}
function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"});}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}
function access(elems,key,value,exec,fn,pass){var length=elems.length;if(typeof key==="object"){for(var k in key){access(elems,k,key[k],exec,fn,value);}
return elems;}
if(value!==undefined){exec=!pass&&exec&&jQuery.isFunction(value);for(var i=0;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass);}
return elems;}
return length?fn(elems[0],key):undefined;}
function now(){return(new Date).getTime();}
(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+now();div.style.display="none";div.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return;}
jQuery.support={leadingWhitespace:div.firstChild.nodeType===3,tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:/^0.55$/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:div.getElementsByTagName("input")[0].value==="on",optSelected:document.createElement("select").appendChild(document.createElement("option")).selected,parentNode:div.removeChild(div.appendChild(document.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){}
root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id];}
try{delete script.test;}catch(e){jQuery.support.deleteExpando=false;}
root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function click(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",click);});div.cloneNode(true).fireEvent("onclick");}
div=document.createElement("div");div.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var fragment=document.createDocumentFragment();fragment.appendChild(div.firstChild);jQuery.support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none';div=null;});var eventSupported=function(eventName){var el=document.createElement("div");eventName="on"+eventName;var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,"return;");isSupported=typeof el[eventName]==="function";}
el=null;return isSupported;};jQuery.support.submitBubbles=eventSupported("submit");jQuery.support.changeBubbles=eventSupported("change");root=script=div=all=a=null;})();jQuery.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},expando:expando,noData:{"embed":true,"object":true,"applet":true},data:function(elem,name,data){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){return;}
elem=elem==window?windowData:elem;var id=elem[expando],cache=jQuery.cache,thisCache;if(!id&&typeof name==="string"&&data===undefined){return null;}
if(!id){id=++uuid;}
if(typeof name==="object"){elem[expando]=id;thisCache=cache[id]=jQuery.extend(true,{},name);}else if(!cache[id]){elem[expando]=id;cache[id]={};}
thisCache=cache[id];if(data!==undefined){thisCache[name]=data;}
return typeof name==="string"?thisCache[name]:thisCache;},removeData:function(elem,name){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){return;}
elem=elem==window?windowData:elem;var id=elem[expando],cache=jQuery.cache,thisCache=cache[id];if(name){if(thisCache){delete thisCache[name];if(jQuery.isEmptyObject(thisCache)){jQuery.removeData(elem);}}}else{if(jQuery.support.deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}
delete cache[id];}}});jQuery.fn.extend({data:function(key,value){if(typeof key==="undefined"&&this.length){return jQuery.data(this[0]);}else if(typeof key==="object"){return this.each(function(){jQuery.data(this,key);});}
var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key);}
return data===undefined&&parts[1]?this.data(parts[0]):data;}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}});jQuery.extend({queue:function(elem,type,data){if(!elem){return;}
type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!data){return q||[];}
if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data));}else{q.push(data);}
return q;},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift();if(fn==="inprogress"){fn=queue.shift();}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
fn.call(elem,function(){jQuery.dequeue(elem,type);});}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined){return jQuery.queue(this[0],type);}
return this.each(function(i,elem){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(){var elem=this;setTimeout(function(){jQuery.dequeue(elem,type);},time);});},clearQueue:function(type){return this.queue(type||"fx",[]);}});var rclass=/[\n\t]/g,rspace=/\s+/,rreturn=/\r/g,rspecialurl=/href|src|style/,rtype=/(button|input)/i,rfocusable=/(button|input|object|select|textarea)/i,rclickable=/^(a|area)$/i,rradiocheck=/radio|checkbox/;jQuery.fn.extend({attr:function(name,value){return access(this,name,value,true,jQuery.attr);},removeAttr:function(name,fn){return this.each(function(){jQuery.attr(this,name,"");if(this.nodeType===1){this.removeAttribute(name);}});},addClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.addClass(value.call(this,i,self.attr("class")));});}
if(value&&typeof value==="string"){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1){if(!elem.className){elem.className=value;}else{var className=" "+elem.className+" ",setClass=elem.className;for(var c=0,cl=classNames.length;c<cl;c++){if(className.indexOf(" "+classNames[c]+" ")<0){setClass+=" "+classNames[c];}}
elem.className=jQuery.trim(setClass);}}}}
return this;},removeClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.removeClass(value.call(this,i,self.attr("class")));});}
if((value&&typeof value==="string")||value===undefined){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1&&elem.className){if(value){var className=(" "+elem.className+" ").replace(rclass," ");for(var c=0,cl=classNames.length;c<cl;c++){className=className.replace(" "+classNames[c]+" "," ");}
elem.className=jQuery.trim(className);}else{elem.className="";}}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.toggleClass(value.call(this,i,self.attr("class"),stateVal),stateVal);});}
return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(rspace);while((className=classNames[i++])){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className);}}else if(type==="undefined"||type==="boolean"){if(this.className){jQuery.data(this,"__className__",this.className);}
this.className=this.className||value===false?"":jQuery.data(this,"__className__")||"";}});},hasClass:function(selector){var className=" "+selector+" ";for(var i=0,l=this.length;i<l;i++){if((" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true;}}
return false;},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text;}
if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null;}
for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
return values;}
if(rradiocheck.test(elem.type)&&!jQuery.support.checkOn){return elem.getAttribute("value")===null?"on":elem.value;}
return(elem.value||"").replace(rreturn,"");}
return undefined;}
var isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val=value;if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,self.val());}
if(typeof val==="number"){val+="";}
if(jQuery.isArray(val)&&rradiocheck.test(this.type)){this.checked=jQuery.inArray(self.val(),val)>=0;}else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(val);jQuery("option",this).each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0;});if(!values.length){this.selectedIndex=-1;}}else{this.value=val;}});}});jQuery.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(elem,name,value,pass){if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value);}
var notxml=elem.nodeType!==1||!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.nodeType===1){var special=rspecialurl.test(name);if(name==="selected"&&!jQuery.support.optSelected){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}}
if(name in elem&&notxml&&!special){if(set){if(name==="type"&&rtype.test(elem.nodeName)&&elem.parentNode){jQuery.error("type property can't be changed");}
elem[name]=value;}
if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue;}
if(name==="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;}
return elem[name];}
if(!jQuery.support.style&&notxml&&name==="style"){if(set){elem.style.cssText=""+value;}
return elem.style.cssText;}
if(set){elem.setAttribute(name,""+value);}
var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}
return jQuery.style(elem,name,value);}});var rnamespaces=/\.(.*)$/,fcleanup=function(nm){return nm.replace(/[^\w\s\.\|`]/g,function(ch){return"\\"+ch;});};jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType===3||elem.nodeType===8){return;}
if(elem.setInterval&&(elem!==window&&!elem.frameElement)){elem=window;}
var handleObjIn,handleObj;if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;}
if(!handler.guid){handler.guid=jQuery.guid++;}
var elemData=jQuery.data(elem);if(!elemData){return;}
var events=elemData.events=elemData.events||{},eventHandle=elemData.handle,eventHandle;if(!eventHandle){elemData.handle=eventHandle=function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(eventHandle.elem,arguments):undefined;};}
eventHandle.elem=elem;types=types.split(" ");var type,i=0,namespaces;while((type=types[i++])){handleObj=handleObjIn?jQuery.extend({},handleObjIn):{handler:handler,data:data};if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();handleObj.namespace=namespaces.slice(0).sort().join(".");}else{namespaces=[];handleObj.namespace="";}
handleObj.type=type;handleObj.guid=handler.guid;var handlers=events[type],special=jQuery.event.special[type]||{};if(!handlers){handlers=events[type]=[];if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle);}}}
if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}
handlers.push(handleObj);jQuery.event.global[type]=true;}
elem=null;},global:{},remove:function(elem,types,handler,pos){if(elem.nodeType===3||elem.nodeType===8){return;}
var ret,type,fn,i=0,all,namespaces,namespace,special,eventType,handleObj,origType,elemData=jQuery.data(elem),events=elemData&&elemData.events;if(!elemData||!events){return;}
if(types&&types.type){handler=types.handler;types=types.type;}
if(!types||typeof types==="string"&&types.charAt(0)==="."){types=types||"";for(type in events){jQuery.event.remove(elem,type+types);}
return;}
types=types.split(" ");while((type=types[i++])){origType=type;handleObj=null;all=type.indexOf(".")<0;namespaces=[];if(!all){namespaces=type.split(".");type=namespaces.shift();namespace=new RegExp("(^|\\.)"+
jQuery.map(namespaces.slice(0).sort(),fcleanup).join("\\.(?:.*\\.)?")+"(\\.|$)")}
eventType=events[type];if(!eventType){continue;}
if(!handler){for(var j=0;j<eventType.length;j++){handleObj=eventType[j];if(all||namespace.test(handleObj.namespace)){jQuery.event.remove(elem,origType,handleObj.handler,j);eventType.splice(j--,1);}}
continue;}
special=jQuery.event.special[type]||{};for(var j=pos||0;j<eventType.length;j++){handleObj=eventType[j];if(handler.guid===handleObj.guid){if(all||namespace.test(handleObj.namespace)){if(pos==null){eventType.splice(j--,1);}
if(special.remove){special.remove.call(elem,handleObj);}}
if(pos!=null){break;}}}
if(eventType.length===0||pos!=null&&eventType.length===1){if(!special.teardown||special.teardown.call(elem,namespaces)===false){removeEvent(elem,type,elemData.handle);}
ret=null;delete events[type];}}
if(jQuery.isEmptyObject(events)){var handle=elemData.handle;if(handle){handle.elem=null;}
delete elemData.events;delete elemData.handle;if(jQuery.isEmptyObject(elemData)){jQuery.removeData(elem);}}},trigger:function(event,data,elem){var type=event.type||event,bubbling=arguments[3];if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true;}
if(!elem){event.stopPropagation();if(jQuery.event.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem);}});}}
if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event);}
event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle){handle.apply(elem,data);}
var parent=elem.parentNode||elem.ownerDocument;try{if(!(elem&&elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()])){if(elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false;}}}catch(e){}
if(!event.isPropagationStopped()&&parent){jQuery.event.trigger(event,data,parent,true);}else if(!event.isDefaultPrevented()){var target=event.target,old,isClick=jQuery.nodeName(target,"a")&&type==="click",special=jQuery.event.special[type]||{};if((!special._default||special._default.call(elem,event)===false)&&!isClick&&!(target&&target.nodeName&&jQuery.noData[target.nodeName.toLowerCase()])){try{if(target[type]){old=target["on"+type];if(old){target["on"+type]=null;}
jQuery.event.triggered=true;target[type]();}}catch(e){}
if(old){target["on"+type]=old;}
jQuery.event.triggered=false;}}},handle:function(event){var all,handlers,namespaces,namespace,events;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;all=event.type.indexOf(".")<0&&!event.exclusive;if(!all){namespaces=event.type.split(".");event.type=namespaces.shift();namespace=new RegExp("(^|\\.)"+namespaces.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");}
var events=jQuery.data(this,"events"),handlers=events[event.type];if(events&&handlers){handlers=handlers.slice(0);for(var j=0,l=handlers.length;j<l;j++){var handleObj=handlers[j];if(all||namespace.test(handleObj.namespace)){event.handler=handleObj.handler;event.data=handleObj.data;event.handleObj=handleObj;var ret=handleObj.handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}
if(event.isImmediatePropagationStopped()){break;}}}}
return event.result;},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event;}
var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=event.srcElement||document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;}
if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}
if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode;}
if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey;}
if(!event.which&&event.button!==undefined){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));}
return event;},guid:1E8,proxy:jQuery.proxy,special:{ready:{setup:jQuery.bindReady,teardown:jQuery.noop},live:{add:function(handleObj){jQuery.event.add(this,handleObj.origType,jQuery.extend({},handleObj,{handler:liveHandler}));},remove:function(handleObj){var remove=true,type=handleObj.origType.replace(rnamespaces,"");jQuery.each(jQuery.data(this,"events").live||[],function(){if(type===this.origType.replace(rnamespaces,"")){remove=false;return false;}});if(remove){jQuery.event.remove(this,handleObj.origType,liveHandler);}}},beforeunload:{setup:function(data,namespaces,eventHandle){if(this.setInterval){this.onbeforeunload=eventHandle;}
return false;},teardown:function(namespaces,eventHandle){if(this.onbeforeunload===eventHandle){this.onbeforeunload=null;}}}}};var removeEvent=document.removeEventListener?function(elem,type,handle){elem.removeEventListener(type,handle,false);}:function(elem,type,handle){elem.detachEvent("on"+type,handle);};jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;}else{this.type=src;}
this.timeStamp=now();this[expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.preventDefault){e.preventDefault();}
e.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.stopPropagation){e.stopPropagation();}
e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;try{while(parent&&parent!==this){parent=parent.parentNode;}
if(parent!==this){event.type=event.data;jQuery.event.handle.apply(this,arguments);}}catch(e){}},delegate=function(event){event.type=event.data;jQuery.event.handle.apply(this,arguments);};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={setup:function(data){jQuery.event.add(this,fix,data&&data.selector?delegate:withinElement,orig);},teardown:function(data){jQuery.event.remove(this,fix,data&&data.selector?delegate:withinElement);}};});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(data,namespaces){if(this.nodeName.toLowerCase()!=="form"){jQuery.event.add(this,"click.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="submit"||type==="image")&&jQuery(elem).closest("form").length){return trigger("submit",this,arguments);}});jQuery.event.add(this,"keypress.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="text"||type==="password")&&jQuery(elem).closest("form").length&&e.keyCode===13){return trigger("submit",this,arguments);}});}else{return false;}},teardown:function(namespaces){jQuery.event.remove(this,".specialSubmit");}};}
if(!jQuery.support.changeBubbles){var formElems=/textarea|input|select/i,changeFilters,getVal=function(elem){var type=elem.type,val=elem.value;if(type==="radio"||type==="checkbox"){val=elem.checked;}else if(type==="select-multiple"){val=elem.selectedIndex>-1?jQuery.map(elem.options,function(elem){return elem.selected;}).join("-"):"";}else if(elem.nodeName.toLowerCase()==="select"){val=elem.selectedIndex;}
return val;},testChange=function testChange(e){var elem=e.target,data,val;if(!formElems.test(elem.nodeName)||elem.readOnly){return;}
data=jQuery.data(elem,"_change_data");val=getVal(elem);if(e.type!=="focusout"||elem.type!=="radio"){jQuery.data(elem,"_change_data",val);}
if(data===undefined||val===data){return;}
if(data!=null||val){e.type="change";return jQuery.event.trigger(e,arguments[1],elem);}};jQuery.event.special.change={filters:{focusout:testChange,click:function(e){var elem=e.target,type=elem.type;if(type==="radio"||type==="checkbox"||elem.nodeName.toLowerCase()==="select"){return testChange.call(this,e);}},keydown:function(e){var elem=e.target,type=elem.type;if((e.keyCode===13&&elem.nodeName.toLowerCase()!=="textarea")||(e.keyCode===32&&(type==="checkbox"||type==="radio"))||type==="select-multiple"){return testChange.call(this,e);}},beforeactivate:function(e){var elem=e.target;jQuery.data(elem,"_change_data",getVal(elem));}},setup:function(data,namespaces){if(this.type==="file"){return false;}
for(var type in changeFilters){jQuery.event.add(this,type+".specialChange",changeFilters[type]);}
return formElems.test(this.nodeName);},teardown:function(namespaces){jQuery.event.remove(this,".specialChange");return formElems.test(this.nodeName);}};changeFilters=jQuery.event.special.change.filters;}
function trigger(type,elem,args){args[0].type=type;return jQuery.event.handle.apply(elem,args);}
if(document.addEventListener){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){jQuery.event.special[fix]={setup:function(){this.addEventListener(orig,handler,true);},teardown:function(){this.removeEventListener(orig,handler,true);}};function handler(e){e=jQuery.event.fix(e);e.type=fix;return jQuery.event.handle.call(this,e);}});}
jQuery.each(["bind","one"],function(i,name){jQuery.fn[name]=function(type,data,fn){if(typeof type==="object"){for(var key in type){this[name](key,data,type[key],fn);}
return this;}
if(jQuery.isFunction(data)){fn=data;data=undefined;}
var handler=name==="one"?jQuery.proxy(fn,function(event){jQuery(this).unbind(event,handler);return fn.apply(this,arguments);}):fn;if(type==="unload"&&name!=="one"){this.one(type,data,fn);}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.add(this[i],type,handler,data);}}
return this;};});jQuery.fn.extend({unbind:function(type,fn){if(typeof type==="object"&&!type.preventDefault){for(var key in type){this.unbind(key,type[key]);}}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.remove(this[i],type,fn);}}
return this;},delegate:function(selector,types,data,fn){return this.live(types,data,fn,selector);},undelegate:function(selector,types,fn){if(arguments.length===0){return this.unbind("live");}else{return this.die(types,null,fn,selector);}},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result;}},toggle:function(fn){var args=arguments,i=1;while(i<args.length){jQuery.proxy(fn,args[i++]);}
return this.click(jQuery.proxy(fn,function(event){var lastToggle=(jQuery.data(this,"lastToggle"+fn.guid)||0)%i;jQuery.data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);}});var liveMap={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};jQuery.each(["live","die"],function(i,name){jQuery.fn[name]=function(types,data,fn,origSelector){var type,i=0,match,namespaces,preType,selector=origSelector||this.selector,context=origSelector?this:jQuery(this.context);if(jQuery.isFunction(data)){fn=data;data=undefined;}
types=(types||"").split(" ");while((type=types[i++])!=null){match=rnamespaces.exec(type);namespaces="";if(match){namespaces=match[0];type=type.replace(rnamespaces,"");}
if(type==="hover"){types.push("mouseenter"+namespaces,"mouseleave"+namespaces);continue;}
preType=type;if(type==="focus"||type==="blur"){types.push(liveMap[type]+namespaces);type=type+namespaces;}else{type=(liveMap[type]||type)+namespaces;}
if(name==="live"){context.each(function(){jQuery.event.add(this,liveConvert(type,selector),{data:data,selector:selector,handler:fn,origType:type,origHandler:fn,preType:preType});});}else{context.unbind(liveConvert(type,selector),fn);}}
return this;}});function liveHandler(event){var stop,elems=[],selectors=[],args=arguments,related,match,handleObj,elem,j,i,l,data,events=jQuery.data(this,"events");if(event.liveFired===this||!events||!events.live||event.button&&event.type==="click"){return;}
event.liveFired=this;var live=events.live.slice(0);for(j=0;j<live.length;j++){handleObj=live[j];if(handleObj.origType.replace(rnamespaces,"")===event.type){selectors.push(handleObj.selector);}else{live.splice(j--,1);}}
match=jQuery(event.target).closest(selectors,event.currentTarget);for(i=0,l=match.length;i<l;i++){for(j=0;j<live.length;j++){handleObj=live[j];if(match[i].selector===handleObj.selector){elem=match[i].elem;related=null;if(handleObj.preType==="mouseenter"||handleObj.preType==="mouseleave"){related=jQuery(event.relatedTarget).closest(handleObj.selector)[0];}
if(!related||related!==elem){elems.push({elem:elem,handleObj:handleObj});}}}}
for(i=0,l=elems.length;i<l;i++){match=elems[i];event.currentTarget=match.elem;event.data=match.handleObj.data;event.handleObj=match.handleObj;if(match.handleObj.origHandler.apply(match.elem,args)===false){stop=false;break;}}
return stop;}
function liveConvert(type,selector){return"live."+(type&&type!=="*"?type+".":"")+selector.replace(/\./g,"`").replace(/ /g,"&");}
jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error").split(" "),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};if(jQuery.attrFn){jQuery.attrFn[name]=true;}});if(window.attachEvent&&!window.addEventListener){window.attachEvent("onunload",function(){for(var id in jQuery.cache){if(jQuery.cache[id].handle){try{jQuery.event.remove(jQuery.cache[id].handle.elem);}catch(e){}}}});}
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true;[0,0].sort(function(){baseHasDuplicate=false;return 0;});var Sizzle=function(selector,context,results,seed){results=results||[];var origContext=context=context||document;if(context.nodeType!==1&&context.nodeType!==9){return[];}
if(!selector||typeof selector!=="string"){return results;}
var parts=[],m,set,checkSet,extra,prune=true,contextXML=isXML(context),soFar=selector;while((chunker.exec(""),m=chunker.exec(soFar))!==null){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break;}}
if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift();}
set=posProcess(selector,set);}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){var ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0];}
if(context){var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,contextXML);}}else{checkSet=parts=[];}}
if(!checkSet){checkSet=set;}
if(!checkSet){Sizzle.error(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context&&context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results);}
return results;};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=context.getElementsByTagName("*");}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.leftMatch[type].exec(expr))!=null&&match[2]){var filter=Expr.filter[type],found,item,left=match[1];anyFound=false;match.splice(1,1);if(left.substr(left.length-1)==="\\"){continue;}
if(curLoop===result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr===old){if(anyFound==null){Sizzle.error(expr);}else{break;}}
old=expr;}
return curLoop;};Sizzle.error=function(msg){throw"Syntax error, unrecognized expression: "+msg;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag){part=part.toLowerCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName.toLowerCase()===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=part.toLowerCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName.toLowerCase()===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=part.toLowerCase();checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=part.toLowerCase();checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").replace(/[\t\n]/g," ").indexOf(match)>=0)){if(!inplace){result.push(elem);}}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){return match[1].toLowerCase();},CHILD:function(match){if(match[1]==="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toLowerCase()==="button";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0===i;},eq:function(elem,i,match){return match[3]-0===i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||getText([elem])||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}}
return true;}else{Sizzle.error("Syntax error, unrecognized expression: "+name);}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while((node=node.previousSibling)){if(node.nodeType===1){return false;}}
if(type==="first"){return true;}
node=elem;case'last':while((node=node.nextSibling)){if(node.nodeType===1){return false;}}
return true;case'nth':var first=match[2],last=match[3];if(first===1&&last===0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first===0){return diff===0;}else{return(diff%first===0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName.toLowerCase()===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,function(all,num){return"\\"+(num-0+1);}));}
var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType;}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(!a.compareDocumentPosition||!b.compareDocumentPosition){if(a==b){hasDuplicate=true;}
return a.compareDocumentPosition?-1:1;}
var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;}
return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){if(!a.sourceIndex||!b.sourceIndex){if(a==b){hasDuplicate=true;}
return a.sourceIndex?-1:1;}
var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;}
return ret;};}else if(document.createRange){sortOrder=function(a,b){if(!a.ownerDocument||!b.ownerDocument){if(a==b){hasDuplicate=true;}
return a.ownerDocument?-1:1;}
var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.setStart(a,0);aRange.setEnd(a,0);bRange.setStart(b,0);bRange.setEnd(b,0);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;}
return ret;};}
function getText(elems){var ret="",elem;for(var i=0;elems[i];i++){elem=elems[i];if(elem.nodeType===3||elem.nodeType===4){ret+=elem.nodeValue;}else if(elem.nodeType!==8){ret+=getText(elem.childNodes);}}
return ret;}
(function(){var form=document.createElement("div"),id="script"+(new Date).getTime();form.innerHTML="<a name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);root=form=null;})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}
div=null;})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}}
return oldSizzle(query,context,extra,seed);};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop];}
div=null;})();}
(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return;}
div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return;}
Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};div=null;})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName.toLowerCase()===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
var contains=document.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16);}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=Sizzle.uniqueSort;jQuery.text=getText;jQuery.isXMLDoc=isXML;jQuery.contains=contains;return;window.Sizzle=Sizzle;})();var runtil=/Until$/,rparentsprev=/^(?:parents|prevUntil|prevAll)/,rmultiselector=/,/,slice=Array.prototype.slice;var winnow=function(elements,qualifier,keep){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)===keep;});}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return(elem===qualifier)===keep;});}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1;});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep);}else{qualifier=jQuery.filter(qualifier,filtered);}}
return jQuery.grep(elements,function(elem,i){return(jQuery.inArray(elem,qualifier)>=0)===keep;});};jQuery.fn.extend({find:function(selector){var ret=this.pushStack("","find",selector),length=0;for(var i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){for(var n=length;n<ret.length;n++){for(var r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break;}}}}}
return ret;},has:function(target){var targets=jQuery(target);return this.filter(function(){for(var i=0,l=targets.length;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector);},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector);},is:function(selector){return!!selector&&jQuery.filter(selector,this).length>0;},closest:function(selectors,context){if(jQuery.isArray(selectors)){var ret=[],cur=this[0],match,matches={},selector;if(cur&&selectors.length){for(var i=0,l=selectors.length;i<l;i++){selector=selectors[i];if(!matches[selector]){matches[selector]=jQuery.expr.match.POS.test(selector)?jQuery(selector,context||this.context):selector;}}
while(cur&&cur.ownerDocument&&cur!==context){for(selector in matches){match=matches[selector];if(match.jquery?match.index(cur)>-1:jQuery(cur).is(match)){ret.push({selector:selector,elem:cur});delete matches[selector];}}
cur=cur.parentNode;}}
return ret;}
var pos=jQuery.expr.match.POS.test(selectors)?jQuery(selectors,context||this.context):null;return this.map(function(i,cur){while(cur&&cur.ownerDocument&&cur!==context){if(pos?pos.index(cur)>-1:jQuery(cur).is(selectors)){return cur;}
cur=cur.parentNode;}
return null;});},index:function(elem){if(!elem||typeof elem==="string"){return jQuery.inArray(this[0],elem?jQuery(elem):this.parent().children());}
return jQuery.inArray(elem.jquery?elem[0]:elem,this);},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context||this.context):jQuery.makeArray(selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all));},andSelf:function(){return this.add(this.prevObject);}});function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return jQuery.dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until;}
if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}
ret=this.length>1?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse();}
return this.pushStack(ret,name,slice.call(arguments).join(","));};});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")";}
return jQuery.find.matches(expr,elems);},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}
cur=cur[dir];}
return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break;}}
return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}
return r;}});var rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/(<([\w:]+)[^>]*?)\/>/g,rselfClosing=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnocache=/<script|<object|<embed|<option|<style/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,fcloseTag=function(all,front,tag){return rselfClosing.test(tag)?all:front+"></"+tag+">";},wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div<div>","</div>"];}
jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);self.text(text.call(this,i,self.text()));});}
if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));}
return jQuery.text(this);},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}
return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem);}});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild);}});},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});}else if(arguments.length){var set=jQuery(arguments[0]);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});}else if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery(arguments[0]).toArray());return set;}},remove:function(selector,keepData){for(var i=0,elem;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem]);}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}}
return this;},empty:function(){for(var i=0,elem;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));}
while(elem.firstChild){elem.removeChild(elem.firstChild);}}
return this;},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML,ownerDocument=this.ownerDocument;if(!html){var div=ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML;}
return jQuery.clean([html.replace(rinlinejQuery,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(rleadingWhitespace,"")],ownerDocument)[0];}else{return this.cloneNode(true);}});if(events===true){cloneCopyEvent(this,ret);cloneCopyEvent(this.find("*"),ret.find("*"));}
return ret;},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null;}else if(typeof value==="string"&&!rnocache.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,fcloseTag);try{for(var i=0,l=this.length;i<l;i++){if(this[i].nodeType===1){jQuery.cleanData(this[i].getElementsByTagName("*"));this[i].innerHTML=value;}}}catch(e){this.empty().append(value);}}else if(jQuery.isFunction(value)){this.each(function(i){var self=jQuery(this),old=self.html();self.empty().append(function(){return value.call(this,i,old);});});}else{this.empty().append(value);}
return this;},replaceWith:function(value){if(this[0]&&this[0].parentNode){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this),old=self.html();self.replaceWith(value.call(this,i,old));});}
if(typeof value!=="string"){value=jQuery(value).detach();}
return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value);}else{jQuery(parent).append(value);}});}else{return this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value);}},detach:function(selector){return this.remove(selector,true);},domManip:function(args,table,callback){var results,first,value=args[0],scripts=[],fragment,parent;if(!jQuery.support.checkClone&&arguments.length===3&&typeof value==="string"&&rchecked.test(value)){return this.each(function(){jQuery(this).domManip(args,table,callback,true);});}
if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);self.domManip(args,table,callback);});}
if(this[0]){parent=value&&value.parentNode;if(jQuery.support.parentNode&&parent&&parent.nodeType===11&&parent.childNodes.length===this.length){results={fragment:parent};}else{results=buildFragment(args,this,scripts);}
fragment=results.fragment;if(fragment.childNodes.length===1){first=fragment=fragment.firstChild;}else{first=fragment.firstChild;}
if(first){table=table&&jQuery.nodeName(first,"tr");for(var i=0,l=this.length;i<l;i++){callback.call(table?root(this[i],first):this[i],i>0||results.cacheable||this.length>1?fragment.cloneNode(true):fragment);}}
if(scripts.length){jQuery.each(scripts,evalScript);}}
return this;function root(elem,cur){return jQuery.nodeName(elem,"table")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}}});function cloneCopyEvent(orig,ret){var i=0;ret.each(function(){if(this.nodeName!==(orig[i]&&orig[i].nodeName)){return;}
var oldData=jQuery.data(orig[i++]),curData=jQuery.data(this,oldData),events=oldData&&oldData.events;if(events){delete curData.handle;curData.events={};for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data);}}}});}
function buildFragment(args,nodes,scripts){var fragment,cacheable,cacheresults,doc=(nodes&&nodes[0]?nodes[0].ownerDocument||nodes[0]:document);if(args.length===1&&typeof args[0]==="string"&&args[0].length<512&&doc===document&&!rnocache.test(args[0])&&(jQuery.support.checkClone||!rchecked.test(args[0]))){cacheable=true;cacheresults=jQuery.fragments[args[0]];if(cacheresults){if(cacheresults!==1){fragment=cacheresults;}}}
if(!fragment){fragment=doc.createDocumentFragment();jQuery.clean(args,doc,fragment,scripts);}
if(cacheable){jQuery.fragments[args[0]]=cacheresults?fragment:1;}
return{fragment:fragment,cacheable:cacheable};}
jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),parent=this.length===1&&this[0].parentNode;if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);return this;}else{for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,insert.selector);}};});jQuery.extend({clean:function(elems,context,fragment,scripts){context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;}
var ret=[];for(var i=0,elem;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+="";}
if(!elem){continue;}
if(typeof elem==="string"&&!rhtml.test(elem)){elem=context.createTextNode(elem);}else if(typeof elem==="string"){elem=elem.replace(rxhtmlTag,fcloseTag);var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild;}
if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j]);}}}
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild);}
elem=div.childNodes;}
if(elem.nodeType){ret.push(elem);}else{ret=jQuery.merge(ret,elem);}}
if(fragment){for(var i=0;ret[i];i++){if(scripts&&jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));}
fragment.appendChild(ret[i]);}}}
return ret;},cleanData:function(elems){var data,id,cache=jQuery.cache,special=jQuery.event.special,deleteExpando=jQuery.support.deleteExpando;for(var i=0,elem;(elem=elems[i])!=null;i++){id=elem[jQuery.expando];if(id){data=cache[id];if(data.events){for(var type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{removeEvent(elem,type,data.handle);}}}
if(deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}
delete cache[id];}}}});var rexclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,ralpha=/alpha\([^)]*\)/,ropacity=/opacity=([^)]*)/,rfloat=/float/i,rdashAlpha=/-([a-z])/ig,rupper=/([A-Z])/g,rnumpx=/^-?\d+(?:px)?$/i,rnum=/^-?\d/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssWidth=["Left","Right"],cssHeight=["Top","Bottom"],getComputedStyle=document.defaultView&&document.defaultView.getComputedStyle,styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat",fcamelCase=function(all,letter){return letter.toUpperCase();};jQuery.fn.css=function(name,value){return access(this,name,value,true,function(elem,name,value){if(value===undefined){return jQuery.curCSS(elem,name);}
if(typeof value==="number"&&!rexclude.test(name)){value+="px";}
jQuery.style(elem,name,value);});};jQuery.extend({style:function(elem,name,value){if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
if((name==="width"||name==="height")&&parseFloat(value)<0){value=undefined;}
var style=elem.style||elem,set=value!==undefined;if(!jQuery.support.opacity&&name==="opacity"){if(set){style.zoom=1;var opacity=parseInt(value,10)+""==="NaN"?"":"alpha(opacity="+value*100+")";var filter=style.filter||jQuery.curCSS(elem,"filter")||"";style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):opacity;}
return style.filter&&style.filter.indexOf("opacity=")>=0?(parseFloat(ropacity.exec(style.filter)[1])/100)+"":"";}
if(rfloat.test(name)){name=styleFloat;}
name=name.replace(rdashAlpha,fcamelCase);if(set){style[name]=value;}
return style[name];},css:function(elem,name,force,extra){if(name==="width"||name==="height"){var val,props=cssShow,which=name==="width"?cssWidth:cssHeight;function getWH(){val=name==="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border"){return;}
jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;}
if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;}});}
if(elem.offsetWidth!==0){getWH();}else{jQuery.swap(elem,props,getWH);}
return Math.max(0,Math.round(val));}
return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style,filter;if(!jQuery.support.opacity&&name==="opacity"&&elem.currentStyle){ret=ropacity.test(elem.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return ret===""?"1":ret;}
if(rfloat.test(name)){name=styleFloat;}
if(!force&&style&&style[name]){ret=style[name];}else if(getComputedStyle){if(rfloat.test(name)){name="float";}
name=name.replace(rupper,"-$1").toLowerCase();var defaultView=elem.ownerDocument.defaultView;if(!defaultView){return null;}
var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle){ret=computedStyle.getPropertyValue(name);}
if(name==="opacity"&&ret===""){ret="1";}}else if(elem.currentStyle){var camelCase=name.replace(rdashAlpha,fcamelCase);ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!rnumpx.test(ret)&&rnum.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=camelCase==="fontSize"?"1em":(ret||0);ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}
return ret;},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(var name in options){elem.style[name]=old[name];}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){var width=elem.offsetWidth,height=elem.offsetHeight,skip=elem.nodeName.toLowerCase()==="tr";return width===0&&height===0&&!skip?true:width>0&&height>0&&!skip?false:jQuery.curCSS(elem,"display")==="none";};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};}
var jsc=now(),rscript=/<script(.|\s)*?\/script>/gi,rselectTextarea=/select|textarea/i,rinput=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,jsre=/=\?(&|$)/,rquery=/\?/,rts=/(\?|&)_=.*?(&|$)/,rurl=/^(\w+:)?\/\/([^\/?#]+)/,r20=/%20/g,_load=jQuery.fn.load;jQuery.fn.extend({load:function(url,params,callback){if(typeof url!=="string"){return _load.call(this,url);}else if(!this.length){return this;}
var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=null;}else if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST";}}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status==="success"||status==="notmodified"){self.html(selector?jQuery("<div />").append(res.responseText.replace(rscript,"")).find(selector):res.responseText);}
if(callback){self.each(callback,[res.responseText,status,res]);}}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data={};}
return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:window.XMLHttpRequest&&(window.location.protocol!=="file:"||!window.ActiveXObject)?function(){return new window.XMLHttpRequest();}:function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(origSettings){var s=jQuery.extend(true,{},jQuery.ajaxSettings,origSettings);var jsonp,status,data,callbackContext=origSettings&&origSettings.context||s,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
if(s.dataType==="jsonp"){if(type==="GET"){if(!jsre.test(s.url)){s.url+=(rquery.test(s.url)?"&":"?")+(s.jsonp||"callback")+"=?";}}else if(!s.data||!jsre.test(s.data)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";}
s.dataType="json";}
if(s.dataType==="json"&&(s.data&&jsre.test(s.data)||jsre.test(s.url))){jsonp=s.jsonpCallback||("jsonp"+jsc++);if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");}
s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=window[jsonp]||function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}
if(head){head.removeChild(script);}};}
if(s.dataType==="script"&&s.cache===null){s.cache=false;}
if(s.cache===false&&type==="GET"){var ts=now();var ret=s.url.replace(rts,"$1_="+ts+"$2");s.url=ret+((ret===s.url)?(rquery.test(s.url)?"&":"?")+"_="+ts:"");}
if(s.data&&type==="GET"){s.url+=(rquery.test(s.url)?"&":"?")+s.data;}
if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart");}
var parts=rurl.exec(s.url),remote=parts&&(parts[1]&&parts[1]!==location.protocol||parts[2]!==location.host);if(s.dataType==="script"&&type==="GET"&&remote){var head=document.getElementsByTagName("head")[0]||document.documentElement;var script=document.createElement("script");script.src=s.url;if(s.scriptCharset){script.charset=s.scriptCharset;}
if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script);}}};}
head.insertBefore(script,head.firstChild);return undefined;}
var requestDone=false;var xhr=s.xhr();if(!xhr){return;}
if(s.username){xhr.open(type,s.url,s.async,s.username,s.password);}else{xhr.open(type,s.url,s.async);}
try{if(s.data||origSettings&&origSettings.contentType){xhr.setRequestHeader("Content-Type",s.contentType);}
if(s.ifModified){if(jQuery.lastModified[s.url]){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]);}
if(jQuery.etag[s.url]){xhr.setRequestHeader("If-None-Match",jQuery.etag[s.url]);}}
if(!remote){xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");}
xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}
if(s.beforeSend&&s.beforeSend.call(callbackContext,xhr,s)===false){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop");}
xhr.abort();return false;}
if(s.global){trigger("ajaxSend",[xhr,s]);}
var onreadystatechange=xhr.onreadystatechange=function(isTimeout){if(!xhr||xhr.readyState===0||isTimeout==="abort"){if(!requestDone){complete();}
requestDone=true;if(xhr){xhr.onreadystatechange=jQuery.noop;}}else if(!requestDone&&xhr&&(xhr.readyState===4||isTimeout==="timeout")){requestDone=true;xhr.onreadystatechange=jQuery.noop;status=isTimeout==="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";var errMsg;if(status==="success"){try{data=jQuery.httpData(xhr,s.dataType,s);}catch(err){status="parsererror";errMsg=err;}}
if(status==="success"||status==="notmodified"){if(!jsonp){success();}}else{jQuery.handleError(s,xhr,status,errMsg);}
complete();if(isTimeout==="timeout"){xhr.abort();}
if(s.async){xhr=null;}}};try{var oldAbort=xhr.abort;xhr.abort=function(){if(xhr){oldAbort.call(xhr);}
onreadystatechange("abort");};}catch(e){}
if(s.async&&s.timeout>0){setTimeout(function(){if(xhr&&!requestDone){onreadystatechange("timeout");}},s.timeout);}
try{xhr.send(type==="POST"||type==="PUT"||type==="DELETE"?s.data:null);}catch(e){jQuery.handleError(s,xhr,null,e);complete();}
if(!s.async){onreadystatechange();}
function success(){if(s.success){s.success.call(callbackContext,data,status,xhr);}
if(s.global){trigger("ajaxSuccess",[xhr,s]);}}
function complete(){if(s.complete){s.complete.call(callbackContext,xhr,status);}
if(s.global){trigger("ajaxComplete",[xhr,s]);}
if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop");}}
function trigger(type,args){(s.context?jQuery(s.context):jQuery.event).trigger(type,args);}
return xhr;},handleError:function(s,xhr,status,e){if(s.error){s.error.call(s.context||s,xhr,status,e);}
if(s.global){(s.context?jQuery(s.context):jQuery.event).trigger("ajaxError",[xhr,s,e]);}},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol==="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status===304||xhr.status===1223||xhr.status===0;}catch(e){}
return false;},httpNotModified:function(xhr,url){var lastModified=xhr.getResponseHeader("Last-Modified"),etag=xhr.getResponseHeader("Etag");if(lastModified){jQuery.lastModified[url]=lastModified;}
if(etag){jQuery.etag[url]=etag;}
return xhr.status===304||xhr.status===0;},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml=type==="xml"||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.nodeName==="parsererror"){jQuery.error("parsererror");}
if(s&&s.dataFilter){data=s.dataFilter(data,type);}
if(typeof data==="string"){if(type==="json"||!type&&ct.indexOf("json")>=0){data=jQuery.parseJSON(data);}else if(type==="script"||!type&&ct.indexOf("javascript")>=0){jQuery.globalEval(data);}}
return data;},param:function(a,traditional){var s=[];if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional;}
if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value);});}else{for(var prefix in a){buildParams(prefix,a[prefix]);}}
return s.join("&").replace(r20,"+");function buildParams(prefix,obj){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||/\[\]$/.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v);}});}else if(!traditional&&obj!=null&&typeof obj==="object"){jQuery.each(obj,function(k,v){buildParams(prefix+"["+k+"]",v);});}else{add(prefix,obj);}}
function add(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);}}});var elemdisplay={},rfxtypes=/toggle|show|hide/,rfxnum=/^([+-]=)?([\d+-.]+)(.*)$/,timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];jQuery.fn.extend({show:function(speed,callback){if(speed||speed===0){return this.animate(genFx("show",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var nodeName=this[i].nodeName,display;if(elemdisplay[nodeName]){display=elemdisplay[nodeName];}else{var elem=jQuery("<"+nodeName+" />").appendTo("body");display=elem.css("display");if(display==="none"){display="block";}
elem.remove();elemdisplay[nodeName]=display;}
jQuery.data(this[i],"olddisplay",display);}}
for(var j=0,k=this.length;j<k;j++){this[j].style.display=jQuery.data(this[j],"olddisplay")||"";}
return this;}},hide:function(speed,callback){if(speed||speed===0){return this.animate(genFx("hide",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"));}}
for(var j=0,k=this.length;j<k;j++){this[j].style.display="none";}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";if(jQuery.isFunction(fn)&&jQuery.isFunction(fn2)){this._toggle.apply(this,arguments);}else if(fn==null||bool){this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();});}else{this.animate(genFx("toggle",3),fn,fn2);}
return this;},fadeTo:function(speed,to,callback){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);if(jQuery.isEmptyObject(prop)){return this.each(optall.complete);}
return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType===1&&jQuery(this).is(":hidden"),self=this;for(p in prop){var name=p.replace(rdashAlpha,fcamelCase);if(p!==name){prop[name]=prop[p];delete prop[p];p=name;}
if(prop[p]==="hide"&&hidden||prop[p]==="show"&&!hidden){return opt.complete.call(this);}
if((p==="height"||p==="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}
if(jQuery.isArray(prop[p])){(opt.specialEasing=opt.specialEasing||{})[p]=prop[p][1];prop[p]=prop[p][0];}}
if(opt.overflow!=null){this.style.overflow="hidden";}
opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(rfxtypes.test(val)){e[val==="toggle"?hidden?"show":"hide":val](prop);}else{var parts=rfxnum.exec(val),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!=="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}
if(parts[1]){end=((parts[1]==="-="?-1:1)*end)+start;}
e.custom(start,end,unit);}else{e.custom(start,val,"");}}});return true;});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue){this.queue([]);}
this.each(function(){for(var i=timers.length-1;i>=0;i--){if(timers[i].elem===this){if(gotoEnd){timers[i](true);}
timers.splice(i,1);}}});if(!gotoEnd){this.dequeue();}
return this;}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue();}
if(jQuery.isFunction(opt.old)){opt.old.call(this);}};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig){options.orig={};}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this);}
(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block";}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop];}
var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(jQuery.fx.tick,13);}},show:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now(),done=true;if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false;}}
if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var old=jQuery.data(this.elem,"olddisplay");this.elem.style.display=old?old:this.options.display;if(jQuery.css(this.elem,"display")==="none"){this.elem.style.display="block";}}
if(this.options.hide){jQuery(this.elem).hide();}
if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.style(this.elem,p,this.options.orig[p]);}}
this.options.complete.call(this.elem);}
return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;var specialEasing=this.options.specialEasing&&this.options.specialEasing[this.prop];var defaultEasing=this.options.easing||(jQuery.easing.swing?"swing":"linear");this.pos=jQuery.easing[specialEasing||defaultEasing](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}
return true;}};jQuery.extend(jQuery.fx,{tick:function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++){if(!timers[i]()){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}},stop:function(){clearInterval(timerId);timerId=null;},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.style(fx.elem,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=(fx.prop==="width"||fx.prop==="height"?Math.max(0,fx.now):fx.now)+fx.unit;}else{fx.elem[fx.prop]=fx.now;}}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};}
function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
if("getBoundingClientRect"in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
var box=elem.getBoundingClientRect(),doc=elem.ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left};};}else{jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
jQuery.offset.initialize();var offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){break;}
computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevOffsetParent=offsetParent,offsetParent=elem.offsetParent;}
if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft;}
if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft);}
return{top:top,left:left};};}
jQuery.offset={initialize:function(){var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,bodyMarginTop=parseFloat(jQuery.curCSS(body,"marginTop",true))||0,html="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";jQuery.extend(container.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild;checkDiv=innerDiv.firstChild;td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);checkDiv.style.position="fixed",checkDiv.style.top="20px";this.supportsFixedPosition=(checkDiv.offsetTop===20||checkDiv.offsetTop===15);checkDiv.style.position=checkDiv.style.top="";innerDiv.style.overflow="hidden",innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==bodyMarginTop);body.removeChild(container);body=container=innerDiv=checkDiv=table=td=null;jQuery.offset.initialize=jQuery.noop;},bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;jQuery.offset.initialize();if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.curCSS(body,"marginTop",true))||0;left+=parseFloat(jQuery.curCSS(body,"marginLeft",true))||0;}
return{top:top,left:left};},setOffset:function(elem,options,i){if(/static/.test(jQuery.curCSS(elem,"position"))){elem.style.position="relative";}
var curElem=jQuery(elem),curOffset=curElem.offset(),curTop=parseInt(jQuery.curCSS(elem,"top",true),10)||0,curLeft=parseInt(jQuery.curCSS(elem,"left",true),10)||0;if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset);}
var props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({position:function(){if(!this[0]){return null;}
var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.curCSS(elem,"marginTop",true))||0;offset.left-=parseFloat(jQuery.curCSS(elem,"marginLeft",true))||0;parentOffset.top+=parseFloat(jQuery.curCSS(offsetParent[0],"borderTopWidth",true))||0;parentOffset.left+=parseFloat(jQuery.curCSS(offsetParent[0],"borderLeftWidth",true))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent;}
return offsetParent;});}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem=this[0],win;if(!elem){return null;}
if(val!==undefined){return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop());}else{this[method]=val;}});}else{win=getWindow(elem);return win?("pageXOffset"in win)?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method];}};});function getWindow(elem){return("scrollTo"in elem&&elem.document)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}
jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],type,false,"padding"):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],type,false,margin?"margin":"border"):null;};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this;}
if(jQuery.isFunction(size)){return this.each(function(i){var self=jQuery(this);self[type](size.call(this,i,self[type]()));});}
return("scrollTo"in elem&&elem.document)?elem.document.compatMode==="CSS1Compat"&&elem.document.documentElement["client"+name]||elem.document.body["client"+name]:(elem.nodeType===9)?Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name]):size===undefined?jQuery.css(elem,type):this.css(type,typeof size==="string"?size:size+"px");};});window.jQuery=window.$=jQuery;})(window);(function(c){function p(d,a,b){var e=this,l=d.add(this),h=d.find(b.tabs),j=a.jquery?a:d.children(a),i;h.length||(h=d.children());j.length||(j=d.parent().find(a));j.length||(j=c(a));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(b.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(i>=0)return e;f=b.initialIndex;k=h.eq(f)}if(f===i)return e;g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[b.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});i=f;h.removeClass(b.current);k.addClass(b.current);return e}},getConf:function(){return b},getTabs:function(){return h},getPanes:function(){return j},getCurrentPane:function(){return j.eq(i)},getCurrentTab:function(){return h.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-1)}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(b[g])&&c(e).bind(g,b[g]);e[g]=function(k){c(e).bind(g,k);return e}});if(b.history&&c.fn.history){c.tools.history.init(h);b.event="history"}h.each(function(f){c(this).bind(b.event,function(g){e.click(f,g);return g.preventDefault()})});j.find("a[href^=#]").click(function(f){e.click(c(this).attr("href"),f)});if(location.hash)e.click(location.hash);else if(b.initialIndex===0||b.initialIndex>0)e.click(b.initialIndex)}c.tools=c.tools||{version:"1.2.2"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,a){o[d]=a}};var o={"default":function(d,a){this.getPanes().hide().eq(d).show();a.call()},fade:function(d,a){var b=this.getConf(),e=b.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(b.fadeInSpeed,a)},slide:function(d,a){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,a)},ajax:function(d,a){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),a)}},m;c.tools.tabs.addEffect("horizontal",function(d,a){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();a.call()})});c.fn.tabs=function(d,a){var b=this.data("tabs");if(b)return b;if(c.isFunction(a))a={onBeforeClick:a};a=c.extend({},c.tools.tabs.conf,a);this.each(function(){b=new p(c(this),d,a);c(this).data("tabs",b)});return a.api?b:this}})(jQuery);(function(d){function r(g,a){function p(f){var e=d(f);return e.length<2?e:g.parent().find(f)}var c=this,j=g.add(this),b=g.data("tabs"),h,l,m,n=false,o=p(a.next).click(function(){b.next()}),k=p(a.prev).click(function(){b.prev()});d.extend(c,{getTabs:function(){return b},getConf:function(){return a},play:function(){if(!h){var f=d.Event("onBeforePlay");j.trigger(f);if(f.isDefaultPrevented())return c;n=false;h=setInterval(b.next,a.interval);j.trigger("onPlay");b.next()}},pause:function(){if(!h)return c;var f=d.Event("onBeforePause");j.trigger(f);if(f.isDefaultPrevented())return c;h=clearInterval(h);m=clearInterval(m);j.trigger("onPause")},stop:function(){c.pause();n=true}});d.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","),function(f,e){d.isFunction(a[e])&&c.bind(e,a[e]);c[e]=function(s){return c.bind(e,s)}});if(a.autopause){var t=b.getTabs().add(o).add(k).add(b.getPanes());t.hover(function(){c.pause();l=clearInterval(l)},function(){n||(l=setTimeout(c.play,a.interval))})}if(a.autoplay)m=setTimeout(c.play,a.interval);else c.stop();a.clickable&&b.getPanes().click(function(){b.next()});if(!b.getConf().rotate){var i=a.disabledClass;b.getIndex()||k.addClass(i);b.onBeforeClick(function(f,e){if(e){k.removeClass(i);e==b.getTabs().length-1?o.addClass(i):o.removeClass(i)}else k.addClass(i)})}}var q;q=d.tools.tabs.slideshow={conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:false,autopause:true,interval:3E3,clickable:true,api:false}};d.fn.slideshow=function(g){var a=this.data("slideshow");if(a)return a;g=d.extend({},q.conf,g);this.each(function(){a=new r(d(this),g);d(this).data("slideshow",a)});return g.api?a:this}})(jQuery);(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,e=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];e+=a.outerWidth()+c.offset[1];var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")e-=a/2;if(i=="left")e-=a;return{top:h,left:e}}function t(a,b){var c=this,h=a.add(c),e,i=0,j=0,m=a.attr("title"),q=n[b.effect],k,r=a.is(":input"),u=r&&a.is(":checkbox, :radio, select, :button"),s=a.attr("type"),l=b.events[s]||b.events[r?u?"widget":"input":"def"];if(!q)throw'Nonexistent effect "'+b.effect+'"';l=l.split(/,\s*/);if(l.length!=2)throw"Tooltip: bad events configuration for "+s;a.bind(l[0],function(d){if(b.predelay){clearTimeout(i);j=setTimeout(function(){c.show(d)},b.predelay)}else c.show(d)}).bind(l[1],function(d){if(b.delay){clearTimeout(j);i=setTimeout(function(){c.hide(d)},b.delay)}else c.hide(d)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(d){if(!e){if(m)e=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else if(b.tip)e=f(b.tip).eq(0);else{e=a.next();e.length||(e=a.parent().next())}if(!e.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;e.stop(true,true);var g=p(a,e,b);d=d||f.Event();d.type="onBeforeShow";h.trigger(d,[g]);if(d.isDefaultPrevented())return c;g=p(a,e,b);e.css({position:"absolute",top:g.top,left:g.left});k=true;q[0].call(c,function(){d.type="onShow";k="full";h.trigger(d)});g=b.events.tooltip.split(/,\s*/);e.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&e.bind(g[1],function(o){o.relatedTarget!=a[0]&&a.trigger(l[1].split(" ")[0])});return c},hide:function(d){if(!e||!c.isShown())return c;d=d||f.Event();d.type="onBeforeHide";h.trigger(d);if(!d.isDefaultPrevented()){k=false;n[b.effect][1].call(c,function(){d.type="onHide";k=false;h.trigger(d)});return c}},isShown:function(d){return d?k=="full":k},getConf:function(){return b},getTip:function(){return e},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(d,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(o){f(c).bind(g,o);return c}})}f.tools=f.tools||{version:"1.2.2"};f.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){n[a]=[b,c]}};var n={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new t(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);(function(e){function n(f,c){var a=e(c);return a.length<2?a:f.parent().find(c)}function t(f,c){var a=this,l=f.add(a),g=f.children(),k=0,m=c.vertical;j||(j=a);if(g.length>1)g=e(c.items,f);e.extend(a,{getConf:function(){return c},getIndex:function(){return k},getSize:function(){return a.getItems().size()},getNaviButtons:function(){return o.add(p)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(b,d){return a.seekTo(k+
b,d)},next:function(b){return a.move(1,b)},prev:function(b){return a.move(-1,b)},begin:function(b){return a.seekTo(0,b)},end:function(b){return a.seekTo(a.getSize()-1,b)},focus:function(){return j=a},addItem:function(b){b=e(b);if(c.circular){e(".cloned:last").before(b);e(".cloned:first").replaceWith(b.clone().addClass(c.clonedClass))}else g.append(b);l.trigger("onAddItem",[b]);return a},seekTo:function(b,d,h){if(c.circular&&b===0&&k==-1&&d!==0)return a;if(!c.circular&&b<0||b>a.getSize()||b<-1)return a;var i=b;if(b.jquery)b=a.getItems().index(b);else i=a.getItems().eq(b);var q=e.Event("onBeforeSeek");if(!h){l.trigger(q,[b,d]);if(q.isDefaultPrevented()||!i.length)return a}i=m?{top:-i.position().top}:{left:-i.position().left};k=b;j=a;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){l.trigger("onSeek",[b])});return a}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(b,d){e.isFunction(c[d])&&e(a).bind(d,c[d]);a[d]=function(h){e(a).bind(d,h);return a}});if(c.circular){var r=a.getItems().slice(-1).clone().prependTo(g),s=a.getItems().eq(1).clone().appendTo(g);r.add(s).addClass(c.clonedClass);a.onBeforeSeek(function(b,d,h){if(!b.isDefaultPrevented())if(d==-1){a.seekTo(r,h,function(){a.end(0)});return b.preventDefault()}else d==a.getSize()&&a.seekTo(s,h,function(){a.begin(0)})});a.seekTo(0,0)}var o=n(f,c.prev).click(function(){a.prev()}),p=n(f,c.next).click(function(){a.next()});!c.circular&&a.getSize()>1&&a.onBeforeSeek(function(b,d){o.toggleClass(c.disabledClass,d<=0);p.toggleClass(c.disabledClass,d>=a.getSize()-
1)});c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(b,d){if(c.mousewheel){a.move(d<0?1:-1,c.wheelSpeed||50);return false}});c.keyboard&&e(document).bind("keydown.scrollable",function(b){if(!(!c.keyboard||b.altKey||b.ctrlKey||e(b.target).is(":input")))if(!(c.keyboard!="static"&&j!=a)){var d=b.keyCode;if(m&&(d==38||d==40)){a.move(d==38?-1:1);return b.preventDefault()}if(!m&&(d==37||d==39)){a.move(d==37?-1:1);return b.preventDefault()}}});e(a).trigger("onBeforeSeek",[c.initialIndex])}e.tools=e.tools||{version:"1.2.2"};e.tools.scrollable={conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,wheelSpeed:0}};var j;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},e.tools.scrollable.conf,f);this.each(function(){c=new t(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);(function(c){var g=c.tools.scrollable;g.autoscroll={conf:{autoplay:true,interval:3E3,autopause:true}};c.fn.autoscroll=function(d){if(typeof d=="number")d={interval:d};var b=c.extend({},g.autoscroll.conf,d),h;this.each(function(){var a=c(this).data("scrollable");if(a)h=a;var e,i,f=true;a.play=function(){if(!e){f=false;e=setInterval(function(){a.next()},b.interval);a.next()}};a.pause=function(){e=clearInterval(e)};a.stop=function(){a.pause();f=true};b.autopause&&a.getRoot().add(a.getNaviButtons()).hover(function(){a.pause();clearInterval(i)},function(){f||(i=setTimeout(a.play,b.interval))});b.autoplay&&setTimeout(a.play,b.interval)});return b.api?h:this}})(jQuery);(function(d){function p(c,g){var h=d(g);return h.length<2?h:c.parent().find(g)}var m=d.tools.scrollable;m.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:false,idPrefix:null,history:false}};d.fn.navigator=function(c){if(typeof c=="string")c={navi:c};c=d.extend({},m.navigator.conf,c);var g;this.each(function(){function h(a,b,i){e.seekTo(b);if(j){if(location.hash)location.hash=a.attr("href").replace("#","")}else return i.preventDefault()}function f(){return k.find(c.naviItem||"> *")}function n(a){var b=d("<"+(c.naviItem||"a")+"/>").click(function(i){h(d(this),a,i)}).attr("href","#"+a);a===0&&b.addClass(l);c.indexed&&b.text(a+1);c.idPrefix&&b.attr("id",c.idPrefix+a);return b.appendTo(k)}function o(a,b){a=f().eq(b.replace("#",""));a.length||(a=f().filter("[href="+b+"]"));a.click()}var e=d(this).data("scrollable"),k=p(e.getRoot(),c.navi),q=e.getNaviButtons(),l=c.activeClass,j=c.history&&d.fn.history;if(e)g=e;e.getNaviButtons=function(){return q.add(k)};f().length?f().each(function(a){d(this).click(function(b){h(d(this),a,b)})}):d.each(e.getItems(),function(a){n(a)});e.onBeforeSeek(function(a,b){var i=f().eq(b);!a.isDefaultPrevented()&&i.length&&f().removeClass(l).eq(b).addClass(l)});e.onAddItem(function(a,b){b=n(e.getItems().index(b));j&&b.history(o)});j&&f().history(o)});return c.api?g:this}})(jQuery);(function(a){function t(d,b){var c=this,i=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";i.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var j=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof j=="string")j=j=="center"?Math.max((o.height()-v)/2,0):parseInt(j,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:j,left:r},function(){if(m){e.type="onLoad";i.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";i.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";i.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(j){a(c).bind(h,j);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<div class="close"></div>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.2"};a.tools.overlay={addEffect:function(d,b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),i=a(window);if(!c.fixed){d.top+=i.scrollTop();d.left+=i.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);(function(i){function j(b){var d=b.offset();return{top:d.top+b.height()/2,left:d.left+b.width()/2}}var k=i.tools.overlay,f=i(window);i.extend(k.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function n(b,d){var a=this.getOverlay(),c=this.getConf(),g=this.getTrigger(),o=this,l=a.outerWidth({margin:true}),h=a.data("img");if(!h){var e=a.css("backgroundImage");if(!e)throw"background-image CSS property not set for overlay";e=e.slice(e.indexOf("(")+1,e.indexOf(")")).replace(/\"/g,"");a.css("backgroundImage","none");h=i('<img src="'+e+'"/>');h.css({border:0,display:"none"}).width(l);i("body").append(h);a.data("img",h)}e=c.start.top||Math.round(f.height()/2);var m=c.start.left||Math.round(f.width()/2);if(g){g=j(g);e=g.top;m=g.left}h.css({position:"absolute",top:e,left:m,width:0,zIndex:c.zIndex}).show();b.top+=f.scrollTop();b.left+=f.scrollLeft();b.position="absolute";a.css(b);h.animate({top:a.css("top"),left:a.css("left"),width:l},c.speed,function(){if(c.fixed){b.top-=f.scrollTop();b.left-=f.scrollLeft();b.position="fixed";h.add(a).css(b)}a.css("zIndex",c.zIndex+1).fadeIn(c.fadeInSpeed,function(){o.isOpened()&&!i(this).index(a)?d.call():a.hide()})})}function p(b){var d=this.getOverlay().hide(),a=this.getConf(),c=this.getTrigger();d=d.data("img");var g={top:a.start.top,left:a.start.left,width:0};c&&i.extend(g,j(c));a.fixed&&d.css({position:"absolute"}).animate({top:"+="+f.scrollTop(),left:"+="+f.scrollLeft()},0);d.animate(g,a.closeSpeed,b)}k.addEffect("apple",n,p)})(jQuery);(function(d){function R(b,c){return 32-(new Date(b,c,32)).getDate()}function S(b,c){b=""+b;for(c=c||2;b.length<c;)b="0"+b;return b}function T(b,c,j){var m=b.getDate(),h=b.getDay(),t=b.getMonth();b=b.getFullYear();var f={d:m,dd:S(m),ddd:B[j].shortDays[h],dddd:B[j].days[h],m:t+1,mm:S(t+1),mmm:B[j].shortMonths[t],mmmm:B[j].months[t],yy:String(b).slice(2),yyyy:b};c=c.replace(X,function(o){return o in f?f[o]:o.slice(1,o.length-1)});return Y.html(c).html()}function y(b){return parseInt(b,10)}function U(b,c){return b.getYear()===c.getYear()&&b.getMonth()==c.getMonth()&&b.getDate()==c.getDate()}function C(b){if(b){if(b.constructor==Date)return b;if(typeof b=="string"){var c=b.split("-");if(c.length==3)return new Date(y(c[0]),y(c[1])-1,y(c[2]));if(!/^-?\d+$/.test(b))return;b=y(b)}c=new Date;c.setDate(c.getDate()+b);return c}}function Z(b,c){function j(a,e,g){l=a;D=a.getFullYear();E=a.getMonth();G=a.getDate();g=g||d.Event("api");g.type="change";H.trigger(g,[a]);if(!g.isDefaultPrevented()){b.val(T(a,e.format,e.lang));b.data("date",a);h.hide(g)}}function m(a){a.type="onShow";H.trigger(a);d(document).bind("keydown.d",function(e){var g=e.keyCode;if(g==8){b.val("");return h.hide(e)}if(g==27)return h.hide(e);if(d(V).index(g)>=0){if(!u){h.show(e);return e.preventDefault()}var i=d("#"+f.weeks+" a"),p=d("."+f.focus),q=i.index(p);p.removeClass(f.focus);if(g==74||g==40)q+=7;else if(g==75||g==38)q-=7;else if(g==76||g==39)q+=1;else if(g==72||g==37)q-=1;if(q==-1){h.addMonth(-1);p=d("#"+f.weeks+" a:last")}else if(q==35){h.addMonth();p=d("#"+f.weeks+" a:first")}else p=i.eq(q);p.addClass(f.focus);return e.preventDefault()}if(g==34)return h.addMonth();if(g==33)return h.addMonth(-1);if(g==36)return h.today();if(g==13)d(e.target).is("select")||d("."+f.focus).click();return d([16,17,18,9]).index(g)>=0});d(document).bind("click.d",function(e){var g=e.target;if(!d(g).parents("#"+f.root).length&&g!=b[0]&&(!K||g!=K[0]))h.hide(e)})}var h=this,t=new Date,f=c.css,o=B[c.lang],k=d("#"+f.root),L=k.find("#"+f.title),K,I,J,D,E,G,l=b.attr("data-value")||c.value||b.val(),r=b.attr("min")||c.min,s=b.attr("max")||c.max,u;l=C(l)||t;r=C(r||c.yearRange[0]*365);s=C(s||c.yearRange[1]*365);if(!o)throw"Dateinput: invalid language: "+c.lang;if(b.attr("type")=="date"){var M=d("<input/>");d.each("name,readonly,disabled,value,required".split(","),function(a,e){M.attr(e,b.attr(e))});b.replaceWith(M);b=M}b.addClass(f.input);var H=b.add(h);if(!k.length){k=d("<div><div><a/><div/><a/></div><div><div/><div/></div></div>").hide().css({position:"absolute"}).attr("id",f.root);k.children().eq(0).attr("id",f.head).end().eq(1).attr("id",f.body).children().eq(0).attr("id",f.days).end().eq(1).attr("id",f.weeks).end().end().end().find("a").eq(0).attr("id",f.prev).end().eq(1).attr("id",f.next);L=k.find("#"+f.head).find("div").attr("id",f.title);if(c.selectors){var z=d("<select/>").attr("id",f.month),A=d("<select/>").attr("id",f.year);L.append(z.add(A))}for(var $=k.find("#"+f.days),N=0;N<7;N++)$.append(d("<span/>").text(o.shortDays[(N+c.firstDay)%7]));b.after(k)}if(c.trigger)K=d("<a/>").attr("href","#").addClass(f.trigger).click(function(a){h.show();return a.preventDefault()}).insertAfter(b);var O=k.find("#"+f.weeks);A=k.find("#"+f.year);z=k.find("#"+f.month);d.extend(h,{show:function(a){if(!(b.is("[readonly]")||u)){a=a||d.Event();a.type="onBeforeShow";H.trigger(a);if(!a.isDefaultPrevented()){d.each(W,function(){this.hide()});u=true;z.unbind("change").change(function(){h.setValue(A.val(),d(this).val())});A.unbind("change").change(function(){h.setValue(d(this).val(),z.val())});I=k.find("#"+f.prev).unbind("click").click(function(){I.hasClass(f.disabled)||h.addMonth(-1);return false});J=k.find("#"+f.next).unbind("click").click(function(){J.hasClass(f.disabled)||h.addMonth();return false});h.setValue(l);var e=b.position();k.css({top:e.top+b.outerHeight({margins:true})+c.offset[0],left:e.left+c.offset[1]});if(c.speed)k.show(c.speed,function(){m(a)});else{k.show();m(a)}return h}}},setValue:function(a,e,g){var i;if(parseInt(e,10)>=-1){a=y(a);e=y(e);g=y(g);i=new Date(a,e,g)}else{i=a||l;a=i.getYear()+1900;e=i.getMonth();g=i.getDate()}if(e==-1){e=11;a--}else if(e==12){e=0;a++}if(!u){j(i,c);return h}E=e;D=a;i=new Date(a,e,1-c.firstDay);g=i.getDay();var p=R(a,e),q=R(a,e-1),P;if(c.selectors){z.empty();d.each(o.months,function(v,F){r<new Date(a,v+1,-1)&&s>new Date(a,v,0)&&z.append(d("<option/>").html(F).attr("value",v))});A.empty();for(i=a+c.yearRange[0];i<a+c.yearRange[1];i++)r<new Date(i+1,-1,0)&&s>new Date(i,0,0)&&A.append(d("<option/>").text(i));z.val(e);A.val(a)}else L.html(o.months[e]+" "+a);O.empty();I.add(J).removeClass(f.disabled);for(var w=0,n,x;w<42;w++){n=d("<a/>");if(w%7===0){P=d("<div/>").addClass(f.week);O.append(P)}if(w<g){n.addClass(f.off);x=q-g+w+1;i=new Date(a,e-1,x)}else if(w>=g+p){n.addClass(f.off);x=w-p-g+1;i=new Date(a,e+1,x)}else{x=w-g+1;i=new Date(a,e,x);if(U(l,i))n.attr("id",f.current).addClass(f.focus);else U(t,i)&&n.attr("id",f.today)}r&&i<r&&n.add(I).addClass(f.disabled);s&&i>s&&n.add(J).addClass(f.disabled);n.attr("href","#"+x).text(x).data("date",i);P.append(n);n.click(function(v){var F=d(this);if(!F.hasClass(f.disabled)){d("#"+f.current).removeAttr("id");F.attr("id",f.current);j(F.data("date"),c,v)}return false})}f.sunday&&O.find(f.week).each(function(){var v=c.firstDay?7-c.firstDay:0;d(this).children().slice(v,v+1).addClass(f.sunday)});return h},setMin:function(a,e){r=C(a);e&&l<r&&h.setValue(r);return h},setMax:function(a,e){s=C(a);e&&l>s&&h.setValue(s);return h},today:function(){return h.setValue(t)},addDay:function(a){return this.setValue(D,E,G+(a||1))},addMonth:function(a){return this.setValue(D,E+(a||1),G)},addYear:function(a){return this.setValue(D+(a||1),E,G)},hide:function(a){if(u){a=a||d.Event();a.type="onHide";H.trigger(a);d(document).unbind("click.d").unbind("keydown.d");if(a.isDefaultPrevented())return;k.hide();u=false}return h},getConf:function(){return c},getInput:function(){return b},getCalendar:function(){return k},getValue:function(a){return a?T(l,a,c.lang):l},isOpen:function(){return u}});d.each(["onBeforeShow","onShow","change","onHide"],function(a,e){d.isFunction(c[e])&&d(h).bind(e,c[e]);h[e]=function(g){d(h).bind(e,g);return h}});b.bind("focus click",h.show).keydown(function(a){var e=a.keyCode;if(!u&&d(V).index(e)>=0){h.show(a);return a.preventDefault()}return a.shiftKey||a.ctrlKey||a.altKey||e==9?true:a.preventDefault()});C(b.val())&&j(l,c)}d.tools=d.tools||{version:"1.2.2"};var W=[],Q,V=[75,76,38,39,74,72,40,37],B={};Q=d.tools.dateinput={conf:{format:"mm/dd/yy",selectors:false,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:0,max:0,trigger:false,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},localize:function(b,c){d.each(c,function(j,m){c[j]=m.split(",")});B[b]=c}};Q.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var X=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,Y=d("<a/>");d.expr[":"].date=function(b){var c=b.getAttribute("type");return c&&c=="date"||!!d(b).data("dateinput")};d.fn.dateinput=function(b){if(this.data("dateinput"))return this;b=d.extend({},Q.conf,b);d.each(b.css,function(j,m){if(!m&&j!="prefix")b.css[j]=(b.css.prefix||"")+(m||j)});var c;this.each(function(){var j=new Z(d(this),b);W.push(j);j=j.getInput().data("dateinput",j);c=c?c.add(j):j});return c?c:this}})(jQuery);(function(e){function F(d,a){a=Math.pow(10,a);return Math.round(d*a)/a}function p(d,a){if(a=parseInt(d.css(a),10))return a;return(d=d[0].currentStyle)&&d.width&&parseInt(d.width,10)}function C(d){return(d=d.data("events"))&&d.onSlide}function G(d,a){function h(c,b,f,j){if(f===undefined)f=b/k*z;else if(j)f-=a.min;if(r)f=Math.round(f/r)*r;if(b===undefined||r)b=f*k/z;if(isNaN(f))return g;b=Math.max(0,Math.min(b,k));f=b/k*z;if(j||!n)f+=a.min;if(n)if(j)b=k-b;else f=a.max-f;f=F(f,t);var q=c.type=="click";if(D&&l!==undefined&&!q){c.type="onSlide";A.trigger(c,[f,b]);if(c.isDefaultPrevented())return g}j=q?a.speed:0;q=q?function(){c.type="change";A.trigger(c,[f])}:null;if(n){m.animate({top:b},j,q);a.progress&&B.animate({height:k-b+m.width()/2},j)}else{m.animate({left:b},j,q);a.progress&&B.animate({width:b+m.width()/2},j)}l=f;H=b;d.val(f);return g}function s(){if(n=a.vertical||p(i,"height")>p(i,"width")){k=p(i,"height")-p(m,"height");u=i.offset().top+k}else{k=p(i,"width")-p(m,"width");u=i.offset().left}}
function v(){s();g.setValue(a.value||a.min)}var g=this,o=a.css,i=e("<div><div/><a href='#'/></div>").data("rangeinput",g),n,l,u,k,H;d.before(i);var m=i.addClass(o.slider).find("a").addClass(o.handle),B=i.find("div").addClass(o.progress);e.each("min,max,step,value".split(","),function(c,b){c=d.attr(b);if(parseFloat(c))a[b]=parseFloat(c,10)});var z=a.max-a.min,r=a.step=="any"?0:a.step,t=a.precision;if(t===undefined)try{t=r.toString().split(".")[1].length}catch(I){t=0}if(d.attr("type")=="range"){var w=e("<input/>");e.each("name,readonly,disabled,required".split(","),function(c,b){w.attr(b,d.attr(b))});w.val(a.value);d.replaceWith(w);d=w}d.addClass(o.input);var A=e(g).add(d),D=true;e.extend(g,{getValue:function(){return l},setValue:function(c,b){return h(b||e.Event("api"),undefined,c,true)},getConf:function(){return a},getProgress:function(){return B},getHandle:function(){return m},getInput:function(){return d},step:function(c,b){b=b||e.Event();var f=a.step=="any"?1:a.step;g.setValue(l+f*(c||1),b)},stepUp:function(c){return g.step(c||1)},stepDown:function(c){return g.step(-c||-1)}});e.each("onSlide,change".split(","),function(c,b){e.isFunction(a[b])&&e(g).bind(b,a[b]);g[b]=function(f){e(g).bind(b,f);return g}});m.drag({drag:false}).bind("dragStart",function(){D=C(e(g))||C(d)}).bind("drag",function(c,b,f){if(d.is(":disabled"))return false;h(c,n?b:f)}).bind("dragEnd",function(c){if(!c.isDefaultPrevented()){c.type="change";A.trigger(c,[l])}}).click(function(c){return c.preventDefault()});i.click(function(c){if(d.is(":disabled")||c.target==m[0])return c.preventDefault();s();var b=m.width()/2;h(c,n?k-u-b+c.pageY:c.pageX-u-b)});a.keyboard&&d.keydown(function(c){if(!d.attr("readonly")){var b=c.keyCode,f=e([75,76,38,33,39]).index(b)!=-1,j=e([74,72,40,34,37]).index(b)!=-1;if((f||j)&&!(c.shiftKey||c.altKey||c.ctrlKey)){if(f)g.step(b==33?10:1,c);else if(j)g.step(b==34?-10:-1,c);return c.preventDefault()}}});d.blur(function(c){var b=e(this).val();b!==l&&g.setValue(b,c)});e.extend(d[0],{stepUp:g.stepUp,stepDown:g.stepDown});v();k||e(window).load(v)}e.tools=e.tools||{version:"1.2.2"};var E;E=e.tools.rangeinput={conf:{min:0,max:100,step:"any",steps:0,value:0,precision:undefined,vertical:0,keyboard:true,progress:false,speed:100,css:{input:"range",slider:"slider",progress:"progress",handle:"handle"}}};var x,y;e.fn.drag=function(d){document.ondragstart=function(){return false};d=e.extend({x:true,y:true,drag:true},d);x=x||e(document).bind("mousedown mouseup",function(a){var h=e(a.target);if(a.type=="mousedown"&&h.data("drag")){var s=h.position(),v=a.pageX-s.left,g=a.pageY-s.top,o=true;x.bind("mousemove.drag",function(i){var n=i.pageX-v;i=i.pageY-g;var l={};if(d.x)l.left=n;if(d.y)l.top=i;if(o){h.trigger("dragStart");o=false}d.drag&&h.css(l);h.trigger("drag",[i,n]);y=h});a.preventDefault()}else try{y&&y.trigger("dragEnd")}finally{x.unbind("mousemove.drag");y=null}});return this.data("drag",true)};e.expr[":"].range=function(d){var a=d.getAttribute("type");return a&&a=="range"||!!e(d).filter("input").data("rangeinput")};e.fn.rangeinput=function(d){if(this.data("rangeinput"))return this;d=e.extend(true,{},E.conf,d);var a;this.each(function(){var h=new G(e(this),e.extend(true,{},d));h=h.getInput().data("rangeinput",h);a=a?a.add(h):h});return a?a:this}})(jQuery);(function(e){function v(a,b,c){var j=a.offset().top,g=a.offset().left,l=c.position.split(/,?\s+/),f=l[0];l=l[1];j-=b.outerHeight()-c.offset[0];g+=a.outerWidth()+c.offset[1];c=b.outerHeight()+a.outerHeight();if(f=="center")j+=c/2;if(f=="bottom")j+=c;a=a.outerWidth();if(l=="center")g-=(a+b.outerWidth())/2;if(l=="left")g-=a;return{top:j,left:g}}function w(a){function b(){return this.getAttribute("type")==a}b.key="[type="+a+"]";return b}function s(a,b,c){function j(f,d,k){if(!(!c.grouped&&f.length)){var h;if(k===false||e.isArray(k)){h=i.messages[d.key||d]||i.messages["*"];h=h[c.lang]||i.messages["*"].en;(d=h.match(/\$\d/g))&&e.isArray(k)&&e.each(d,function(n){h=h.replace(this,k[n])})}else h=k[c.lang]||k;f.push(h)}}var g=this,l=b.add(g);a=a.not(":button, :image, :reset, :submit");e.extend(g,{getConf:function(){return c},getForm:function(){return b},getInputs:function(){return a},invalidate:function(f,d){if(!d){var k=[];e.each(f,function(h,n){h=a.filter("[name="+h+"]");if(h.length){h.trigger("OI",[n]);k.push({input:h,messages:[n]})}});f=k;d=e.Event()}d.type="onFail";l.trigger(d,[f]);d.isDefaultPrevented()||q[c.effect][0].call(g,f,d);return g},reset:function(f){f=f||a;f.removeClass(c.errorClass).each(function(){var d=e(this).data("msg.el");if(d){d.remove();e(this).data("msg.el",null)}})},checkValidity:function(f,d){f=f||a;f=f.not(":disabled");if(!f.length)return true;d=d||e.Event();d.type="onBeforeValidate";l.trigger(d,[f]);if(d.isDefaultPrevented())return d.result;var k=[],h=c.errorInputEvent+".v";f.each(function(){var p=[],m=e(this).unbind(h).data("messages",p);e.each(t,function(){var o=this,r=o[0];if(m.filter(r).length){o=o[1].call(g,m,m.val());if(o!==true){d.type="onBeforeFail";l.trigger(d,[m,r]);if(d.isDefaultPrevented())return false;var u=m.attr(c.messageAttr);if(u){p=[u];return false}else j(p,r,o)}}});if(p.length){k.push({input:m,messages:p});m.trigger("OI",[p]);c.errorInputEvent&&m.bind(h,function(o){g.checkValidity(m,o)})}if(c.singleError&&k.length)return false});var n=q[c.effect];if(!n)throw'Validator: cannot find effect "'+c.effect+'"';if(k.length){g.invalidate(k,d);return false}else{n[1].call(g,f,d);d.type="onSuccess";l.trigger(d,[f]);f.unbind(h)}return true}});e.each("onBeforeValidate,onBeforeFail,onFail,onSuccess".split(","),function(f,d){e.isFunction(c[d])&&e(g).bind(d,c[d]);g[d]=function(k){e(g).bind(d,k);return g}});c.formEvent&&b.bind(c.formEvent,function(f){if(!g.checkValidity(null,f))return f.preventDefault()});b.bind("reset",function(){g.reset()});a[0]&&a[0].validity&&a.each(function(){this.oninvalid=function(){return false}});if(b[0])b[0].checkValidity=g.checkValidity;c.inputEvent&&a.bind(c.inputEvent,function(f){g.checkValidity(e(this),f)});a.filter(":checkbox, select").filter("[required]").change(function(f){var d=e(this);if(this.checked||d.is("select")&&e(this).val())q[c.effect][1].call(g,d,f)})}e.tools=e.tools||{version:"1.2.2"};var x=/\[type=([a-z]+)\]/,y=/^-?[0-9]*(\.[0-9]+)?$/,z=/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i,A=/^(https?:\/\/)?([\da-z\.\-]+)\.([a-z\.]{2,6})([\/\w \.\-]*)*\/?$/i,i;i=e.tools.validator={conf:{grouped:false,effect:"default",errorClass:"invalid",inputEvent:null,errorInputEvent:"keyup",formEvent:"submit",lang:"en",message:"<div/>",messageAttr:"data-message",messageClass:"error",offset:[0,0],position:"center right",singleError:false,speed:"normal"},messages:{"*":{en:"Please correct this value"}},localize:function(a,b){e.each(b,function(c,j){i.messages[c]=i.messages[c]||{};i.messages[c][a]=j})},localizeFn:function(a,b){i.messages[a]=i.messages[a]||{};e.extend(i.messages[a],b)},fn:function(a,b,c){if(e.isFunction(b))c=b;else{if(typeof b=="string")b={en:b};this.messages[a.key||a]=b}if(b=x.exec(a))a=w(b[1]);t.push([a,c])},addEffect:function(a,b,c){q[a]=[b,c]}};var t=[],q={"default":[function(a){var b=this.getConf();e.each(a,function(c,j){c=j.input;c.addClass(b.errorClass);var g=c.data("msg.el");if(!g){g=e(b.message).addClass(b.messageClass).appendTo(document.body);c.data("msg.el",g)}g.css({visibility:"hidden"}).find("span").remove();e.each(j.messages,function(l,f){e("<span/>").html(f).appendTo(g)});g.outerWidth()==g.parent().width()&&g.add(g.find("p")).css({display:"inline"});j=v(c,g,b);g.css({visibility:"visible",position:"absolute",top:j.top,left:j.left}).fadeIn(b.speed)})},function(a){var b=this.getConf();a.removeClass(b.errorClass).each(function(){var c=e(this).data("msg.el");c&&c.css({visibility:"hidden"})})}]};e.each("email,url,number".split(","),function(a,b){e.expr[":"][b]=function(c){return c.getAttribute("type")===b}});e.fn.oninvalid=function(a){return this[a?"bind":"trigger"]("OI",a)};i.fn(":email","Please enter a valid email address",function(a,b){return!b||z.test(b)});i.fn(":url","Please enter a valid URL",function(a,b){return!b||A.test(b)});i.fn(":number","Please enter a numeric value.",function(a,b){return y.test(b)});i.fn("[max]","Please enter a value smaller than $1",function(a,b){a=a.attr("max");return parseFloat(b)<=parseFloat(a)?true:[a]});i.fn("[min]","Please enter a value larger than $1",function(a,b){a=a.attr("min");return parseFloat(b)>=parseFloat(a)?true:[a]});i.fn("[required]","Please complete this mandatory field.",function(a,b){if(a.is(":checkbox"))return a.is(":checked");return!!b});i.fn("[pattern]",function(a){var b=new RegExp("^"+a.attr("pattern")+"$");return b.test(a.val())});e.fn.validator=function(a){if(this.data("validator"))return this;a=e.extend(true,{},i.conf,a);if(this.is("form"))return this.each(function(){var c=e(this),j=new s(c.find(":input"),c,a);c.data("validator",j)});else{var b=new s(this,this.eq(0).closest("form"),a);return this.data("validator",b)}}})(jQuery);(function(){function f(a,b){if(b)for(key in b)if(b.hasOwnProperty(key))a[key]=b[key];return a}function l(a,b){var c=[];for(var d in a)if(a.hasOwnProperty(d))c[d]=b(a[d]);return c}function m(a,b,c){if(e.isSupported(b.version))a.innerHTML=e.getHTML(b,c);else if(b.expressInstall&&e.isSupported([6,65]))a.innerHTML=e.getHTML(f(b,{src:b.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});else{if(!a.innerHTML.replace(/\s/g,"")){a.innerHTML="<h2>Flash version "+
b.version+" or greater is required</h2><h3>"+(g[0]>0?"Your version is "+g:"You have no flash plugin installed")+"</h3>"+(a.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+k+"'>here</a></p>");if(a.tagName=="A")a.onclick=function(){location.href=k}}if(b.onFail){var d=b.onFail.call(this);if(typeof d=="string")a.innerHTML=d}}if(h)window[b.id]=document.getElementById(b.id);f(this,{getRoot:function(){return a},getOptions:function(){return b},getConf:function(){return c},getApi:function(){return a.firstChild}})}var h=document.all,k="http://www.adobe.com/go/getflashplayer",n=typeof jQuery=="function",o=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,i={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}});window.flashembed=function(a,b,c){if(typeof a=="string")a=document.getElementById(a.replace("#",""));if(a){if(typeof b=="string")b={src:b};return new m(a,f(f({},i),b),c)}};var e=f(window.flashembed,{conf:i,getVersion:function(){var a;try{a=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(b){try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");a=c&&c.GetVariable("$version")}catch(d){}}return(a=o.exec(a))?[a[1],a[3]]:[0,0]},asString:function(a){if(a===null||a===undefined)return null;var b=typeof a;if(b=="object"&&a.push)b="array";switch(b){case"string":a=a.replace(new RegExp('(["\\\\])',"g"),"\\$1");a=a.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+a+'"';case"array":return"["+l(a,function(d){return e.asString(d)}).join(",")+"]";case"function":return'"function()"';case"object":b=[];for(var c in a)a.hasOwnProperty(c)&&b.push('"'+c+'":'+e.asString(a[c]));return"{"+b.join(",")+"}"}return String(a).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(a,b){a=f({},a);var c='<object width="'+
a.width+'" height="'+a.height+'" id="'+a.id+'" name="'+a.id+'"';if(a.cachebusting)a.src+=(a.src.indexOf("?")!=-1?"&":"?")+Math.random();c+=a.w3c||!h?' data="'+a.src+'" type="application/x-shockwave-flash"':' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';c+=">";if(a.w3c||h)c+='<param name="movie" value="'+a.src+'" />';a.width=a.height=a.id=a.w3c=a.src=null;a.onFail=a.version=a.expressInstall=null;for(var d in a)if(a[d])c+='<param name="'+d+'" value="'+a[d]+'" />';a="";if(b){for(var j in b)if(b[j]){d=b[j];a+=j+"="+(/function|object/.test(typeof d)?e.asString(d):d)+"&"}a=a.slice(0,-1);c+='<param name="flashvars" value=\''+a+"' />"}c+="</object>";return c},isSupported:function(a){return g[0]>a[0]||g[0]==a[0]&&g[1]>=a[1]}}),g=e.getVersion();if(n){jQuery.tools=jQuery.tools||{version:"1.2.2"};jQuery.tools.flashembed={conf:i};jQuery.fn.flashembed=function(a,b){return this.each(function(){$(this).data("flashembed",flashembed(this,a,b))})}}})();(function(b){function h(c){if(c){var a=d.contentWindow.document;a.open().close();a.location.hash=c}}var g,d,f,i;b.tools=b.tools||{version:"1.2.2"};b.tools.history={init:function(c){if(!i){if(b.browser.msie&&b.browser.version<"8"){if(!d){d=b("<iframe/>").attr("src","javascript:false;").hide().get(0);b("body").append(d);setInterval(function(){var a=d.contentWindow.document;a=a.location.hash;g!==a&&b.event.trigger("hash",a)},100);h(location.hash||"#")}}else setInterval(function(){var a=location.hash;a!==g&&b.event.trigger("hash",a)},100);f=!f?c:f.add(c);c.click(function(a){var e=b(this).attr("href");d&&h(e);if(e.slice(0,1)!="#"){location.href="#"+e;return a.preventDefault()}});i=true}}};b(window).bind("hash",function(c,a){a?f.filter(function(){var e=b(this).attr("href");return e==a||e==a.replace("#","")}).trigger("history",[a]):f.eq(0).trigger("history",[a]);g=a;window.location.hash=g});b.fn.history=function(c){b.tools.history.init(this);return this.bind("history",c)}})(jQuery);(function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(window).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.2"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};var c,i,f,g,j;b.mask={load:function(a,d){if(f)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(e){e.keyCode==27&&b.mask.close(e)});a.closeOnClick&&c.bind("click.mask",function(e){b.mask.close(e)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var e=b(this);/relative|absolute|fixed/i.test(e.css("position"))||e.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad)});f=true;return this},close:function(){if(f){if(h(g.onBeforeClose)===false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j})});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask");f=false}return this},fit:function(){if(f){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(){return f},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);(function(b){function c(a){switch(a.type){case"mousemove":return b.extend(a.data,{clientX:a.clientX,clientY:a.clientY,pageX:a.pageX,pageY:a.pageY});case"DOMMouseScroll":b.extend(a,a.data);a.delta=-a.detail/3;break;case"mousewheel":a.delta=a.wheelDelta/120;break}a.type="wheel";return b.event.handle.call(this,a,a.delta)}b.fn.mousewheel=function(a){return this[a?"bind":"trigger"]("wheel",a)};b.event.special.wheel={setup:function(){b.event.add(this,d,c,{})},teardown:function(){b.event.remove(this,d,c)}};var d=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":"")})(jQuery);(function($){$.fn.showTooltip=function(pos,size,offset,content){};$.tools.overlay.addEffect('slide',function(css,done)
{var conf=this.getConf(),overlay=this.getOverlay();if(conf.fixed){css.position='fixed';css.left+=200;}else{css.top+=$(window).scrollTop();css.left+=($(window).scrollLeft()+200);css.position='absolute';}
overlay.css(css).show();overlay.animate({left:'-=200',opacity:1},200,'slide',done);},function(done)
{this.getOverlay().animate({left:'+=200',opacity:0},100,'slide',function()
{$(this).hide();done.call();});});$.easing.slide=function(x,t,b,c,d)
{return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;};})(jQuery);jQuery.fn.extend({everyTime:function(interval,label,fn,times){return this.each(function(){jQuery.timer.add(this,interval,label,fn,times);});},oneTime:function(interval,label,fn){return this.each(function(){jQuery.timer.add(this,interval,label,fn,1);});},stopTime:function(label,fn){return this.each(function(){jQuery.timer.remove(this,label,fn);});}});jQuery.fn.checkIt=function(){$(this).each(function(){if($(this).attr('type')!='checkbox'){return;}
if($(this).attr('checked')){return;}
$(this).click();});};jQuery.fn.unCheckIt=function(){$(this).each(function(){if($(this).attr('type')!='checkbox'){return;}
if(!$(this).is(':checked')){return;}
$(this).click();});};jQuery.extend({timer:{global:[],guid:1,dataKey:"jQuery.timer",regex:/^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,powers:{'ms':1,'cs':10,'ds':100,'s':1000,'das':10000,'hs':100000,'ks':1000000},timeParse:function(value){if(value==undefined||value==null)
return null;var result=this.regex.exec(jQuery.trim(value.toString()));if(result[2]){var num=parseFloat(result[1]);var mult=this.powers[result[2]]||1;return num*mult;}else{return value;}},add:function(element,interval,label,fn,times){var counter=0;if(jQuery.isFunction(label)){if(!times)
times=fn;fn=label;label=interval;}
interval=jQuery.timer.timeParse(interval);if(typeof interval!='number'||isNaN(interval)||interval<0)
return;if(typeof times!='number'||isNaN(times)||times<0)
times=0;times=times||0;var timers=jQuery.data(element,this.dataKey)||jQuery.data(element,this.dataKey,{});if(!timers[label])
timers[label]={};fn.timerID=fn.timerID||this.guid++;var handler=function(){if((++counter>times&&times!==0)||fn.call(element,counter)===false)
jQuery.timer.remove(element,label,fn);};handler.timerID=fn.timerID;if(!timers[label][fn.timerID])
timers[label][fn.timerID]=window.setInterval(handler,interval);this.global.push(element);},remove:function(element,label,fn){var timers=jQuery.data(element,this.dataKey),ret;if(timers){if(!label){for(label in timers)
this.remove(element,label,fn);}else if(timers[label]){if(fn){if(fn.timerID){window.clearInterval(timers[label][fn.timerID]);delete timers[label][fn.timerID];}}else{for(var fn in timers[label]){window.clearInterval(timers[label][fn]);delete timers[label][fn];}}
for(ret in timers[label])break;if(!ret){ret=null;delete timers[label];}}
for(ret in timers)break;if(!ret)
jQuery.removeData(element,this.dataKey);}}}});$.fn.selectbox=function(selectobj,opt){var sb=new TCI.FormElements.SelectBox({id:$(selectobj).attr('id')});}
$.fn.selectboxOLD=function(selectobj,opt){opt=jQuery.extend({inputClass:"selectbox",containerClass:"selectbox-wrapper",hoverClass:"selected",debug:false,offsetTop:24,offsetLeft:0},opt);var elm_id=$(selectobj).attr('id');var active=-1;var inFocus=false;var hasfocus=0;var $select=$(selectobj);var $container=setupContainer(opt);var $input=setupInput(opt);$select.hide().before($input);var $handle=setupHandle();$select.before($handle);$handle.show();$('body').append($container);var tp=$input.offset().top+opt.offsetTop;var lft=$input.offset().left+opt.offsetLeft;$container.css({left:lft,top:tp});init();setEnabled();$handle.click(function(e){setEnabled();e.stopPropagation();if($container.is(':visible')){hideMe($input);return;}
hideAll();if(isEnabled()){showContainer();}});$select.click(function(e,val,label){setSelected(val,label);});$input.click(function(e){hideAll();setEnabled();if(isEnabled()){showContainer();}
e.stopPropagation();}).focus(function(){if($container.not(':visible')){inFocus=true;}}).keydown(function(event){setEnabled();if(isEnabled()){switch(event.keyCode){case 38:event.preventDefault();moveSelect(-1);break;case 40:showContainer();event.preventDefault();moveSelect(1);break;case 9:hideMe(this);$select.blur();break;case 27:hideMe(this);break;case 13:event.preventDefault();setCurrent();hideMe(this);return false;break;}}});$(document).click(function(){hideAll();});$(window).resize(function(){setPosition();});function hideAll(){$('.selectbox-wrapper').hide();$('.handle').removeClass('opened');};function setEnabled(){if(!isEnabled()){$input.attr('disabled','disabled');$input.addClass('disabled');$handle.addClass('disabled');}
else{$input.removeAttr('disabled');$input.removeClass('disabled');$handle.removeClass('disabled');}};function isEnabled(){return $select.attr('disabled')==true?false:true;};function setPosition(){var tp=$input.offset().top+opt.offsetTop;var lft=$input.offset().left+opt.offsetLeft;$container.css({left:lft,top:tp});};function setWidth(){$container.width($input.width()+6);};function showContainer(){$handle.addClass('opened');$input.addClass('touched');setWidth();setPosition();$container.show();};function hideMe(el){hasfocus=0;$input.removeClass('touched');$handle.removeClass('opened');$container.hide();};function init(){$container.append(getSelectOptions()).hide();var width=$select.width();$container.width(width);var cssWidth=$select.css('width');width==0?$input.width(cssWidth):$input.width(width);$container.find('li').live('click',function(){$(this).addClass(opt.hoverClass);setCurrent();hideMe($input);});};function setupHandle(){var handle=document.createElement('span');$(handle).addClass('handle');return $(handle);};function setupContainer(options){var container=document.createElement("div");$container=$(container);$container.attr('id',elm_id+'_container');$container.addClass(options.containerClass);return $container;};function setupInput(options){var input=document.createElement("input");var $input=$(input);$input.attr("id",elm_id+"_input");$input.attr("type","text");$input.addClass(options.inputClass);$input.attr("autocomplete","off");$input.attr("readonly","readonly");$input.attr("tabIndex",$select.attr("tabindex"));return $input;};function moveSelect(step){var lis=$("li",$container);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
lis.removeClass(opt.hoverClass);$(lis[active]).addClass(opt.hoverClass);};function hasChanged(li,oldIndex){return $(li).index()!=oldIndex?true:false;};function setSelected(val,label){$select.val(val);$input.val(label);};function setCurrent(){var li=$("li."+opt.hoverClass,$container).get(0);var el=li.id;var oldIndex=$select.children('option:selected').index();$select.val(el);$input.val($(li).html());if(hasChanged(li,oldIndex)){$select.change();}
$select.blur();return true;};function getCurrentSelected(){return $select.val();};function getCurrentValue(){return $input.val();};function getSelectOptions(){var select_options=new Array();var ul=document.createElement('ul');$(ul).addClass($select.attr('class'));$(ul).attr('id',elm_id+'_list');$select.children('option').each(function(){var li=document.createElement('li');li.setAttribute('id',$(this).val());li.innerHTML=$(this).html();if($(this).is(':selected')){$input.val($(this).html());$(li).addClass(opt.hoverClass);}
ul.appendChild(li);$(li).mouseover(function(event){hasfocus=1;if(opt.debug)console.log('out on : '+this.id);jQuery(event.target,$container).addClass(opt.hoverClass);}).mouseout(function(event){hasfocus=-1;if(opt.debug)console.log('out on : '+this.id);jQuery(event.target,$container).removeClass(opt.hoverClass);}).click(function(event){if(opt.debug)console.log('click on :'+this.id);$(this).addClass(opt.hoverClass);setCurrent();hideMe($input);event.stopPropagation();});});return ul;};};jQuery(window).bind("unload",function(){jQuery.each(jQuery.timer.global,function(index,item){jQuery.timer.remove(item);});});(function($){$.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;}
var $textarea=$(this),$twin=$('<div />').css({'position':'absolute','display':'none'}),lineHeight=parseInt($textarea.css('lineHeight'),10)||parseInt($textarea.css('fontSize'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));}
function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}}
function update(){var textareaContent=$textarea.val().replace(/<|>/g,' ').replace(/\n/g,'<br />').replace(/&/g,"&amp;");var twinContent=$twin.html();if(textareaContent+'&nbsp;'!=twinContent){$twin.html(textareaContent+'&nbsp;');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}}
$textarea.css({'overflow':'hidden'}).bind('focus',function(){self.periodicalUpdater=window.setInterval(function(){update();},50);}).bind('blur',function(){clearInterval(self.periodicalUpdater);});update();});}});})(jQuery);(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);(function($){$.jScrollPane={active:[]};$.fn.jScrollPane=function(settings)
{settings=$.extend({},$.fn.jScrollPane.defaults,settings);var rf=function(){return false;};return this.each(function()
{var $this=$(this);$this.css('overflow','hidden');var paneEle=this;if($(this).parent().is('.jScrollPaneContainer')){var currentScrollPosition=settings.maintainPosition?$this.position().top:0;var $c=$(this).parent();var paneWidth=$c.innerWidth();var paneHeight=$c.outerHeight();var trackHeight=paneHeight;$('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown',$c).remove();$this.css({'top':0});}else{var currentScrollPosition=0;this.originalPadding=$this.css('paddingTop')+' '+$this.css('paddingRight')+' '+$this.css('paddingBottom')+' '+$this.css('paddingLeft');this.originalSidePaddingTotal=(parseInt($this.css('paddingLeft'))||0)+(parseInt($this.css('paddingRight'))||0);var paneWidth=$this.innerWidth();var paneHeight=$this.innerHeight();var trackHeight=paneHeight;$this.wrap($('<div></div>').attr({'className':'jScrollPaneContainer'}).css({'height':paneHeight+'px','width':paneWidth+'px'}));$(document).bind('emchange',function(e,cur,prev)
{$this.jScrollPane(settings);});}
if(settings.reinitialiseOnImageLoad){var $imagesToLoad=$.data(paneEle,'jScrollPaneImagesToLoad')||$('img',$this);var loadedImages=[];if($imagesToLoad.length){$imagesToLoad.each(function(i,val){$(this).bind('load',function(){if($.inArray(i,loadedImages)==-1){loadedImages.push(val);$imagesToLoad=$.grep($imagesToLoad,function(n,i){return n!=val;});$.data(paneEle,'jScrollPaneImagesToLoad',$imagesToLoad);settings.reinitialiseOnImageLoad=false;$this.jScrollPane(settings);}}).each(function(i,val){if(this.complete||this.complete===undefined){this.src=this.src;}});});};}
var p=this.originalSidePaddingTotal;var cssToApply={'height':'auto','width':paneWidth-settings.scrollbarWidth-settings.scrollbarMargin-p+'px'};if(settings.scrollbarOnLeft){cssToApply.paddingLeft=settings.scrollbarMargin+settings.scrollbarWidth+'px';}else{cssToApply.paddingRight=settings.scrollbarMargin+'px';}
$this.css(cssToApply);var contentHeight=$this.outerHeight();var percentInView=paneHeight/contentHeight;if(percentInView<.99){var $container=$this.parent();$container.append($('<div></div>').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append($('<div></div>').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),$('<div></div>').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'}))));var $track=$('>.jScrollPaneTrack',$container);var $drag=$('>.jScrollPaneTrack .jScrollPaneDrag',$container);if(settings.showArrows){var currentArrowButton;var currentArrowDirection;var currentArrowInterval;var currentArrowInc;var whileArrowButtonDown=function()
{if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection*mouseWheelMultiplier);}
currentArrowInc++;};var onArrowMouseUp=function(event)
{$('html').unbind('mouseup',onArrowMouseUp);currentArrowButton.removeClass('jScrollActiveArrowButton');clearInterval(currentArrowInterval);};var onArrowMouseDown=function(){$('html').bind('mouseup',onArrowMouseUp);currentArrowButton.addClass('jScrollActiveArrowButton');currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100);};$container.append($('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowUp'}).css({'width':settings.scrollbarWidth+'px'}).html('Scroll up').bind('mousedown',function()
{currentArrowButton=$(this);currentArrowDirection=-1;onArrowMouseDown();this.blur();return false;}).bind('click',rf),$('<a></a>').attr({'href':'javascript:;','className':'jScrollArrowDown'}).css({'width':settings.scrollbarWidth+'px'}).html('Scroll down').bind('mousedown',function()
{currentArrowButton=$(this);currentArrowDirection=1;onArrowMouseDown();this.blur();return false;}).bind('click',rf));var $upArrow=$('>.jScrollArrowUp',$container);var $downArrow=$('>.jScrollArrowDown',$container);if(settings.arrowSize){trackHeight=paneHeight-settings.arrowSize-settings.arrowSize;$track.css({'height':trackHeight+'px',top:settings.arrowSize+'px'});}else{var topArrowHeight=$upArrow.height();settings.arrowSize=topArrowHeight;trackHeight=paneHeight-topArrowHeight-$downArrow.height();$track.css({'height':trackHeight+'px',top:topArrowHeight+'px'});}}
var $pane=$(this).css({'position':'absolute','overflow':'visible'});var currentOffset;var maxY;var mouseWheelMultiplier;var dragPosition=0;var dragMiddle=percentInView*paneHeight/2;var getPos=function(event,c){var p=c=='X'?'Left':'Top';return event['page'+c]||(event['client'+c]+(document.documentElement['scroll'+p]||document.body['scroll'+p]))||0;};var ignoreNativeDrag=function(){return false;};var initDrag=function()
{ceaseAnimation();currentOffset=$drag.offset(false);currentOffset.top-=dragPosition;maxY=trackHeight-$drag[0].offsetHeight;mouseWheelMultiplier=2*settings.wheelSpeed*maxY/contentHeight;};var onStartDrag=function(event)
{initDrag();dragMiddle=getPos(event,'Y')-dragPosition-currentOffset.top;$('html').bind('mouseup',onStopDrag).bind('mousemove',updateScroll);if($.browser.msie){$('html').bind('dragstart',ignoreNativeDrag).bind('selectstart',ignoreNativeDrag);}
return false;};var onStopDrag=function()
{$('html').unbind('mouseup',onStopDrag).unbind('mousemove',updateScroll);dragMiddle=percentInView*paneHeight/2;if($.browser.msie){$('html').unbind('dragstart',ignoreNativeDrag).unbind('selectstart',ignoreNativeDrag);}};var positionDrag=function(destY)
{destY=destY<0?0:(destY>maxY?maxY:destY);dragPosition=destY;$drag.css({'top':destY+'px'});var p=destY/maxY;$pane.css({'top':((paneHeight-contentHeight)*p)+'px'});$this.trigger('scroll');if(settings.showArrows){$upArrow[destY==0?'addClass':'removeClass']('disabled');$downArrow[destY==maxY?'addClass':'removeClass']('disabled');}};var updateScroll=function(e)
{positionDrag(getPos(e,'Y')-currentOffset.top-dragMiddle);};var dragH=Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2),settings.dragMaxHeight),settings.dragMinHeight);$drag.css({'height':dragH+'px'}).bind('mousedown',onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function()
{if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)));}
trackScrollInc++;};var onStopTrackClick=function()
{clearInterval(trackScrollInterval);$('html').unbind('mouseup',onStopTrackClick).unbind('mousemove',onTrackMouseMove);};var onTrackMouseMove=function(event)
{trackScrollMousePos=getPos(event,'Y')-currentOffset.top-dragMiddle;};var onTrackClick=function(event)
{initDrag();onTrackMouseMove(event);trackScrollInc=0;$('html').bind('mouseup',onStopTrackClick).bind('mousemove',onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll();};$track.bind('mousedown',onTrackClick);$container.bind('mousewheel',function(event,delta){initDrag();ceaseAnimation();var d=dragPosition;positionDrag(dragPosition-delta*mouseWheelMultiplier);var dragOccured=d!=dragPosition;return!dragOccured;});var _animateToPosition;var _animateToInterval;function animateToPosition()
{var diff=(_animateToPosition-dragPosition)/settings.animateStep;if(diff>1||diff<-1){positionDrag(dragPosition+diff);}else{positionDrag(_animateToPosition);ceaseAnimation();}}
var ceaseAnimation=function()
{if(_animateToInterval){clearInterval(_animateToInterval);delete _animateToPosition;}};var scrollTo=function(pos,preventAni)
{if(typeof pos=="string"){$e=$(pos,$this);if(!$e.length)return;pos=$e.offset().top-$this.offset().top;}
$container.scrollTop(0);ceaseAnimation();var destDragPosition=-pos/(paneHeight-contentHeight)*maxY;if(preventAni||!settings.animateTo){positionDrag(destDragPosition);}else{_animateToPosition=destDragPosition;_animateToInterval=setInterval(animateToPosition,settings.animateInterval);}};$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta)
{var currentPos=-parseInt($pane.css('top'))||0;scrollTo(currentPos+delta);};initDrag();scrollTo(-currentScrollPosition,true);$('*',this).bind('focus',function(event)
{var $e=$(this);var eleTop=0;while($e[0]!=$this[0]){eleTop+=$e.position().top;$e=$e.offsetParent();}
var viewportTop=-parseInt($pane.css('top'))||0;var maxVisibleEleTop=viewportTop+paneHeight;var eleInView=eleTop>viewportTop&&eleTop<maxVisibleEleTop;if(!eleInView){var destPos=eleTop-settings.scrollbarMargin;if(eleTop>viewportTop){destPos+=$(this).height()+15+settings.scrollbarMargin-paneHeight;}
scrollTo(destPos);}});$.jScrollPane.active.push($this[0]);}else{$this.css({'height':paneHeight+'px','width':paneWidth-this.originalSidePaddingTotal+'px','padding':this.originalPadding});$this.parent().unbind('mousewheel');}});};$.fn.jScrollPaneRemove=function()
{$(this).each(function()
{$this=$(this);var $c=$this.parent();if($c.is('.jScrollPaneContainer')){$this.css({'top':'','height':'','width':'','padding':'','overflow':'','position':''});$this.attr('style',$this.data('originalStyleTag'));$c.after($this).remove();}});};$.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false};$(window).bind('unload',function(){var els=$.jScrollPane.active;for(var i=0;i<els.length;i++){els[i].scrollTo=els[i].scrollBy=null;}});})(jQuery);(function($){$.extend({head:function(url,data,callback){if($.isFunction(data)){callback=data;data={};}
return $.ajax({type:"HEAD",url:url,data:data,complete:function(XMLHttpRequest,textStatus){var new_headers={};if(XMLHttpRequest.getAllResponseHeaders()){var headers=XMLHttpRequest.getAllResponseHeaders().split("\n");var l=headers.length;for(var key=0;key<l;key++){if(headers[key].length!=0){header=headers[key].split(": ");new_headers[header[0]]=header[1];}}}else{TCI.Log.debug("header response is null");}
if($.isFunction(callback)){callback(new_headers);}}});}});})(jQuery);var TCI=(function(name){return name;}(TCI||{}));TCI.Globals=(function()
{return{brand:'',dealerBrand:'',contextPath:'',dealerCode:'',locale:document.documentElement.lang,urlLocaleToken:document.documentElement.lang=='fr'?'/fr':'',domainPath:'',securePath:'',userFirstName:'',userLastName:'',update:function(name,value,async,forceSecure)
{var postData=TCI.Utils.parseJSON('{"'+name+'" : ""}');var securePath=TCI.Utils.getOptionalSecurePrefix();if(forceSecure)
{securePath=TCI.Utils.getSecurePrefix();}
postData[name]=value;return $.ajax({type:'POST',url:TCI.Utils.getURL(securePath+'/GlobalsAction_update.action'),error:function(response){if(response.status==409){if(TCI.cas&&TCI.Globals.loginId){TCI.cas.logout();}else{TCI.ajax.get(TCI.Utils.getURL(securePath+'/GlobalsAction_clear.action'),{},function(){},function(){},false);window.location=TCI.Utils.getHttpUrl("");}}},async:async||false,data:postData});},clear:function(name,leave_in_js,async,forceSecure)
{var name=name;var securePath=TCI.Utils.getOptionalSecurePrefix();if(forceSecure)
{securePath=TCI.Utils.getSecurePrefix();}
$.ajax({type:'POST',async:async||false,url:TCI.Utils.getURL(securePath+'/GlobalsAction_delete.action'),data:{name:name},success:function(data){if(!!name&&!leave_in_js){delete TCI.Globals[name];}}});}};})();var TCI=(function(name){return name;}(TCI||{}));TCI.localize={};TCI.localize.getLabel=function(labelId,replacements,locale)
{var localeMessages;if(locale&&locale=='fr'||TCI.Globals.locale=='fr'){localeMessages=messages.fr;}else{localeMessages=messages.en;}
var message=localeMessages[labelId]||labelId;if(replacements){for(value in replacements){var replaceRegex=new RegExp('\{'+value+'\}','g');message=message.replace(replaceRegex,replacements[value]);}}
return message;};TCI.localize.amount=function(amount,locale)
{var thouSepChar;var localizedAmount=amount;if(locale&&locale=='fr'||TCI.Globals.locale=='fr'){thouSepChar=' ';var thouIndex=(localizedAmount.indexOf('.')-3);localizedAmount=localizedAmount.slice(0,thouIndex)+thouSepChar+localizedAmount.slice(thouIndex);localizedAmount=localizedAmount.replace('.',',');localizedAmount=localizedAmount+' $';}else{localizedAmount='$'+localizedAmount;}
return localizedAmount;};var TCI=(function(name){return name;}(TCI||{}));TCI.Log={method:"log",level:"all",quietDismiss:true,_ALL:"all",_NONE:"none",_INFO:"info",_WARNING:"warn",_ERROR:"error",_DEBUG:"debug",_hasConsole:function(_method)
{var _method=_method||"log";return typeof(console)=='object'&&typeof(console[_method])!="undefined";},_consoleMethod:function()
{if(this.level==this._NONE||TCI.Core.isLoggerOff()){return false;}
if(this.level!=this._ALL)
if(this.method!="error"&&(this.level==this._ERROR))
return false;if(this.method!="warn"&&(this.level==this._ERROR||this.level==this._WARNING))
return false;if(this.method!="info"&&(this.level==this._ERROR||this.level==this._WARNING||this.level==this._INFO))
return false;if(this.method!="log"&&(this.level==this._ERROR||this.level==this._WARNING||this.level==this._INFO||this.level==this._DEBUG))
return false;if(this._hasConsole(this.method)){try{console[this.method].apply(this,arguments);}catch(e){for(var i=0,l=arguments.length;i<l;i++)
console[this.method](arguments[i]);}}else if(!this.quietDismiss&&arguments.length){var result="";for(var i=0,l=arguments.length;i<l;i++)
result+=arguments[i]+" ("+typeof arguments[i]+") ";}},setLevel:function(level){this.level=level;},log:function(){this.method="log";this._consoleMethod.apply(this,arguments);},info:function(){this.method="info";this._consoleMethod.apply(this,arguments);},warn:function(){this.method="warn";this._consoleMethod.apply(this,arguments);},error:function(){this.method="error";this._consoleMethod.apply(this,arguments);},debug:function(){this.method="log";this._consoleMethod.apply(this,arguments);},clear:function(){this.method="clear";this._consoleMethod.apply(this);},count:function(){this.method="count";this._consoleMethod.apply(this,arguments);},trace:function(){this.method="trace";this._consoleMethod.apply(this,arguments);},assert:function(){this.method="assert";this._consoleMethod.apply(this,arguments);}};var TCI=(function(name){return name;}(TCI||{}));TCI.Error=(function()
{var getErrorHTML=function(params)
{TCI.Log.debug('TCI.Error.getErrorHTML: Create and render failure error in supplied container or just return the HTML.');if(!params||!params.message){throw'Missing parameters in TCI.Error.getErrorHTML';}
var showButton=!!params.button||!!params.close;var buttonHtml='';if(showButton){if(!!params.button){buttonHtml='<button class="action_btn"><em>'+(!!params.button?params.button:TCI.Utils.getLabel('btn_close'))+'</em></button>';}else if(!!params.close){buttonHtml='<button class="delete_btn close_error"><em></em></button>';}}
var html;switch(TCI.Globals.brand){case'TOY':var msg=params.message;var msg_split_ndx=msg.indexOf('@@embed_error_icon@@',0);if(msg_split_ndx!==-1){msg=msg.slice(0,msg_split_ndx)+'<span class="error_icon_embeeded_text">&nbsp;</span>'+msg.slice(msg_split_ndx+'@@embed_error_icon@@'.length);}
html='<div class="error"><div class="error_icon" >&nbsp;</div><p class="error">'+msg+'</p>'+buttonHtml+'</div>';break;case'SCI':html='<div class="error-notice-from-server"><span></span><p style="'+(showButton?'margin-bottom:10px;':'')+'">'+params.message+'</p>'+buttonHtml+'</div>';break;default:html='<div><p>'+params.message+'</p>'+buttonHtml+'</div>';}
return html;};return{error:null,displayError:function(params)
{TCI.Log.debug('TCI.Error.displayError: Create and render failure error in supplied container or just return the HTML.');if(!params||!params.message||!params.container){throw'Missing parameters in TCI.Error.displayError';}
var container=$(params.container);if(container.length==0){throw'Cannot find container for error <'+params.container+'>';}
var showButton=!!params.callback||!!params.button||!!params.close;var buttonHtml='';if(showButton){if(!!params.button){buttonHtml='<button class="action_btn"><em>'+(!!params.button?params.button:TCI.Utils.getLabel('btn_close'))+'</em></button>';}else if(!!params.close){buttonHtml='<button class="delete_btn close_error"><em></em></button>';}}
var html;switch(TCI.Globals.brand){case'TOY':var msg=params.message;var msg_split_ndx=msg.indexOf('@@embed_error_icon@@',0);if(msg_split_ndx!==-1){msg=msg.slice(0,msg_split_ndx)+'<span class="error_icon_embeeded_text">&nbsp;</span>'+msg.slice(msg_split_ndx+'@@embed_error_icon@@'.length);}
html='<div class="error"><div class="error_icon" >&nbsp;</div><p class="error">'+msg+'</p>'+buttonHtml+'</div>';break;case'SCI':html='<div class="error-notice-from-server"><span></span><p style="'+(showButton?'margin-bottom:10px;':'')+'">'+params.message+'</p>'+buttonHtml+'</div>';break;default:html='<div><p>'+params.message+'</p>'+buttonHtml+'</div>';}
if(!params.overwrite){container.prepend(html);}else{container.html(html);}
if(showButton){var buttonEl=container.find('button');buttonEl.click(params.callback||(function(){}));if(!!params.close){buttonEl.click(function(){$(this).parent().remove();});}}
var errorPanel=container.children(0).show();return errorPanel;},getErrorHTML:function(params)
{return getErrorHTML(params);},displayFatalError:function(message,close)
{TCI.Error.fe=TCI.Error.displayError({message:message,container:'#error_panel',overwrite:true,close:close});TCI.Error.fe.parent().css({display:'block'});return TCI.Error.fe;},appendFatalError:function(message,close)
{TCI.Error.fe=TCI.Error.displayError({message:message,container:'#error_panel',overwrite:false,close:close});TCI.Error.fe.parent().css({display:'block'});return TCI.Error.fe;},removeError:function(container)
{$(container).each(function(){$(this).find('div.error').remove();});},removeFatalError:function()
{if(!!TCI.Error.fe){TCI.Error.fe.parent().css({display:'none'});TCI.Error.fe.remove();}}};})();var TCI=(function(name){return name;}(TCI||{}));TCI.ajax={};TCI.ajax.defaultErrorHandler=function(XMLHttpRequest,textStatus,errorThrown){TCI.Log.warn(textStatus,errorThrown);};TCI.ajax.get=function(url,data,success,error,async){return jQuery.ajax({type:'GET',url:url,data:data,success:success,error:error,async:async==undefined?false:async});};TCI.ajax.post=function(url,data,success,error,async){return jQuery.ajax({type:'POST',url:url,data:data,success:success,error:error,async:async});};TCI.ajax.getScript=function(url,success,error){jQuery.ajax({async:false,url:url,success:success||function(){},error:function(){if(error){error();}
TCI.ajax.defaultErrorHandler();},dataType:'script'});};TCI.ajax.postJSON=function(url,data,success,error,async){jQuery.ajax({type:'POST',url:url,contentType:'application/json; charset='+TCI.Data.charset,data:data,success:success,error:error?error:TCI.ajax.defaultErrorHandler,dataType:'json',async:async});};TCI.ajax.postSecureJSON=function(url,data,success,error,async)
{return jQuery.ajax({type:'POST',url:url,data:data,beforeSend:function(XMLHttpRequest){var serviceTicketUrl=TCI.cas.getServiceTicketCallURL(url);var serviceTicket=TCI.cas.requestServiceTicket(serviceTicketUrl);XMLHttpRequest.setRequestHeader('ticket',serviceTicket);},success:success,error:error?error:TCI.ajax.defaultErrorHandler,dataType:'json',contentType:'application/json; charset=utf-8',async:async==undefined?true:async});};TCI.ajax.getJSON=function(url,data,success,error,async,cache){jQuery.ajax({type:'GET',url:url,data:data,success:success,error:error?error:TCI.ajax.defaultErrorHandler,dataType:'json',contentType:'application/json; charset=utf-8',async:async,cache:cache});};TCI.ajax.deleteRequest=function(url,async){jQuery.ajax({type:'DELETE',url:url,error:TCI.ajax.defaultErrorHandler,async:async});};TCI.ajax.checkServerStatus=function(url,success,error){jQuery.ajax({type:"POST",url:url,success:success,error:error,async:true});};var TCI=(function(name){return name;}(TCI||{}));TCI.Data=(function(){return{charset:'utf-8',imageMap:[],userProfile:null};})();TCI.Data.getBrand=function(params)
{if(!!TCI.Globals.brandData){TCI.Log.debug('TCI.Data.getBrand: Brand data is cached, no need to call the service.');params.success(TCI.Globals.brandData);}else{try
{TPM.Performance.TimeLog.start("request_brand_data");TCI.ajax.getJSON(TCI.Utils.getBrandURL(TCI.Globals.brand),null,function(data)
{TPM.Performance.TimeLog.stop("request_brand_data");if(!data.serviceInfo||data.serviceInfo.status!='SUCCESS')
{params.error(TCI.Utils.getLabel('err_noBrandData'));}
TPM.Performance.TimeLog.start("parse_brand_data");if(!data.seriesDetails.TciGetSeriesModelViewDataArea.length)
{data.seriesDetails.TciGetSeriesModelViewDataArea=[data.seriesDetails.TciGetSeriesModelViewDataArea];}
for(var i in data.seriesDetails.TciGetSeriesModelViewDataArea)
{data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelViewHeader.Brand.$=data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelViewHeader.Brand.$.trim();data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesInfo.SeriesCode.$=data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesInfo.SeriesCode.$.trim();if(!data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesModel.length)
{data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesModel=[data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesModel];}
for(var j in data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesModel)
{data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesModel[j].Model.$=data.seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries.TciSeriesModel[j].Model.$.trim();}}
TPM.Performance.TimeLog.stop("parse_brand_data");TCI.Globals.update('brandData',JSON.stringify(data.seriesDetails),true);TCI.Globals.brandData=data.seriesDetails;params.success(data.seriesDetails);},function()
{TPM.Performance.TimeLog.stop("request_brand_data");params.error(TCI.Utils.getLabel('err_noBrandData'));},false);}
catch(err)
{TCI.Log.warn('TCI.Data.getBrand: Error getting brand json data: ',err);params.error(TCI.Utils.getLabel('err_noBrandData'));}}
return TCI.Data.brandDataCache;};TCI.Data.getSeries=function(params)
{var exception=null;TPM.Performance.TimeLog.start("request_series_data");$.ajax({type:'GET',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:params.async||false,url:TCI.Utils.getSeriesURL(TCI.Globals.brand,params.seriesCode.toUpperCase()),success:function(data)
{TPM.Performance.TimeLog.stop("request_series_data");try{params.callback(TCI.Utils.parseJSON(data));}catch(err){TCI.Log.debug('TCI.Data.getSeries: Series json data: '+data);exception=err;throw err;}},error:function(err)
{TPM.Performance.TimeLog.stop("request_series_data");TCI.Log.debug('TCI.Data.getSeries: Error getting series json data: '+err);exception=TCI.Utils.getLabel('err_noSeriesData');throw TCI.Utils.getLabel('err_noSeriesData');}});if(exception!=null){throw exception;}};TCI.Data.getVehicle=function(params)
{var x=new Date();var series=params.series;var model=params.model;TCI.Log.debug('TCI.Data.getVehicle: Loading model data: '+model.code+'/'+model.year);TPM.Performance.TimeLog.start("request_vehicle_data");$.ajax({type:'GET',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,cache:false,async:params.async||false,url:TCI.Utils.getVehicleURL(TCI.Globals.brand,series.code,model.code,model.year),success:function(data)
{TPM.Performance.TimeLog.stop("request_vehicle_data");try
{n=new Date();perf_results=(n.getTime()-x.getTime())/1000+', ';var y=new Date();var json=TCI.Utils.parseJSON(data);n=new Date();perf_results+=(n.getTime()-y.getTime())/1000+', ';var z=new Date();params.callback(series,model,json);n=new Date();perf_results+=(n.getTime()-z.getTime())/1000+', ';TCI.Log.warn(series.code+', '+model.code+', '+perf_results);TCI.Log.warn('>>> END PERFORMACE LOGGING - VEHICLE SERVICE');}catch(err){}},error:function(err)
{TPM.Performance.TimeLog.stop("request_vehicle_data");TCI.Log.warn('TCI.Data.getVehicle: Error getting vehicle json data due to: ',err);throw TCI.Utils.getLabel('err_noVehicleData');}});};TCI.Data.getSavedVehicles=function(params)
{TCI.Log.debug('TCI.Data.getSavedVehicles: Get saved vehicles.');var use_profile=true;if(use_profile){params.callback(TCI.Data.getProfile(TCI.Globals.loginId,true,true));}else{TPM.Performance.TimeLog.start("request_saved_vehicle_data");$.ajax({type:'POST',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:false,url:TCI.Utils.getGetSavedVehiclesURL(),data:TCI.Data.json_getSavedVehicles(params.configuration,params.vehicleId),beforeSend:function(XMLHttpRequest)
{var serviceTicket=TCI.cas.requestServiceTicket(TCI.cas.getServiceTicketCallURL(TCI.Utils.getGetSavedVehiclesURL()));XMLHttpRequest.setRequestHeader('ticket',serviceTicket);},success:function(data)
{TPM.Performance.TimeLog.stop("request_saved_vehicle_data");params.callback(TCI.Utils.parseJSON(data));},error:function(err)
{TPM.Performance.TimeLog.stop("request_saved_vehicle_data");TCI.Log.warn('TCI.Data.getSavedVehicles: Error getting saved vehicle: '+err);}});}};TCI.Data.json_getSavedVehicles=function(configuration,vehicleId)
{var json={"TciConsumerInfoRequest":{"userIdentifier":{"provinceCode":{"provinceCode":configuration.getProvince()},"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId()},"dealerIdentifier":{"dealerCode":configuration.getDealer().getCode(),"provinceCode":{"provinceCode":configuration.getDealer().getProvince()}},"requestIdentifier":{"requestType":"READ","loginId":TCI.Globals.loginId,"brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale(),"savedVehicleLocator":vehicleId||"","constraintCd":"F","consumerId":0}}};return JSON.stringify(json);};TCI.Data.getVehiclesByLink=function(params)
{TCI.Log.debug('TCI.Data.getVehiclesByLink: Get vehicles by link.');TPM.Performance.TimeLog.start("request_vehicle_by_link");$.ajax({type:'POST',dataType:'text',contentType:'application/json;',async:false,url:TCI.Utils.getGetVehicleByLinkURL(),data:TCI.Data.json_getVehiclesByLink(params.configuration,params.vehicleKey),success:function(response)
{TPM.Performance.TimeLog.stop("request_vehicle_by_link");var data=TCI.Utils.parseJSON(response);if(data.serviceInfo.status=='SUCCESS')
params.success(data);else
params.error(TCI.Utils.getLabel('err_cannotGetVehicleByLink'));},error:function(err)
{TPM.Performance.TimeLog.stop("request_vehicle_by_link");params.error(TCI.Utils.getLabel('err_cannotGetVehicleByLink'));TCI.Log.warn('TCI.Data.getVehiclesByLink: Error getting vehicle by link: '+err);}});};TCI.Data.json_getVehiclesByLink=function(configuration,vehicleKey)
{var json={"TciConsumerInfoRequest":{"userIdentifier":{"provinceCode":{"provinceCode":""},"programId":TCI.Globals.programId,"tciUserId":"public"},"dealerIdentifier":{"dealerCode":"","provinceCode":{"provinceCode":""}},"requestIdentifier":{"requestType":"READ","loginId":"","brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale(),"constraintCd":"","consumerId":0,"savedVehicleLocator":vehicleKey}}};return JSON.stringify(json);};TCI.Data.saveVehicle=function(params)
{TCI.Log.debug('TCI.Data.saveVehicle: Save vehicle.');$.ajax({type:'POST',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:false,url:TCI.Utils.getSaveVehicleURL(),data:TCI.Data.json_saveVehicle(params.configuration,params.vehicleId,params.vehicleName),beforeSend:function(XMLHttpRequest){var serviceTicket=TCI.cas.requestServiceTicket(TCI.cas.getServiceTicketCallURL(TCI.Utils.getSaveVehicleURL()));XMLHttpRequest.setRequestHeader('ticket',serviceTicket);},success:function(response)
{var data=TCI.Utils.parseJSON(response);if(data.serviceInfo.status!='SUCCESS'){var message;if(data.serviceInfo.errorCode)
{try{var errorCode=data.serviceInfo.errorCode.toLowerCase();var errorMessage=data.serviceInfo.errorMessage;switch(errorCode){case('error100'):var vehicleName=errorMessage.split(':')[1].trim();message=TCI.Utils.getLabel('msg_saveVehicle_'+errorCode,{name:vehicleName});break;default:message=TCI.Utils.getLabel('err_cannotSaveVehicle');break;}}catch(err){message=TCI.Utils.getLabel('err_cannotSaveVehicle');}}
params.error(message);TCI.Log.warn('TCI.Data.saveVehicle: Error saving vehicle: '+message);}else{params.success(data);}},error:function(err){TCI.Log.warn('TCI.Data.saveVehicle: Error saving vehicle: '+err);params.error(TCI.Utils.getLabel('err_cannotSaveVehicle'));}});};TCI.Data.json_saveVehicle=function(configuration,vehicleId,vehicleName)
{var json={"TciConsumerInfoRequest":{"userIdentifier":{"provinceCode":{"provinceCode":configuration.getProvince()},"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId()},"dealerIdentifier":{"dealerCode":configuration.getDealer().getCode(),"provinceCode":{"provinceCode":configuration.getDealer().getProvince()}},"requestIdentifier":{"requestType":"UPDATE","loginId":TCI.Globals.loginId,"brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale(),"constraintCd":"F","consumerId":0,"savedVehicleLocator":vehicleId||''},"savedVehicleIdentifier":[configuration.getConfigurationJson(vehicleId,vehicleName)]}};return JSON.stringify(json);};TCI.Data.deleteSavedVehicle=function(params)
{TCI.Log.debug('TCI.Data.deleteSavedVehicle: Delete saved vehicles.');$.ajax({type:'POST',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:true,url:TCI.Utils.getDeleteVehicelURL(),data:TCI.Data.json_deleteSavedVehicle(params.configuration,params.vehicleId),beforeSend:function(XMLHttpRequest){var serviceTicket=TCI.cas.requestServiceTicket(TCI.cas.getServiceTicketCallURL(TCI.Utils.getDeleteVehicelURL()));XMLHttpRequest.setRequestHeader('ticket',serviceTicket);},success:function(response)
{var data=TCI.Utils.parseJSON(response);if(data.serviceInfo.status!='SUCCESS'){params.error(TCI.Utils.getLabel('err_cannotDeleteVehicle')+' '+data.serviceInfo.errorMessage?data.serviceInfo.errorMessage:'');}else{params.success(data);}},error:function(error){TCI.Log.warn('TCI.Data.deleteSavedVehicle: Error deleting vehicle: '+error.message);params.error(TCI.Utils.getLabel('err_cannotDeleteVehicle'));}});};TCI.Data.json_deleteSavedVehicle=function(configuration,vehicleId)
{var json={"TciConsumerInfoRequest":{"userIdentifier":{"provinceCode":{"provinceCode":configuration.getProvince()},"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId()},"dealerIdentifier":{"dealerCode":configuration.getDealer().getCode(),"provinceCode":{"provinceCode":configuration.getDealer().getProvince()}},"requestIdentifier":{"requestType":"DELETE","loginId":TCI.Globals.loginId,"brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale(),"savedVehicleLocator":vehicleId||"","constraintCd":"F","consumerId":0}}};return JSON.stringify(json);};TCI.Data.getNationalPrograms=function(params)
{TCI.Log.debug('TCI.Data.getNationalPrograms: Get national programs.');var programs=null;$.ajax({type:'GET',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:params.async,url:TCI.Utils.getProgramsURL(params.brand,params.seriesCode,params.modelYear,params.model.code,params.packageCode,TCI.Date.getClientDate().format('yyyy-mm-dd')),success:function(data)
{programs=NationalPrograms.parse(params.model,params.packageCode,TCI.Utils.parseJSON(data));try{params.success(params.model,params.packageCode,programs);}catch(err){params.error(params.model,params.packageCode,err);}},error:function(err)
{programs=NationalPrograms.parse(params.model,params.packageCode,null);TCI.Log.warn('TCI.Data.getNationalPrograms: Error getting national programs: '+err);params.error(params.model,TCI.Utils.getLabel('err_noPromotionsData'));}});return programs;};TCI.Data.getAccessoryDescription=function(accessoryCode,callback)
{TCI.Log.debug('TCI.Data.getAccessoryDescription: Get accessory description.');var description=null;$.ajax({type:'GET',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:!!callback?true:false,url:TCI.Utils.getAccessoryDescriptionURL(accessoryCode,TCI.Globals.locale),success:function(data)
{TCI.Core.Encoder.EncodeType="entity";var decoded=TCI.Core.Encoder.htmlDecode(data);decoded=decoded.replace(/&amp;quot;/g,'').replace(/&quot;/g,'').replace(/7pt "times new roman"/g,'').replace(/<p><\/p>/g,'').replace(/<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><\/p>/g,'');if(!!callback){callback(decoded);}else{description=decoded;}},error:function(err)
{TCI.Log.warn('TCI.Data.getAccessoryDescription: Error getting long accessory exception: '+err);if(!!callback){callback(null);}}});return description;};TCI.Data.getPackageMessage=function(params)
{TCI.Log.debug('TCI.Data.getAccessoryDescription: Get accessory description.');var message={fr:'',en:'',show:false};$.ajax({type:'GET',dataType:'text',contentType:'application/json; charset='+TCI.Data.charset,async:params.async,url:TCI.Utils.getPackageMessageURL(params.brand,params.series,params.model,params.year,params.package),success:function(data)
{try
{var messageObject=TCI.Utils.parseJSON(data);message={fr:messageObject.Response.warnFr,en:messageObject.Response.warnEn,show:messageObject.Response.foundFlag};if(!!params.callback){params.callback(message);}}
catch(err)
{TCI.Log.warn('TCI.Data.getPackageMessage: Error getting package availability message: '+err);message={fr:'',en:'',show:false};if(!!params.callback){params.callback(message);}}},error:function(err)
{TCI.Log.warn('TCI.Data.getPackageMessage: Error getting package availability message: '+err);if(!!params.callback){params.callback(message);}}});return message;};TCI.Data.getSpecifications=function(params)
{$.ajax({type:'GET',dataType:'text',contentType:'application/json;',async:false,url:TCI.Utils.getSpecificationsURL(params.seriesCode,params.modelYear),success:function(data)
{if(data.indexOf('[REDIRECT]')>-1){params.error(params.modelYear,data);}else{try{params.success(params.modelYear,Specs.parse(params.seriesCode,params.modelYear,data));}catch(err){params.error(params.modelYear,err);}}},error:function(err)
{TCI.Log.warn('TCI.Data.getSpecifications: Error getting specifications data: ',err);params.error(params.modelYear,TCI.Utils.getLabel('err_noSpecsData'));}});};TCI.Data.priceVehicle=function(params)
{TCI.Log.debug('TCI.Data.priceVehicle');TPM.Performance.TimeLog.start("price_vehicle");var params=params||{};$.ajax({type:'POST',url:TCI.Utils.getPriceURL(),dataType:'json',async:(params.async!=null)?params.async:true,contentType:'application/json; charset='+TCI.Data.charset,success:function(data)
{params.that.parsePricingData({data:data,type:params.responseType,loadEJS:(params.loadEJS!=null)?params.loadEJS:null,async:(params.async!=null)?params.async:true,loading:params.loading});TPM.Performance.TimeLog.stop("price_vehicle");},error:function(e)
{TPM.Performance.TimeLog.stop("price_vehicle");},data:params.priceJSON});};TCI.Data.createProfile=function(loginId)
{var result=false;TCI.cas.assertCasEmailPrefix('TCI.Data.createProfile',loginId);TCI.Log.debug('TCI.Data.createProfile: create user profile.');var response=TCI.ajax.postSecureJSON(TCI.Utils.getGetConsumerInfoCreateAccountURL(),TCI.Data.json_createProfile(loginId),function(){},function(){},false);if(response.status==200)
{var responseJSON=JSON.parse(response.responseText);if(responseJSON.serviceInfo.status=='SUCCESS'){result=true;}}
return result;};TCI.Data.json_createProfile=function(loginId)
{TCI.cas.assertCasEmailPrefix('TCI.Data.json_createProfile',loginId);var json={"TciConsumerInfoRequest":{"userIdentifier":{"provinceCode":{"provinceCode":""},"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId()},"dealerIdentifier":{"dealerCode":"","provinceCode":{"provinceCode":""}},"requestIdentifier":{"requestType":"CREATE","constraintCd":"","consumerId":0,"savedVehicleLocator":"","loginId":loginId,"brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale()},"consumerInfoIdentifier":{"personTypeDetails":{"ID":"","givenName":{"languageID":"EN","value":""},"alias":{"languageID":"EN","value":""},"middleName":{"languageID":"EN","value":""},"familyName":{"languageID":"EN","value":""},"title":{"languageID":"EN","value":""},"salutation":{"languageID":"EN","value":""},"nameSuffix":{"languageID":"EN","value":""},"maritalStatusCode":"","genderCode":"","birthDate":"","ageMeasure":{"unitCode":"year","value":""},"maidenName":{"languageID":"EN","value":""},"preferredName":{"languageID":"EN","value":""},"nationalityCountryID":"","contactMethodTypeCode":"","optInForCommunicationInd":true,"preferredLanguageCode":""},"loginId":"","loginPassword":""}}};if(TCI.Globals.dealerCode){var theDealer=new Dealer(TCI.Globals.dealerBrand,TCI.Globals.dealerCode,false,null,null);json.TciConsumerInfoRequest.dealerIdentifier={"dealerCode":TCI.Globals.dealerCode,"provinceCode":{"provinceCode":theDealer.getProvince()}};json.TciConsumerInfoRequest.consumerInfoIdentifier.personTypeDetails.alias.value=TCI.Globals.dealerCode;json.TciConsumerInfoRequest.requestIdentifier.constraintCd="N";}
return JSON.stringify(json);};TCI.Data.getProfile=function(loginId,createIfMissing,forceUpdate)
{TCI.cas.assertCasEmailPrefix('TCI.Data.getProfile',loginId);TCI.Log.debug('TCI.Data.getProfile: Get user profile. createIfMissing: '+createIfMissing+' forceUpdate:'+forceUpdate);if(this.userProfile!=null&&!forceUpdate){TCI.Log.debug('TCI.Data.getProfile returning cached profile');return this.userProfile;}
var response=TCI.ajax.postSecureJSON(TCI.Utils.getGetConsumerInfoGetAccountURL(),TCI.Data.json_getProfile(loginId),function(){},function(){},false);var responseJSON=null;if(response.status==200)
{responseJSON=JSON.parse(response.responseText);if(responseJSON.serviceInfo.status=='ERROR'&&responseJSON.serviceInfo.errorCode=='ERROR100'&&createIfMissing&&TCI.Data.createProfile(loginId)){TCI.Log.debug('TCI.Data.getProfile recursive call to look it up');this.userProfile=TCI.Data.getProfile(loginId,false,true);return this.userProfile;}else if(responseJSON.serviceInfo.status=='ERROR'){TCI.Log.debug('TCI.Data.getProfile - Service returned error.');return null;}}
this.userProfile=responseJSON;return this.userProfile;};TCI.Data.json_getProfile=function(loginId)
{TCI.cas.assertCasEmailPrefix('TCI.Data.json_getProfile',loginId);var json={"TciConsumerInfoRequest":{"userIdentifier":{"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId(),"provinceCode":{"provinceCode":""}},"requestIdentifier":{"requestType":"READ","loginId":loginId,"brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale()}}};return JSON.stringify(json);};TCI.Data.deleteAccount=function(params)
{TCI.Log.debug('TCI.Data.deleteAccount: Delete user account.');var profileDeleted=false;var accountDeleted=false;try{TCI.ajax.postSecureJSON(TCI.Utils.getGetConsumerInfoDeleteAccountURL(),TCI.Data.json_deleteProfile(params.loginId),function(response){if(response.serviceInfo.status=="SUCCESS"){profileDeleted=true;TCI.Log.debug('Profile deleted successfuly');}else{TCI.Log.debug(response.serviceInfo.serviceDetails);}},function(err){TCI.Log.warn('Error deleting profile: '+err);},false);if(profileDeleted){TCI.ajax.postSecureJSON(TCI.Utils.getGetAuthenticationDeleteAccountURL(),TCI.Data.json_deleteAccount(params.loginId),function(response){if(response.deleteAccountResponse.serviceInfo.status=="SUCCESS"){accountDeleted=true;TCI.Log.debug('Account deleted successfuly');}else{TCI.Log.debug(response.deleteAccountResponse.serviceInfo.serviceDetails);}},function(err){TCI.Log.debug('Error deleting account: '+err);},false);}
if(profileDeleted&&accountDeleted){params.success();}else{params.error();}}catch(err){TCI.Log.debug('Error deleting account: '+err);params.error();}};TCI.Data.json_deleteProfile=function(loginId)
{var json={"TciConsumerInfoRequest":{"userIdentifier":{"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId()},"requestIdentifier":{"requestType":"DELETE","loginId":loginId||TCI.Globals.loginId,"brand":TCI.Globals.brand,"locale":TCI.Core.getFullLocale(),"constraintCd":"","consumerId":0,"savedVehicleLocator":""}}};return JSON.stringify(json);};TCI.Data.json_deleteAccount=function(loginId)
{var json={"deleteAccountRequest":{"accountEmail":loginId||TCI.Globals.loginId}};return JSON.stringify(json);};TCI.Data.getVehicleLink=function(params)
{TCI.ajax.postJSON(TCI.Utils.getGetProcessVehicleForSocialURL(),TCI.Data.json_getVehicleLink(params.config),function(response)
{if(response.serviceInfo.status=='SUCCESS'&&response.savedVehicle){var vlink=response.savedVehicle[0].savedVehicleId.trim();TCI.Log.debug('TCI.Data.getVehicleLink: configuration link = '+vlink);params.success(vlink);}else{TCI.Log.warn('TCI.Data.getVehicleLink: status not SUCCESS or saveVehicle missing');params.error();}},function(err)
{TCI.Log.warn('TCI.Data.getVehicleLink: '+err);params.error();},false);};TCI.Data.json_getVehicleLink=function(conf)
{var json={"TciConsumerInfoRequest":{"userIdentifier":{"programId":TCI.Globals.programId,"tciUserId":TCI.Utils.getTCIUserId(),"provinceCode":{"provinceCode":""}},"requestIdentifier":{"requestType":!!conf.getVehicleId()?"READ":"CREATE","constraintCd":"N","consumerId":0,"savedVehicleLocator":!!conf.getVehicleId()?conf.getVehicleId():"","brand":TCI.Globals.brand,"loginId":"","emailAddress":[],"emailBody":"","locale":TCI.Core.getFullLocale()},"consumerInfoIdentifier":{"personTypeDetails":{"URICommunication":[]},"loginId":""},"savedVehicleIdentifier":!!conf.getVehicleId()?[]:[conf.getConfigurationJson()]}};return JSON.stringify(json);};TCI.Data.getImageURL=function(params)
{var imagePath=null;if(!!TCI.Data.imageMap[params.path])
{imagePath=TCI.Data.imageMap[params.path];if(params.success&&typeof(params.success)=='function'){params.success(imagePath);}}
else
{$.ajax({type:'GET',dataType:'text',contentType:'text/html; charset='+TCI.Data.charset,async:params.async||false,url:TCI.Utils.getImageServiceURL(params.path),success:function(data){imagePath=data.trim();if(imagePath!='')
{imagePath=TCI.Utils.getMediaURL(imagePath);TCI.Data.imageMap[params.path]=imagePath;if(params.success&&typeof(params.success)=='function'){params.success(imagePath);}}
else
{imagePath=null;TCI.Log.warn('TCI.Data.getImageURL: Error getting image URL: Service response: '+data);if(params.error&&typeof(params.error)=='function'){params.error();}}},error:function(err){TCI.Log.warn('TCI.Data.getImageURL: Error getting image URL: ',err);if(params.error&&typeof(params.error)=='function'){params.error();}}});}
return imagePath;};TCI.Data.getLanguageSpecificNodeValue=function(node,locale,encode)
{TCI.Core.Encoder.EncodeType="entity";locale=(locale||TCI.Globals.locale).toLowerCase();if(!node){return'';}
var nodeValue='';var nodeLocale;if(!node.length)
{nodeValue=!!node.$?node.$.trim():'';}
else
{for(var i=0;i<node.length;i++)
{nodeLocale=node[i]['@languageID']||node[i]['@languageId'];if(!!nodeLocale&&nodeLocale.indexOf(locale)>-1)
{nodeValue=node[i].$?node[i].$.trim():'';}}}
return(!!encode)?TCI.Core.Encoder.htmlEncode(nodeValue):nodeValue;};TCI.Data.getArrayNode=function(node)
{if(!node){return[];};return!node.length?[node]:node;};TCI.Data.parseZone=function(zone,province){if(typeof(zone)=='string'){if(zone==province){return true;}}else{for(var z in zone){if(zone[z]==province){return true;}}}};TCI.Data.isIncompleteProfile=function()
{var response=TCI.Data.getProfile(TCI.Globals.loginId);if(response==null)
{return true;}
else
{var person=response.consumerProfile.personTypeDetails;var hasPhone=false;for(var i=0;i<person.telephoneCommunication.length;i++){if(person.telephoneCommunication[i].completeNumber.value!=''){hasPhone=true;break;}}
var hasAddress=(person.residenceAddress&&person.residenceAddress.lineOne.value!='')||(person.residenceAddress&&person.residenceAddress.cityName.value!='')||(person.residenceAddress&&person.residenceAddress.postcode&&person.residenceAddress.postcode.value!='')||(person.residenceAddress&&person.residenceAddress.stateOrProvinceCountrySubDivisionID!='');return person.givenName.value==''&&person.familyName.value==''&&person.salutation.value==''&&!hasPhone&&!hasAddress&&person.ageMeasure.value<16;}};var TCI=(function(name){return name;}(TCI||{}));TCI.Core=(function(){return{getBrandNamespace:function(){var namespace;switch(TCI.Globals.brand){case"TOY":namespace="Toyota";break;case"SCI":namespace="Scion";break;default:throw("TCI.Core.getBrandNamespace(): Brand has not been initialized");}
return namespace;},images:{},global:new Object(),createCookie:function(name,value,days)
{if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires='; expires='+date.toGMTString();}
else var expires="";document.cookie=name+'='+value+expires+'; path='+TCI.Globals.contextPath;},createCookieWithDomainAndPath:function(name,value,days,path)
{if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires='; expires='+date.toGMTString();}
else var expires="";document.cookie=name+'='+value+expires+'; path='+path;},readCookie:function(name)
{var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;},readCookies:function(name)
{var nameEQ=name+"=";var ca=document.cookie.split(';');var vals=[];for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)vals[vals.length]=c.substring(nameEQ.length,c.length);}
return vals;},eraseCookieWithDomainAndPath:function(name,path,domain)
{document.cookie=name+'=;path='+path+';domain='+domain+';expires=Thu, 01-Jan-70 00:00:01 GMT;';},eraseCookieWithPath:function(name,path)
{document.cookie=name+'=;path='+path+'; expires=Thu, 01-Jan-70 00:00:01 GMT;';TCI.Core.eraseCookieSimple(name);},eraseCookie:function(name)
{document.cookie=name+'=;path='+TCI.Globals.contextPath+'; expires=Thu, 01-Jan-70 00:00:01 GMT;';TCI.Core.eraseCookieSimple(name);},eraseCookieSimple:function(name)
{var date=new Date();date.setTime(date.getTime()+(-1*24*60*60*1000));document.cookie=name+'=;expires=Thu, 01-Jan-70 00:00:01 GMT;';},isNewSession:function()
{if(!!TCI.Core.readCookie('session-in-progress')){return false;}else{!TCI.Core.createCookie('session-in-progress',true,1);return true;}},getFullLocale:function()
{return TCI.Globals.locale+'-'+(TCI.Globals.locale=='en'?'us':'ca');},getContextPath:function()
{return $('meta[name="contextPath"]').attr('content');},getLang:function()
{return $('html').attr('lang');},isDealer:function()
{return!!TCI.Globals.dealerCode;},getVehiclesPerPage:function()
{return 10;},loadImage:function(imagePath,errorPath,imageElem,callbacks)
{showImage=function(elem,url)
{if(elem instanceof jQuery){elem.load(function(){return false;});elem.attr('src',url);}else{elem.onload=function(){return false;};elem.src=url;}
$(elem).show();};if(!TCI.Core.images[imagePath]){TCI.Core.images[imagePath]=new Image();}
TCI.Core.images[imagePath].onBeforeOnLoad=!callbacks?undefined:callbacks.onBeforeOnLoad;TCI.Core.images[imagePath].onBeforeOnError=!callbacks?undefined:callbacks.onBeforeOnError;TCI.Core.images[imagePath].onAfterOnLoad=!callbacks?undefined:callbacks.onAfterOnLoad;TCI.Core.images[imagePath].onAfterOnError=!callbacks?undefined:callbacks.onAfterOnError;TCI.Core.images[imagePath].onload=function()
{TCI.Log.warn('TIME->loadImage: '+(new Date().getTime()-pageLoadStart.getTime())/1000+'s');this.exists=true;this.onload=function(){return false;};if(!(!this.onBeforeOnLoad?true:this.onBeforeOnLoad(this,imageElem)!=false)){return;}
if(!!imageElem){showImage(imageElem,imagePath);}
if(!(!this.onAfterOnLoad?true:this.onAfterOnLoad(this,imageElem)!=false)){return;}};TCI.Core.images[imagePath].onerror=function()
{TCI.Log.warn('TIME->loadImage: '+(new Date().getTime()-pageLoadStart.getTime())/1000+'s');this.exists=false;this.onload=function(){return false;};if(!(!this.onBeforeOnError?true:this.onBeforeOnError(this,imageElem)!=false)){return;}
if(!!errorPath){this.src=errorPath;if(!!imageElem){showImage(imageElem,errorPath);}}
if(!(!this.onAfterOnError?true:this.onAfterOnError(this,imageElem)!=false)){return;}};if(TCI.Core.images[imagePath].exists){TCI.Core.images[imagePath].onload();}else{TCI.Core.images[imagePath].src=imagePath;}},getFromPrices:function()
{var tmp=[];TCI.Data.getBrand({success:function(seriesDetails)
{for(var i in seriesDetails.TciGetSeriesModelViewDataArea)
{var series=seriesDetails.TciGetSeriesModelViewDataArea[i].TciSeriesModelView.TciSeriesModelView.TciSeries;var code=series.TciSeriesInfo.SeriesCode.$;var name=TCI.Data.getLanguageSpecificNodeValue(series.TciSeriesInfo.SeriesName);var price=100000;var year=null;var currentModelYear=TCI.Globals['model_year_'+code.toLowerCase()];series.TciSeriesModel=(!series.TciSeriesModel.length)?[series.TciSeriesModel]:series.TciSeriesModel;for(var j in series.TciSeriesModel){if(series.TciSeriesModel[j].ModelYear==currentModelYear){var tmpPrice=parseInt(series.TciSeriesModel[j].Price.ChargeAmount.$);price=(price>tmpPrice)?tmpPrice:price;year=series.TciSeriesModel[j].ModelYear;}}
tmp[code]={name:name.toUpperCase(),price:price,year:year};}},error:function(){}});var staticPrices=TCI.Globals.static_vehicle_msrp;if(!!staticPrices){staticPrices=staticPrices.split(',');if(staticPrices.length>0){for(var j in staticPrices){var staticPrice=staticPrices[j].split(':');tmp[staticPrice[0]]={name:staticPrice[0].toUpperCase(),price:staticPrice[1]};}}}
return tmp;},getImage:function(imagePath)
{return TCI.Core.images[imagePath];},isLoggerOff:function()
{return(TCI.Globals.logger_off)?TCI.Globals.logger_off=='true':false;},getApxForTerm:function(acsyApxArray,term)
{var objectArrayIndex=0;var myObjectArray=new Array();var myObject=new Object();var found;var mySortedArray=new Array();myObject.apx="";myObject.foundCount=0;for(var i=0;i<acsyApxArray.length;i++)
{for(var j=0;j<acsyApxArray[i].OfferToPackageIDGroup.length;j++)
{if(myObjectArray.length>0){found=false;for(var k=0;k<myObjectArray.length;k++)
{if(myObjectArray[k].apx==acsyApxArray[i].OfferToPackageIDGroup[j].OfferToApxPackageID){found=true;break;}}
if(found==false){myObject=new Object();myObject.apx=acsyApxArray[i].OfferToPackageIDGroup[j].OfferToApxPackageID;myObject.foundCount=0;objectArrayIndex=objectArrayIndex+1;myObjectArray[objectArrayIndex]=myObject;}}
else{myObject.apx=acsyApxArray[i].OfferToPackageIDGroup[j].OfferToApxPackageID;myObject.foundCount=0;myObjectArray[0]=myObject;}}}
for(var i=0;i<myObjectArray.length;i++)
{for(var j=0;j<acsyApxArray.length;j++)
{for(var k=0;k<acsyApxArray[j].OfferToPackageIDGroup.length;k++)
{if(myObjectArray[i].apx==acsyApxArray[j].OfferToPackageIDGroup[k].OfferToApxPackageID){myObjectArray[i].foundCount=myObjectArray[i].foundCount+1;}}}
if(myObjectArray[i].foundCount==acsyApxArray.length){return myObjectArray[i].apx+term;}}
return"00"+term;}};})();TCI.LoadSpinner=function(params)
{var params=params||{};this.container=!params.container?null:$(params.container);this.text=params.text||TCI.Utils.getLabel('label_loading').toUpperCase();this.size=params.size||'small';this.width=params.width||150;this.top=params.top||310;this.z_index=params.z_index;this.active=false;this.attach=params.attach||false;this.reposition=params.reposition||false;};TCI.LoadSpinner.prototype.position=function()
{if(!this.handle)
{this.handle=$('<div class="loading_panel" style="display:none;"><div><img src="'+TCI.Utils.getQualifiedMediaURL('/media/chrome/load_spinner_'+this.size+'.gif')+'"/></div><p>'+this.text+'</p></div>').appendTo('body');this.handle.css({width:this.width});if(this.z_index){this.handle.css({"z-index":this.z_index});}
if(!this.container||this.container.length==0){this.handle.center($('body'));this.handle.css({top:this.top+'px'});}else{if(this.attach){this.container.empty().append(this.handle);this.handle.css({margin:'0px auto'});}else{this.handle.center(this.container);}}}
if(this.attach){this.container.empty().append(this.handle);this.handle.css({margin:'0px auto'});}
if(this.reposition&&this.container&&this.container.is(':visible')){this.handle.center(this.container);}
return this;};TCI.LoadSpinner.prototype.show=function()
{this.position();this.active=true;this.handle.show();return this;};TCI.LoadSpinner.prototype.hide=function()
{if(!!this.handle)
this.handle.hide();this.active=false;return this;};TCI.LoadSpinner.prototype.move=function(x,y)
{if(!!this.handle){this.handle.css({top:parseInt(this.handle.css('top'))+y});this.handle.css({left:parseInt(this.handle.css('left'))+x});}
return this;};TCI.LoadSpinner.prototype.distroy=function()
{if(!!this.handle)
this.handle.remove();this.active=false;};TCI.Core.Mask=function(o){this.mask=document.createElement('div');$(this.mask).addClass('mask');$(this.mask).attr('id',o.name+"_mask");this.z_index=o.z_index-10;this.width=$(window).width();this.height=$(window).height();this.top=0;this.maskOpacity=o.maskOpacity||0.7;$(this.mask).css({width:this.width,height:this.height,background:'#000',opacity:this.maskOpacity,position:'fixed',left:0,top:this.top,'z-index':this.z_index});$('body').append(this.mask);this.addListeners();};TCI.Core.Mask.prototype.addListeners=function(){var self=this;$(window).resize(function(){$(self.mask).width($(window).width()).height($(window).height());});};TCI.Core.Mask.prototype.show=function(){var visibleModals=TCI.Core.Modal.getVisibleModals();if(visibleModals.length==0){var self=this;$(self.mask).show();}
else{for(var i in visibleModals){var orgZIndex=visibleModals[i].getElement().css('z-index');visibleModals[i].getElement().css({'z-index':parseInt(orgZIndex)-20});}}};TCI.Core.Mask.prototype.hide=function(){var visibleModals=TCI.Core.Modal.getVisibleModals();for(var i in visibleModals){var orgZIndex=visibleModals[i].getElement().css('z-index');visibleModals[i].getElement().css({'z-index':visibleModals[i].z_index});}
var self=this;$(self.mask).hide();};TCI.Core.Modal=function(o){this.parent='body';this.maskOpacity="0.5";if(o){this.setProperties(o);this.addListeners();this.finalize();}};TCI.Core.Modal.prototype={setProperties:function(o){this.name=o.name||"modal";this.title=o.title||null;this.url=o.url||null;this.z_index=o.z_index||88888;this.data=o.data||{};this.trigger=o.trigger||"no-trigger";this.params=o.params||{};this.maskOpacity=o.maskOpacity||"0.5";this.width=o.width||'640px';this.height=o.height||'315px';this.selector=o.selector||'id';this.iframe=o.iframe||false;this.content=o.content||null;this.parent=o.parent||'body';this.isInitialised=false;this.scrollable=o.scrollable||false;this.allowedHeight=o.allowedHeight||340;this.modal;this.mask;this.onTrigger=o.onTrigger||this.onTrigger;this.onBeforeInit=o.onBeforeInit||this.onBeforeInit;this.onBeforeLoad=o.onBeforeLoad||this.onBeforeLoad;this.onBeforeShow=o.onBeforeShow||this.onBeforeShow;this.onBeforeClose=o.onBeforeClose||this.onBeforeClose;this.onBeforeRefresh=o.onBeforeRefresh||this.onBeforeRefresh;this.onShow=o.onShow||this.onShow;this.onClose=o.onClose||this.onClose;this.onError=o.onError||this.onError;this.onAfterInit=o.onAfterInit||this.onAfterInit;this.onAfterLoad=o.onAfterLoad||this.onAfterLoad;this.onAfterShow=o.onAfterShow||this.onAfterShow;this.onAfterClose=o.onAfterClose||this.onAfterClose;this.onAfterRefresh=o.onAfterRefresh||this.onAfterRefresh;},init:function(){this.onBeforeInit();this.modal=this.getContainer();this.modal.appendTo(this.parent);this.params.name=this.name;this.setZIndex();this.setMask();this.setDimensions();this.iframe?this.addiframe():this.addOther();this.onAfterInit();this.isInitialised=true;TCI.Core.Modal.addModal(this);},refreshContent:function(){this.isInitialised=false;this.onBeforeRefresh();this.removeContent();this.iframe?this.addiframe():this.addOther();this.onAfterRefresh();this.isInitialised=true;},removeContent:function(){this.modal.find('.modal_content_container').remove();},setScrollPane:function(){if(!this.scrollable){return;}
if($('#'+this.name+' .modal_content_container')[0].scrollHeight>this.allowedHeight){$('#'+this.name+' .modal_content_container').jScrollPane({scrollbarWidth:15,dragMinHeight:36,dragMaxHeight:36});}},finalize:function(){},setPosition:function(){var lft=Math.round(($(window).width()-$('#'+this.name).width())/2);if(typeof(Scion)!='undefined'){!TCI.Browser.isIE()?lft-=20:0;}
var tp=Math.round(($(window).height()-$('#'+this.name).height())/2);!TCI.Browser.isIE()?tp-=20:0;tp<0?tp=0:0;$('#'+this.name).css({left:lft,top:tp});},setOpacity:function(){$('#'+this.name).css({opacity:0});},setMask:function(){this.mask=new TCI.Core.Mask({name:this.name,z_index:this.z_index,opacity:this.maskOpacity});},setZIndex:function(){$(this.modal).css({'z-index':this.z_index,'position':'fixed'});},setDimensions:function(){$('#'+this.name).css({width:this.width,height:this.height});},addListeners:function(){var self=this;var el="";switch(this.selector){case'class':el='.'+this.trigger;break;case'jquery':el=this.trigger;break;default:el='#'+this.trigger;}
$(el).unbind('click');$(el).live('click',function(e){e.preventDefault();if(!self.isInitialised){self.init();self.isInitialised=true;}
self.onTrigger(e);self.show();return false;});$('#'+this.name+' .close-it').live('click',function(event){self.closeModal();event.preventDefault();});$('#'+this.name+' .external_continue').live('click',function(){self.closeModal();});$(window).resize(function(){self.setPosition();});this.suppListenerHook();},suppListenerHook:function(){},getContainer:function(){return $('<div id="'+this.name+'" class="bp_modal loaded" />').append('<span class="tr"><span class="tl"></span></span><div class="modal_container"><div class="closer close-it" /><h2 class="modal_content_title">'+(this.title!==null?this.title:'')+'</h2>'+this.containerBody()+'</div><span class="br"><span class="bl"></span></span>');},containerBody:function(){return"";},onTrigger:function(event){},onError:function(err){},onBeforeInit:function(){},onBeforeLoad:function(){},onBeforeShow:function(){},onBeforeClose:function(){},onBeforeRefresh:function(){},onAfterInit:function(){},onAfterLoad:function(){},onAfterShow:function(){},onAfterClose:function(){},onAfterRefresh:function(){},onLoad:function(){var self=this;$('#'+this.name+' .close-it').click(function(event){self.closeModal();event.preventDefault();});},onShow:function(){},onClose:function(){},preparePage:function()
{if(typeof(Scion)!='undefined'){Scion.Core.hideUnity();Scion.widgets.ToolTip.kill();}else if(typeof(Toyota)!='undefined'){Toyota.Core.hideTooltips();}},reparePage:function()
{if(typeof(Scion)!='undefined'){Scion.widgets.ToolTip.kill();Scion.Core.showUnity();}else if(typeof(Toyota)!='undefined'){Toyota.Core.hideTooltips();}},show:function(param)
{this.onBeforeShow(param);this.preparePage();this.mask.show();$('#'+this.name).css({'left':$('#'+this.name).css('left')});$('#'+this.name).show();this.setPosition();this.setScrollPane();this.onAfterShow(param);return this;},addiframe:function()
{$('#'+this.name+' .modal_container').append('<iframe class="modal_content_container" src="'+this.url+'" scrolling="no" frameborder="0">');},addOther:function()
{try{var htmlContent='';if(this.content)
{switch(this.content.type){case"html":htmlContent=$(this.content.target).html();if(this.content.isClearAfter){$(this.content.target).empty().remove();}
break;default:htmlContent=new EJS({url:this.content.target}).render(this.data);break;}}
else
{if(!this.url){htmlContent='';}
else{if(TCI.View.isTemplate(this.url)){htmlContent=TCI.View.getTemplate(this.url,this.data);}else{htmlContent=new EJS({url:TCI.Globals.brand=='TOY'?TCI.Utils.getContentPath(this.url):this.url}).render(this.data);}}}
$('#'+this.name+' .modal_container').append('<div class="modal_content_container">'+htmlContent+'</div>');}
catch(err){this.onError(err);}},showModal:function()
{$(this.modal).overlay().load();},closeModal:function()
{this.onBeforeClose();$('#'+this.name).hide();if(this.mask){this.mask.hide();}
this.reparePage();this.onClose();this.onAfterClose();},getElement:function(){return $(this.modal);},isVisible:function(){return $(this.modal).is(':visible');},hideBorder:function(){this.getElement().addClass('no_border');return this;},showBorder:function(){this.getElement().removeClass('no_border');return this;}};TCI.Core.Modal.addModal=function(modal)
{if(!TCI.Core.Modal.modalsArray){TCI.Core.Modal.modalsArray=[];}
TCI.Core.Modal.modalsArray.push(modal);};TCI.Core.Modal.getVisibleModals=function()
{var tmp=[];if(!!TCI.Core.Modal.modalsArray){for(var i in TCI.Core.Modal.modalsArray){if(TCI.Core.Modal.modalsArray[i].isVisible()){tmp.push(TCI.Core.Modal.modalsArray[i]);}}}
return tmp;};TCI.Core.Modal.show=function(modal)
{switch(TCI.Globals.brand){case'TOY':var tp=($(window).height()/2)-($('#'+modal.name).height()/2);var lf=($(window).width()/2)-($('#'+modal.name).width()/2);$('#'+modal.name).css({top:tp,left:lf});modal.mask.show();$('#'+modal.name).show().animate({opacity:1},500);break;case'SCI':modal.preparePage();modal.mask.show();var targetLeft=$('#'+modal.name).css('left');$('#'+modal.name).css({'left':targetLeft});$('#'+modal.name).show();modal.setPosition();break;}};TCI.Core.ChildModal=function(o){if(o){this.setProperties(o);this.init();this.addListeners();this.finalize();}};TCI.Core.ChildModal.prototype=new TCI.Core.Modal();TCI.Core.ChildModal.prototype.setZIndex=function(zIndex){this.z_index=zIndex||99999;$(this.modal).css({'z-index':this.z_index,'position':'fixed'});};TCI.Core.Carousel=function(){this.manager;this.modal;this.name;this.current;};TCI.Core.Carousel.prototype={setup:function(current){this.current=current;this.addListeners();},removeListeners:function(){$('#'+this.name+' .left').unbind('click');$('#'+this.name+' .right').unbind('click');},addListeners:function(){var self=this;this.removeListeners();$('#'+this.name+' .left').click(function(){self.changeContent(-1);});$('#'+this.name+' .right').click(function(){self.changeContent(1);});},changeContent:function(num){},hide:function(nav){$('#'+this.name+' .'+nav).hide();},show:function(){}};TCI.Core.Encoder={EncodeType:"entity",CharsNumeric:new Array('&#160;','&#161;','&#162;','&#163;','&#164;','&#165;','&#166;','&#167;','&#168;','&#169;','&#170;','&#171;','&#172;','&#173;','&#174;','&#175;','&#176;','&#177;','&#178;','&#179;','&#180;','&#181;','&#182;','&#183;','&#184;','&#185;','&#186;','&#187;','&#188;','&#189;','&#190;','&#191;','&#192;','&#193;','&#194;','&#195;','&#196;','&#197;','&#198;','&#199;','&#200;','&#201;','&#202;','&#203;','&#204;','&#205;','&#206;','&#207;','&#208;','&#209;','&#210;','&#211;','&#212;','&#213;','&#214;','&#215;','&#216;','&#217;','&#218;','&#219;','&#220;','&#221;','&#222;','&#223;','&#224;','&#225;','&#226;','&#227;','&#228;','&#229;','&#230;','&#231;','&#232;','&#233;','&#234;','&#235;','&#236;','&#237;','&#238;','&#239;','&#240;','&#241;','&#242;','&#243;','&#244;','&#245;','&#246;','&#247;','&#248;','&#249;','&#250;','&#251;','&#252;','&#253;','&#254;','&#255;','&#34;','&#38;','&#60;','&#62;','&#338;','&#339;','&#352;','&#353;','&#376;','&#710;','&#732;','&#8194;','&#8195;','&#8201;','&#8204;','&#8205;','&#8206;','&#8207;','&#8211;','&#8212;','&#8216;','&#8217;','&#8218;','&#8220;','&#8221;','&#8222;','&#8224;','&#8225;','&#8240;','&#8249;','&#8250;','&#8364;','&#402;','&#913;','&#914;','&#915;','&#916;','&#917;','&#918;','&#919;','&#920;','&#921;','&#922;','&#923;','&#924;','&#925;','&#926;','&#927;','&#928;','&#929;','&#931;','&#932;','&#933;','&#934;','&#935;','&#936;','&#937;','&#945;','&#946;','&#947;','&#948;','&#949;','&#950;','&#951;','&#952;','&#953;','&#954;','&#955;','&#956;','&#957;','&#958;','&#959;','&#960;','&#961;','&#962;','&#963;','&#964;','&#965;','&#966;','&#967;','&#968;','&#969;','&#977;','&#978;','&#982;','&#8226;','&#8230;','&#8242;','&#8243;','&#8254;','&#8260;','&#8472;','&#8465;','&#8476;','&#8482;','&#8501;','&#8592;','&#8593;','&#8594;','&#8595;','&#8596;','&#8629;','&#8656;','&#8657;','&#8658;','&#8659;','&#8660;','&#8704;','&#8706;','&#8707;','&#8709;','&#8711;','&#8712;','&#8713;','&#8715;','&#8719;','&#8721;','&#8722;','&#8727;','&#8730;','&#8733;','&#8734;','&#8736;','&#8743;','&#8744;','&#8745;','&#8746;','&#8747;','&#8756;','&#8764;','&#8773;','&#8776;','&#8800;','&#8801;','&#8804;','&#8805;','&#8834;','&#8835;','&#8836;','&#8838;','&#8839;','&#8853;','&#8855;','&#8869;','&#8901;','&#8968;','&#8969;','&#8970;','&#8971;','&#9001;','&#9002;','&#9674;','&#9824;','&#9827;','&#9829;','&#9830;'),CharsEntity:new Array('&nbsp;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&sup1;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&thorn;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&Oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;','&quot;','&amp;','&lt;','&gt;','&oelig;','&oelig;','&scaron;','&scaron;','&yuml;','&circ;','&tilde;','&ensp;','&emsp;','&thinsp;','&zwnj;','&zwj;','&lrm;','&rlm;','&ndash;','&mdash;','&lsquo;','&rsquo;','&sbquo;','&ldquo;','&rdquo;','&bdquo;','&dagger;','&dagger;','&permil;','&lsaquo;','&rsaquo;','&euro;','&fnof;','&alpha;','&beta;','&gamma;','&delta;','&epsilon;','&zeta;','&eta;','&theta;','&iota;','&kappa;','&lambda;','&mu;','&nu;','&xi;','&omicron;','&pi;','&rho;','&sigma;','&tau;','&upsilon;','&phi;','&chi;','&psi;','&omega;','&alpha;','&beta;','&gamma;','&delta;','&epsilon;','&zeta;','&eta;','&theta;','&iota;','&kappa;','&lambda;','&mu;','&nu;','&xi;','&omicron;','&pi;','&rho;','&sigmaf;','&sigma;','&tau;','&upsilon;','&phi;','&chi;','&psi;','&omega;','&thetasym;','&upsih;','&piv;','&bull;','&hellip;','&prime;','&prime;','&oline;','&frasl;','&weierp;','&image;','&real;','&trade;','&alefsym;','&larr;','&uarr;','&rarr;','&darr;','&harr;','&crarr;','&larr;','&uarr;','&rarr;','&darr;','&harr;','&forall;','&part;','&exist;','&empty;','&nabla;','&isin;','&notin;','&ni;','&prod;','&sum;','&minus;','&lowast;','&radic;','&prop;','&infin;','&ang;','&and;','&or;','&cap;','&cup;','&int;','&there4;','&sim;','&cong;','&asymp;','&ne;','&equiv;','&le;','&ge;','&sub;','&sup;','&nsub;','&sube;','&supe;','&oplus;','&otimes;','&perp;','&sdot;','&lceil;','&rceil;','&lfloor;','&rfloor;','&lang;','&rang;','&loz;','&spades;','&clubs;','&hearts;','&diams;'),isEmpty:function(val){if(val){return((val===null)||val.length==0||/^\s+$/.test(val));}else{return true;}},HTML2Numerical:function(s){return this.swapArrayVals(s,this.CharsEntity,this.CharsNumeric);},NumericalToHTML:function(s){return this.swapArrayVals(s,this.CharsNumeric,this.CharsEntity);},numEncode:function(s){if(this.isEmpty(s))return"";var e="";for(var i=0;i<s.length;i++)
{var c=s.charAt(i);if(c<" "||c>"~")
{c="&#"+c.charCodeAt()+";";}
e+=c;}
return e;},htmlDecode:function(s){var c,m,d=s;if(this.isEmpty(d))return"";d=this.HTML2Numerical(d);arr=d.match(/&#[0-9]{1,5};/g);if(arr!=null){for(var x=0;x<arr.length;x++){m=arr[x];c=m.substring(2,m.length-1);if(c>=-32768&&c<=65535){d=d.replace(m,String.fromCharCode(c));}else{d=d.replace(m,"");}}}
return d;},htmlEncode:function(s,dbl){if(this.isEmpty(s))return"";dbl=dbl|false;if(dbl){if(this.EncodeType=="numerical"){s=s.replace(/&/g,"&#38;");}else{s=s.replace(/&/g,"&amp;");}}
s=this.XSSEncode(s,false);if(this.EncodeType=="numerical"||!dbl){s=this.HTML2Numerical(s);}
s=this.numEncode(s);if(!dbl){s=s.replace(/&#/g,"##AMPHASH##");if(this.EncodeType=="numerical"){s=s.replace(/&/g,"&#38;");}else{s=s.replace(/&/g,"&amp;");}
s=s.replace(/##AMPHASH##/g,"&#");}
s=s.replace(/&#\d*([^\d;]|$)/g,"$1");if(!dbl){s=this.correctEncoding(s);}
if(this.EncodeType=="entity"){s=this.NumericalToHTML(s);}
return s;},XSSEncode:function(s,en){if(!this.isEmpty(s)){en=en||true;if(en){s=s.replace(/\'/g,"&#39;");s=s.replace(/\"/g,"&quot;");s=s.replace(/</g,"&lt;");s=s.replace(/>/g,"&gt;");}else{s=s.replace(/\'/g,"&#39;");s=s.replace(/\"/g,"&#34;");s=s.replace(/</g,"&#60;");s=s.replace(/>/g,"&#62;");}
return s;}else{return"";}},hasEncoded:function(s){if(/&#[0-9]{1,5};/g.test(s)){return true;}else if(/&[A-Z]{2,6};/gi.test(s)){return true;}else{return false;}},stripUnicode:function(s){return s.replace(/[^\x20-\x7E]/g,"");},correctEncoding:function(s){return s.replace(/(&amp;)(amp;)+/,"$1");},swapArrayVals:function(s,arr1,arr2){if(this.isEmpty(s))return"";var re;if(arr1&&arr2){if(arr1.length==arr2.length){for(var x=0,i=arr1.length;x<i;x++){re=new RegExp(arr1[x],'g');s=s.replace(re,arr2[x]);}}}
return s;},inArray:function(item,arr){for(var i=0,x=arr.length;i<x;i++){if(arr[i]===item){return i;}}
return-1;}};TCI.serviceForm=(function(name){return name;}(TCI.serviceForm||{}));TCI.serviceForm.ButtonManager=(function()
{var _init=function(){initListeners();};var initListeners=function(){$('a.submit.action_btn').focus(function(){$(this).addClass('focussed');}).blur(function(){$(this).removeClass('focussed');});};var _setContainer=function(el,elType){var elementType=elType!=""?elType:':button';$(el).attr('tabindex',0);$(el).focus(function(){$(this).find(':button').addClass('focussed');$(this).attr("hideFocus","hidefocus");}).blur(function(){$(this).find(elementType).removeClass('focussed');}).keydown(function(event){switch(event.keyCode){case 13:event.stopPropagation();$(this).find(elementType).click();break;default:break;}});};return{init:function(){_init();},setContainer:function(el,type){tp=type?type:"";_setContainer(el,tp);}};})();TCI.Browser=(function(){var browser='other';var setup=function(){if(document.all){if(navigator.appVersion.indexOf("MSIE 7.")!=-1){browser='ie7';return;}
if(document.documentMode==8){browser='ie8';return;}
if(navigator.appVersion.indexOf("MSIE 9.")!=-1){browser='ie9';return;}}
browser='other';};return{is:function(b){if(b==browser){return true;}
return false;},isIE:function(){if(document.all){return true;}
return false;},isIE9:function(){return this.is('ie9');},isIE8:function(){return this.is('ie8');},isIE7:function(){return this.is('ie7');},init:function(){setup();}};})();TCI.Browser.init();TCI.HashMonitor=(function()
{var intervalId=null;return{hash:null,start:function(callback)
{TCI.HashMonitor.hash=TCI.Utils.getURLHash();intervalId=setInterval(function(){var current=TCI.Utils.getURLHash();if(TCI.HashMonitor.hash!=current){TCI.HashMonitor.hash=current;callback(current);}},500);},stop:function()
{clearInterval(intervalId);}};})();TCI.ZoomIcon=function(imageUrl,iconElem)
{this.elem=iconElem;this.imageUrl=imageUrl;this.checkImageExists=false;};TCI.ZoomIcon.prototype.render=function(elem)
{var icon=$(elem||this.elem);if(icon.length==0){return;}
if(!this.checkImageExists){this.exists=true;icon.removeClass('hidden');}
else
{if(this.exists==undefined)
{var self=this;TCI.Core.loadImage(this.imageUrl,null,null,{onAfterOnLoad:function(){self.exists=true;icon.removeClass('hidden');},onAfterOnError:function(){self.exists=false;icon.addClass('hidden');}});}
else if(this.exists){icon.removeClass('hidden');}
else{icon.addClass('hidden');}}};TCI.OptionZoomIcon=function(imageUrl,iconElem)
{this.elem=iconElem;this.imageUrl=imageUrl;};TCI.OptionZoomIcon.prototype=new TCI.ZoomIcon();TCI.OptionZoomIcon.getInstance=function(imageUrl,iconElem)
{if(!TCI.OptionZoomIcon.instances){TCI.OptionZoomIcon.instances=[];}
TCI.OptionZoomIcon.instances[imageUrl]=(!TCI.OptionZoomIcon.instances[imageUrl])?new TCI.OptionZoomIcon(imageUrl,iconElem):TCI.OptionZoomIcon.instances[imageUrl];return TCI.OptionZoomIcon.instances[imageUrl];};TCI.UUID=(function()
{var s=[];var itoh='0123456789ABCDEF';return{generateId:function()
{for(var i=0;i<36;i++)
s[i]=Math.floor(Math.random()*0x10);s[14]=4;s[19]=(s[19]&0x3)|0x8;for(var i=0;i<36;i++)
s[i]=itoh.charAt(s[i]);s[8]=s[13]=s[18]=s[23]='-';return s.join('');}};})();TCI.ImageCheck=(function()
{var cacheList=[];return{run:function(imageList)
{var sendList=[];var resultList=[];for(var i in imageList){var found=false;for(var j in cacheList){if(imageList[i].id==cacheList[j].id){resultList.push(cacheList[j]);found=true;}}
if(!found){sendList.push(imageList[i]);}}
var receivedList=[];var postData={};postData.images=JSON.stringify(sendList);TCI.ajax.post(TCI.Utils.getSecureURL('/CheckImagesAction.action'),postData,function(response){if(response.trim()!='FAILED'){var responseJson=TCI.Utils.parseJSON(response);if(!!responseJson&&!!responseJson.imageList){receivedList=responseJson.imageList;}}},function(){},false);for(var i in receivedList){resultList.push(receivedList[i]);cacheList.push(receivedList[i]);}
return resultList;}};})();var pageLoadStart=new Date();var Scion=(function(name){return name;}(Scion||{}));Scion.widgets={};Scion.Core=(function(){var unityHideCount=0;return{dealerDivisionCode:'S',global:new Object(),urlTwitter:'http://twitter.com/home?status=',urlFacebook:'http://www.facebook.com/sharer.php?u=',vehicleNames:{tc:'tC',iq:'iQ',xd:'xD',xb:'xB'},popUp:function()
{},hideUnity:function()
{unityHideCount++;if(!!Scion.VehicleDisplay){Scion.VehicleDisplay.hideUnity();}},showUnity:function()
{unityHideCount=(unityHideCount==0)?0:unityHideCount-1;if(!!Scion.VehicleDisplay&&unityHideCount==0){setTimeout(function(){if(unityHideCount==0){Scion.VehicleDisplay.showUnity();}},100);}},parseUrl:function(data)
{var e=/^((http|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?$/;if(data.match(e)){return{url:RegExp['$&'],protocol:RegExp.$2,host:RegExp.$3,path:RegExp.$4,file:RegExp.$6,hash:RegExp.$7};}
else{return{url:"",protocol:"",host:"",path:"",file:"",hash:""};}},getDealer:function(province)
{try{return Dealer.getDealer(province);}catch(err){throw err;}}};})();Scion.Core.prototype={};Scion.form={};Scion.LanguageToggle=function(el){this.el=el;};Scion.LanguageToggle.prototype={addListeners:function(){var self=this;$(this.el).click(function(){Scion.LocaleManager.toggle();return false;});}};Scion.LocaleManager=(function(){var nextLocale="";var _toggle=function(){var isSecureRegex=new RegExp('^'+TCI.Globals.contextPath+'\/secure');var locPath=window.location.pathname;var newPath="";if(TCI.Globals.locale=='fr'){if(isSecureRegex.test(locPath)){newPath=locPath.replace(new RegExp('^'+TCI.Globals.contextPath+'\/fr\/secure'),TCI.Globals.contextPath+'/secure');}else{newPath=locPath.replace(new RegExp('^'+TCI.Globals.contextPath+'\/fr'),TCI.Globals.contextPath);}
Scion.LocaleManager.setCookie("en");newPath=_cleanPath(newPath);window.location.href=newPath+location.search;nextLocale="en";}else{if(isSecureRegex.test(locPath)){newPath=locPath.replace(new RegExp('^'+TCI.Globals.contextPath+'\/secure'),TCI.Globals.contextPath+'/fr/secure');}else{newPath=locPath.replace(new RegExp('^'+TCI.Globals.contextPath),TCI.Globals.contextPath+'/fr');}
Scion.LocaleManager.setCookie("fr");newPath=_cleanPath(newPath);window.location.href=newPath+location.search;nextLocale="fr";}};var _cleanPath=function(path){return path.replace(new RegExp('news/post/.*'),'news').replace(new RegExp('news/tag/.*'),'news').replace(new RegExp('news/page/.*'),'news').replace(new RegExp('events/post/.*'),'events').replace(new RegExp('photos/album/.*'),'photos').replace(new RegExp('photos/page/.*'),'photos').replace(new RegExp('videos/tag/.*'),'videos').replace(new RegExp('videos/page/.*'),'videos');};var _setCookie=function(lang){if(lang!=""){TCI.Core.createCookieWithDomainAndPath('language_selection',lang,30,'/');}};var _setPage=function(locale){var locationPath=window.location.pathname.replace(new RegExp('^'+TCI.Globals.contextPath+'\/?'),'/');var newLocationPath=TCI.Globals.contextPath;if(locale=="fr"){newLocationPath+="/fr"+locationPath;}else{newLocationPath+=locationPath.replace(/^\/fr\/?/,'/');}
window.location.href=newLocationPath;};var _getCurrentLocale=function(){return TCI.Globals.locale;};var _getOtherLocale=function(){return(TCI.Globals.locale=="en")?"en":"fr";};var _getCookie=function(){return TCI.Core.readCookie('language_selection');};var _eraseCookie=function(){TCI.Core.eraseCookie('language_selection');};return{init:function(){$(window).unload(function(){_setCookie(nextLocale);});},toggle:function(){_toggle();},setPage:function(locale){_setPage(locale);},getCurrentLocale:function(){return _getCurrentLocale();},getOtherLocale:function(){return _getOtherLocale();},setCookie:function(lang){_setCookie(lang);},getCookie:function(){return _getCookie();},eraseCookie:function(){_eraseCookie();}};})();Scion.Navigation=function(el){this.el=el;};Scion.Navigation.prototype={addListeners:function(){var self=this;$(this.el).hover(function(){$(self.el+' > ul').show();$(self.el).addClass('over');Scion.Core.hideUnity();},function(){$(self.el+' > ul').hide();$(self.el).removeClass('over');Scion.Core.showUnity();});$(this.el+' ul.secondary_navigation li').hover(function(){$(this).addClass('over');},function(){$(this).removeClass('over');});}};Scion.VehicleNavigation=function(el){this.el=el;this.vehicle;this.setDefault();this.addListeners();};Scion.VehicleNavigation.prototype=new Scion.Navigation();Scion.VehicleNavigation.prototype.setDefault=function()
{$(this.el+' ul.secondary_navigation_content > li').hide();$(this.el+' li#secondary_navigation_vehicles_tc').addClass('over');$(this.el+' li#secondary_navigation_vehicles_tc_content').show();$(this.el+' > ul').hide();};Scion.VehicleNavigation.prototype.addListeners=function()
{var self=this;$(this.el+' > a').hover(function(){$(self.el+' ul.secondary_navigation > li').removeClass('over');$(self.el+' li#secondary_navigation_vehicles_tc').addClass('over');$(self.el+' li#secondary_navigation_vehicles_tc_content').show();},function(){});$(this.el).hover(function(){$(self.el+' > ul').show();$(self.el).addClass('over');Scion.Core.hideUnity();},function(){$(self.el+' > ul').hide();$(self.el).removeClass('over');self.setDefault();Scion.Core.showUnity();});$(this.el+' ul.secondary_navigation li').hover(function(){if(Scion.Core.global.activeVehicle.nav!=null){$(Scion.Core.global.activeVehicle.nav).removeClass("over");$(Scion.Core.global.activeVehicle.content).hide();}
$(self.el+' ul.secondary_navigation li').removeClass('over');$(this).addClass('over');if($(this).attr("id")!="secondary_navigation_vehicles_concept_vehicles"&&$(this).attr("id")!="secondary_navigation_vehicles_my_saved_vehicles"){var target=self.el+' li#'+$(this).attr('id')+"_content";$(target).show();}
self.setVehicle($(this),target);},function(){});$('.normal_one_line_button').hover(function(){$(this).addClass("over");},function(){$(this).removeClass("over");});};Scion.VehicleNavigation.prototype.setVehicle=function(nav,content)
{Scion.Core.global.activeVehicle.nav=nav;Scion.Core.global.activeVehicle.content=content;};Scion.VehicleNavigation.prototype.getVehicle=function()
{return Scion.Core.global.activeVehicle;};Scion.ConfirmModal=function(o)
{var o=o||{};o.name='confirm_'+(o.name||'');o.title=o.title;o.url=o.url||TCI.Globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/templates/modals/confirm.html';o.trigger=o.trigger||'no-trigger';o.width=o.width||'300px';o.height=o.height||'auto';o.data=o.data||{};this.setProperties(o);this.init();this.addListeners();return this;};Scion.ConfirmModal.prototype=new TCI.Core.Modal();Scion.ConfirmModal.prototype.replaceConfirmFunction=function(confirmFunction){this.getElement().find('a#confirm_btn').unbind('click');this.data.confirm=confirmFunction;var self=this;this.getElement().find('a#confirm_btn').click(function()
{self.closeModal();if(typeof(self.data.confirm)=='function'){self.data.confirm();}
return false;});};Scion.ConfirmModal.prototype.onAfterInit=function()
{var self=this;this.getElement().find('#confirmation_content').html(this.data.text);this.getElement().find('a#confirm_btn').click(function()
{self.closeModal();if(typeof(self.data.confirm)=='function'){self.data.confirm();}
return false;});this.getElement().find('a#cancel_btn').click(function()
{self.closeModal();if(typeof(self.data.cancel)=='function'){self.data.cancel();}
return false;});};Scion.ExitModal=function(o)
{o.url=TCI.Globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/content/'+TCI.Globals.locale+'/modals/exit.html';o.iframe=false;o.height='auto';o.title=TCI.localize.getLabel('title_exit_scion');this.setProperties(o);this.addListeners();};Scion.ExitModal.prototype=new TCI.Core.Modal();Scion.ExitModal.prototype.suppListenerHook=function()
{var self=this;$('#'+this.name+' .btn_continue').live('click',function(){self.track(this);self.closeModal();});};Scion.ExitModal.prototype.onTrigger=function(event)
{var triggerElem=$(event.currentTarget);var url=triggerElem.attr('href').indexOf('http://')<0?'http://'+triggerElem.attr('href'):triggerElem.attr('href');var self=this;var btnContinue=self.getElement().find('.btn_continue a');btnContinue.attr('href',url);btnContinue.attr('target','_blank');};Scion.ExitModal.prototype.track=function(el)
{var href=$(el).children('a').attr('href');switch(true){case href.search('youtube')!=-1:Scion.Analytics.trackEvent({category:'global nav',action:'click-through',label:'global_social_youtube',value:true});break;case href.search('picasa')!=-1:Scion.Analytics.trackEvent({category:'global nav',action:'click-through',label:'global_social_picasa',value:true});break;case href.search('twitter')!=-1:Scion.Analytics.trackEvent({category:'global nav',action:'click-through',label:'global_social_twitter',value:true});break;case href.search('facebook')!=-1:Scion.Analytics.trackEvent({category:'global nav',action:'click-through',label:'global_social_facebook',value:true});break;default:Scion.Analytics.trackEvent({category:'exits',action:'click-through',label:'exit_'+href,value:false});break;}};Scion.PrivacyModal=function(o){this.setProperties(o);this.addListeners();this.finalize();};Scion.PrivacyModal.prototype=new TCI.Core.Modal();Scion.PrivacyModal.prototype.setAsSecure=function(){this.url=TCI.Globals.contextPath+'/secure/content/'+TCI.Globals.locale+'/top_level/privacy.html';};Scion.PreferredDealerModal=function(o)
{o.iframe=false;o.name="preferred_dealer_modal";o.trigger="select_preferred_dealer_btn";o.parent='div#main_content';o.width='400px';o.height='auto';o.content={type:"html",target:"#set_preferred_dealer_modal_content",isClearAfter:true};o.title=TCI.localize.getLabel('title_preferred_dealer');this.setProperties(o);this.init();this.addListeners();};Scion.PreferredDealerModal.prototype=new TCI.Core.Modal();Scion.PreferredDealerModal.prototype.addListeners=function()
{var self=this;var el="";this.selector==='class'?el='.'+this.trigger:el='#'+this.trigger;$(el).live('click',function(e){self.show();return false;});$('#'+this.name+' .close-it').live('click',function(){self.closeModal();});$(window).resize(function(){self.setPosition();});this.suppListenerHook();$('#'+this.name+' .accept_btn').live('click',function(){TCI.Core.createCookie('preferredDealer',$(this).attr("title"),365);self.closeModal();});$('#'+this.name+' .decline_btn').live('click',function(){self.closeModal();});};Scion.VehicleMenuDisclaimerModal=function(o)
{o.iframe=false;o.name="vehicle_menu_disclaimer_"+o.targetId+"_modal";o.trigger="disclaimer_"+o.targetId+"_btn";o.width='600px';o.selector='class';o.height='auto';o.title=TCI.localize.getLabel('title_disclaimer');o.content={type:"html",target:"#"+o.targetId+"_disclaimer_content"};this.setProperties(o);this.addListeners();};Scion.VehicleMenuDisclaimerModal.prototype=new TCI.Core.Modal();Scion.VinInfoModal=function(o){o.url=TCI.Globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/content/'+TCI.Globals.locale+'/modals/vin_info.html';o.trigger='vin_info';o.name='vin_inf';o.title='Locate Your VIN';o.selector='id';o.iframe=false;o.parent='div#main_content';o.width='650px';o.height='430px';this.setProperties(o);this.addListeners();};Scion.VinInfoModal.prototype=new TCI.Core.Modal();Scion.VinInfoModal.prototype.suppListenerHook=function(){};Scion.VinInfoModal.prototype.addListeners=function(){var self=this;$('#'+this.trigger).unbind('click');$('#'+this.trigger).live('click',function(e){e.preventDefault();if(!self.isInitialised){self.init();new Scion.widgets.Tabs({});self.isInitialised=true;}
self.show();return false;});$('#'+this.name+' .close-it').live('click',function(){self.closeModal();});$(window).resize(function(){self.setPosition();});};Scion.LanguageSelectionModal=function(o){o.height='auto';o.width='275px';this.setProperties(o);this.init();this.addListeners();};Scion.LanguageSelectionModal.prototype=new TCI.Core.Modal();Scion.LanguageSelectionModal.prototype.addOther=function(){};Scion.LanguageSelectionModal.prototype.render=function(){};Scion.LanguageSelectionModal.prototype.containerBody=function(){return'<div id="language_selector_container"><h1>scion.ca</h1><ul><li id="btn_language_english"><a href="#">English</a></li><li id="btn_language_french"><a href="#">Francais</a></li></ul></div>';};Scion.Core.LanguageSelector=(function(){return{init:function(){$('li#btn_language_english a').live('click',function(e){Scion.Core.LanguageSelector.setLanguage("en");});$('li#btn_language_french a').live('click',function(e){Scion.Core.LanguageSelector.setLanguage("fr");});},setLanguage:function(lang){Scion.LocaleManager.setCookie(lang);if(TCI.Globals.locale!=lang){Scion.LocaleManager.toggle();}
Scion.Core.global.languageModal.closeModal();}};})();Scion.Core.FlashModal=function(o){this.setProperties(o);this.addListeners();this.isHidden=true;this.finalize();};Scion.Core.FlashModal.prototype=new TCI.Core.Modal();Scion.Core.FlashModal.prototype.closeModal=function(){this.onBeforeClose();$('#'+this.name).css({left:'-9999px'});if(this.mask){this.mask.hide();}
this.reparePage();this.onClose();this.isHidden=true;this.onAfterClose();};Scion.Core.FlashModal.prototype.setOpacity=function(){};Scion.Core.FlashModal.prototype.show=function(param){var modalEl=null,top=null,left=null;modalEl=$('#'+this.name);top=($(window).height()-modalEl.height())/2;left=($(window).width()-modalEl.width())/2;this.mask.show();modalEl.css({display:'block',top:top,left:left});this.setPosition();this.setScrollPane();this.isHidden=false;this.onAfterShow(param);};Scion.Core.FlashModal.prototype.setFlashModalPosition=function(){if(this.isHidden){return;}
var lft=Math.round(($(window).width()-$('#'+this.name).width())/2);if(typeof(Scion)!='undefined'){!TCI.Browser.isIE()?lft-=20:0;}
var tp=Math.round(($(window).height()-$('#'+this.name).height())/2);!TCI.Browser.isIE()?tp-=20:0;tp<0?tp=0:0;$('#'+this.name).css({left:lft,top:tp});};Scion.Core.FlashModal.prototype.suppListenerHook=function(){var self=this;$(window).unbind('resize').resize(function(){self.setFlashModalPosition();});};(function($){var defaults={swfUrl:TCI.Globals.flash_basehref+'/media/shared/FlashVideoPlayer.swf',id:false,width:false,height:false,swfVersion:'9.0.0',expressInstall:false,flashVars:{configPath:TCI.Globals.flash_basehref+'/media/shared/videoPlayerConfig.xml',assetLibraryUrl:TCI.Globals.flash_basehref+"/media/shared/VideoPlayerAssets.swf",singleVideoPath:null,videoPlayerWidth:false,videoPlayerHeight:false,isAutoPlay:0,isVideoControlsToggleActive:"true",isVideoControlsVisible:"true",isPlayButtonActive:"true",isPreload:"true",isV4GATrackingActive:"true",isGoToStartAndStop:"true"},params:{menu:'false',allowscriptaccess:'always'},attrs:{}};var methods={init:function(opts){return this.each(function(){var el=null,pEl=null,o=null,objectEl=null;el=$(this);pEl=$('<div />').appendTo(el);o=$.extend(true,{},defaults,opts);if(!o.id){if(!pEl.attr('id')){o.id=Scion.GenerateRandomID('tpmplayer_container');pEl.attr('id',o.id);}
o.id=pEl.attr('id');}
if(!o.attrs.id){o.attrs.id='tpm_player_dynamic_'+o.id;};o.width=parseInt(o.width||el.css('width'),10);o.height=parseInt(o.height||el.css('height')||el.css('width'),10);o.flashVars.videoPlayerWidth=o.width;o.flashVars.videoPlayerHeight=o.height;o.flashVars.singleVideoPath=TCI.Globals.flash_basehref+'/'+o.flashVars.singleVideoPath.replace(/^\//,'');swfobject.embedSWF(o.swfUrl,o.id,o.width,o.height,o.swfVersion,o.expressInstall,o.flashVars,o.params,o.attrs);objectEl=$('#'+o.attrs.id);el.data('TPMPlayer',{targetEl:el,objectEl:objectEl});});},pause:function(){return this.each(function(){var objectEl=$(this).data('TPMPlayer').objectEl;if(objectEl&&objectEl[0]){TCI.Log.info('jQuery.TPMPlayer.pause: Stopping playback of Flash video '+objectEl.attr('id'));objectEl[0].pauseVideo();}});},play:function(){return this.each(function(){var objectEl=$(this).data('TPMPlayer').objectEl;if(objectEl&&objectEl[0]){TCI.Log.info('jQuery.TPMPlayer.pause: Stopping playback of Flash video '+objectEl.attr('id'));objectEl[0].playVideo();}});},getObjectEl:function(){return this.objectEl;}};document.isReady=function(){return(document.hasOwnProperty(jsReady)&&document.jsReady===true);};$(document).ready(function(){document.jsReady=true;});$.fn.TPMPlayer=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(typeof method==='object'||!method){return methods.init.apply(this,arguments);}else{$.error('Method '+method+' does not exist on jQuery.TPMPlayer');}};})(jQuery);Scion.Core.FlashFromMarkup=function(opts){var defaults={target:'.flash_from_markup',prefix:'flash_from_markup',swfAttrs:{url:'data-swf-url',width:'data-swf-width',height:'data-swf-height'},flvAttrs:{url:'data-flv-url',width:'data-flv-width',height:'data-flv-height'}};this.o=$.extend(true,{},defaults,opts);this.flashEls=[];this.init();};Scion.Core.FlashFromMarkup.prototype.init=function(){var self=this,o=this.o,containerEls=$(o.target);containerEls.each(function(){var containerEl=$(this),flashEl=null,randomFlashId=null,flashOpts=null;randomFlashId=Scion.GenerateRandomID(o.prefix);flashEl=$('<div />').addClass(o.prefix).attr('id',randomFlashId).appendTo(containerEl.empty());if(containerEl.attr(o.flvAttrs.url)!==undefined){var flvOpts=Scion.Core.FlashFromMarkup.readAttrs(containerEl,o.flvAttrs);Scion.Core.FlashFromMarkup.applyFlashVideo(flashEl,flvOpts);self.flashEls.push(flashEl[0]);}
if(containerEl.attr(o.swfAttrs.url)!==undefined){var swfOpts=Scion.Core.FlashFromMarkup.readAttrs(containerEl,o.swfAttrs);Scion.Core.FlashFromMarkup.applyFlash(flashEl,swfOpts);self.flashEls.push(flashEl[0]);}});};Scion.Core.FlashFromMarkup.readAttrs=function(el,attrObj){var attrData={};el=$(el);$.each(attrObj,function(key,attr){if(el&&el.attr(attr)!==undefined){attrData[key]=el.attr(attr);}});return attrData;};Scion.Core.FlashFromMarkup.applyFlashVideo=function(el,opts){$(el).TPMPlayer({width:opts.width,height:opts.height,flashVars:{singleVideoPath:opts.url}});};Scion.Core.FlashFromMarkup.applyFlash=function(el,opts){opts.url=TCI.Globals.flash_basehref+'/'+opts.url.replace(/^\//,'');swfobject.embedSWF(opts.url,el.attr('id'),opts.width,opts.height,'9.0.0.',TCI.Globals.flash_basehref+'/media/shared/expressInstall.swf',opts.params,opts.flashVars,opts.attribs);};Scion.Core.FlashFromMarkup.prototype.getEls=function(){return this.flashEls;};Scion.GenerateRandomID=(function(){var idCache=[];function createHash(hash_length){var chars=null,rnum=null,out='';chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";for(var i=0;i<hash_length;i++){var r=Math.floor(Math.random()*chars.length);out+=chars.substring(r,r+1);}
return out;};function indexOf(array,obj,start){for(var i=(start||0);i<array.length;i++){if(array[i]==obj){return i;}}
return-1;};return function(prefix,hash_length){var p=null,l=null,chars=null,randomId=null;p=prefix||'dyn';l=hash_length||5;do{randomId=p+'_'+createHash(l);if(indexOf(idCache,randomId)===-1){idCache.push(randomId);return randomId;}}while(idCache.indexOf(randomId)===-1);};})();Scion.Core.populateFormWithProfile=function(theLoginId,fieldMapping,callback,createIfMissing){var response=null;if(Scion.globals.loadProfileIntoForms){response=TCI.Data.getProfile(theLoginId,createIfMissing);if(response){try{var setField=function(field,value){if(field!=undefined&&value!=undefined){$(field).val(value);}};setField(fieldMapping.email,TCI.cas.removeCasEmailPrefix(theLoginId));setField(fieldMapping.email+'_confirmation',TCI.cas.removeCasEmailPrefix(theLoginId));var personTypeDetails=response.consumerProfile?response.consumerProfile.personTypeDetails:null;if(personTypeDetails){if(fieldMapping.salutation&&personTypeDetails.salutation.value){$(fieldMapping.salutation).val(personTypeDetails.salutation.value);$(fieldMapping.salutation+'_input').val($(fieldMapping.salutation+" option:selected").text());}
if(fieldMapping.province&&personTypeDetails.residenceAddress&&personTypeDetails.residenceAddress.stateOrProvinceCountrySubDivisionID){$(fieldMapping.province+'_input').val(personTypeDetails.residenceAddress.stateOrProvinceCountrySubDivisionID.toUpperCase());$(fieldMapping.province).val(personTypeDetails.residenceAddress.stateOrProvinceCountrySubDivisionID);}
setField(fieldMapping.first_name,personTypeDetails.givenName.value);setField(fieldMapping.last_name,personTypeDetails.familyName.value);if(personTypeDetails.residenceAddress){setField(fieldMapping.address,personTypeDetails.residenceAddress.lineOne.value);setField(fieldMapping.apt,personTypeDetails.residenceAddress.lineTwo.value);setField(fieldMapping.city,personTypeDetails.residenceAddress.cityName.value);setField(fieldMapping.postal_code_part1,personTypeDetails.residenceAddress.postcode.value.substring(0,3));setField(fieldMapping.postal_code_part2,personTypeDetails.residenceAddress.postcode.value.substring(3,6));}
var telephoneCommunication=personTypeDetails.telephoneCommunication;if(telephoneCommunication){for(var i=0;i<telephoneCommunication.length;i++){var currnet=telephoneCommunication[i];switch(currnet.channelCode.value){case"H":setField(fieldMapping.home_phone_area,currnet.areaNumberCode.value);setField(fieldMapping.home_phone_complete,currnet.completeNumber.value);break;case"C":setField(fieldMapping.cell_phone_area,currnet.areaNumberCode.value);setField(fieldMapping.cell_phone_complete,currnet.completeNumber.value);break;case"W":setField(fieldMapping.work_phone_area,currnet.areaNumberCode.value);setField(fieldMapping.work_phone_complete,currnet.completeNumber.value);setField(fieldMapping.work_phone_ext,currnet.extensionNumber.value);break;}}}}}catch(e){TCI.Log.error(e);}}}
callback(response);};Scion.PriceDisplayManager=(function()
{return{populate:function()
{var prices=TCI.Core.getFromPrices();$('span.vehicle_price_container').each(function()
{var code=!!$(this).attr('title')?$(this).attr('title').trim().toUpperCase():'';var html='';if(!!prices[code]){if($(this).hasClass('from_price')){html='<span class="price_label">'+TCI.Utils.getLabel('label_from')+' </span>';}
html+='<span class="price_amount">'+new String(prices[code].price).toCurrency()+'</span>';$(this).html(html);$(this).addClass('has_price');}
else{$(this).html(TCI.Utils.getLabel('price_not_available'));$(this).removeClass('has_price');}});$('span.vehicle_menu_price_container').each(function()
{var code=!!$(this).attr('title')?$(this).attr('title').trim().toUpperCase():'';$(this).html(!!prices[code]?'<span class="price_label">'+TCI.Utils.getLabel('label_from')+'</span> <span class="price_amount">'+new String(prices[code].price).toCurrency()+'</span>':TCI.Utils.getLabel('price_not_available'));!!prices[code]?$(this).addClass('has_price'):$(this).removeClass('has_price');});$('.disclaimer_modal_content').each(function()
{var code=!!$(this).attr('title')?$(this).attr('title').trim().toUpperCase():'';$(this).find("span.price_amount").html(!!prices[code]?new String(prices[code].price).toCurrency():TCI.Utils.getLabel('not_applicable_label'));!!prices[code]?$(this).addClass('has_price'):$(this).removeClass('has_price');});$('.disclaimer_modal_content').attr('title','');}};})();Scion.LoadSpinner=TCI.LoadSpinner;Scion.NavigationManager=(function(){var _setup=function(){Scion.Core.global.activeVehicle=new Object();new Scion.VehicleNavigation("li#primary_navigation_vehicles");new Scion.Navigation("li#primary_navigation_accessories").addListeners();new Scion.Navigation("li#primary_navigation_shopping_tools").addListeners();new Scion.Navigation("li#primary_navigation_owners").addListeners();new Scion.Navigation("li#primary_navigation_lifestyle").addListeners();new Scion.Navigation("li#primary_navigation_about").addListeners();new Scion.LanguageToggle("ul#footer_shortcuts li#language_toggle a").addListeners();new Scion.ExitModal({z_index:900000,name:'exit_modal',trigger:'exit_modal_trigger',selector:'class',data:{modelCode:$(this).attr('mcode')}});$('.logout_link').click(function(){TCI.cas.logout();});};return{init:function(){_setup();}};})();Scion.widgets.ImageStepper=function(o){this.activeIndex=o.activeIndex;this.ImageStepperLength=$("ul.image_stepper_content > li").length;this.path=o.path||TCI.Globals.contextPath+'/media/content/home/main_gallery/';this.addListeners();this.descriptors=o.descriptors||[];this.isTimerActive=true;this.itemClicked('ul.image_stepper_nav li:nth-child('+this.activeIndex+')',false);this.firstDescriptor=this.getTrackingCode($('ul.image_stepper_content > li:nth-child('+this.activeIndex+')'));Scion.Analytics.trackEvent({category:'promotions',action:'view',label:'promo_home_'+this.firstDescriptor+'_view',value:true});var self=this;var counter=0;$('ul.image_stepper_content').everyTime(15000,"next",function(){counter++;if(self.isTimerActive){var nextIndex=(self.activeIndex>=self.ImageStepperLength)?1:self.activeIndex+1;self.itemClicked('div.image_stepper ul.image_stepper_nav li:nth-child('+nextIndex+')',false);if(counter<3){Scion.Analytics.trackEvent({category:'promotions',action:'view',label:'promo_home_'+self.getTrackingCode($('ul.image_stepper_content > li:nth-child('+nextIndex+')'))+'_view',value:true});}}});};Scion.widgets.ImageStepper.prototype.getDescriptor=function(txt){return txt.toLowerCase().replace(/\s/g,'_');};Scion.widgets.ImageStepper.prototype.render=function(){$('#main-image').detach();this.ul=document.createElement('ul');$(this.ul).addClass('image_stepper');this.navUL=document.createElement('ul');$(this.navUL).addClass('image_stepper_nav');for(var i=1;i<=this.ImageStepperLength;i++){this.createNavigation(i);};$(this.ul).append(this.navUL);$('div#main_content_inner').append(this.ul);$('ul.image_stepper_content > li').hide();};Scion.widgets.ImageStepper.prototype.addListeners=function(){var self=this;$('div.image_stepper ul.image_stepper_nav li').click(function(){self.itemClicked(this,true);});$('div.image_stepper ul li a').click(function(){var trackcode=self.getTrackingCode(this);if(trackcode!=""){Scion.Analytics.trackEvent({category:'promotions',action:'click-through',label:'promo_home_'+trackcode+"_click",value:true});}});};Scion.widgets.ImageStepper.prototype.getTrackingCode=function(el){var code="";var classes=$(el).attr('class').split(' ');$(classes).each(function(){if(this.search('trackcode_')!=-1){code=this.split('trackcode_')[1];}});return code;};Scion.widgets.ImageStepper.prototype.itemClicked=function(el,isFromButton){$('div.image_stepper ul.image_stepper_nav li').removeClass('current');var i=$(el).addClass('current').index()+1;if(this.activeIndex!=i){$('ul.image_stepper_content > li').fadeOut('slow');$('ul.image_stepper_content > li.stepper_'+i).fadeIn('slow');this.activeIndex=i;if(isFromButton==true){this.isTimerActive=false;}}};Scion.widgets.ImageStepper.prototype.addImage=function(num){var li=document.createElement('li');var img=document.createElement('img');$(li).addClass('stepper_'+num);$(this.ul).append($(li).append(img));};Scion.widgets.ImageStepper.prototype.createNavigation=function(num){var li=document.createElement('li');$(li).addClass('stepper_'+num);$(this.navUL).append(li);};Scion.widgets.Ticker=function(o){if(o){this.setProperties(o);this.addListeners();this.move(0);this.limitLeft=-1*((this.itemWidth*this.length)-(3*this.itemWidth));this.limitRight=0;this.setDefaults();}};Scion.widgets.Ticker.prototype.setDefaults=function(){$('.ticker .right_btn').show();$('.ticker .right_btn').css('opacity',1);$('.ticker .left_btn').hide();};Scion.widgets.Ticker.prototype.setProperties=function(o){this.length=o.numItems;this.itemWidth=o.itemWidth||320;this.path=o.path||TCI.Globals.contextPath+'/media/content/home/ticker/';this.position=0;this.width=o.width||(this.itemWidth*this.length)-$('.ticker').width();};Scion.widgets.Ticker.prototype.render=function(){this.div=document.createElement('div');this.ul=document.createElement('ul');$(this.div).addClass('ticker');for(var i=1;i<=this.length;i++){this.addImage(i);};this.makeNavigation();$('#main_content_inner').append($(this.div).append(this.ul));};Scion.widgets.Ticker.prototype.addImage=function(num){var li=document.createElement('li');var img=document.createElement('img');$(img).attr('src',this.path+'image'+num+'.jpg');$(li).addClass('image'+num);$(this.ul).append($(li).append(img));};Scion.widgets.Ticker.prototype.makeNavigation=function(){var navLeft=document.createElement('div');var navRight=document.createElement('div');$(navLeft).addClass('nav left_btn');$(navRight).addClass('nav right_btn');$(this.div).append(navLeft).append(navRight);};Scion.widgets.Ticker.prototype.getDescriptor=function(txt){return txt.toLowerCase().replace(/\s/g,'_');};Scion.widgets.Ticker.prototype.getTrackingCode=function(el){var code="";var classes=$(el).attr('class').split(' ');$(classes).each(function(){if(this.search('trackcode_')!=-1){code=this.split('trackcode_')[1];}});return code;};Scion.widgets.Ticker.prototype.addListeners=function(){var self=this;$('.ticker .left_btn').click(function(){if(self.position+self.itemWidth<=self.limitRight){self.move(1);}});$('.ticker .right_btn').click(function(){if(self.position-self.itemWidth>=self.limitLeft){self.move(-1);}});$('.ticker .ticker_list li img').click(function(){Scion.Analytics.trackEvent({category:'promotions',action:'click-through',label:'promo_ticker_home_'+self.getTrackingCode($(this).parent('li')),value:true});if($(this).siblings('p').children('a').hasClass('exit_modal_trigger')||$(this).siblings('p').children('a').hasClass('find_a_dealer_trigger')){$(this).siblings('p').children('a').click();}else{document.location=$(this).siblings('p').children('a').attr('href');}});$('.ticker .ticker_list li').hover(function(){$(this).children('.ticker_mask').animate({opacity:0.07},0);},function(){$(this).children('.ticker_mask').animate({opacity:0},'fast');});$('.ticker .ticker_list li .ticker_mask').click(function(){Scion.Analytics.trackEvent({category:'promotions',action:'click-through',label:'promo_ticker_home_'+self.getTrackingCode($(this).parent('li')),value:true});if($(this).siblings('p').children('a').hasClass('exit_modal_trigger')||$(this).siblings('p').children('a').hasClass('find_a_dealer_trigger')){$(this).siblings('p').children('a').click();}else{document.location=$(this).siblings('p').children('a').attr('href');}});$('.ticker .ticker_list li p a').click(function(){Scion.Analytics.trackEvent({category:'promotions',action:'click-through',label:'promo_ticker_home_'+self.getTrackingCode($(this).parent().parent('li')),value:true});});};Scion.widgets.Ticker.prototype.move=function(num){this.position+=this.itemWidth*num;switch(this.position){case 0:if(this.length==4){$('.ticker .right_btn').show();}
$('.ticker .left_btn').animate({'opacity':0},500,function(){$(this).hide().css('opacity',1);});break;case this.width*-1:if(this.length==4){$('.ticker .left_btn').show();}
$('.ticker .right_btn').animate({'opacity':0},500,function(){$(this).hide().css('opacity',1);});break;default:$('.ticker .right_btn').show();$('.ticker .left_btn').show();break;}
$('.ticker ul.ticker_list').animate({'margin-left':this.position},500,'swing');};Scion.widgets.ToolTipManager=(function(){var tooltips={};var action="show";var id;var isRadioGroup=false;var _show=function(id,offset){tooltips[id]?_do(id):_new(id);};var _do=function(id){tooltips[id].addText($('#field_'+id+' .error_container span').text());tooltips[id][action]();};var _new=function(id){var trig;id=chop(id);trig=isRadioGroup?'#field_'+id+' > .error_container':'#field_'+id+' .error_container';tooltips[id]=new Scion.widgets.ToolTip({trigger:trig,target:'#tt-'+id,content:"",text:$('#field_'+id+' .error_container span').text(),dynamic:true,parent:'#document'});_do(id);};var chop=function(id){id=id.replace('_complete','');id=id.replace('_area','');id=id.replace('_part1','');id=id.replace('_input','');id=id.replace('dob_day','dob');id=id.replace('dob_month','dob');id=id.replace('dob_year','dob');return id;};return{init:function(el){},show:function(el,offset,name){isRadioGroup=name?true:false;id=$(el).siblings('input').attr('id')||$(el).siblings('textarea').attr('id')||name;offset==5?action="reveal":action="show";_show(id,offset);}};})();Scion.widgets.ToolTip=function(o){if(o){this.setProperties(o);this.init();}};Scion.widgets.ToolTip.kill=function(){$('.tooltip').hide();};Scion.widgets.ToolTip.prototype={setProperties:function(o){if(o.dynamic===undefined){this.dynamic=true;}else{this.dynamic=o.dynamic;}
this.text=o.text||"";this.content=o.content||"";this.trigger=o.trigger;this.target=o.target;this.parent=o.parent||'body';this.style=o.style||'tooltip';this.offsets=o.offsets||{aboveX:30,aboveY:50,belowX:30,belowY:50,top:15,right:0,bottom:30};this.position=o.position||'right';this.zIndex=o.zIndex||9999;this.text_align=o.text_align||'left';this.dinContent=o.dinContent;this.eventType=o.eventType||'hover';this.delayId=null;this.isActive=false;},init:function(){this.dynamic?this.createShell():0;this.dynamic?this.addContent(this.content):0;$(this.target+" .inner").css("text-align",this.text_align);this.initListeners();},createShell:function(){var shell=document.createElement('div');var outer=document.createElement('div');var inner=document.createElement('div');$(this.parent).append($(shell).append($(outer).append($(inner).addClass('inner')).addClass('outer')).attr('id',this.target.substr(1)).addClass(this.target.substr(1)).addClass(this.style));$(shell).hide();},showTip:function(elem)
{if(!!this.dinContent){this.addText(this.dinContent(elem));}
this.show();},show:function(){var self=this;self.setPosition();self.delayId=null;self.isActive=true;$(self.target).show();},hide:function(){$(this.target).hide();var self=this;this.delayId=setTimeout(function(){if(self.delayId!=null){self.delayId=null;self.isActive=false;$(self.target).hide();}},500);},hideSlow:function(){var self=this;$(this.target).fadeTo('slow',0,function(){self.hide();$(self.target).css('opacity',1);});},reveal:function(){var self=this;$(this.target).oneTime(10,'delayShow',function(){self.setPosition();$(self.target).show();});$(this.target).oneTime(3000,'showthislong',function(){TCI.Browser.isIE()?self.hide():self.hideSlow();});},initListeners:function()
{var self=this;var triggers=$(this.trigger);triggers.live(this.eventType||'mouseover',function(ev)
{ev.stopPropagation();self.trigger=this;self.showTip($(this));});triggers.live('hover',function(ev)
{if(!self.isActive){return false;}
switch(ev.type){case'mouseover':if(self.delayId!=null)
{self.delayId==null;ev.stopPropagation();self.show();}
break;case'mouseout':ev.stopPropagation();self.hide();break;}});$(this.target).live('hover',function(ev)
{switch(ev.type){case'mouseover':ev.stopPropagation();self.show();break;case'mouseout':ev.stopPropagation();self.hide();break;}});},addContent:function(content){content!=""?$(this.target+' .inner').empty().append(content):this.addText(this.text);},addText:function(txt){txt!=""?$(this.target+' .inner').html(txt):0;},setPosition:function(){this['setAt_'+this.position]();},setAt_top:function(){var lft=this.getPosition('left')+this.offsets.right;var tp=this.getPosition('top')+this.offsets.top;$(this.target).css({top:tp,left:lft,zIndex:this.zIndex}).addClass('top');},setAt_bottom:function(){var lft=this.getPosition('left')+this.offsets.right;var tp=this.getPosition('top')+this.offsets.bottom;$(this.target).css({top:tp,left:lft,zIndex:this.zIndex}).addClass('bottom');},setAt_left:function(){var lft=this.getPosition('left')-this.offsets.left-$(this.target).width();var tp=this.getPosition('top')+this.offsets.top-($(this.target).height()/2);$(this.target).css({top:tp,left:lft}).addClass('left');},setAt_right:function(){var lft=this.getPosition('left')+this.offsets.right+$(this.trigger).width();var tp=this.getPosition('top')+this.offsets.top-($(this.target).height()/2);$(this.target).css({top:tp,left:lft}).addClass('right');},setAt_topleft:function(){},setAt_topright:function(){},setAt_bottomleft:function(){},setAt_bottomright:function(){},getPosition:function(i){return $(this.trigger).offset()[i];}};Scion.widgets.Paginator=(function()
{var itemsPerPage,totalResults,startIndex,shell,path,thisPage,pagesToShow,lastPage,firstPage;var setValues=function(){pagesToShow=5;itemsPerPage=Number($('#itemsPerPage').text());totalResults=Number($('#totalResults').text());startIndex=Number($('#startIndex').text());totalPages=Math.ceil(totalResults/itemsPerPage);var buffer=2;thisPage=Math.ceil(startIndex/itemsPerPage);lastPage=(thisPage<pagesToShow-buffer)?pagesToShow:thisPage+buffer;lastPage>totalPages-buffer?totalPages:thisPage+buffer;firstPage=(thisPage<pagesToShow-buffer)?1:lastPage-pagesToShow+1;firstPage=(firstPage>(totalPages-pagesToShow))?totalPages-pagesToShow+1:firstPage;firstPage=(firstPage<1)?1:firstPage;lastPage>totalPages?lastPage=totalPages:0;shell=$('#pagination');ul=$('#pagination ul');};var init=function(p){if(!/\/$/.test(p)){p=p+'/';}
path=p;setValues();make();if(!hasNext()&&!hasPrev()){shell.hide();}
else{shell.show();}};var make=function(){shell.empty();for(var i=firstPage;i<=lastPage;i++){shell.append(page(i));}
shell.prepend(previous());!hasPrev()?setLeftEndWithoutPrevious():0;$('#pagination li:last').css('width',(20+1));shell.append(next());!hasNext()?setRightEndWithoutNext():0;};var setLeftEndWithoutPrevious=function(){$('#pagination li:first').addClass('disabled');$('#pagination li:first').empty();};var setRightEndWithoutNext=function(){$('#pagination li:last').addClass('disabled');$('#pagination li:last').empty();};var setFirstPageToShow=function(){firstPage=((thisPage/pagesToShow)-(pagesToShow-1));};var hasNext=function(){if(thisPage<totalPages){return true;}
return false;};var hasPrev=function(){if(thisPage>1&&thisPage<=totalPages){return true;}
return false;};var page=function(i){if(i==thisPage){return'<li class="page current">'+i+'</li>';}
return'<li class="page"><a href="'+path+'page/'+i+'">'+i+'</a></li>';};var previous=function(){return'<li class="prev"><a href="'+path+'page/'+(thisPage-1)+'"></a></li>';};var next=function(){return'<li class="next"><a href="'+path+'page/'+(thisPage+1)+'"></a></li>';};return{init:function(p){init(p);}};})();Scion.widgets.Tabs=function(o){if(o){this.clss=o.clss||'.tabs';this.contentClass=o.contentClass||'.tab_content';if(o.actv){$(this.clss+' li:eq('+o.actv+') a').addClass('active');}else{$(this.clss+' li:first a').addClass('active');}}
else{this.clss='.tabs';this.contentClass='.tab_content';$(this.clss+' li:first a').addClass('active');}
this.addListeners();};Scion.widgets.Tabs.prototype.addListeners=function(){var self=this;$(this.clss+' a').click(function(){$(self.clss+' .active').removeClass('active');$(this).addClass('active');$(self.contentClass).hide();var selectedTab=$(this).attr('title');$('#'+selectedTab).show();return false;});};Scion.widgets.ColourPicker=function(o){if(o){this.el=o.el;this.initListeners();}};Scion.widgets.ColourPicker.prototype={initListeners:function(){var self=this;$(this.el+' a').mouseover(function(){self.removeSelected();self.hideAllPictures();self.hideAllInteriors();$(this).next('div').show();self.showInterior($(this).attr('class'));$(this).addClass('selected');});},hideAllPictures:function(){$(this.el+' li > div').hide();},removeSelected:function(){$(this.el+' li > a').removeClass('selected');},hideAllInteriors:function(){$(this.el+' #interiors ul').hide();},showInterior:function(clss){$(this.el+' #interiors ul.'+clss).show();}};Scion.widgets.ShareManager=(function(){var staf="";var swaf="";var lang=TCI.Globals.locale;var _init=function(){lang=='fr'?$('.share-nav').addClass('fr'):0;initListeners();};var removeListeners=function(el){$(el).unbind('click');};var initListeners=function(){removeListeners('.share-nav span');$('.share-nav span').bind('click',function(e){_makeShareWithAFriendModal();var parent=$(this).parent();parent.children('ul').show();parent.addClass('selected');e.stopPropagation();});$(document).click(function(){$('.share-nav ul').hide();$('.share-nav').removeClass('selected');});initTracking();};var initTracking=function(){$('.share-nav ul li.facebook a').click(function(){Scion.Analytics.trackEvent({category:'social media',action:'share',label:'share_facebook',value:false});});$('.share-nav ul li.twitter a').click(function(){Scion.Analytics.trackEvent({category:'social media',action:'share',label:'share_twitter',value:false});});$('.share-nav ul li.email a').click(function(){Scion.Analytics.trackEvent({category:'social media',action:'share',label:'share_email',value:false});});};var _makeShareWithAFriendModal=function(){if(swaf!=""){return;}
swaf=new TCI.Core.Modal({iframe:false,name:'send_uri_to_friend_modal',selector:'class',trigger:'email a',title:TCI.localize.getLabel('title_send_to_friend'),url:TCI.Globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/content/'+TCI.Globals.locale+'/modals/send_uri_to_friend.html',height:'auto',width:'580px',z_index:88899,onAfterInit:function(){TCI.ajax.getScript(Scion.globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+Scion.globals.urlLocaleToken+'/ServiceFormAction_send_uri_to_friend.action');},onAfterClose:function(){$('#'+this.name+' .success-notice-from-server').remove();$('#'+this.name+' .error-notice-from-server').remove();$('#'+this.name+' form').show();},onTrigger:function(event){$('#cr_sf_uri').val(event.currentTarget.href);}});};var _updateShareWithAFriendModal=function(){if(swaf!=""){swaf.addListeners();}};var _makeSendToAFriendModal=function(){if(staf!=""){return;}
staf=new TCI.Core.Modal({iframe:false,name:'send_to_friend_modal',trigger:'email_btn',title:TCI.localize.getLabel('title_send_to_friend'),url:TCI.Globals.contextPath+'/templates/forms/send_to_friend.html',height:'auto',width:'580px',z_index:88899});};var _updateLinks=function(link){$('.share-nav li.twitter a').attr('href','http://twitter.com/home?status='+link);$('.share-nav li.facebook a').attr('href','http://www.facebook.com/sharer.php?u='+link);$('.share-nav li.email a').attr('href',link);};return{init:function(){_init();},updateLinks:function(link){_updateLinks(link);},makeShareWithAFriendModal:function(){_makeShareWithAFriendModal();},updateShareWithAFriendModal:function(){_updateShareWithAFriendModal();},makeSendToAFriendModal:function(){_makeSendToAFriendModal();}};})();Scion.Chat={};Scion.Chat.errorModal="";Scion.Chat.getCookie=function()
{return TCI.Core.readCookie('chat_window');};Scion.Chat.setCookie=function(win)
{if(win!=""){TCI.Core.createCookie('chat_window',win,0);}};Scion.Chat.serviceSuccess=function(data)
{TCI.Log.debug("Chat service active: "+data);var features="height=530,width=450,scrollTo,resizable=1,location=no,scrollbars=no,location=no,screenX=200,screenY=200";if(TCI.Globals.loginId!=null&&TCI.Globals.loginId!=undefined){TCI.Globals.chatwindow=window.open(TCI.Globals.chat_base_url+"?method=init&div=SCI&locale="+TCI.Globals.locale+"&firstName="+TCI.Globals.userFirstName+"&lastName="+TCI.Globals.userLastName+"&email="+TCI.cas.removeCasEmailPrefix(TCI.Globals.loginId),'chatwindow',features);}else{TCI.Globals.chatwindow=window.open(TCI.Globals.chat_base_url+"?method=init&div=SCI&locale="+TCI.Globals.locale,'chatwindow',features);}
Scion.Analytics.trackEvent({category:'global nav',action:'click-through',label:'global_chat',value:true});if($.browser.safari!=true){TCI.Globals.chatwindow.blur();setTimeout(TCI.Globals.chatwindow.focus,0);TCI.Globals.chatwindow.focus();}};Scion.Chat.serviceError=function(e){if(!Scion.Chat.errorModal.isInitialised){Scion.Chat.errorModal.init();Scion.Chat.errorModal.isInitialised=true;}
Scion.Chat.errorModal.show();return false;};Scion.Chat.init=function()
{};Scion.Analytics={};Scion.Analytics.trackEvent=function(o){if(o.value){var val=TCI.Globals.locale=='fr'?'_fr':'_en';_gaq.push(['_trackEvent',o.category,o.action,o.label+''+val]);TCI.Log.debug('track : '+o.category+' '+o.action+' '+o.label+''+val);}
else{_gaq.push(['_trackEvent',o.category,o.action,o.label]);TCI.Log.debug('track : '+o.category+' '+o.action+' '+o.label);}};Scion.Analytics.trackPageview=function(o){if(o){var path=window.location.pathname;_gaq.push(['_trackPageview','/'+path+'/'+o.page]);TCI.Log.debug('trackPageview : '+'/'+path+'/'+o.page);}};TCI.ToolTipAction=(function(){var showToolTip=function(o){o.flag===5?Scion.widgets.ToolTipManager.show($(o.field).siblings('.error_container'),o.flag,o.name):0;if($('#bp_tooltip')>0){jQuery('#bp_tooltip').fadeOut(3000);}};return{init:function(o){showToolTip(o);}};})();Scion.widgets.AutoComplete=function(o){this.el=o.el;this.button=o.button||'';this.offset=o.offset||{left:0,top:22}
this.containerClass=o.containerClass||'autocomplete';this.container=o.container;this.parent=o.parent||'body';this.hoverClass=o.hoverClass||"selected";this.active=-1;this.resultDelay=o.resultDelay||1000;this.init();}
Scion.widgets.AutoComplete.prototype={init:function(){this.initListeners();this.list=this.createContainer();this.inject();this.setPosition();this.lis="";this.locked=false;this.empty();},inject:function(){$(this.parent).append(this.list);},initListeners:function(){var self=this;$(this.el).die();$(this.el).live('keyup',function(event){switch(event.keyCode){case 38:if(self.isVisible()){self.move(-1);}
break;case 40:if(self.isVisible()){self.move(1);}
break;case 27:self.empty();break;case 13:if(self.isVisible()){self.setCurrent();}else{$(self.button).click();}
break;default:self.initAJAXCall();break;}}).blur(function(e){$(this).oneTime(200,'delayEmpty',function(){self.empty();});});$('#'+this.container+' li').live('click',function(e){self.text=$(this).text();$(self.el).val($(this).text());self.empty();}).focus(function(){self.lock=true;});$(window).resize(function(){if(!self.isVisible()){return;}
self.setPosition();});},initAJAXCall:function(){if(this.locked){return;}
var self=this;this.locked=true;$('body').oneTime(this.resultDelay,'delayAJAXLoad',function(){TCI.ajax.get(TCI.Globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/SearchAction_suggest.action?q='+$(self.el).val(),{},function(d){self.onCallback(d);},function(){return;});});},setCurrent:function(){if(this.active!=-1){$(this.el).val($(this.lis[this.active]).text());}
this.empty();},move:function(step){this.lis=$('#'+this.container+' li');this.active+=step;if(this.active<0){this.active=0;}
else if(this.active>=this.lis.size()){this.active=this.lis.size()-1;}
this.lis.removeClass(this.hoverClass);$(this.lis[this.active]).addClass(this.hoverClass);},isVisible:function(){return $('#'+this.container).is(':visible');},empty:function(){$('#'+this.container+' ul').empty();$('#'+this.container).hide();this.active=-1;},onCallback:function(data){var self=this;this.locked=false;this.empty();$.each(data,function(index,value){$('#'+self.container+' ul').append('<li title="'+value+'">'+value+'</li>');});this.setPosition();if(!$('#'+self.container+' ul').is(':empty')){$('#'+this.container).show();}},createContainer:function(){return'<div id="'+this.container+'" class="'+this.containerClass+'"><ul></ul></div>';},setPosition:function(){var tp=Math.round($(this.el).offset().top)+this.offset.top-$(window).scrollTop();var lft=Math.round($(this.el).offset().left)+this.offset.left;var wdth=Math.round($(this.el).width());$('#'+this.container).css({left:lft,top:tp,width:wdth});return this;}};Scion.GlobalTasksManager=(function()
{var setup=function()
{setUpNavigation();setModals();setUpChat();Scion.Core.LanguageSelector.init();setPPTooltip();};var setPPTooltip=function()
{new Scion.widgets.ToolTip({dynamic:false,trigger:'div#footer ul#footer_shortcuts li.privacy a',target:'#pp_tooltip',position:'top',offsets:{right:TCI.Globals.locale=="en"?-30:-30,top:-95}});};var setUpChat=function()
{$(".chat_link").live('click',function()
{Scion.Chat.serviceSuccess({});return false;});Scion.Chat.errorModal=new TCI.Core.Modal({height:'auto',name:'chat_error_modal',title:TCI.localize.getLabel('chat_error_title'),url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/modals/chat/chat_error.html'),width:320});$('#chat_error_modal button').live('click',function(){var lang=TCI.Globals.locale=='fr'?'fr/':'';document.location.href=TCI.Globals.contextPath+'/'+lang+'secure/contact-us';});new Scion.widgets.ToolTip({dynamic:false,trigger:'#site_functions_chat a',target:'#chat_tooltip',position:'bottom',offsets:{right:TCI.Globals.locale=="en"?-70:-55,bottom:10}});};var setUpNavigation=function()
{Scion.NavigationManager.init();};var checkPageLocale=function()
{if(Scion.LocaleManager.getCookie()==null){Scion.Core.global.languageModal.show();}};var setModals=function(){TCI.Globals.privacyModalInstance=new Scion.PrivacyModal({z_index:888888,height:'350px',selector:'class',trigger:'privacy_notice',title:TCI.localize.getLabel('title_privacy_policy'),name:'privacy_policy_modal',url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/content/'+TCI.Globals.locale+'/top_level/privacy.html'),scrollable:true});TCI.Globals.privacyModalInstanceTCCI=new Scion.PrivacyModal({z_index:888889,height:'350px',selector:'class',trigger:'privacy_notice_tcci',title:TCI.localize.getLabel('title_privacy_policy_tcci'),name:'privacy_policy_modal',url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/content/'+TCI.Globals.locale+'/top_level/privacy_tcci.html'),scrollable:true});new Scion.VehicleMenuDisclaimerModal({targetId:"tc"});new Scion.VehicleMenuDisclaimerModal({targetId:"xb"});new Scion.VehicleMenuDisclaimerModal({targetId:"xd"});new Scion.VehicleMenuDisclaimerModal({targetId:"iq"});Scion.Core.global.languageModal=new Scion.LanguageSelectionModal({name:"language_selector"});};return{init:function(){setup();},checkPageLocale:function(){checkPageLocale();},initAsyncChat:function(){setUpChat();}};})();Scion.Core.global.TooltipIsAnimating=false;$(document).ready(function()
{Scion.GlobalTasksManager.init();});$(window).load(function()
{Scion.PriceDisplayManager.populate();});String.prototype.trim=function(){return jQuery.trim(this);};String.prototype.replaceAll=function(s1,s2){return this.replace(new RegExp(s1,'g'),s2);};String.prototype.removeSpaces=function(){return this.replace(/\s/g,'');};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1);};String.prototype.capitalizeAll=function(){return this.replace(/(^|\s)([a-z])/g,function(m,p1,p2){return p1+p2.toUpperCase();});};String.prototype.toCurrency=function(lang,floatToggle)
{lang=lang||TCI.Globals.locale||'en';floatToggle=floatToggle==undefined?false:floatToggle;switch(lang){case'fr':var tDem='&#160;';var dDem=',';break;default:var tDem=',';var dDem='.';break;}
var num=this.replace(/\$|\,/g,'');if(isNaN(num)){num='0';}
var sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);var cents=num%100;if(cents>0){if(cents<10){cents='0'+cents;}}else{if(floatToggle){cents='00';}else{dDem='';cents='';}}
num=Math.floor(num/100).toString();var loopCount=Math.ceil(num.length/3);var newNum='';for(var i=0;i<loopCount;i++){newNum=num.substring(num.length-((i+1)*3),num.length-(i*3))+tDem+newNum;}
newNum=newNum.substring(0,newNum.length-tDem.length);switch(lang){case'fr':return(((sign)?'':'-')+newNum+dDem+cents+'&#160;$');break;default:return(((sign)?'':'-')+'$'+newNum+dDem+cents);break;}};String.prototype.toNumber=function(lang,floatToggle)
{lang=lang||TCI.Globals.locale||'en';floatToggle=floatToggle==undefined?false:floatToggle;switch(lang){case'fr':var tDem='&#160;';var dDem=',';break;default:var tDem=',';var dDem='.';break;}
var num=this.replace(/\$|\,/g,'');if(isNaN(num)){num='0';}
var sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);var cents=num%100;if(cents>0){if(cents<10){cents='0'+cents;}}else{if(floatToggle){cents='00';}else{dDem='';cents='';}}
num=Math.floor(num/100).toString();var loopCount=Math.ceil(num.length/3);var newNum='';for(var i=0;i<loopCount;i++){newNum=num.substring(num.length-((i+1)*3),num.length-(i*3))+tDem+newNum;}
newNum=newNum.substring(0,newNum.length-tDem.length);return newNum+dDem+cents;};String.prototype.toPercentage=function(lang,floatToggle)
{switch(lang){case'fr':var tDem='&#160;';var dDem=',';break;default:var tDem=',';var dDem='.';break;}
var num=this.replace(/\$|\,/g,'');if(isNaN(num)){num="0";}
sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);if(floatToggle==true){cents=num%100;}else{dDem='';cents='';}
num=Math.floor(num/100).toString();var loopCount=Math.ceil(num.length/3);var newNum='';for(var i=0;i<loopCount;i++){newNum=num.substring(num.length-((i+1)*3),num.length-(i*3))+tDem+newNum;}
newNum=newNum.substring(0,newNum.length-tDem.length);switch(lang){case'fr':return(((sign)?'':'-')+newNum+dDem+cents+'&#160;%');break;default:return(((sign)?'':'-')+newNum+dDem+cents+'%');break;}};String.prototype.toPhoneNumber=function()
{var completeNbr=this;switch(completeNbr.length){case 11:var prefix=completeNbr.substring(0,0);var areaCode=completeNbr.substring(0,2);var local=completeNbr.substring(3,5);var localNbr=completeNbr.substring(6,9);completeNbr=prefix+'-'+areaCode+'-'+local+'-'+localNbr;break;default:var areaCode=completeNbr.substring(0,3);var local=completeNbr.substring(3,6);var localNbr=completeNbr.substring(6,10);completeNbr=areaCode+'-'+local+'-'+localNbr;break;}
return completeNbr;};String.prototype.toPostalCode=function()
{var pCode=this;var pCode=pCode.substring(0,3)+' '+pCode.substring(3,6);return pCode;};Date.prototype.format=function(mask,utc)
{return TCI.Date.dateFormat(this,mask,utc);};Date.prototype.getLongLocalizedFormat=function(locale,utc)
{var locale=locale||TCI.Globals.locale;switch(locale){case'fr':return TCI.Date.formatToFrench(this,utc);case'en':return TCI.Date.dateFormat(this,'mmm d, yyyy h:MM TT, Z',utc);}};function typeOf(value)
{var s=typeof value;if(s==='object'){if(value){if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))&&typeof value.splice==='function'){s='array';}}else{s='null';}}
return s;}
$.fn.listHandlers=function(events,outputFunction)
{return this.each(function(i)
{var elem=this,dEvents=$(this).data('events');if(!dEvents){return;}
$.each(dEvents,function(name,handler)
{if((new RegExp('^('+(events==='*'?'.+':events.replace(',','|').replace(/^on/i,''))+')$','i')).test(name)){$.each(handler,function(i,handler){outputFunction(elem,'\n'+i+': ['+name+'] : '+handler);});}});});};$.fn.center=function(parent)
{var container=parent||window;this.css('position','absolute');this.css('top',($(container).offset().top+($(container).height()-this.height())/2+$(container).scrollTop()+'px'));this.css('left',($(container).offset().left+($(container).width()-this.width())/2+$(container).scrollLeft()+'px'));return this;};$.fn.getCaretPosition=function()
{var pos=0;var el=$(this).get(0);if(document.selection){el.focus();var Sel=document.selection.createRange();var SelLength=document.selection.createRange().text.length;Sel.moveStart('character',-el.value.length);pos=Sel.text.length-SelLength;}
else if(el.selectionStart||el.selectionStart=='0')
pos=el.selectionStart;return pos;};$.fn.setCaretPosition=function(pos)
{if($(this).get(0).setSelectionRange){$(this).get(0).focus();$(this).get(0).setSelectionRange(pos,pos);}
else if($(this).get(0).createTextRange){var range=$(this).get(0).createTextRange();range.collapse(true);range.moveEnd('character',pos);range.moveStart('character',pos);range.select();}};$.fn.setCaretPositionAtEnd=function()
{$(this).setCaretPosition($(this).val().length);};var TCI=(function(name){return name;}(TCI||{}));TCI.Utils={};TCI.Utils.pause=function(milliseconds)
{var dt=new Date();while((new Date())-dt<=milliseconds){}};TCI.Utils.size=function(array)
{var count=0;for(var i in array)
count++;return count;};TCI.Utils.clone=function(obj)
{var c=obj instanceof Array?[]:{};for(var i in obj){var prop=obj[i];if(typeof prop=='object'){if(prop instanceof Array){c[i]=[];for(var j=0;j<prop.length;j++){if(typeof prop[j]!='object'){c[i].push(prop[j]);}else{c[i].push(TCI.Utils.clone(prop[j]));}}}else{c[i]=TCI.Utils.clone(prop);}}else{c[i]=prop;}}
return c;};TCI.Utils.isEmpty=function(o)
{for(var prop in o)
if(o.hasOwnProperty(prop))
return false;return true;};TCI.Utils.hasCaps=function(s)
{var regexp=/[A-Z]/g;return regexp.exec(s)!=null;};TCI.Utils.getLabel=function(labelId,replacements,locale)
{var locale=locale||TCI.Globals.locale;var message=(messages[locale]||[])[labelId]||labelId;if(replacements){for(value in replacements){var replaceRegex=new RegExp('\{'+value+'\}','g');message=message.replace(replaceRegex,replacements[value]);}}
return message;};TCI.Utils.getProvinceName=function(provinceAbbr,locale)
{return TCI.Utils.getLabel(TCI.Utils.getLabel('province_'+provinceAbbr.toLowerCase(),null,locale));};TCI.Utils.parseJSON=function(data)
{if(data==null||data=='')
return null;var json=!!window.JSON&&!!window.JSON.parse?window.JSON.parse(data):eval('('+data+')');return json;};TCI.Utils.addAlternating=function(className,selectedEl)
{$(selectedEl+':even').addClass(className);};TCI.Utils.addTableHeaderCorners=function()
{if($.browser.webkit!=true){$('.summary_table thead th.finance_item, .summary_table thead th.lease_item, .summary_table thead th.cash_item').prepend('<b class="tl"></b><b class="tr"></b>');}else{$('.summary_table thead th.finance_item, .summary_table thead th.lease_item, .summary_table thead th.cash_item').prepend('<b class="wk tl"></b><b class="wk tr"></b>');}};TCI.Utils.showHidePanels=function(show,hide)
{$(hide).addClass('hidden');$(show).removeClass('hidden').removeClass('invisible');};TCI.Utils.getSelectedRadioValue=function(radioObj)
{if(!radioObj)
return'';var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return'';for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return'';};TCI.Utils.getURLHash=function()
{return location.hash==''?null:location.hash.substr(1);};TCI.Utils.getURLWithHash=function(hash)
{return location.protocol+'//'+location.hostname+location.pathname+'#'+hash;}
TCI.Utils.getURLParameter=function(paramName)
{switch(paramName)
{case'series':return window.location.pathname.match(new RegExp('^'+TCI.Globals.contextPath+TCI.Globals.urlLocaleToken+TCI.Utils.getOptionalSecurePrefix()+'\/build-price\/([^/]+)'))[1];case'lang':return'en';default:paramName=paramName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+paramName+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)
return"";else
return unescape(results[1]);}};TCI.Utils.getSentVehicleId=function()
{if(location.pathname.indexOf('/build-price/sent-vehicle/')>-1){return location.pathname.match(/\/build-price\/sent-vehicle\/([a-zA-Z0-9]+)/)[1];}else{return null;}};TCI.Utils.getHttpsUrl=function(partialPath){return TCI.Globals.basehref_secure+TCI.Globals.contextPath+TCI.Globals.urlLocaleToken+'/secure'+partialPath;};TCI.Utils.getHttpUrl=function(partialPath){return TCI.Globals.basehref+TCI.Globals.contextPath+TCI.Globals.urlLocaleToken+partialPath;};TCI.Utils.getQualifiedMediaURL=function(partialPath,no_cache){var path;if(partialPath.indexOf('/')!=0){partialPath='/'+partialPath;}
if(TCI.Utils.isPageSecure()){path=TCI.Globals.media_secure_basehref+partialPath;}else{path=TCI.Globals.media_basehref+partialPath;}
if(!no_cache){path=TCI.Utils.appendMediaURLCacheParamerter(path);}
return path;};TCI.Utils.appendMediaURLCacheParamerter=function(url)
{if(url.indexOf('?ck=')<0){url=url+'?ck='+TCI.Globals.cacheKill;}
else
{TCI.Log.debug('*********************** already had cache kill : '+url);}
return url;};TCI.Utils.getURL=function(query)
{if(query.charAt(0)!='/')
query='/'+query;return TCI.Globals.contextPath+query;};TCI.Utils.postToUrl=function(url,params,target)
{var form=$('<form action="'+url+'" method="post" target="'+(target||'_self')+'"/>');TCI.Core.Encoder.EncodeType="numerical";for(var i in params){if(params.hasOwnProperty(i)){form.append('<input type="hidden" name="'+i+'" value="'+TCI.Core.Encoder.htmlEncode(params[i])+'"/>');}}
form.appendTo('body');form.submit();};TCI.Utils.getSecureURL=function(path)
{if(path.charAt(0)!='/')
path='/'+path;return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+path);};TCI.Utils.getFullURL=function(path)
{return TCI.Globals.scion_basehref+TCI.Utils.getURL(path);};TCI.Utils.isTargetPageSecure=function(eventObject)
{var isSecure=false;if(!!eventObject&&!!eventObject.target&&!!eventObject.target.activeElement&&!!eventObject.target.activeElement.pathname)
{isSecure=TCI.Utils.isPathSecure(eventObject.target.activeElement.pathname);}
if(isSecure)return true;if(!!eventObject&&!!eventObject.target&&!!eventObject.target.activeElement&&!!eventObject.target.activeElement.href)
{isSecure=TCI.Utils.isPathSecure(eventObject.target.activeElement.href);}
if(isSecure)return true;return isSecure;};TCI.Utils.synchHTTPSJSessions=function()
{TCI.Log.info('TCI.Globals.isSessionNew : '+TCI.Globals.isSessionNew);TCI.Log.info('TCI.Globals.sessionId : '+TCI.Globals.sessionId);var jsessionIds=TCI.Core.readCookies('JSESSIONID');TCI.Log.info('found '+jsessionIds.length+' JSESSIONIDs : '+jsessionIds);TCI.Log.info('deleting them all...');for(var i=0;i<jsessionIds.length;i++)
{TCI.Core.eraseCookie('JSESSIONID');TCI.Core.eraseCookieSimple('JSESSIONID');}
var jsessionIds2=TCI.Core.readCookies('JSESSIONID');TCI.Log.info('now found '+jsessionIds2.length+' JSESSIONIDs : '+jsessionIds2);TCI.Log.info('setting them again...');for(var i=0;i<jsessionIds.length;i++)
{var jsessionId=jsessionIds[i];TCI.Log.info('JSESSIONID : '+jsessionId);if(jsessionId.indexOf(TCI.Globals.sessionId)!=-1)
{TCI.Log.info('SETTING...');document.cookie='JSESSIONID='+jsessionId+'; path='+TCI.Globals.contextPath+'; domain='+TCI.Globals.cookie_domain;}
else
{TCI.Log.info('IGNORING...');}}
jsessionIds=TCI.Core.readCookies('JSESSIONID');TCI.Log.info('finally have '+jsessionIds.length+' JSESSIONIDs : '+jsessionIds);};TCI.Utils.isPathSecure=function(path)
{var re=/\/secure\//;return re.test(path);};TCI.Utils.isPageSecure=function()
{return TCI.Utils.isPathSecure(document.location);};TCI.Utils.getSecurePrefix=function()
{return"/secure";};TCI.Utils.getOptionalSecurePrefix=function()
{if(TCI.Utils.isPageSecure())
{return TCI.Utils.getSecurePrefix();}
return"";};TCI.Utils.getGetGeoIPURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/GeoIP');};TCI.Utils.getVehicleLinkURL=function(link)
{return TCI.Utils.getFullURL(TCI.Globals.urlLocaleToken+'/build-price/sent-vehicle/'+link);};TCI.Utils.getDealerByCodeURL=function(brand,code)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/DealerService/rest/dealer/getDealerByCode/'+brand+'/'+code);};TCI.Utils.getDealerSearchURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/DealerService/rest/dealer/search');};TCI.Utils.getDealerGSASearchURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/dealers/search');};TCI.Utils.getDealerProximitySearchURL=function(brand)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/DealerSearchWeb/rest/searchDealer/'+brand);};TCI.Utils.getPriceURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ProductVerificationWeb/rest/priceVehicle/JSON');};TCI.Utils.getBrandURL=function(brand)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ProductVerificationWeb/rest/series/'+brand);};TCI.Utils.getSeriesURL=function(brand,series)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ProductVerificationWeb/rest/series/'+brand+'/'+series);};TCI.Utils.getVehicleURL=function(brand,series,model,year)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ProductVerificationWeb/rest/vehicle/'+brand+'/'+series+'/'+model+'/'+year);};TCI.Utils.getAccessoryDescriptionURL=function(accessoryCode,locale)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ProductVerificationWeb/Asset/rest/acc/longDesc/'+accessoryCode+'/'+locale);};TCI.Utils.getPackageMessageURL=function(brand,series,model,year,package)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/VehicleParameter/rest/'+brand+'/'+series+'/'+model+'/'+year+'/'+package);};TCI.Utils.getGetConsumerRequestURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ConsumerWeb/rest/consumerRequest');};TCI.Utils.getGetConsumerInfoGetAccountURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/getAccount');};TCI.Utils.getGetProcessVehicleURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/processVehicle');};TCI.Utils.getGetProcessVehicleForSocialURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/processVehicleSN');};TCI.Utils.getGetConsumerInfoCreateAccountURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/createAccount');};TCI.Utils.getGetConsumerInfoDeleteAccountURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/deleteAccount');};TCI.Utils.getGetSavedVehiclesURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/getVehicle');};TCI.Utils.getSaveVehicleURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/saveVehicle');};TCI.Utils.getDeleteVehicelURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/deleteVehicle');};TCI.Utils.getGetVehicleByLinkURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ConsumerInfoRest/rest/consumerInfo/getVehicleByLink');};TCI.Utils.getProgramsURL=function(brand,seriesCode,modelYear,modelCode,packageCode,date)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/PromotionRestWeb/rest/promotion/W/'+brand+'/'+seriesCode.toUpperCase()+'/'+modelYear+'/'+date+'/'+modelCode+'/'+packageCode);};TCI.Utils.getSpecificationsURL=function(seriesCode,modelYear)
{if(TCI.Utils.isScion())
{return TCI.Utils.getURL('/data/specifications/'+TCI.Globals.locale+'/'+seriesCode.toLowerCase()+'/'+modelYear+'.csv');}
else
{return TCI.Utils.getContentPath('/data/specifications/'+TCI.Globals.locale+'/'+seriesCode.toLowerCase()+'/'+modelYear+'.csv');}};TCI.Utils.getImageServiceURL=function(path)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/ProductVerificationWeb/Asset/rest/imagePath'+path);};TCI.Utils.getCatalogServiceURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/service/rest/catalog');};TCI.Utils.getLoyaltyDBURL=function(name)
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/service/LoyaltyDB_'+name);};TCI.Utils.getGetFrsDBURL=function()
{return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/service/FrsDBPost');};TCI.Utils.getGetAuthenticationCreateAccountURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/createAccount');};TCI.Utils.getGetChangeAccountPasswordURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/changeAccountPassword');};TCI.Utils.getGetUpdateAccountEmailURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/updateAccountEmail');};TCI.Utils.getGetAuthenticationDeleteAccountURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/deleteAccount');};TCI.Utils.getGetAuthenticationForgotPasswordStep1URL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/updateAccount');};TCI.Utils.getGetAuthenticationForgotPasswordStep2URL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/updateAccountPassword');};TCI.Utils.getLogoutURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/B2CAuthenticationRESTServiceWeb/rest/b2cAuthentication/logout');};TCI.Utils.getTicketGrantingTicketURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/cas/v1/tickets');};TCI.Utils.getServiceTicketURL=function(tgt)
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/cas/v1/tickets/'+tgt);};TCI.Utils.getCreditAppApplyURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/creditappservice/rest/creditapp');};TCI.Utils.getCreditAppStatusURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/creditappservice/rest/getca/querystatus');};TCI.Utils.getCreditAppCertInfoURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/creditappservice/rest/getca/getcertinfo');};TCI.Utils.getCreditAppResendAppCodeURL=function()
{return TCI.Utils.getURL(TCI.Utils.getSecurePrefix()+'/creditappservice/rest/resendca');};TCI.Utils.getUnityMapXMLURL=function(seriesCode)
{return TCI.Utils.getMediaURL('/media/unity/images/map_scion_'+seriesCode.toLowerCase()+'.xml');};TCI.Utils.redirectTo404=function()
{location.href=TCI.Utils.get404URL();};TCI.Utils.get404URL=function()
{return TCI.Utils.getURL(TCI.Globals.urlLocaleToken+'/404');};TCI.Utils.get500URL=function()
{return TCI.Utils.getURL(TCI.Globals.urlLocaleToken+'/500');};TCI.Utils.getMediaURL=function(path)
{return TCI.Utils.getSecureURL(path);};TCI.Utils.getFullMediaURL=function(path)
{return TCI.Utils.getFullURL(path);};TCI.Utils.getInteriorColorURL=function(seriesCode,colorCode)
{return TCI.Utils.getQualifiedMediaURL('/media/colours/int/'+seriesCode.toLowerCase()+'_'+colorCode+'.png');};TCI.Utils.getExteriorColorURL=function(colorCode)
{return TCI.Utils.getQualifiedMediaURL('/media/colours/ext/'+colorCode.toLowerCase()+'.png');};TCI.Utils.getSummaryImageURL=function(params)
{var series=config.getSeries().code;var year=config.getYear();var color=config.getExterior();var wheels=config.getSelectedWheelsId();var accessory='01';if(!!params){series=params.series||series;year=params.year||year;color=params.color||color;wheels=params.wheels||wheels;accessory=params.accessory||accessory;}
return TCI.Utils.getQualifiedMediaURL('/media/print/'+series.toLowerCase()+'/'+year+'_'+color.toLowerCase()+'_'+wheels.toLowerCase()+'_'+accessory+'.png');};TCI.Utils.getVehicleImageURL=function(seriesCode,modelYear,modelCode,exteriorCode,size)
{return TCI.Utils.getQualifiedMediaURL('/media/build/'+seriesCode.toLowerCase()+'/col/'+size+'/'+size.charAt(0)+(new String(modelYear)).substring(2)+'_'+TCI.Utils.getShortModelCode(modelCode).toLowerCase()+'_'+exteriorCode.toLowerCase()+'.'+TCI.Globals.default_image_type);};TCI.Utils.getOptionImageURL=function(seriesCode,modelCode,optionCode,size)
{return TCI.Utils.getQualifiedMediaURL('/media/build/'+seriesCode.toLowerCase()+'/opt/'+size+'/'+size.charAt(0)+TCI.Utils.getShortModelCode(modelCode).toLowerCase()+'_'+optionCode.toLowerCase()+'.'+TCI.Globals.default_image_type);};TCI.Utils.getAccessoryImageURL=function(accessoryCode,size)
{return TCI.Utils.getQualifiedMediaURL('/media/custom/'+size+'/'+size.charAt(0)+accessoryCode.toLowerCase()+'.'+TCI.Globals.default_image_type);};TCI.Utils.getNoImageURL=function()
{return TCI.Utils.getQualifiedMediaURL('/media/chrome/i_no_image.png');};TCI.Utils.getNoThumbURL=function()
{return TCI.Utils.getQualifiedMediaURL('/media/chrome/i_no_thumb.png');};TCI.Utils.getNoPdfImageURL=function()
{return TCI.Utils.getQualifiedMediaURL('/media/chrome/i_no_pdf_accessory_image.png');};TCI.Utils.getCatalogURL=function(seriesCode)
{var vehicleShortName=!!seriesCode?'/'+TCI.Utils.getLabel('series_shortname_'+seriesCode.toLowerCase()):'';return TCI.Utils.getURL(TCI.Globals.urlLocaleToken+'/vehicles'+vehicleShortName.replace(/_/g,'-')+'/overview');};TCI.Utils.getSeriesNameByCode=function(seriesCode)
{return!!seriesCode?TCI.Utils.getLabel('series_shortname_'+seriesCode.toLowerCase()):null;};TCI.Utils.getSeriesCodeByName=function(seriesName)
{return!!seriesName?TCI.Utils.getLabel('series_code_'+seriesName.toLowerCase()):null;};TCI.Utils.getSeriesFullNameByCode=function(seriesCode)
{return!!seriesCode?TCI.Utils.getLabel('series_displayname_'+seriesCode.toLowerCase()):null;};TCI.Utils.getSeriesNameByCodeForAccessoryConfiguratorURL=function(seriesCode)
{var sname=TCI.Utils.getSeriesNameByCode(seriesCode);switch(seriesCode.toUpperCase()){case'SEQ':case'FJC':case'AVA':case'RNR':case'CAH':return null;case'YAH':return'yarishb';case'HIH':return'highlander';default:return sname;}};TCI.Utils.getTCIUserId=function()
{return TCI.Globals.dealerUserId||TCI.Globals.loginId||'public';};TCI.Utils.loadingSpinner=function(holderid,R1,R2,count,stroke_width,colour)
{var sectorsCount=count||12,color=colour||"#fff",width=stroke_width||15,r1=Math.min(R1,R2)||35,r2=Math.max(R1,R2)||60,cx=r2+width,cy=r2+width,r=Raphael(holderid,r2*2+width*2,r2*2+width*2),sectors=[],opacity=[],beta=2*Math.PI/sectorsCount,pathParams={stroke:color,"stroke-width":width,"stroke-linecap":"round"};Raphael.getColor.reset();for(var i=0;i<sectorsCount;i++){var alpha=beta*i-Math.PI/2,cos=Math.cos(alpha),sin=Math.sin(alpha);opacity[i]=1/sectorsCount*i;sectors[i]=r.path([["M",cx+r1*cos,cy+r1*sin],["L",cx+r2*cos,cy+r2*sin]]).attr(pathParams);if(color=="rainbow"){sectors[i].attr("stroke",Raphael.getColor());}}
var tick;(function ticker(){opacity.unshift(opacity.pop());for(var i=0;i<sectorsCount;i++){sectors[i].attr("opacity",opacity[i]);}
r.safari();tick=setTimeout(ticker,1000/sectorsCount);})();return function(){clearTimeout(tick);r.remove();};};TCI.Utils.isDate=function(str)
{var re=/^(\d{1,2})[\s\.\/-](\d{1,2})[\s\.\/-](\d{4})$/;if(!re.test(str))return false;var result=str.match(re);var d=parseInt(result[1],10);var m=parseInt(result[2],10);var y=parseInt(result[3]);var days;if(m<1||m>12||y<1900||y>2100)return false;if(m==2)
{days=((y%4)==0)?29:28;}
else if(m==4||m==6||m==9||m==11)
{days=30;}
else
{days=31;}
return(d>=1&&d<=days);};TCI.Utils.roundUpTo5=function(num)
{if(num%5===0){return num;}
return num+5-num%5;};TCI.Utils.CSVToArray=function(strData,strDelimiter)
{strDelimiter=(strDelimiter||",");var objPattern=new RegExp(("(\\"+strDelimiter+"|\\r?\\n|\\r|^)"+"(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|"+"([^\"\\"+strDelimiter+"\\r\\n]*))"),"gi");var arrData=[[]];var arrMatches=null;while(arrMatches=objPattern.exec(strData))
{var strMatchedDelimiter=arrMatches[1];if(strMatchedDelimiter.length&&(strMatchedDelimiter!=strDelimiter))
{arrData.push([]);}
if(arrMatches[2])
{var strMatchedValue=arrMatches[2].replace(new RegExp("\"\"","g"),"\"");}else{var strMatchedValue=arrMatches[3];}
arrData[arrData.length-1].push(strMatchedValue);}
return(arrData);};TCI.Utils.decodeHTMLEntities=function(encodedSTR)
{return $("<div/>").html(encodedSTR).text();};TCI.Utils.trancateString=function(string,length,sufix)
{if(string.length<=length){return string;}
var indexOfLastSpace=string.lastIndexOf(' ',length);return string.substring(0,indexOfLastSpace!=-1?indexOfLastSpace:length)+(!!sufix?sufix:'');};TCI.Utils.isSiblingSeries=function(scode1,scode2)
{if(!scode1||!scode2||isNaN(scode1.substring(2))||isNaN(scode2.substring(2))){return false;}
if(scode1.substring(0,2)!=scode2.substring(0,2)){return false;}
return true;};TCI.Utils.getSecondsFromStart=function()
{return((new Date().getTime()-pageLoadStart.getTime())/1000).toFixed(2)+'s';};TCI.Utils.getShortModelCode=function(modelCode)
{return!!modelCode?modelCode.substring(0,modelCode.length-1):'';};TCI.Utils.getTransmissionCode=function(modelCode)
{return!!modelCode?modelCode.substring(5):'';};TCI.Utils.isManualTransmission=function(transCode)
{return transCode=='F'||transCode=='K'||transCode=='L'||transCode=='M';};TCI.Utils.getBrowserVersion=function(browser){var version=0,regexp;if(navigator.userAgent.indexOf(browser)>-1){regexp=browser+'\/([\\d.]+)';regexp=new RegExp(regexp);}
var result=regexp.exec(navigator.userAgent);if(result){version=parseFloat(result[1]);}
return version;};TCI.Utils.getContentDirectPath=function(path,forceSecure)
{var isSecure=forceSecure?true:TCI.Utils.isPageSecure();var base=TCI.Globals['media'+(isSecure?'_secure':'')+'_basehref'];base+='/src';path=base+path+"?ck="+TCI.Globals.cache_kill;TCI.Log.debug('******** '+path);return path;};TCI.Utils.getContentPath=function(path,forceSecure)
{var base=TCI.Globals.contextPath;if(forceSecure){base+=TCI.Utils.getSecurePrefix();}else{base+=TCI.Utils.getOptionalSecurePrefix();}
if(TCI.Utils.isCloudMode())
{if(path.charAt(0)!='/'){path='/'+path;}
var proxy=(!TCI.Utils.isProdEnv())?'/amazon'+TCI.Globals.contextPath:'';path=base+proxy+'/src'+path+"?ck="+TCI.Globals.cache_kill;}
else
{path=base+'/ContentServlet?filePath='+path;}
TCI.Log.debug('******** '+path);return path;};TCI.Utils.getSecureContentPath=function(path)
{return TCI.Utils.getContentPath(path,true);};TCI.Utils.isScion=function()
{return TCI.Globals.brand==="SCI";};TCI.Utils.isToyota=function()
{return TCI.Globals.brand==="TOY";};TCI.Utils.isCloudMode=function()
{return TCI.Globals.content_load_type==="CLOUD";};TCI.Utils.isProdEnv=function()
{return TCI.Globals.is_prod==true;};TCI.Utils.isCharPressed=function(event)
{var charCode=(event.which)?event.which:event.keyCode;if(charCode==8)return false;if(charCode==9)return false;if(charCode==13)return false;if(charCode==16)return false;if(charCode==17)return false;if(charCode==18)return false;if(charCode==19)return false;if(charCode==20)return false;if(charCode==27)return false;if(charCode==33)return false;if(charCode==34)return false;if(charCode==35)return false;if(charCode==36)return false;if(charCode==37)return false;if(charCode==38)return false;if(charCode==39)return false;if(charCode==40)return false;if(charCode==45)return false;if(charCode==46)return false;if(charCode==91)return false;if(charCode==92)return false;if(charCode==93)return false;if(charCode==106)return false;if(charCode==107)return false;if(charCode==109)return false;if(charCode==110)return false;if(charCode==111)return false;if(charCode==112)return false;if(charCode==113)return false;if(charCode==114)return false;if(charCode==115)return false;if(charCode==116)return false;if(charCode==117)return false;if(charCode==118)return false;if(charCode==119)return false;if(charCode==120)return false;if(charCode==121)return false;if(charCode==122)return false;if(charCode==123)return false;if(charCode==144)return false;if(charCode==145)return false;return true;};TCI.Utils.getWebObjectsLocale=function(locale)
{var locale=locale||TCI.Globals.locale;return(locale=='en')?'english':'francais';};TCI.Utils.toArray=function(collection)
{var array=[];for(var i in collection)
array.push(collection[i]);return array;};TCI.Utils.closeHTMLTags=function(content){var i=0;content=String(content).replace(new RegExp('<img([^>]+)(\s*[^\/])>','g'),function(s,m1){i++;return'<img '+m1+'" />';});return content;};TCI.Utils.getAutodataBaseURL=function()
{if(TCI.Utils.isScion()){return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/scion-dw/');}else if(TCI.Utils.isToyota()){return TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/toyota-dw/');}};TCI.Utils.getBuildPriceURL=function(seriesCode)
{return TCI.Utils.getURL(TCI.Globals.urlLocaleToken+'/build-price/'+seriesCode.toLowerCase());};TCI.Utils.getDefaultColorBySeries=function(seriesCode)
{return TCI.Globals['default_color_'+seriesCode.toLowerCase()];};(function(){var rsplit=function(string,regex){var result=regex.exec(string),retArr=new Array(),first_idx,last_idx,first_bit;while(result!=null)
{first_idx=result.index;last_idx=regex.lastIndex;if((first_idx)!=0)
{first_bit=string.substring(0,first_idx);retArr.push(string.substring(0,first_idx));string=string.slice(first_idx);}
retArr.push(result[0]);string=string.slice(result[0].length);result=regex.exec(string);}
if(!string=='')
{retArr.push(string);}
return retArr;},chop=function(string){return string.substr(0,string.length-1);},extend=function(d,s){for(var n in s){if(s.hasOwnProperty(n))d[n]=s[n]}}
EJS=function(options){if(options!==undefined&&options.url!==undefined){TPM.Performance.TimeLog.start("ejs_new",options.url);}
options=typeof options=="string"?{view:options}:options
this.set_options(options);if(options.precompiled){this.template={};this.template.process=options.precompiled;vEJS.update(this.name,this);return;}
if(options.element)
{if(typeof options.element=='string'){var name=options.element
options.element=document.getElementById(options.element)
if(options.element==null)throw name+'does not exist!'}
if(options.element.value){this.text=options.element.value}else{this.text=options.element.innerHTML}
this.name=options.element.id
this.type='['}else if(options.url){options.url=vEJS.endExt(options.url,this.extMatch);this.name=this.name?this.name:options.url;var url=options.url;var template=vEJS.get(this.name,this.cache);if(template)return template;if(template==vEJS.INVALID_PATH)return null;try{if(TCI.Utils.isScion())
{this.text=vEJS.request(url+'?ck='+TCI.Globals.cacheKill);}
else
{this.text=vEJS.request(url);}}catch(e){}
if(this.text==null){throw({type:'vEJS',message:'There is no template at '+url});}}
var template=new vEJS.Compiler(this.text,this.type);template.compile(options,this.name);vEJS.update(this.name,this);if(options.logLabel!==undefined){template.logLabel=options.logLabel;}else if(options.url!==undefined){template.logLabel=options.url;}
this.template=template;TPM.Performance.TimeLog.stop("ejs_new");};var vEJS=EJS;vEJS.prototype={render:function(object,extra_helpers){TPM.Performance.TimeLog.start("ejs_render",this.template.logLabel);object=object||{};this._extra_helpers=extra_helpers;var v=new vEJS.Helpers(object,extra_helpers||{});var renderResult=this.template.process.call(object,object,v);TPM.Performance.TimeLog.stop("ejs_render");return renderResult;},update:function(element,options){if(typeof element=='string'){element=document.getElementById(element)}
if(options==null){_template=this;return function(object){vEJS.prototype.update.call(_template,element,object)}}
if(typeof options=='string'){params={}
params.url=options
_template=this;params.onComplete=function(request){var object=eval(request.responseText)
vEJS.prototype.update.call(_template,element,object)}
vEJS.ajax_request(params)}else
{element.innerHTML=this.render(options)}},out:function(){return this.template.out;},set_options:function(options){this.type=options.type||vEJS.type;this.cache=options.cache!=null?options.cache:vEJS.cache;this.text=options.text||null;this.name=options.name||null;this.ext=options.ext||vEJS.ext;this.extMatch=new RegExp(this.ext.replace(/\./,'\.'));}};vEJS.endExt=function(path,match){if(!path)return null;match.lastIndex=0
return path+(match.test(path)?'':this.ext)}
vEJS.Scanner=function(source,left,right){extend(this,{left_delimiter:left+'%',right_delimiter:'%'+right,double_left:left+'%%',double_right:'%%'+right,left_equal:left+'%=',left_comment:left+'%#'})
this.SplitRegexp=left=='['?/(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/:new RegExp('('+this.double_left+')|(%%'+this.double_right+')|('+this.left_equal+')|('+this.left_comment+')|('+this.left_delimiter+')|('+this.right_delimiter+'\n)|('+this.right_delimiter+')|(\n)');this.source=source;this.stag=null;this.lines=0;};vEJS.Scanner.to_text=function(input){if(input==null||input===undefined)
return'';if(input instanceof Date)
return input.toDateString();if(input.toString)
return input.toString();return'';};vEJS.Scanner.prototype={scan:function(block){scanline=this.scanline;regex=this.SplitRegexp;if(!this.source=='')
{var source_split=rsplit(this.source,/\n/);for(var i=0;i<source_split.length;i++){var item=source_split[i];this.scanline(item,regex,block);}}},scanline:function(line,regex,block){this.lines++;var line_split=rsplit(line,regex);for(var i=0;i<line_split.length;i++){var token=line_split[i];if(token!=null){try{block(token,this);}catch(e){throw{type:'vEJS.Scanner',line:this.lines};}}}}};vEJS.Buffer=function(pre_cmd,post_cmd){this.line=new Array();this.script="";this.pre_cmd=pre_cmd;this.post_cmd=post_cmd;for(var i=0;i<this.pre_cmd.length;i++)
{this.push(pre_cmd[i]);}};vEJS.Buffer.prototype={push:function(cmd){this.line.push(cmd);},cr:function(){this.script=this.script+this.line.join('; ');this.line=new Array();this.script=this.script+"\n";},close:function(){if(this.line.length>0)
{for(var i=0;i<this.post_cmd.length;i++){this.push(pre_cmd[i]);}
this.script=this.script+this.line.join('; ');line=null;}}};vEJS.Compiler=function(source,left){this.pre_cmd=['var ___ViewO = [];'];this.post_cmd=new Array();this.source=' ';if(source!=null)
{if(typeof source=='string')
{source=source.replace(/\r\n/g,"\n");source=source.replace(/\r/g,"\n");this.source=source;}else if(source.innerHTML){this.source=source.innerHTML;}
if(typeof this.source!='string'){this.source="";}}
left=left||'<';var right='>';switch(left){case'[':right=']';break;case'<':break;default:throw left+' is not a supported deliminator';break;}
this.scanner=new vEJS.Scanner(this.source,left,right);this.out='';};vEJS.Compiler.prototype={compile:function(options,name){options=options||{};this.out='';var put_cmd="___ViewO.push(";var insert_cmd=put_cmd;var buff=new vEJS.Buffer(this.pre_cmd,this.post_cmd);var content='';var clean=function(content)
{content=content.replace(/\\/g,'\\\\');content=content.replace(/\n/g,'\\n');content=content.replace(/"/g,'\\"');return content;};this.scanner.scan(function(token,scanner){if(scanner.stag==null)
{switch(token){case'\n':content=content+"\n";buff.push(put_cmd+'"'+clean(content)+'");');buff.cr();content='';break;case scanner.left_delimiter:case scanner.left_equal:case scanner.left_comment:scanner.stag=token;if(content.length>0)
{buff.push(put_cmd+'"'+clean(content)+'")');}
content='';break;case scanner.double_left:content=content+scanner.left_delimiter;break;default:content=content+token;break;}}
else{switch(token){case scanner.right_delimiter:switch(scanner.stag){case scanner.left_delimiter:if(content[content.length-1]=='\n')
{content=chop(content);buff.push(content);buff.cr();}
else{buff.push(content);}
break;case scanner.left_equal:buff.push(insert_cmd+"(vEJS.Scanner.to_text("+content+")))");break;}
scanner.stag=null;content='';break;case scanner.double_right:content=content+scanner.right_delimiter;break;default:content=content+token;break;}}});if(content.length>0)
{buff.push(put_cmd+'"'+clean(content)+'")');}
buff.close();this.out=buff.script+";";var to_be_evaled='/*'+name+'*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {'+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";try{eval(to_be_evaled);}catch(e){if(typeof JSLINT!='undefined'){JSLINT(this.out);for(var i=0;i<JSLINT.errors.length;i++){var error=JSLINT.errors[i];if(error.reason!="Unnecessary semicolon."){error.line++;var e=new Error();e.lineNumber=error.line;e.message=error.reason;if(options.view)
e.fileName=options.view;throw e;}}}else{throw e;}}}};vEJS.config=function(options){vEJS.cache=options.cache!=null?options.cache:vEJS.cache;vEJS.type=options.type!=null?options.type:vEJS.type;vEJS.ext=options.ext!=null?options.ext:vEJS.ext;var templates_directory=vEJS.templates_directory||{};vEJS.templates_directory=templates_directory;vEJS.get=function(path,cache){if(cache==false)return null;if(templates_directory[path])return templates_directory[path];return null;};vEJS.update=function(path,template){if(path==null)return;templates_directory[path]=template;};vEJS.INVALID_PATH=-1;};vEJS.config({cache:true,type:'<',ext:'.html'});vEJS.Helpers=function(data,extras){this._data=data;this._extras=extras;extend(this,extras);};vEJS.Helpers.prototype={view:function(options,data,helpers){if(!helpers)helpers=this._extras
if(!data)data=this._data;return new vEJS(options).render(data,helpers);},to_text:function(input,null_text){if(input==null||input===undefined)return null_text||'';if(input instanceof Date)return input.toDateString();if(input.toString)return input.toString().replace(/\n/g,'<br />').replace(/''/g,"'");return'';}};vEJS.newRequest=function(){var factories=[function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Microsoft.XMLHTTP");}];for(var i=0;i<factories.length;i++){try{var request=factories[i]();if(request!=null)return request;}
catch(e){continue;}}}
vEJS.request=function(path){var request=new vEJS.newRequest()
request.open("GET",path,false);try{request.send(null);}
catch(e){return null;}
if(request.status==404||request.status==2||(request.status==0&&request.responseText==''))return null;return request.responseText}
vEJS.ajax_request=function(params){params.method=(params.method?params.method:'GET')
var request=new vEJS.newRequest();request.onreadystatechange=function(){if(request.readyState==4){if(request.status==200){params.onComplete(request)}else
{params.onComplete(request)}}}
request.open(params.method,params.url)
request.send(null)}})();EJS.Helpers.prototype.date_tag=function(name,value,html_options){if(!(value instanceof Date))
value=new Date()
var month_names=["January","February","March","April","May","June","July","August","September","October","November","December"];var years=[],months=[],days=[];var year=value.getFullYear();var month=value.getMonth();var day=value.getDate();for(var y=year-15;y<year+15;y++)
{years.push({value:y,text:y})}
for(var m=0;m<12;m++)
{months.push({value:(m),text:month_names[m]})}
for(var d=0;d<31;d++)
{days.push({value:(d+1),text:(d+1)})}
var year_select=this.select_tag(name+'[year]',year,years,{id:name+'[year]'})
var month_select=this.select_tag(name+'[month]',month,months,{id:name+'[month]'})
var day_select=this.select_tag(name+'[day]',day,days,{id:name+'[day]'})
return year_select+month_select+day_select;}
EJS.Helpers.prototype.form_tag=function(action,html_options){html_options=html_options||{};html_options.action=action
if(html_options.multipart==true){html_options.method='post';html_options.enctype='multipart/form-data';}
return this.start_tag_for('form',html_options)}
EJS.Helpers.prototype.form_tag_end=function(){return this.tag_end('form');}
EJS.Helpers.prototype.hidden_field_tag=function(name,value,html_options){return this.input_field_tag(name,value,'hidden',html_options);}
EJS.Helpers.prototype.input_field_tag=function(name,value,inputType,html_options){html_options=html_options||{};html_options.id=html_options.id||name;html_options.value=value||'';html_options.type=inputType||'text';html_options.name=name;return this.single_tag_for('input',html_options)}
EJS.Helpers.prototype.is_current_page=function(url){return(window.location.href==url||window.location.pathname==url?true:false);}
EJS.Helpers.prototype.link_to=function(name,url,html_options){if(!name)var name='null';if(!html_options)var html_options={}
if(html_options.confirm){html_options.onclick=" var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} "
html_options.confirm=null;}
html_options.href=url
return this.start_tag_for('a',html_options)+name+this.tag_end('a');}
EJS.Helpers.prototype.submit_link_to=function(name,url,html_options){if(!name)var name='null';if(!html_options)var html_options={}
html_options.onclick=html_options.onclick||'';if(html_options.confirm){html_options.onclick=" var ret_confirm = confirm(\""+html_options.confirm+"\"); if(!ret_confirm){ return false;} "
html_options.confirm=null;}
html_options.value=name;html_options.type='submit'
html_options.onclick=html_options.onclick+
(url?this.url_for(url):'')+'return false;';return this.start_tag_for('input',html_options)}
EJS.Helpers.prototype.link_to_if=function(condition,name,url,html_options,post,block){return this.link_to_unless((condition==false),name,url,html_options,post,block);}
EJS.Helpers.prototype.link_to_unless=function(condition,name,url,html_options,block){html_options=html_options||{};if(condition){if(block&&typeof block=='function'){return block(name,url,html_options,block);}else{return name;}}else
return this.link_to(name,url,html_options);}
EJS.Helpers.prototype.link_to_unless_current=function(name,url,html_options,block){html_options=html_options||{};return this.link_to_unless(this.is_current_page(url),name,url,html_options,block)}
EJS.Helpers.prototype.password_field_tag=function(name,value,html_options){return this.input_field_tag(name,value,'password',html_options);}
EJS.Helpers.prototype.select_tag=function(name,value,choices,html_options){html_options=html_options||{};html_options.id=html_options.id||name;html_options.value=value;html_options.name=name;var txt=''
txt+=this.start_tag_for('select',html_options)
for(var i=0;i<choices.length;i++)
{var choice=choices[i];var optionOptions={value:choice.value}
if(choice.value==value)
optionOptions.selected='selected'
txt+=this.start_tag_for('option',optionOptions)+choice.text+this.tag_end('option')}
txt+=this.tag_end('select');return txt;}
EJS.Helpers.prototype.single_tag_for=function(tag,html_options){return this.tag(tag,html_options,'/>');}
EJS.Helpers.prototype.start_tag_for=function(tag,html_options){return this.tag(tag,html_options);}
EJS.Helpers.prototype.submit_tag=function(name,html_options){html_options=html_options||{};html_options.type=html_options.type||'submit';html_options.value=name||'Submit';return this.single_tag_for('input',html_options);}
EJS.Helpers.prototype.tag=function(tag,html_options,end){if(!end)var end='>'
var txt=' '
for(var attr in html_options){if(html_options[attr]!=null)
var value=html_options[attr].toString();else
var value=''
if(attr=="Class")
attr="class";if(value.indexOf("'")!=-1)
txt+=attr+'=\"'+value+'\" '
else
txt+=attr+"='"+value+"' "}
return'<'+tag+txt+end;}
EJS.Helpers.prototype.tag_end=function(tag){return'</'+tag+'>';}
EJS.Helpers.prototype.text_area_tag=function(name,value,html_options){html_options=html_options||{};html_options.id=html_options.id||name;html_options.name=html_options.name||name;value=value||''
if(html_options.size){html_options.cols=html_options.size.split('x')[0]
html_options.rows=html_options.size.split('x')[1];delete html_options.size}
html_options.cols=html_options.cols||50;html_options.rows=html_options.rows||4;return this.start_tag_for('textarea',html_options)+value+this.tag_end('textarea')}
EJS.Helpers.prototype.text_tag=EJS.Helpers.prototype.text_area_tag
EJS.Helpers.prototype.text_field_tag=function(name,value,html_options){return this.input_field_tag(name,value,'text',html_options);}
EJS.Helpers.prototype.url_for=function(url){return'window.location="'+url+'";'}
EJS.Helpers.prototype.img_tag=function(image_location,alt,options){options=options||{};options.src=image_location
options.alt=alt
return this.single_tag_for('img',options)}
var TCI=(function(name){return name;}(TCI||{}));TCI.cas={};TCI.cas.getServiceTicketCallURL=function(url)
{return TCI.Globals.cas_protected_service_base_url+url;};TCI.cas.getCasEmailPrefix=function(){return TCI.Globals.brand+'_';};TCI.cas.addCasEmailPrefix=function(email){var prefix=TCI.cas.getCasEmailPrefix();if(email.indexOf(prefix)==0)
{var errorMessage='[TCI.cas.addCasEmailPrefix] email "'+email+'" already has the brand prefix.';TCI.Log.error(errorMessage);throw errorMessage;}
return prefix+email;};TCI.cas.removeCasEmailPrefix=function(email){var prefix=TCI.cas.getCasEmailPrefix();if(email.indexOf(prefix)==0)
{return email.substr(prefix.length);}
return email;};TCI.cas.assertCasEmailPrefix=function(functionName,email){var prefix=TCI.cas.getCasEmailPrefix();if(email.indexOf(prefix)!=0){var errorMessage='['+functionName+'] email "'+email+'" requires the brand prefix.';TCI.Log.error(errorMessage);throw errorMessage;}};TCI.cas.assertNoCasEmailPrefix=function(functionName,email){var prefix=TCI.cas.getCasEmailPrefix();if(email.indexOf(prefix)==0){var errorMessage='['+functionName+'] email "'+email+'" has the brand prefix but should not.';TCI.Log.error(errorMessage);throw errorMessage;}};TCI.cas.saveTGT=function(xhResponse){var location=xhResponse.getResponseHeader('Location');var tgt=location.substring(location.lastIndexOf('/')+1);TCI.Core.createCookieWithDomainAndPath('tgt',tgt,false,'/');};TCI.cas.retrieveTGT=function(){var tgt=TCI.Core.readCookie('tgt');TCI.Log.debug('tgt : '+tgt);var tgts=TCI.Core.readCookies('tgt');TCI.Log.debug('tgts.length : '+tgts.length);return tgt;};TCI.cas.requestServiceTicket=function(service){TCI.Log.debug('TCI.cas.requestServiceTicket');var url=TCI.Utils.getServiceTicketURL(TCI.cas.retrieveTGT());var xhResponse=TCI.ajax.post(url,{service:service},function(){},function(){},false);if(xhResponse.status==200){return xhResponse.responseText;}else{TCI.Log.error('TCI.cas.requestServiceTicket : '+xhResponse.responseText);return'';}};TCI.cas.insertServiceTicketHeader=function(XMLHttpRequest){TCI.Log.debug('TCI.cas.insertServiceTicketHeader');TCI.Log.debug('XMLHttpRequest : '+XMLHttpRequest);var serviceTicket=TCI.cas.requestServiceTicket();XMLHttpRequest.setRequestHeader('ticket',serviceTicket);};TCI.cas.logout=function(){var tgt=TCI.cas.retrieveTGT();TCI.Log.debug("TGT : "+tgt);if(TCI.Utils.isPageSecure())
{TCI.Log.debug("LOGOUT: logging out...");TCI.ajax.postSecureJSON(TCI.Utils.getLogoutURL(),TCI.cas.getLogoutRequest(tgt),function(){},function(){},false);TCI.Core.eraseCookieWithPath('tgt','/');var tgt2=TCI.cas.retrieveTGT();TCI.Log.debug("TGT (after erase) : "+tgt2);window.location=TCI.Globals.contextPath+TCI.Globals.urlLocaleToken+'/secure/logout';}
else
{TCI.Log.debug("LOGOUT: non-secure can't logout!!!");window.location=TCI.Globals.contextPath+TCI.Globals.urlLocaleToken+'/logout';}};TCI.cas.getLogoutRequest=function(tgt){return JSON.stringify({"logoutRequest":{"ticket":tgt}});};TCI.cas.performPageLogin=function(postData,service,saveRequest,postLogin)
{var xhResponse=TCI.ajax.post(TCI.Utils.getTicketGrantingTicketURL(),postData,function(){},function(){},false);if(xhResponse.status==201)
{TCI.Log.debug('Logged in successfully!  Getting Profile...');var location=xhResponse.getResponseHeader('Location');var tgt=location.substring(location.lastIndexOf('/')+1);TCI.Core.createCookieWithDomainAndPath('tgt',tgt,false,'/');TCI.Globals.update('loginId','"'+postData.username+'"',false);TCI.Globals.loginId=postData.username;var userProfileData=TCI.Data.getProfile(postData.username,true,true);if(postLogin!==undefined){postLogin(userProfileData);}
TCI.Analytics.Event.track('My Saved Vehicles','Submit','saved_submit_login_form');TCI.Log.debug('service : '+service);TCI.Log.debug('saveRequest : '+saveRequest);if(saveRequest){var vehicleName=$('#ss_li_name_your_toyota, #ss_ca_name_your_toyota,#ss_li_name_your_scion, #ss_ca_name_your_scion').val();service=service+'?save=&name='+escape(vehicleName);}
TCI.Log.debug('service : '+service);window.location=service;}
else if(xhResponse.status==400)
{TCI.Error.displayFatalError(TCI.Utils.getLabel('msg_failed_login'));if(TCI.serviceForm){TCI.serviceForm.unlockForm();}}
else
{TCI.Error.displayFatalError(TCI.Utils.getLabel('content_general_error'));if(TCI.serviceForm){TCI.serviceForm.unlockForm();}}};var dealer;Dealer=function(brand,code,async,province,labourRate,mandatoryOptions)
{this.brand=brand||TCI.Globals.dealerBrand;this.dealerCode=code||null;this.labourRate=0;this.zoneCode=null;this.dealerName=null;this.address={};this.address.streetAddress=null;this.address.postalCode=null;this.address.city=null;this.address.province=province||null;this.phoneNumbers=null;this.faxNumbers=null;this.email=null;this.mandatoryOptions=mandatoryOptions||[];this.loaded=false;try{if(brand&&code){this.getDealerData(brand,code,async);}else if(province&&labourRate){this.labourRate=labourRate;this.address={};this.address.province=province;this.loaded=true;}else if(province){this.getRegionalDealerData(province,async);}}catch(err){this.dealerError(err);}};Dealer.initDealer=function(province)
{Dealer.setDealer(new Dealer(TCI.Globals.regionalDealerBrand,null,false,province,null));};Dealer.getDealer=function(province)
{if(!province&&!!dealer&&!!TCI.Globals.dealerState&&dealer.getCode()==TCI.Globals.dealerState.dealerCode&&dealer.isLoaded())
{return dealer;}
var newDealer;try
{if(TCI.Globals.dealerCode)
{newDealer=new Dealer(TCI.Globals.dealerBrand,TCI.Globals.dealerCode,false,null,null);}
else if(TCI.Core.readCookie('pre_selected_dealer'))
{newDealer=Dealer.getPreSelectedDealer();}
else if(TCI.Core.readCookie('preferredDealer'))
{newDealer=Dealer.getPreferredDealer();}
else if(TCI.Globals.dealerState&&TCI.Globals.dealerState.dealerCode)
{newDealer=new Dealer(TCI.Globals.dealerBrand,TCI.Globals.dealerState.dealerCode,false,TCI.Globals.dealerState.province,TCI.Globals.dealerState.labourRate,TCI.Globals.dealerState.mandatoryOptions);}
else
{var dealerProvince=province||(!!TCI.Globals.dealerState&&!!TCI.Globals.dealerState.province?TCI.Globals.dealerState.province:undefined)||TCI.Geo.getUserRegion();newDealer=new Dealer(TCI.Globals.regionalDealerBrand,null,false,dealerProvince,null,null);}
Dealer.setDealer(newDealer);return newDealer;}
catch(err)
{throw'CANNOT FIND DEALER';}};Dealer.getPreferredDealer=function()
{var prefDealer={};if(TCI.Core.readCookie('preferredDealer')){prefDealer=new Dealer(TCI.Globals.brand,TCI.Core.readCookie('preferredDealer'),false,null,null);}else{prefDealer.dealerCode=null;}
return prefDealer;};Dealer.getPreSelectedDealer=function()
{var preSelDealer={};if(TCI.Core.readCookie('pre_selected_dealer')){preSelDealer=new Dealer(TCI.Globals.brand,TCI.Core.readCookie('pre_selected_dealer'),false,null,null);}else{preSelDealer.dealerCode=null;}
return preSelDealer;};Dealer.setDealer=function(dealerObject)
{dealer=dealerObject;TCI.Globals.dealerState=dealer.getDealerStateObject();TCI.Globals.update('dealerState',dealer.getDealerStateJson(),true);Dealer.notifyObservers(dealer);};Dealer.savePreferredDealer=function(dealerObject)
{TCI.Core.createCookie('preferredDealer',dealerObject.dealerCode,365);};Dealer.removePreferredDealer=function()
{TCI.Core.eraseCookie('preferredDealer');};Dealer.savePreSelectedDealer=function(dealerObject)
{TCI.Core.createCookie('pre_selected_dealer',dealerObject.dealerCode,365);};Dealer.removePreSelectedDealer=function()
{TCI.Core.eraseCookie('pre_selected_dealer');};Dealer.getSelectionType=function(dealerObject)
{return!dealer?'provice':!dealer.getCode()?'province':'dealer';};Dealer.observers=[];Dealer.registerObserver=function(obj)
{Dealer.observers.push(obj);};Dealer.notifyObservers=function(data)
{for(var i in Dealer.observers){if(Dealer.observers[i]&&Dealer.observers[i].notifyDealerUpdated){Dealer.observers[i].notifyDealerUpdated(data);}}};Dealer.prototype={getDealerData:function(brand,code,async)
{var that=this;TCI.ajax.getJSON(TCI.Utils.getDealerByCodeURL(brand,code),null,function(data){if(data.serviceInfo.status=='SUCCESS'){that.parseDealer(data);}else{that.getRegionalDealerData(TCI.Geo.getUserRegion(),async);}},function(data){that.getRegionalDealerData(TCI.Geo.getUserRegion(),async);},async);},getRegionalDealerData:function(province,async)
{if(!TCI.Geo.isValidProvince(province)){province=TCI.Globals.default_province;}
var that=this;TCI.ajax.getJSON(TCI.Utils.getDealerByCodeURL(TCI.Globals.regionalDealerBrand,province),null,function(data){that.parseDealer(data);that.dealerCode=null;that.address={};that.address.province=province;},function(data){that.dealerError(data);},async);},parseDealer:function(data)
{if(data.serviceInfo.status=='SUCCESS'){var dealerData=data.DealerContentDetail.TciDealerViewType;this.populateDealer(dealerData);}else{this.dealerCode=null;}},populateDealer:function(dealerData)
{var org=dealerData.DealerParty.SpecifiedOrganization;this.dealerCode=dealerData.DealerParty.PartyID;this.labourRate=dealerData.LaborRateAmount?dealerData.LaborRateAmount.$:0;this.zoneCode=dealerData.ZoneCode?dealerData.ZoneCode.$:null;this.dealerName=org.CompanyName?org.CompanyName.$:'';this.address={};this.mandatoryOptions=[];if(org.PostalAddress){this.address.streetAddress=org.PostalAddress.LineOne.$;this.address.postalCode=org.PostalAddress.Postcode.$;this.address.city=org.PostalAddress.CityName.$;this.address.province=org.PostalAddress['StateOrProvinceCountrySub-DivisionID'];}
if(org.PrimaryContact){this.phoneNumbers=org.PrimaryContact.TelephoneCommunication;this.faxNumbers=org.PrimaryContact.FaxCommunication;}
if(dealerData.ProximityMeasureGroup){this.lat=dealerData.ProximityMeasureGroup.GeographicalCoordinate.LatitudeMeasure.$;this.lng=dealerData.ProximityMeasureGroup.GeographicalCoordinate.LongitudeMeasure.$;}
if(dealerData.Department){for(var dept in dealerData.Department){if(dealerData.Department[dept]['@DepartmentName'].indexOf('Sales')>-1){this.email=dealerData.Department[dept].PrimaryContact.URICommunication;break;}}}
if(dealerData.OptionTypeCode){if(!dealerData.OptionTypeCode.length){dealerData.OptionTypeCode=[dealerData.OptionTypeCode];}
for(var i in dealerData.OptionTypeCode){this.mandatoryOptions.push(dealerData.OptionTypeCode[i].$);}}
this.loaded=true;},dealerError:function(data)
{TCI.Error.displayFatalError(TCI.Utils.getLabel('err_generalServiceError'));this.loaded=false;},getCode:function(){return this.dealerCode;},getDealerName:function(){return this.dealerName;},getLabourRate:function(){return this.labourRate;},getZoneCode:function(){return this.zoneCode;},getDealerName:function(){return this.dealerName;},getAddress:function(){return this.address;},getProvince:function(){return this.address.province;},getPhoneNumbers:function(){return this.phoneNumbers;},getFaxNumbers:function(){return this.faxNumbers;},getEmails:function(){return this.email;},getMandatoryOptions:function(){return this.mandatoryOptions;},setCode:function(dealerCode){this.dealerCode=dealerCode;},setDealerName:function(dealerName){this.dealerName=dealerName;},setLabourRate:function(labourRate){this.labourRate=labourRate;},setZoneCode:function(zoneCode){this.zoneCode=zoneCode;},setDealerName:function(dealerName){this.dealerName=dealerName;},setAddress:function(addressObj){this.address=addressObj;},setProvince:function(province){this.address.province=province;},setPhoneNumbers:function(phoneNumbers){this.phoneNumbers=phoneNumbers;},setFaxNumbers:function(faxNumbers){this.faxNumbers=faxNumbers;},setEmail:function(email){this.email=email;},setMandatoryOptions:function(mandatoryOptions){this.mandatoryOptions=mandatoryOptions;},hasMandatoryOptions:function()
{return this.mandatoryOptions.length>0;},isLoaded:function()
{return this.loaded;},getDealerStateJson:function(dealerCode)
{return JSON.stringify(this.getDealerStateObject());},getDealerStateObject:function(dealerCode)
{return{'dealerCode':dealerCode||this.dealerCode,'labourRate':this.labourRate,'province':this.getProvince(),'mandatoryOptions':this.mandatoryOptions};}};DealerSearch=function(){};DealerSearch.prototype={getDealer:function(brand,code,async){return new Dealer(brand,code,async);},parseDealers:function(data,brand){var dealers=new Array();if(data){if(data.serviceInfo&&data.DealerLocatorDetail&&data.serviceInfo.status=='SUCCESS'){var dealerData=data.DealerLocatorDetail;if(dealerData&&typeOf(dealerData)=='array'){for(var i=0;i<dealerData.length;i++){var dlr=new Dealer();dlr.populateDealer(dealerData[i].TciDealerViewType);dealers.push(dlr);}}else if(dealerData&&dealerData.TciDealerViewType){var dlr=new Dealer();dlr.populateDealer(dealerData.TciDealerViewType);dealers.push(dlr);}
function sortByDealerName(a,b){var x=a.dealerName.toLowerCase();var y=b.dealerName.toLowerCase();return((x<y)?-1:((x>y)?1:0));}
dealers=dealers.sort(sortByDealerName);this.handleResult(dealers);}else{TCI.Log.error('Service Status: '+data.serviceInfo.status);}}else{this.handleResult([]);}},search:function(query,async){var that=this;TCI.ajax.getJSON(TCI.Utils.getDealerGSASearchURL(),{q:query},function(data){that.parseDealers(data);},function(){that.parseDealers();},async);},provinceSearch:function(theProvince,async){var that=this;TCI.ajax.getJSON(TCI.Utils.getDealerSearchURL(),{province:theProvince,brand:TCI.Globals.dealerBrand},function(data){that.parseDealers(data);},function(){that.parseDealers();},async);},handleResult:function(data){TCI.Log.warn('DealerSearch has no default rendering method');}};var TCI=(function(name){return name;}(TCI||{}));TCI.DealerSearch=(function(){var modal={};var mode='find';var dealerCodeField='';var dealerProvinceField='';var currentResults=[];var currentSelection=null;var spinner=null;var lastSearchMethod='';var showSpinner=function(){spinner.show();};var hideSpinner=function(){spinner.hide();};var displayError=function(){hideSpinner();TCI.Error.displayError({container:"#dealer_search_msg_container",message:TCI.localize.getLabel("content_general_error")});};var displayInvalidPostalCodeError=function(theQuery){hideSpinner();TCI.Error.displayError({container:"#dealer_search_msg_container",message:TCI.localize.getLabel("dealer_search_invalid_postalcode",{query:theQuery})});};var displayNoResultsError=function(theQuery){hideSpinner();TCI.Error.displayError({container:"#dealer_search_msg_container",message:TCI.localize.getLabel("dealer_search_no_results",{query:theQuery})});};var clearErrors=function(){$('#dealer_search_msg_container').html('');};var clearResults=function(){TCI.DealerSearch.ResultMap.clearResults();$('#search_results_list_container').html('');$('.dealer_search_results_intro').html('');$('ul#search_results_list li.result a.map_link, ul#search_results_list li.result a.gmap_marker').unbind();currentResults=[];};var displayResults=function(results){$('#dealer_by_postcode').val('');var theQuery=TCI.DealerSearch.SearchMethods.getPreviousQuery();if(results.length!=0){$('#search_results_list_container').html(new EJS({url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/dealer_search/modal.dealer_search_results.html')}).render({mode:mode,dealerSearchResults:results}));TCI.DealerSearch.ResultMap.displayResults(results);setView('search_results','search_method');$('#search_results_list').jScrollPane({scrollbarWidth:15,dragMinHeight:36,dragMaxHeight:36});$('.dealer_search_results_intro').html(TCI.localize.getLabel("dealer_search_found_keywod_results",{number:results.length}));modal.setPosition();}else{displayNoResultsError(theQuery);}
currentResults=results;hideSpinner();};var displayProximityResults=function(results){resetTabs();$('#dealer_by_keyword').val('');var theQuery=TCI.DealerSearch.SearchMethods.getPreviousQuery();$('#search_results_list_container').html(new EJS({url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/dealer_search/modal.dealer_search_results.html')}).render({mode:mode,dealerSearchResults:results}));TCI.DealerSearch.ResultMap.displayResults(results);TCI.DealerSearch.ResultMap.displayProximityMarker(theQuery);setView('search_results','search_method');$('#search_results_list').jScrollPane({scrollbarWidth:15,dragMinHeight:36,dragMaxHeight:36});$('.dealer_search_results_intro').html(TCI.localize.getLabel("dealer_search_found_proximity_results",{number:results.length}));currentResults=results;hideSpinner();modal.setPosition();};var resetTabs=function(){if(lastSearchMethod=="keyword"){$('.searchtabs li a').removeClass('active');$('.searchtabs li:last a').addClass('active');$('.search_tools li').hide();$('.search_tools li:last').show();}else{$('.searchtabs li a').removeClass('active');$('.searchtabs li:first a').addClass('active');$('.search_tools li').hide();$('.search_tools li:first').show();}};var reset=function(){hideSpinner();clearResults();clearErrors();TCI.DealerSearch.ResultMap.clearResults();$('#dealer_by_keyword').val('');$('#dealer_by_postcode').val('');$('#preferred_selection').html('');$('#map_container').show();$('#search_results').show();setView('search_results','search_method');$('#'+modal.name).css({top:getPositionForSize('top',130),left:getPositionForSize('left',880),width:'880px',height:'auto'});resetTabs();};var addListeners=function(){$('.find_a_dealer_trigger, .select_a_dealer_trigger, .select_a_dealer_form_trigger, .select_preferred_dealer_trigger').live('click',function(event){event.preventDefault();TCI.DealerSearch.openModal(event);});$('#dealer_by_keyword_btn').live('click',function(event){event.preventDefault();event.stopPropagation();showSpinner();clearErrors();clearResults();lastSearchMethod="keyword";Scion.Analytics.trackEvent({category:'dealers',action:'dealer_search',label:'dealers_search_keyword',value:false});TCI.DealerSearch.SearchMethods.keywordSearch($('#dealer_by_keyword').val(),displayResults,displayError);$(this).blur();return false;});$('#dealer_by_postcode_btn').live('click',function(event){event.preventDefault();event.stopPropagation();showSpinner();clearErrors();clearResults();lastSearchMethod="postcode";Scion.Analytics.trackEvent({category:'dealers',action:'dealer_search',label:'dealers_search_postcode',value:false});var theQuery=$('#dealer_by_postcode').val();var postalCodePattern=/^\s*[a-z]\d[a-z]\s*(\d[a-z]\d)?\s*$/i;if(postalCodePattern.test(theQuery)){TCI.DealerSearch.SearchMethods.proximitySearch(theQuery,displayProximityResults);}else{displayInvalidPostalCodeError(theQuery);}
$(this).blur();return false;});$('ul#search_results_list li.result a.map_link, ul#search_results_list li.result a.gmap_marker').live('click',function(event){event.preventDefault();$('ul#search_results_list li.result').removeClass('active');$(this).parents('li.result').addClass('active');TCI.DealerSearch.ResultMap.openInfoWindow($(this).attr('dindex'));return false;});$('#dealer_search_modal .select_dealer_btn').live('click',function(e){var selectedDealer=new Dealer(TCI.Globals.dealerBrand,currentResults[$(this).attr('dindex')].getCode(),false);document.location.href.search('build-price')!=-1?Scion.Analytics.trackEvent({category:'dealers',action:'configure_by_dealer',label:'dealers_configureby_'+selectedDealer.getCode(),value:false}):0;Dealer.setDealer(selectedDealer);if(!!dealerCodeField&&!!dealerProvinceField){$(dealerCodeField).val(dealer.getCode());$(dealerProvinceField).val(dealer.getProvince());}
var dealerSelectorContainer=$('.dealer_selector');if(dealerSelectorContainer.length>0){dealerSelectorContainer.html(new EJS({url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/forms/dealer_selector.html')}).render());}
modal.closeModal();return false;});$('#dealer_search_modal .select_preferred_dealer_btn').live('click',function(e){currentSelection=currentResults[$(this).attr('dindex')];displayChoice(currentSelection);});$('#decline_preferred_dealer_btn').live('click',function(e){displayResultsView();});$('#dealer_search_modal #set_preferred_dealer_btn').live('click',function(e){var selectedDealer=new Dealer(TCI.Globals.dealerBrand,currentSelection.getCode(),false);Dealer.savePreferredDealer(selectedDealer);Dealer.removePreSelectedDealer();Dealer.setDealer(selectedDealer);if(!!dealerCodeField&&!!dealerProvinceField){$(dealerCodeField).val(dealer.getCode());$(dealerProvinceField).val(dealer.getProvince());}
var dealerSelectorContainer=$('.dealer_selector');if(dealerSelectorContainer.length>0){dealerSelectorContainer.html(new EJS({url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/forms/dealer_selector.html')}).render());}
if(typeof(myProfile)!='undefined'){myProfile.setDealer(selectedDealer);Scion.Analytics.trackEvent({category:'dealers',action:'set preferred dealer',label:'dealers_prefdealer_'+selectedDealer.getCode(),value:false});}else{if($('body.build_price').length>0){Scion.Analytics.trackEvent({category:'dealers',action:'configure by dealer',label:'dealers_configureby_'+selectedDealer.getCode(),value:false});}}
modal.closeModal();return false;});};var displayChoice=function(selection){$('#map_container').hide();$('#search_results').hide();$('#preferred_selection').html(new EJS({url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/modals/modal.dealer_search_choice.html')}).render({selectedDealer:selection}));$('#'+modal.name).animate({top:getPositionForSize('top',200),left:getPositionForSize('left',640),width:'640px',height:'200px'},{duration:200});};var displayResultsView=function(){$('#'+modal.name).animate({top:getPositionForSize('top',525),left:getPositionForSize('left',880),width:'880px',height:'525px'},{duration:200});$('#preferred_selection').html('');$('#map_container').show();$('#search_results').show();};var getPositionForSize=function(attr,size){if(attr=="left"){return($(window).width()/2)-(size/2);}
return($(window).height()/2)-(size/2);};var configureModal=function(){modal=new TCI.Core.Modal({name:"dealer_search_modal",title:TCI.localize.getLabel('title_find_a_dealer'),url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/dealer_search/modal.dealer_search.html'),width:'880px',height:'auto',parent:'body',z_index:999999,onAfterClose:reset,onAfterInit:afterModalInit});};var afterModalInit=function(){TCI.serviceForm.ButtonManager.setContainer('#search_postcode','a');TCI.serviceForm.ButtonManager.setContainer('#search_keyword','a');};var setMode=function(theMode){$('#'+modal.name).removeClass('mode_find');$('#'+modal.name).removeClass('mode_select');$('#'+modal.name).removeClass('mode_form');$('#'+modal.name).removeClass('mode_select_preferred');$('#'+modal.name).addClass('mode_'+mode);mode=theMode;};var setView=function(view,oldview){if(oldview){$('#'+modal.name+' .modal_content_container').removeClass(oldview);}
$('#'+modal.name+' .modal_content_container').addClass(view);};return{init:function(){new Scion.widgets.ToolTip({dynamic:true,text:TCI.localize.getLabel('currentDealerSelection'),trigger:'#search_results_list .current_dealer_selection',target:'#current_dealer_selection_tooltip',zIndex:9999999});spinner=new Scion.SmartSpinner({container:"#dealer_search_modal",text:TCI.localize.getLabel('wait_label'),z_index:999999999999,top:40});configureModal();addListeners();},resetTabs:function(){resetTabs();},setGoogleMapsLoaded:function(){TCI.DealerSearch.ResultMap.setGoogleMapsLoaded();},openModal:function(event){if(event){if($(event.currentTarget).hasClass('find_a_dealer_trigger'))
{mode='find';if($(event.currentTarget).parent().attr('id')=='primary_actions_find_a_dealer'){Scion.Analytics.trackEvent({category:'global nav',action:'click-through',label:'global_dealer_find',value:true});}}else if($(event.currentTarget).hasClass('select_a_dealer_trigger')){mode='select';}else if($(event.currentTarget).hasClass('select_a_dealer_form_trigger')){mode='form';}else if($(event.currentTarget).hasClass('select_preferred_dealer_trigger')){mode='select_preferred';}}else{mode='find';}
TCI.DealerSearch.ResultMap.loadJs(TCI.DealerSearch.showModal,TCI.Globals.locale);},showModal:function(){if(!modal.isInitialised){modal.init();}
setView('search_method','search_results');new Scion.widgets.Tabs({contentClass:'.search_form',clss:'.searchtabs'});setMode(mode);modal.show();$('.search_tools li').show();$('#map_container').hide();modal.setPosition();},addDealerModalToForm:function(theDealerCodeField,theDealerProvinceField)
{dealerCodeField=theDealerCodeField;dealerProvinceField=theDealerProvinceField;if(!!dealer.getCode()){$(theDealerCodeField).val(dealer.getCode());}
if(!!dealer.getProvince()){$(theDealerProvinceField).val(dealer.getProvince());}}};})();TCI.DealerSearch.SearchMethods=(function(){var previousQuery='';var parseGSAResults=function(data){var dealers=[];var dealerData=data.DealerLocatorDetail;if(dealerData&&typeOf(dealerData)=='array'){for(var i=0;i<dealerData.length;i++){var dlr=new Dealer();dlr.populateDealer(dealerData[i].TciDealerViewType);dealers.push(dlr);}}else if(dealerData&&dealerData.TciDealerViewType){var dlr=new Dealer();dlr.populateDealer(dealerData.TciDealerViewType);dealers.push(dlr);}
return dealers;};var parseProximityResults=function(data){var dealers=[];for(var i=0;i<data.dealers.length;i++){var dlr=new Dealer();dlr.setCode(data.dealers[i].partyId);dlr.setDealerName(data.dealers[i].companyName);dlr.setAddress({streetAddress:data.dealers[i].postalAddress,postalCode:data.dealers[i].postalCode,city:data.dealers[i].cityName,province:data.dealers[i].province});dlr.phoneNumbers=[{CompleteNumber:{"$":data.dealers[i].telephoneNumber}}]
dlr.lat=data.dealers[i].latitude;dlr.lng=data.dealers[i].longitude;dlr.distance=data.dealers[i].distance;dealers.push(dlr);}
return dealers;};return{getPreviousQuery:function(){return previousQuery;},keywordSearch:function(query,success,error){previousQuery=query;TCI.ajax.getJSON(TCI.Utils.getDealerGSASearchURL(),{q:query},function(response){success(parseGSAResults(response));},error,false);},proximitySearch:function(query,success,error){previousQuery=query;query=query.replace(/\s/g,'');TCI.ajax.getJSON(TCI.Utils.getDealerProximitySearchURL(TCI.Globals.dealerBrand),{postalCode:query,noOfRec:"10",sortBy:"PROXIMITY"},function(response){success(parseProximityResults(response));},error,false);}};})();TCI.DealerSearch.ResultMap=(function(){var theMap=null;var mapEl='map_canvas';var markers=[];var infoWindow=null;var image=null;var shadow=null;var callback=function(){};var googleMapsLoaded=false;var initialized=false;var proximityImageimage=null;var geocoder=null;var proximityMarker=null;var initMap=function(){if(!initialized){var defaultOptions={zoom:3,center:new google.maps.LatLng(58.29297691435728,-93.65127174999999),mapTypeId:google.maps.MapTypeId.ROADMAP};theMap=new google.maps.Map(document.getElementById(mapEl),defaultOptions);infoWindow=new google.maps.InfoWindow({size:new google.maps.Size(120,50)});image=new google.maps.MarkerImage(Scion.globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/media/content/dealers/map_marker.png',new google.maps.Size(36,32),new google.maps.Point(0,0),new google.maps.Point(18,32));shadow=new google.maps.MarkerImage(Scion.globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/media/content/dealers/map_marker_shadow.png',new google.maps.Size(46,22),new google.maps.Point(0,0),new google.maps.Point(10,22));proximityImage=new google.maps.MarkerImage(Scion.globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+'/media/content/dealers/proximity_map_marker.png',new google.maps.Size(36,32),new google.maps.Point(0,0),new google.maps.Point(18,32));geocoder=new google.maps.Geocoder();initialized=true;}};var makeMarker=function(idx,dealer){return new google.maps.Marker({map:theMap,position:new google.maps.LatLng(dealer.lat,dealer.lng),icon:image,shadow:shadow,title:dealer.dealerName,dealer:dealer,idx:idx});};return{setGoogleMapsLoaded:function(){googleMapsLoaded=true;},loadJs:function(theCallback,locale){if(googleMapsLoaded){theCallback();}else{callBack=theCallback;TCI.ajax.getScript('http://maps.google.com/maps/api/js?sensor=false&callback=TCI.DealerSearch.ResultMap.loadJsCallback&language='+locale);}},loadJsCallback:function(){googleMapsLoaded=true;callBack();},displayResults:function(results){$('#map_container').show();TCI.DealerSearch.resetTabs();initMap();latLngBounds=null;var idx;for(idx=0;idx<results.length;idx++){var dealerMarker=makeMarker(idx,results[idx]);if(latLngBounds==null){latLngBounds=new google.maps.LatLngBounds();}
latLngBounds.extend(dealerMarker.position);var markerIdx=markers.push(dealerMarker);google.maps.event.addListener(dealerMarker,'click',function(){TCI.DealerSearch.ResultMap.openInfoWindow(this.idx);});}
if(latLngBounds!=null){theMap.fitBounds(latLngBounds);}},displayProximityMarker:function(postalCode){geocoder.geocode({'address':postalCode,region:'CA',language:TCI.Globals.locale},function(results,status){if(status==google.maps.GeocoderStatus.OK){proximityMarker=new google.maps.Marker({position:results[0].geometry.location,map:theMap,title:postalCode,icon:proximityImage,shadow:shadow,html:'<div class="info_window"><h3>'+postalCode+'</h3></div>'});var newBounds=theMap.getBounds();newBounds.extend(results[0].geometry.location);theMap.fitBounds(newBounds);$('#search_results_list .map_link.proximity_marker').text(postalCode);$('#search_results_list .proximity_marker').show();google.maps.event.addListener(proximityMarker,'click',function(){TCI.DealerSearch.ResultMap.openInfoWindow('proximity_marker');});}else{TCI.Log.error("unable to geocode postal code");}});},clearResults:function(){if(infoWindow!=null){infoWindow.close();}
$('#search_results_list .proximity_marker').hide();for(idx=0;idx<markers.length;idx++){markers[idx].setMap(null);}
if(proximityMarker!=null){proximityMarker.setMap(null);proximityMarker=null;}
markers=[];},openInfoWindow:function(idx){if(idx=="proximity_marker"){var dealerMarker=proximityMarker;var html=dealerMarker.html;infoWindow.setContent(html);infoWindow.open(theMap,dealerMarker);}else{var dealerMarker=markers[idx];var html=new EJS({url:TCI.Utils.getURL(TCI.Utils.getOptionalSecurePrefix()+'/templates/maps/map.dealer_info_window.html')}).render({dResult:dealerMarker.dealer,index:dealerMarker.idx});infoWindow.setContent(html);infoWindow.open(theMap,dealerMarker);}}};})();Scion.SmartSpinner=function(params){var params=params||{};this.container=$(params.container)||$('body');this.text=params.text||TCI.Utils.getLabel('label_loading').toUpperCase();this.size=params.size||'small';this.width=params.width||150;this.top=params.top||310;this.z_index=params.z_index||0;this.active=false;this.attach=params.attach||false;this.init();};Scion.SmartSpinner.prototype=new TCI.LoadSpinner();Scion.SmartSpinner.prototype.init=function(){this.handle=$('<div class="loading_panel"><div><img src="'+TCI.Utils.getQualifiedMediaURL('/media/chrome/load_spinner_'+this.size+'.gif')+'"/></div><p>'+this.text+'</p></div>');this.setWidth();this.append();this.setZIndex();this.initListeners();this.handle.hide();};Scion.SmartSpinner.prototype.initListeners=function(){var self=this;$(window).resize(function(){if(!self.isVisible()){return;}
self.setPosition();});};Scion.SmartSpinner.prototype.isVisible=function(){return this.handle.is(':visible');};Scion.SmartSpinner.prototype.append=function(){this.handle.appendTo($('body'));};Scion.SmartSpinner.prototype.show=function(){this.setPosition();this.handle.show();};Scion.SmartSpinner.prototype.hide=function(){this.handle.hide();};Scion.SmartSpinner.prototype.setPosition=function(){var lft=(($(window).width()/2)-(this.width/2));var hgt=this.handle.height()==0?this.handle.height():84;var tp=(($(window).height()/2)-(hgt/2));this.handle.css({left:lft,top:tp,position:'fixed'});};Scion.SmartSpinner.prototype.setWidth=function(){this.handle.css({width:this.width});};Scion.SmartSpinner.prototype.setZIndex=function(){this.handle.css({"z-index":this.z_index});};Scion.DealerSearch=TCI.DealerSearch;var dealer;$(document).ready(function(){TCI.DealerSearch.init();if(location.hash=='#open-find-a-dealer'&&(location.pathname==TCI.Globals.contextPath||location.pathname==TCI.Globals.contextPath+'/fr')){Scion.DealerSearch.openModal();}});var TCI=(function(name){return name;}(TCI||{}));TCI.Geo=(function()
{return{getUserRegion:function()
{try
{var province=TCI.Core.readCookie('userProvince');if(!province||province=='undefined')
{TCI.ajax.getScript(TCI.Utils.getGetGeoIPURL(),function(){if(geoip_country_code&&geoip_region){province=(geoip_country_code()=='CA')?geoip_region():TCI.Globals.default_province;TCI.Core.createCookie('userProvince',province,1);}else{province=TCI.Globals.default_province;}},function(){TCI.Log.warn('TCI.Geo.getUserRegion: GeoIP has failed to return geo information.');province=TCI.Globals.default_province;});}
if(!this.isValidProvince(province)){province=TCI.Globals.default_province;}
return province;}
catch(err)
{TCI.Log.warn('TCI.Geo.getUserRegion: '+err);return TCI.Globals.default_province;}},isValidProvince:function(province)
{for(var i in TCI.Geo.Regions){if(province==TCI.Geo.Regions[i].abbr){return true;}}
return false;},getRegionCoors:function(provinceCode)
{var coorsObj={lat:null,lng:null};for(region in TCI.Geo.Regions){if(TCI.Geo.Regions[region].abbr==provinceCode){coorsObj.lat=TCI.Geo.Regions[region].lat;coorsObj.lng=TCI.Geo.Regions[region].lng;}}
return coorsObj;},getRegionName:function(provinceCode,locale)
{var name=null;var provinceCode=provinceCode.toUpperCase();for(region in TCI.Geo.Regions){if(TCI.Geo.Regions[region].abbr==provinceCode){name=!locale?TCI.Geo.Regions[region].name:TCI.Geo.Regions[region][locale];}}
return name;},getRegionByName:function(provinceName)
{var abbr;for(region in TCI.Geo.Regions){if(TCI.Geo.Regions[region].en.toLowerCase()==provinceName.toLowerCase()||TCI.Geo.Regions[region].fr.toLowerCase()==provinceName.toLowerCase()){abbr=TCI.Geo.Regions[region].abbr;break;}}
return abbr;}};})();TCI.Geo.Regions=[{abbr:'AB',name:TCI.Utils.getProvinceName('ab'),'fr':'Alberta','en':'Alberta',lat:54.437677,lng:-114.265138},{abbr:'BC',name:TCI.Utils.getProvinceName('bc'),'fr':'Colombie-Britannique','en':'British Columbia',lat:52.582581,lng:-123.361817},{abbr:'MB',name:TCI.Utils.getProvinceName('mb'),'fr':'Manitoba','en':'Manitoba',lat:53.92332,lng:-97.873536},{abbr:'NB',name:TCI.Utils.getProvinceName('nb'),'fr':'Nouveau-Brunswick','en':'New Brunswick',lat:45.85125,lng:-65.793458},{abbr:'NL',name:TCI.Utils.getProvinceName('nl'),'fr':'Terre-Neuve-et-Labrador','en':'Newfoundland and Labrador',lat:48.712229,lng:-55.993653},{abbr:'NT',name:TCI.Utils.getProvinceName('nt'),'fr':'Territoires du Nord-Ouest','en':'Northwest Territories',lat:61.725975,lng:-116.901856},{abbr:'NS',name:TCI.Utils.getProvinceName('ns'),'fr':'Nouvelle-Écosse','en':'Nova Scotia',lat:45.29756,lng:-62.629395},{abbr:'NU',name:TCI.Utils.getProvinceName('nu'),'fr':'Nunavut','en':'Nunavut',lat:65.214982,lng:-96.599122},{abbr:'ON',name:TCI.Utils.getProvinceName('on'),'fr':'Ontario','en':'Ontario',lat:47.537947,lng:-83.360841},{abbr:'PE',name:TCI.Utils.getProvinceName('pe'),'fr':'Île-du-Prince-Édouard','en':'Prince Edward Island',lat:46.156498,lng:-63.420411},{abbr:'QC',name:TCI.Utils.getProvinceName('qc'),'fr':'Québec','en':'Quebec',lat:48.040875,lng:-73.17627},{abbr:'SK',name:TCI.Utils.getProvinceName('sk'),'fr':'Saskatchewan','en':'Saskatchewan',lat:53.92332,lng:-106.223145},{abbr:'YT',name:TCI.Utils.getProvinceName('yt'),'fr':'Yukon','en':'Yukon',lat:62.869845,lng:-136.105958}];Scion.View={Templates:{}};var TCI=(function(name){return name;}(TCI||{}));TCI.View=(function(){var getUncompiledTemplate=function(path,data){var template;try{if(path.indexOf(TCI.Globals.contextPath)!=0)
{TCI.Log.debug("..............................TCI.View.getUncompiledTemplate, appending to path : "+path);if(TCI.Utils.isScion())
{path=TCI.Globals.contextPath+TCI.Utils.getOptionalSecurePrefix()+path;}
else
{path=TCI.Utils.getContentPath(path);}}
template=new EJS({url:path}).render(data);}
catch(e)
{switch(typeof(e)){case'object':TCI.Log.warn(e.name+' '+e.message);break;case'string':TCI.Log.warn(e);break;}
template=null;}
return template;};var getCompiledTemplate=function(path,data){var key=path.substring(11).replace(/\/+/g,'_').replace('.html','').replace(/\.+/g,'_');var template;try{TPM.Performance.TimeLog.start("ejs_new",path);if(TCI.Utils.isScion())
{template=new EJS({text:window[TCI.Core.getBrandNamespace()].View.Templates[key]}).render(data);}
else
{var text=window[TCI.Core.getBrandNamespace()].View.Templates[key];if(!!text)
{template=new EJS({precompiled:text}).render(data);}
else
{TCI.Log.error("content key '"+key+"' was not found in content array.");}}}
catch(e)
{switch(typeof(e)){case'object':TCI.Log.warn(e.name+' '+e.message);break;case'string':TCI.Log.warn(e);break;}
template=null;}
return template;};return{getTemplate:function(path_key,data,forceAJAX)
{var template;if(TCI.Globals.ajax_js_templates=="true"||forceAJAX==true){template=getUncompiledTemplate(path_key,data);}else{template=getCompiledTemplate(path_key,data);}
return template;},isTemplate:function(path)
{try{var key=path.substring(11).replace(/\/+/g,'_').replace('.html','').replace(/\.+/g,'_');return!!(window[TCI.Core.getBrandNamespace()].View.Templates[key]);}catch(e){return false;}}};})();var TCI=(function(name){return name;}(TCI||{}));TCI.Date=(function()
{var timeDiff=0;var months={en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fr:["janvier","f&eacute;vrier","mars","avril","mai","juin","juillet","ao&ucirc;t","septembre","octobre","novembre","d&eacute;cembre"]};var caZones={'EST':'HNE','PST':'HNP','CST':'HNC','AST':'HNA','MST':'HNR','NST':'HNT','EDT':'HAE','PDT':'HAP','CDT':'HAC','ADT':'HAA','MDT':'HAR','NDT':'HAT','Eastern Standard Time':'HNE','Pacific Standard Time':'HNP','Central Standard Time':'HNC','Atlantic Standard Time':'HNA','Mountain Standard Time':'HNR','Newfoundland Standard Time':'HNT','Eastern Daylight Time':'HAE','Pacific Daylight Time':'HAP','Central Daylight Time':'HAC','Atlantic Daylight Time':'HAA','Mountain Daylight Time':'HAR','Newfoundland Daylight Time':'HAT'};var pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};return{formatServiceDate:function(date,locale)
{if(locale==undefined){locale=TCI.Globals.locale;}
var parts=/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):\d{2}.\d{3}(\+|-)(\d{2}):(\d{2})/.exec(date);var year=parts[1];var month=parseInt(parts[2],10)-1;var day=parseInt(parts[3],10);var hour=parseInt(parts[4],10);var min=parseInt(parts[5],10);var userDate=new Date();userDate.setFullYear(year,month,day);userDate.setHours(hour,min,0,0);var zoneMatchs=/.*\((.*)\)/.exec(userDate.toTimeString())||/\d{2}:\d{2}:\d{2} (.*)/.exec(userDate.toTimeString());var zone=zoneMatchs.length>1?zoneMatchs[1]:'';var multiplier=parts[6]=='+'?1:-1;var serverOffset=multiplier*60*parseInt(parts[7],10)+parseInt(parts[8],10);var userOffset=-userDate.getTimezoneOffset();var diff=(userOffset-serverOffset)*60000;var adjustedTime=userDate.getTime()+diff;userDate.setTime(adjustedTime);year=userDate.getFullYear();month=months[TCI.Globals.locale][userDate.getMonth()];day=userDate.getDate();hour=userDate.getHours();min=userDate.getMinutes();if(locale=='fr'){if(caZones[zone]!=undefined){zone=caZones[zone];}else if(zone.indexOf('UTC')!=0){zone=TCI.Date.dateFormat(date,'Z');}
return'le '+day+' '+month+' '+year+' '+pad(hour)+' h '+pad(min)+', '+zone;}else{if(caZones[zone]==undefined){zone=TCI.Date.dateFormat(date,'Z');}
ampm=parseInt(hour,10)<12?'AM':'PM';hour=hour%12;return month+' '+day+', '+year+' '+pad(hour)+':'+pad(min)+' '+ampm+', '+zone;}},serverDate:null,clientDate:null,getServerDate:function(forceSecure)
{var securePath=TCI.Utils.getOptionalSecurePrefix();if(forceSecure){securePath=TCI.Utils.getSecurePrefix();}
TCI.ajax.getJSON(TCI.Utils.getURL(securePath+'/server_date.action'),{format:"yyyy-MM-dd'T'HH:mm:ss.000Z"},function(data,textStatus,xhr){TCI.Date.serverDate=data.date;},function(){TCI.Date.serverDate=new Date().format("yyyy-mm-dd'T'HH:MM:ss");},false,false);return TCI.Date.serverDate;},getFormatedServerDate:function(theFormat,forceSecure)
{var result;var securePath=TCI.Utils.getOptionalSecurePrefix();if(forceSecure){securePath=TCI.Utils.getSecurePrefix();}
TCI.ajax.getJSON(TCI.Utils.getURL(securePath+'/server_date.action'),function(data){result=data.date;},function(){result=(new Date()).format(theFormat);},false,false);return result;},getClientDate:function(forceSecure)
{var currClientDate=new Date();if(!!TCI.Date.clientDate&&(currClientDate.getTime()-TCI.Date.clientDate.getTime()-timeDiff<10000))
return TCI.Date.clientDate;TCI.Date.clientDate=new Date(TCI.Date.parse(TCI.Date.getServerDate(forceSecure)));timeDiff=currClientDate.getTime()-TCI.Date.clientDate.getTime();return TCI.Date.clientDate;},parse:function(date)
{var timestamp=Date.parse(date),minutesOffset=0,struct;var splitDate=date.split('T');if(!!splitDate[1]&&splitDate[1].length==8){date=date+'-0000';}
if(isNaN(timestamp)&&(struct=/^(\d{4}|[+\-]\d{6})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?/.exec(date)))
{minutesOffset=0;if(struct[8]!=='Z'){minutesOffset=(+struct[10]||0)*60+(+struct[11]||0);if(struct[9]==='+'){minutesOffset=0-minutesOffset;}}
if(minutesOffset==0){minutesOffset=new Date().getTimezoneOffset();}
var milli=0;if(struct[7]){milli=struct[7].substr(0,3);}
timestamp=Date.UTC(+struct[1],+struct[2]-1,+struct[3],+struct[4],+struct[5]+minutesOffset,+struct[6],+milli);}
return timestamp;},formatToFrench:function(date,utc)
{if(!date){return'';}
var year=date.getFullYear();var month=months['fr'][date.getMonth()];var day=date.getDate();var hour=date.getHours();var min=date.getMinutes();var zoneMatchs=/.*\((.*)\)/.exec(date.toTimeString())||/\d{2}:\d{2}:\d{2} (.*)/.exec(date.toTimeString());var zone=zoneMatchs.length>1?zoneMatchs[1]:'';if(caZones[zone]!=undefined){zone=caZones[zone];}else{zone=TCI.Date.dateFormat(date,'Z',utc);}
return'le '+day+' '+month+' '+year+' '+pad(hour)+' h '+pad(min)+', '+zone;}};})();TCI.Date.dateFormat=function()
{var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[NPMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};return function(date,mask,utc)
{var dF=TCI.Date.dateFormat;if(arguments.length==1&&Object.prototype.toString.call(date)=="[object String]"&&!/\d/.test(date)){mask=date;date=undefined;}
date=date?new Date(date):new Date;mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true;}
var _=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?" a.m.":" p.m.",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0)
{return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});};}();TCI.Date.dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};TCI.Date.dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};
