//------------------------------------------------------
// Thanx Media - SuggestAhead(TM) - Copyright (C) 2008
//------------------------------------------------------
function ak(ao,bo){

this.av= -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
this.bs=10; // Number of elements autocomplete can show (-1: no limit)
this.bl=false; // should the auto complete be limited to the beginning of keyword?
this.aF=true; // Enable Mouse Support
this.aL=new Array(';',','); // Delimiter for multiple autocomplete. Set it to empty array for single autocomplete
this.bw=1; // Show widget only after this number of characters is typed in.
this.bm='search'; // Search form ID 

this.aw='#FFFFFF'; // background color
this.aO='#000000'; // text color
this.bh='1px solid #000000'; // border
this.aN='#FFE597'; // highlight color
this.bg='Arial,Helvetica,sans-serif'; // font family
this.aM='11px'; // font size
this.bn='text-decoration:underline;font-weight="bold"'; // highlight style
this.bb='225px'; // width

this.ba='2000'; // index

var at=new Array();var aA=0;var bf=new Array();var ax=false;var ar=0;var aK=0;var ap=null;var aE=0;var aD=0;var aH=new Array();var aY=0;var as;var bc=false;var bx="";var au=1;var aX=0;var aG=false;this.ay=new Array();this.ay=bo;var an=this;ap=ao;f(ap,"focus",T);function T(){f(document,"keydown",C);f(ap,"blur",B);f(document,"keypress",H);};function B(aq){if(!aq)aq=event;v(document,"keydown",C);v(ap,"blur",B);v(document,"keypress",H);d();};function D(n){if(an.aL.length>0){var t=at[aA].aU().aP();var aW=at[aA].aU().length;}else{var t=ap.value.aP();var aW=ap.value.length;}var aI='';var i;if(an.bl){var aR=new RegExp("^"+t,"i");}else{var aR=new RegExp(t,"i");}var p=n.search(aR);for(i=0;i<p;i++){aI+=n.substr(i,1);}aI+="<font style='"+(an.bn)+"'>";for(i=p;i<aW+p;i++){aI+=n.substr(i,1);}aI+="</font>";for(i=aW+p;i<n.length;i++){aI+=n.substr(i,1);}return aI;};function af(){if(document.getElementById('tat_table')){ax=false;document.body.removeChild(document.getElementById('tat_table'));}if(aX==0){ax=false;return;}a=document.createElement('table');a.cellSpacing='1px';a.cellPadding='2px';a.style.position='absolute';a.style.zIndex=an.ba;a.style.border=an.bh;a.style.width=an.bb;a.style.top=eval(L(ap)+ap.offsetHeight)+"px";a.style.left=P(ap)+"px";a.style.backgroundColor=an.aw;a.id='tat_table';document.body.appendChild(a);var i;var first=true;var j=1;if(an.aF){a.onmouseout=K;a.onmouseover=O;}var bt=0;for(i=0;i<an.ay.length;i++){if(aH[i]){bt++;r=a.insertRow(-1);r.style.backgroundColor=an.aw;r.id='tat_tr'+(j);c=r.insertCell(-1);c.style.color=an.aO;c.style.fontFamily=an.bg;c.style.fontSize=an.aM;c.innerHTML=D(an.ay[i]);c.id='tat_td'+(j);c.setAttribute('pos',j);c.style.textAlign='left';c.style.padding='1px 5px';if(an.aF){c.style.cursor='pointer';c.onclick=F;c.onmouseover=J;}j++;}if(j-1==an.bs&&j<aK){r=a.insertRow(-1);r.style.backgroundColor=an.aw;c=r.insertCell(-1);c.style.color=an.aO;c.style.fontFamily='arial narrow';c.style.fontSize=an.aM;c.align='center';o(c,'\\/');if(an.aF){c.style.cursor='pointer';c.onclick=G;}break;}}aE=1;aD=j-1;ax=true;};function Q(){document.body.removeChild(document.getElementById('tat_table'));a=document.createElement('table');a.cellSpacing='1px';a.cellPadding='2px';a.style.position='absolute';a.style.zIndex=an.ba;a.style.border=an.bh;a.style.width=an.bb;a.style.top=eval(L(ap)+ap.offsetHeight)+"px";a.style.left=P(ap)+"px";a.style.backgroundColor=an.aw;a.id='tat_table';if(an.aF){a.onmouseout=K;a.onmouseover=O;}document.body.appendChild(a);var i;var first=true;var j=1;if(aE>1){r=a.insertRow(-1);r.style.backgroundColor=an.aw;c=r.insertCell(-1);c.style.color=an.aO;c.style.fontFamily='arial narrow';c.style.fontSize=an.aM;c.align='center';o(c,'/\\');if(an.aF){c.style.cursor='pointer';c.onclick=U;}}for(i=0;i<an.ay.length;i++){if(aH[i]){if(j>=aE&&j<=aD){r=a.insertRow(-1);r.style.backgroundColor=an.aw;r.id='tat_tr'+(j);c=r.insertCell(-1);c.style.color=an.aO;c.style.fontFamily=an.bg;c.style.fontSize=an.aM;c.innerHTML=D(an.ay[i]);c.id='tat_td'+(j);c.setAttribute('pos',j);c.style.textAlign='left';c.style.padding='1px 5px';if(an.aF){c.style.cursor='pointer';c.onclick=F;c.onmouseover=J;}j++;}else{j++;}}if(j>aD)break;}if(j-1<aK){r=a.insertRow(-1);r.style.backgroundColor=an.aw;c=r.insertCell(-1);c.style.color=an.aO;c.style.fontFamily='arial narrow';c.style.fontSize=an.aM;c.align='center';o(c,'\\/');if(an.aF){c.style.cursor='pointer';c.onclick=G;}}};function ae(){if(!ax)return;if(ar==1)return;document.getElementById('tat_tr'+ar).style.backgroundColor=an.aw;ar--;if(ar<aE)g();document.getElementById('tat_tr'+ar).style.backgroundColor=an.aN;if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);};function ag(){if(!ax)return;if(ar==aK)return;if(ar>0){document.getElementById('tat_tr'+ar).style.backgroundColor=an.aw;}ar++;if(ar>aD)k();document.getElementById('tat_tr'+ar).style.backgroundColor=an.aN;if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);};function k(){aE++;aD++;Q();};function g(){aE--;aD--;Q();};function G(){document.getElementById('tat_tr'+ar).style.backgroundColor=an.aw;ar++;k();document.getElementById('tat_tr'+ar).style.backgroundColor=an.aN;ap.focus();au=0;if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);};function U(aq){if(!aq)aq=event;if(aq.stopPropagation){aq.stopPropagation();}else{aq.cancelBubble=true;}document.getElementById('tat_tr'+ar).style.backgroundColor=an.aw;ar--;g();document.getElementById('tat_tr'+ar).style.backgroundColor=an.aN;ap.focus();au=0;if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);};function F(aq){if(!aq)aq=event;if(!ax)return;au=0;ar=this.getAttribute('pos');I();};function O(){au=1;};function K(){au=0;if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);};function J(){au=1;if(ar==null||ar==0){ar=1;}document.getElementById('tat_tr'+ar).style.backgroundColor=an.aw;ar=this.getAttribute('pos');while(ar<aE)g();while(ar>aD)k();document.getElementById('tat_tr'+ar).style.backgroundColor=an.aN;if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);};function ad(a){if(an.aL.length>0){aB='';l=0;for(i=0;i<at.length;i++){if(aA==i){bk=bj='';bi=false;for(j=0;j<at[i].length;++j){if(at[i].charAt(j)!=' '){bi=true;break;}bk+=' ';}for(j=at[i].length-1;j>=0;--j){if(at[i].charAt(j)!=' ')break;bj+=' ';}aB+=bk;aB+=a;l=aB.length;if(bi)aB+=bj;}else{aB+=at[i];}if(i!=at.length-1){aB+=bf[i];}}ap.value=aB;ab(ap,l);}else{ap.value=a;}au=0;d();};function I(){if(!ax)return;ax=false;var word='';var c=0;for(var i=0;i<=an.ay.length;i++){if(aH[i])c++;if(c==ar){word=an.ay[i];break;}}ad(word);l=A(ap);aa();};function aa(){if(document.getElementById(an.bm)!=null){var bq=document.getElementById(an.bm);bq.submit();}};function d(){if(au==0){ax=0;if(document.getElementById('tat_table')){document.body.removeChild(document.getElementById('tat_table'));}if(as)clearTimeout(as);}};function H(e){if(aG)ac(e);return!aG;};function C(aq){if(!aq)aq=event;a=aq.keyCode;bu=A(ap);aG=0;switch(a){case 38:ae();aG=1;return false;break;case 40:ag();aG=1;return false;break;case 13:case 9:if(ax&&ar>0){aG=1;I();return false;}else{return true;}break;default:setTimeout(function(){R(a)},50);break;}};function R(aZ){if(aZ==38||aZ==40||aZ==13)return;var i;if(ax){var word=0;var c=0;for(var i=0;i<=an.ay.length;i++){if(aH[i])c++;if(c==ar){word=i;break;}}aY=word;}else{aY= -1};if(ap.value==''){au=0;d();return;}if(an.aL.length>0){bu=A(ap);bd=V(ap);aT='';for(i=0;i<an.aL.length;i++){aT+=an.aL[i];}aT=aT.aP();be=new RegExp("(["+aT+"])");c=0;at=new Array();at[0]='';for(i=0,j=ap.value.length;i<ap.value.length;i++,j--){if(ap.value.substr(i,j).search(be)==0){bp=ap.value.substr(i,j).match(be);bf[c]=bp[1];c++;at[c]='';}else{at[c]+=ap.value.charAt(i);}}var l=0;aA= -1;for(i=0;i<at.length;i++){if(bd>=l&&bd<=l+at[i].length){aA=i;}l+=at[i].length+1;}var aV=at[aA].aU();var t=at[aA].aP().aU();}else{var aV=ap.value;var t=ap.value.aP();}if(aV.length==0){au=0;d();}if(aV.length<an.bw)return this;if(an.bl){var aR=new RegExp("^"+t,"i");}else{var aR=new RegExp(t,"i");}aK=0;bc=false;aX=0;for(i=0;i<an.ay.length;i++){aH[i]=false;if(aR.test(an.ay[i])){aK++;aH[i]=true;aX++;if(aY==i)bc=true;}}if(as)clearTimeout(as);if(an.av>0)as=setTimeout(function(){au=0;d();},an.av);af();};return this;};function f(ao,aC,aJ){if(ao.attachEvent){ao.attachEvent("on"+aC,aJ);}else if(ao.addEventListener){ao.addEventListener(aC,aJ,true);}else{ao["on"+aC]=aJ;}};function v(ao,aC,aJ){if(ao.detachEvent){ao.detachEvent("on"+aC,aJ);}else if(ao.removeEventListener){ao.removeEventListener(aC,aJ,true);}else{ao["on"+aC]=null;}};function ac(aq){aq||window.event;if(aq.stopPropagation){aq.stopPropagation();aq.preventDefault();}else if(typeof aq.cancelBubble!="undefined"){aq.cancelBubble=true;aq.returnValue=false;}return false;};function ai(aq){if(window.event){return window.event.srcElement;}else{return aq.currentTarget;}};function ah(aq){if(window.event){return window.event.srcElement;}else{return aq.target;}};function al(ao){if(typeof ao.onselectstart!='undefined'){f(ao,"selectstart",function(){return false;});}};function V(ao){if(typeof ao.selectionEnd!="undefined"){return ao.selectionEnd;}else if(document.selection&&document.selection.createRange){var M=document.selection.createRange();try{var az=M.duplicate();az.moveToElementText(ao);}catch(e){var az=ao.createTextRange();}az.setEndPoint("EndToEnd",M);var aS=az.text.length;if(aS>ao.value.length){return-1;}return aS;}};function A(ao){if(typeof ao.selectionStart!="undefined"){return ao.selectionStart;}else if(document.selection&&document.selection.createRange){var M=document.selection.createRange();try{var az=M.duplicate();az.moveToElementText(ao);}catch(e){var az=ao.createTextRange();}az.setEndPoint("EndToStart",M);var aS=az.text.length;if(aS>ao.value.length){return-1;}return aS;}};function ab(ao,l){ao.focus();if(ao.setSelectionRange){ao.setSelectionRange(l,l);}else if(ao.createTextRange){m=ao.createTextRange();m.moveStart('character',l);m.collapse();m.select();}};function am(ao,s,e){ao.focus();if(ao.setSelectionRange){ao.setSelectionRange(s,e);}else if(ao.createTextRange){m=ao.createTextRange();m.moveStart('character',s);m.moveEnd('character',e);m.select();}};String.prototype.aP=function(){return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g,'\\$1');};String.prototype.aU=function(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");};function L(ao){aQ=0;while(ao){aQ+=ao.offsetTop;ao=ao.offsetParent;}return aQ;};function P(ao){aQ=0;while(ao){aQ+=ao.offsetLeft;ao=ao.offsetParent;}return aQ;};function aj(a){return typeof a=='number'&&isFinite(a);};function o(ao,text){while(bv=ao.childNodes[0]){ao.removeChild(bv);};ao.appendChild(document.createTextNode(text));}
