/*---------01_firms.js---------*/

function countWords(str){return str.split(' ').length;}
function inittagblocks(){var tr=document.getElementById("tagblock1");h=tr.clientHeight;tr=document.getElementById("tagblock2");h2=tr.clientHeight;tr=document.getElementById("tagblock3");h3=tr.clientHeight;if(h2>h){h=h2;}
if(h3>h){h=h3;}
document.getElementById("tagblock1").style.height=h+'px';document.getElementById("tagblock2").style.height=h+'px';document.getElementById("tagblock3").style.height=h+'px';}
function OnDialogOpen(form){idobj=form.object.value;if(form.id=='formeditcomment'){idv='cmt'+idobj;val=trim(document.getElementById(idv).innerHTML);val=trim(val);val=val.replace(/<br>/gi,"");form.txt.value=val;}
if(form.id=='formeditreview'){idv='REVIEW_HIGHS'+idobj;if(document.getElementById(idv)){val=trim(document.getElementById(idv).innerHTML);val=val.replace(/<br>/gi,"");form.REVIEW_HIGHS.value=val;}
idv='REVIEW_LOWS'+idobj;if(document.getElementById(idv)){val=trim(document.getElementById(idv).innerHTML);val=val.replace(/<br>/gi,"");form.REVIEW_LOWS.value=val;}
idv='REVIEW_BODY'+idobj;if(document.getElementById(idv)){val=trim(document.getElementById(idv).innerHTML);val=val.replace(/<br>/gi,"");form.REVIEW_BODY.value=val;}}}
function addreviewfirm_try(auth){if(auth==1){var areAllValid=LiveValidation.massValidate([COMMENTBODY]);}else{var areAllValid=LiveValidation.massValidate([COMMENTBODY,pnick,ppass]);}
if(areAllValid!=1){alert('Не все обязательные поля заполнены или заполнены неверно');}else{dial.show('formwaitmsg',12);document.forms['addcmtform'].submit();}}
function addmember_try(){var err='';userlogin=document.getElementById('unick');if(userlogin.value==''){err+='Не заполнен ник пользователя\n';userlogin.className='fieldAtten';}
if(err!=''){alert(err);}
else{dial.show('formwaitmsg',12);document.forms['addmember'].submit();};}
function firm_login(){err='';titl=document.getElementById('admpass');if(titl.value==''){err+='Не заполнен пароль на вход в компанию\n';titl.className='fieldAtten';}
if(err!=''){alert(err);}else{dial.show('formwaitmsg',12);document.forms['adminzone'].submit();return true;}}
function firm_add_review(auth){err='';titl=document.getElementById('review[REVIEW_BODY]');if(titl.value==''){err+='Не заполнено поле "Текст отзыва"\n';titl.className='fieldAtten';}else{titl.className='';}
titl=document.getElementById('rules_passed');if(titl.checked!=1){err+='Вы не согласились с правилами\n';titl.className='fieldAtten';}else{titl.className='';}
if(auth==1){var areAllValid=LiveValidation.massValidate([REVIEW_HIGHS,REVIEW_LOWS,REVIEW_BODY]);}else{var areAllValid=LiveValidation.massValidate([REVIEW_HIGHS,REVIEW_LOWS,REVIEW_BODY,pnick,ppass]);}
if(areAllValid!=1){alert('Не все обязательные поля заполнены или заполнены неверно');}else{dial.show('formwaitmsg',12);document.forms['add_review'].submit();}}
function gconfirm(txt,url){if(confirm(txt)){parent.location=url;}
else{}}
function send_file(forma,fname,loadername,formdataname,statusname,previewname){var req=new JsHttpRequest();var data=document.forms[fname].filefield.value;if(data==''){alert('Вы не выбрали файл');return;}
req.onreadystatechange=function(){if(req.readyState==4){document.getElementById(formdataname).style.display='block'
document.getElementById(statusname).style.display='block'
document.getElementById(loadername).style.display='none'
document.getElementById(statusname).innerHTML='<li>'+req.responseJS.msg+'</li>'
if(req.responseJS.status>0){document.getElementById(previewname).src=req.responseJS.file
document.getElementById(statusname).className='informer'
dial.close();}else{document.getElementById(statusname).className='alerter'
alert('Не получилось закачать лого\n'+req.responseJS.msg);}}}
req.open(null,"/sitepages/upload/upload.php",true);document.getElementById(loadername).style.display='block'
document.getElementById(formdataname).style.display='none'
req.send({q:forma});}
function send_cmtedit(tip){var req=new JsHttpRequest();if(tip=='comment'){var fname='formeditcomment';var id=document.forms[fname].object.value;var data=document.forms[fname].txt.value;if(data==''){alert('Вы не заполнили текст комментария');return;}
req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.status>0){locid='cmt'+id;document.getElementById(locid).innerHTML=data.replace(/\n/gi,"<br>");}else{alert('Не получилось отредактировать\n'+req.responseJS.err);}
dial.close();}}
req.open(null,"/sitepages/ajax/edit.php",true);req.send({txt:data,idd:id,stype:tip});}
if(tip=='review'){var fname='formeditreview';var id=document.forms[fname].object.value;var REVIEW_BODY=document.forms[fname].REVIEW_BODY.value;var REVIEW_LOWS=document.forms[fname].REVIEW_LOWS.value;var REVIEW_HIGHS=document.forms[fname].REVIEW_HIGHS.value;var REVIEW_GOODS=document.forms[fname].REVIEW_GOODS.value;var REVIEW_GOODSDATE=document.forms[fname].REVIEW_GOODSDATE.value;var REVIEW_FIRMMARK=document.forms[fname].REVIEW_FIRMMARK.value;var REVIEW_PERSONALMARK=document.forms[fname].REVIEW_PERSONALMARK.value;var REVIEW_PRICEMARK=document.forms[fname].REVIEW_PRICEMARK.value;var REVIEW_DELIVERYMARK=document.forms[fname].REVIEW_DELIVERYMARK.value;if(document.forms[fname].REVIEW_BODY.value==''){alert('Вы не заполнили текст отзыва');return;}
req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.status>0){str1=req.responseJS.err;str1=str1+"?r="+Math.random()+"#opinion";document.location.reload();}else{alert('Не получилось отредактировать\n'+req.responseJS.err);}
dial.close();return false;}}
req.open(null,"/sitepages/ajax/edit.php",true);req.send({REVIEW_BODY:REVIEW_BODY,REVIEW_HIGHS:REVIEW_HIGHS,REVIEW_LOWS:REVIEW_LOWS,REVIEW_GOODS:REVIEW_GOODS,REVIEW_GOODSDATE:REVIEW_GOODSDATE,REVIEW_FIRMMARK:REVIEW_FIRMMARK,REVIEW_PERSONALMARK:REVIEW_PERSONALMARK,REVIEW_PRICEMARK:REVIEW_PRICEMARK,REVIEW_DELIVERYMARK:REVIEW_DELIVERYMARK,idd:id,stype:tip});}}
function send_abuse(tip){var req=new JsHttpRequest();var subtip=null;if(tip=='review'){fname='formabuse';}
if(tip=='comment'){fname='formabusecmt';}
if(tip=='firm'){fname='formabusefirm';subtip=document.forms[fname].fctype.value;}
var id=document.forms[fname].object.value;var data=document.forms[fname].txt.value;if(data==''){alert('Вы не заполнили текст жалобы');return;}
req.onreadystatechange=function(){if(req.readyState==4){dial.close();}}
req.open(null,"/sitepages/ajax/index.php",true);req.send({abuse:data,idd:id,stype:tip,fctype:subtip});}
function URLEncode(clearString){var output='';var x=0;clearString=clearString.toString();var regex=/(^[a-zA-Z0-9_.]*)/;while(x<clearString.length){var match=regex.exec(clearString.substr(x));if(match!=null&&match.length>1&&match[1]!=''){output+=match[1];x+=match[1].length;}else{if(clearString[x]==' ')
output+='+';else{var charCode=clearString.charCodeAt(x);var hexVal=charCode.toString(16);output+='%'+(hexVal.length<2?'0':'')+hexVal.toUpperCase();}
x++;}}
return output;}
function altgo2page(arg,idd){page=document.getElementById('pageno'+idd).value;document.forms['pagg'+idd].action=arg+page;document.forms['pagg'+idd].submit();return true;}
function go2page(idd){finame='pageno'+idd;page=document.getElementById(finame).value;fname='pagg'+idd;document.forms[fname].action=document.forms['pagg'+idd].action+page;document.forms[fname].submit();return true;}
function showHide(id){var elem=document.getElementById('nadpis');if(document.layers){current=(document.layers[id].display=='none')?'block':'none';if(document.layers[id].display=='none'){elem.innerHTML='Развернуть';}else{elem.innerHTML='Свернуть';}
document.layers[id].display=current;}else if(document.all){current=(document.all[id].style.display=='none')?'block':'none';if(document.all[id].style.display=='none'){elem.innerHTML='Развернуть';}else{elem.innerHTML='Свернуть';}
document.all[id].style.display=current;}else if(document.getElementById){vista=(document.getElementById(id).style.display=='none')?'block':'none';document.getElementById(id).style.display=vista;if(document.getElementById(id).style.display=='none'){elem.innerHTML='Развернуть';}else{elem.innerHTML='Свернуть';}}}

/*---------02_livevalidation_standalone.compressed.js---------*/

var LiveValidation=function(B,A){this.initialize(B,A);};LiveValidation.VERSION="1.3 standalone";LiveValidation.TEXTAREA=1;LiveValidation.TEXT=2;LiveValidation.PASSWORD=3;LiveValidation.CHECKBOX=4;LiveValidation.SELECT=5;LiveValidation.FILE=6;LiveValidation.massValidate=function(C){var D=true;for(var B=0,A=C.length;B<A;++B){var E=C[B].validate();if(D){D=E;}}return D;};LiveValidation.prototype={validClass:"LV_valid",invalidClass:"LV_invalid",messageClass:"LV_validation_message",validFieldClass:"LV_valid_field",invalidFieldClass:"LV_invalid_field",initialize:function(D,C){var A=this;if(!D){throw new Error("LiveValidation::initialize - No element reference or element id has been provided!");}this.element=D.nodeName?D:document.getElementById(D);if(!this.element){throw new Error("LiveValidation::initialize - No element with reference or id of '"+D+"' exists!");}this.validations=[];this.elementType=this.getElementType();this.form=this.element.form;var B=C||{};this.validMessage=B.validMessage||"Thankyou!";var E=B.insertAfterWhatNode||this.element;this.insertAfterWhatNode=E.nodeType?E:document.getElementById(E);this.onValid=B.onValid||function(){this.insertMessage(this.createMessageSpan());this.addFieldClass();};this.onInvalid=B.onInvalid||function(){this.insertMessage(this.createMessageSpan());this.addFieldClass();};this.onlyOnBlur=B.onlyOnBlur||false;this.wait=B.wait||0;this.onlyOnSubmit=B.onlyOnSubmit||false;if(this.form){this.formObj=LiveValidationForm.getInstance(this.form);this.formObj.addField(this);}this.oldOnFocus=this.element.onfocus||function(){};this.oldOnBlur=this.element.onblur||function(){};this.oldOnClick=this.element.onclick||function(){};this.oldOnChange=this.element.onchange||function(){};this.oldOnKeyup=this.element.onkeyup||function(){};this.element.onfocus=function(F){A.doOnFocus(F);return A.oldOnFocus.call(this,F);};if(!this.onlyOnSubmit){switch(this.elementType){case LiveValidation.CHECKBOX:this.element.onclick=function(F){A.validate();return A.oldOnClick.call(this,F);};case LiveValidation.SELECT:case LiveValidation.FILE:this.element.onchange=function(F){A.validate();return A.oldOnChange.call(this,F);};break;default:if(!this.onlyOnBlur){this.element.onkeyup=function(F){A.deferValidation();return A.oldOnKeyup.call(this,F);};}this.element.onblur=function(F){A.doOnBlur(F);return A.oldOnBlur.call(this,F);};}}},destroy:function(){if(this.formObj){this.formObj.removeField(this);this.formObj.destroy();}this.element.onfocus=this.oldOnFocus;if(!this.onlyOnSubmit){switch(this.elementType){case LiveValidation.CHECKBOX:this.element.onclick=this.oldOnClick;case LiveValidation.SELECT:case LiveValidation.FILE:this.element.onchange=this.oldOnChange;break;default:if(!this.onlyOnBlur){this.element.onkeyup=this.oldOnKeyup;}this.element.onblur=this.oldOnBlur;}}this.validations=[];this.removeMessageAndFieldClass();},add:function(A,B){this.validations.push({type:A,params:B||{}});return this;},remove:function(B,D){var E=false;for(var C=0,A=this.validations.length;C<A;C++){if(this.validations[C].type==B){if(this.validations[C].params==D){E=true;break;}}}if(E){this.validations.splice(C,1);}return this;},deferValidation:function(B){if(this.wait>=300){this.removeMessageAndFieldClass();}var A=this;if(this.timeout){clearTimeout(A.timeout);}this.timeout=setTimeout(function(){A.validate();},A.wait);},doOnBlur:function(A){this.focused=false;this.validate(A);},doOnFocus:function(A){this.focused=true;this.removeMessageAndFieldClass();},getElementType:function(){switch(true){case(this.element.nodeName.toUpperCase()=="TEXTAREA"):return LiveValidation.TEXTAREA;case(this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="TEXT"):return LiveValidation.TEXT;case(this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="PASSWORD"):return LiveValidation.PASSWORD;case(this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="CHECKBOX"):return LiveValidation.CHECKBOX;case(this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="FILE"):return LiveValidation.FILE;case(this.element.nodeName.toUpperCase()=="SELECT"):return LiveValidation.SELECT;case(this.element.nodeName.toUpperCase()=="INPUT"):throw new Error("LiveValidation::getElementType - Cannot use LiveValidation on an "+this.element.type+" input!");default:throw new Error("LiveValidation::getElementType - Element must be an input, select, or textarea!");}},doValidations:function(){this.validationFailed=false;for(var C=0,A=this.validations.length;C<A;++C){var B=this.validations[C];switch(B.type){case Validate.Presence:case Validate.Confirmation:case Validate.Acceptance:this.displayMessageWhenEmpty=true;this.validationFailed=!this.validateElement(B.type,B.params);break;default:this.validationFailed=!this.validateElement(B.type,B.params);break;}if(this.validationFailed){return false;}}this.message=this.validMessage;return true;},validateElement:function(A,C){var D=(this.elementType==LiveValidation.SELECT)?this.element.options[this.element.selectedIndex].value:this.element.value;if(A==Validate.Acceptance){if(this.elementType!=LiveValidation.CHECKBOX){throw new Error("LiveValidation::validateElement - Element to validate acceptance must be a checkbox!");}D=this.element.checked;}var E=true;try{A(D,C);}catch(B){if(B instanceof Validate.Error){if(D!==""||(D===""&&this.displayMessageWhenEmpty)){this.validationFailed=true;this.message=B.message;E=false;}}else{throw B;}}finally{return E;}},validate:function(){if(!this.element.disabled){var A=this.doValidations();if(A){this.onValid();return true;}else{this.onInvalid();return false;}}else{return true;}},enable:function(){this.element.disabled=false;return this;},disable:function(){this.element.disabled=true;this.removeMessageAndFieldClass();return this;},createMessageSpan:function(){var A=document.createElement("span");var B=document.createTextNode(this.message);A.appendChild(B);return A;},insertMessage:function(B){this.removeMessage();if((this.displayMessageWhenEmpty&&(this.elementType==LiveValidation.CHECKBOX||this.element.value==""))||this.element.value!=""){var A=this.validationFailed?this.invalidClass:this.validClass;B.className+=" "+this.messageClass+" "+A;if(this.insertAfterWhatNode.nextSibling){this.insertAfterWhatNode.parentNode.insertBefore(B,this.insertAfterWhatNode.nextSibling);}else{this.insertAfterWhatNode.parentNode.appendChild(B);}}},addFieldClass:function(){this.removeFieldClass();if(!this.validationFailed){if(this.displayMessageWhenEmpty||this.element.value!=""){if(this.element.className.indexOf(this.validFieldClass)==-1){this.element.className+=" "+this.validFieldClass;}}}else{if(this.element.className.indexOf(this.invalidFieldClass)==-1){this.element.className+=" "+this.invalidFieldClass;}}},removeMessage:function(){var A;var B=this.insertAfterWhatNode;while(B.nextSibling){if(B.nextSibling.nodeType===1){A=B.nextSibling;break;}B=B.nextSibling;}if(A&&A.className.indexOf(this.messageClass)!=-1){this.insertAfterWhatNode.parentNode.removeChild(A);}},removeFieldClass:function(){if(this.element.className.indexOf(this.invalidFieldClass)!=-1){this.element.className=this.element.className.split(this.invalidFieldClass).join("");}if(this.element.className.indexOf(this.validFieldClass)!=-1){this.element.className=this.element.className.split(this.validFieldClass).join(" ");}},removeMessageAndFieldClass:function(){this.removeMessage();this.removeFieldClass();}};var LiveValidationForm=function(A){this.initialize(A);};LiveValidationForm.instances={};LiveValidationForm.getInstance=function(A){var B=Math.random()*Math.random();if(!A.id){A.id="formId_"+B.toString().replace(/\./,"")+new Date().valueOf();}if(!LiveValidationForm.instances[A.id]){LiveValidationForm.instances[A.id]=new LiveValidationForm(A);}return LiveValidationForm.instances[A.id];};LiveValidationForm.prototype={initialize:function(B){this.name=B.id;this.element=B;this.fields=[];this.oldOnSubmit=this.element.onsubmit||function(){};var A=this;this.element.onsubmit=function(C){return(LiveValidation.massValidate(A.fields))?A.oldOnSubmit.call(this,C||window.event)!==false:false;};},addField:function(A){this.fields.push(A);},removeField:function(C){var D=[];for(var B=0,A=this.fields.length;B<A;B++){if(this.fields[B]!==C){D.push(this.fields[B]);}}this.fields=D;},destroy:function(A){if(this.fields.length!=0&&!A){return false;}this.element.onsubmit=this.oldOnSubmit;LiveValidationForm.instances[this.name]=null;return true;}};var Validate={Presence:function(B,C){var C=C||{};var A=C.failureMessage||"Can't be empty!";if(B===""||B===null||B===undefined){Validate.fail(A);}return true;},Numericality:function(J,E){var A=J;var J=Number(J);var E=E||{};var F=((E.minimum)||(E.minimum==0))?E.minimum:null;var C=((E.maximum)||(E.maximum==0))?E.maximum:null;var D=((E.is)||(E.is==0))?E.is:null;var G=E.notANumberMessage||"Must be a number!";var H=E.notAnIntegerMessage||"Must be an integer!";var I=E.wrongNumberMessage||"Must be "+D+"!";var B=E.tooLowMessage||"Must not be less than "+F+"!";var K=E.tooHighMessage||"Must not be more than "+C+"!";if(!isFinite(J)){Validate.fail(G);}if(E.onlyInteger&&(/\.0+$|\.$/.test(String(A))||J!=parseInt(J))){Validate.fail(H);}switch(true){case(D!==null):if(J!=Number(D)){Validate.fail(I);}break;case(F!==null&&C!==null):Validate.Numericality(J,{tooLowMessage:B,minimum:F});Validate.Numericality(J,{tooHighMessage:K,maximum:C});break;case(F!==null):if(J<Number(F)){Validate.fail(B);}break;case(C!==null):if(J>Number(C)){Validate.fail(K);}break;}return true;},Format:function(C,E){var C=String(C);var E=E||{};var A=E.failureMessage||"Not valid!";var B=E.pattern||/./;var D=E.negate||false;if(!D&&!B.test(C)){Validate.fail(A);}if(D&&B.test(C)){Validate.fail(A);}return true;},Email:function(B,C){var C=C||{};var A=C.failureMessage||"Must be a valid email address!";Validate.Format(B,{failureMessage:A,pattern:/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i});return true;},Length:function(F,G){var F=String(F);var G=G||{};var E=((G.minimum)||(G.minimum==0))?G.minimum:null;var H=((G.maximum)||(G.maximum==0))?G.maximum:null;var C=((G.is)||(G.is==0))?G.is:null;var A=G.wrongLengthMessage||"Must be "+C+" characters long!";var B=G.tooShortMessage||"Must not be less than "+E+" characters long!";var D=G.tooLongMessage||"Must not be more than "+H+" characters long!";switch(true){case(C!==null):if(F.length!=Number(C)){Validate.fail(A);}break;case(E!==null&&H!==null):Validate.Length(F,{tooShortMessage:B,minimum:E});Validate.Length(F,{tooLongMessage:D,maximum:H});break;case(E!==null):if(F.length<Number(E)){Validate.fail(B);}break;case(H!==null):if(F.length>Number(H)){Validate.fail(D);}break;default:throw new Error("Validate::Length - Length(s) to validate against must be provided!");}return true;},Inclusion:function(H,F){var F=F||{};var K=F.failureMessage||"Must be included in the list!";var G=(F.caseSensitive===false)?false:true;if(F.allowNull&&H==null){return true;}if(!F.allowNull&&H==null){Validate.fail(K);}var D=F.within||[];if(!G){var A=[];for(var C=0,B=D.length;C<B;++C){var I=D[C];if(typeof I=="string"){I=I.toLowerCase();}A.push(I);}D=A;if(typeof H=="string"){H=H.toLowerCase();}}var J=false;for(var E=0,B=D.length;E<B;++E){if(D[E]==H){J=true;}if(F.partialMatch){if(H.indexOf(D[E])!=-1){J=true;}}}if((!F.negate&&!J)||(F.negate&&J)){Validate.fail(K);}return true;},Exclusion:function(A,B){var B=B||{};B.failureMessage=B.failureMessage||"Must not be included in the list!";B.negate=true;Validate.Inclusion(A,B);return true;},Confirmation:function(C,D){if(!D.match){throw new Error("Validate::Confirmation - Error validating confirmation: Id of element to match must be provided!");}var D=D||{};var B=D.failureMessage||"Does not match!";var A=D.match.nodeName?D.match:document.getElementById(D.match);if(!A){throw new Error("Validate::Confirmation - There is no reference with name of, or element with id of '"+D.match+"'!");}if(C!=A.value){Validate.fail(B);}return true;},Acceptance:function(B,C){var C=C||{};var A=C.failureMessage||"Must be accepted!";if(!B){Validate.fail(A);}return true;},Custom:function(D,E){var E=E||{};var B=E.against||function(){return true;};var A=E.args||{};var C=E.failureMessage||"Not valid!";if(!B(D,A)){Validate.fail(C);}return true;},now:function(A,D,C){if(!A){throw new Error("Validate::now - Validation function must be provided!");}var E=true;try{A(D,C||{});}catch(B){if(B instanceof Validate.Error){E=false;}else{throw B;}}finally{return E;}},fail:function(A){throw new Validate.Error(A);},Error:function(A){this.message=A;this.name="ValidationError";}};

/*---------03_dial.js---------*/

dial=(function(){var blui={style:'position:absolute;display:none;top:0px;left:-40px;zIndex:200;width:0px;height:0px;backgroundColor:#ccc;opacity:0.6;filter:alpha(Opacity=60);',id:'blockui'},reToForm=[]
var cfmid=null;function toggleUI(state){var div=document.getElementById(blui.id);if(!div){div=document.body.appendChild(document.createElement('div'));div.id=blui.id;}
setStyle(div,blui.style);if(state&&div){window.onresize=null;document.body.removeChild(div,true);}
if(!state){div.style.display='block';setBlockSize(div);window.onresize=function(){setBlockSize(div);setFormPosition(document.getElementById(cfmid));}}}
function setStyle(div,str){var arr=str.split(';');for(var i=0;i<arr.length;i++){var tmp=arr[i].split(':');try{div.style[tmp[0]]=tmp[1];}
catch(e){}}}
function setBlockSize(div){if(!div){return}
div.style.width=(40+document.body.clientWidth)+'px';div.style.height='3000px';}
function setFormPosition(form){if(!form){return}
form.style.left=Math.round((document.body.clientWidth-form.clientWidth)/2)+'px'
var scrolled=window.pageYOffset?window.pageYOffset:document[(document.compatMode=='CSS1Compat')?'documentElement':'body'].scrollTop;form.style.top=Math.round(scrolled+150)+'px'}
function show(fmid,id){toggleUI(false);cfmid=fmid;var form=document.getElementById(fmid);form.reset();form.object.value=id;form.style.display='block';setFormPosition(form);document.body.onkeydown=function(e){e=e?e:window.event;if(e.keyCode==27){close();}}
window.onscroll=function(){setFormPosition(form)}
if(window.OnDialogOpen){window.OnDialogOpen(form);}}
function close(){toggleUI(true);document.getElementById(cfmid).style.display='none';window.onscroll=null;document.body.onkeydown=null;}
return{init:function(regExp,fmid){reToForm.push({re:regExp,fid:fmid});document.body.onclick=function(e){e=e?e:window.event;var obj=e.target?e.target:e.srcElement;for(var i=0;i<reToForm.length;i++){if(reToForm[i].re.test(obj.id)){show(reToForm[i].fid,obj.id.split('_')[1]);return reToForm[i];}}}},close:close,show:function(fmid,id){toggleUI(false);cfmid=fmid;var form=document.getElementById(fmid);form.reset();form.object.value=id;form.style.display='block';setFormPosition(form);window.onscroll=function(){setFormPosition(form)}
if(window.OnDialogOpen){window.OnDialogOpen(form);}}}})();function findPos(obj){var curleft=0,curtop=0;while(obj){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;obj=obj.offsetParent;}
return{x:curleft,y:curtop}}
function findPos2(obj)
{var curleft=0;var curtop=0;if(obj.offsetParent)
{while(obj.offsetParent)
{curleft+=obj.offsetLeft-obj.scrollLeft;curtop+=obj.offsetTop-obj.scrollTop;var position='';if(obj.style&&obj.style.position)
position=obj.style.position.toLowerCase();if(!position)
if(obj.currentStyle&&obj.currentStyle.position)
position=obj.currentStyle.position.toLowerCase();if((position=='absolute')||(position=='relative'))break;while(obj.parentNode!=obj.offsetParent){obj=obj.parentNode;curleft-=obj.scrollLeft;curtop-=obj.scrollTop;}
obj=obj.offsetParent;}}
else{if(obj.x)
curleft+=obj.x;if(obj.y)
curtop+=obj.y;}
return{x:curleft,y:curtop};}
function expandPersonal(){var ico=document.getElementById('pmenubtn'),menu=document.getElementById('pmenu'),pos=findPos2(ico);menu.style.top=(pos.y+13)+'px';menu.style.left=(pos.x-((window.external&&typeof window.XMLHttpRequest=="undefined")?1:0))+'px';menu.style.display='block';document.body.onmousedown=function(e){e=e?e:window.event;var el=e.target?e.target:e.srcElement;while(el!=document.body){if(el==menu){return true;}
el=el.parentNode;}
menu.style.display='none';}}

/*---------04_user_routines.js---------*/

function trim(str,chars){return ltrim(rtrim(str,chars),chars);}
function ltrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");}
function rtrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");}
function checklogin(mode){if(mode=='login'||mode=='loginexist'){fname='unick';rname='checkloginres';}else{fname='umail';rname='checkloginresm';}
var login=document.getElementById(fname).value;document.getElementById(fname).value=trim(login);var req=new JsHttpRequest();req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.err==1){document.getElementById(rname).className='red';}else{document.getElementById(rname).className='green';}
document.getElementById(rname).innerHTML=req.responseJS.txt;}}
req.open(null,"/checklogin.php?mode="+mode,true);req.send({login:login});}
function reloadcaptcha(arg){onnclick='javascript: reloadcaptcha("'+arg+'");';srcc=document.getElementById('unick').src=arg+'&randd='+Math.floor(Math.random()*1000);document.getElementById('cap1').innerHTML='<img id="capcha" name="capcha" src="'+srcc+'" width="99" height="23" alt="введите код с картинки" />';}
function checkEmail(str1){var error="";if(str1==""){error="Вы не ввели E-mail.\n";}
var emailFilter=/^.+@.+\..{2,4}$/;if(!emailFilter.test(str1)){error="Введите правильный e-mail.\n";}else{var illegalChars=/[\(\)\<\>\,\;\:\\\"\[\]]/;if(str1.match(illegalChars)){error="Введённый Вами e-mail содержит плохие символы.\n";}}
if(error!=""){}
return error;}
function cdblock(idd){vista=(document.getElementById(idd).style.display=='none')?'block':'none';document.getElementById(idd).style.display=vista;}
function subm_mail(){var mailval=document.getElementById('umail').value;err=checkEmail(mailval);if(err!=''){alert(err);}else{var req=new JsHttpRequest();document.getElementById('mailchanstatus').innerHTML='<img src="/img/working.gif" width=16 height=16 alt="работаю"/>';req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.status==1){document.getElementById('mailchanstatus').className='informer';document.getElementById('mailchanstatus').style.color='#005592';}else{document.getElementById('mailchanstatus').className='alerter';document.getElementById('mailchanstatus').style.color='#F00';}
document.getElementById('mailchanstatus').innerHTML=req.responseJS.txt;}}
req.open(null,"/ajax_chanmail.php",true);req.send({oid:1,mail:mailval});}}
function subm_pwd(){var pval=document.getElementById('upass').value;var pval1=document.getElementById('upass1').value;if(pval==''){alert('Вы пытаетесь поменять пароль на пустой');return false;}
if(pval!=pval1){alert('Введённые пароли не совпадают');return false;}
var req=new JsHttpRequest();document.getElementById('pwdchanstatus').innerHTML='<img src="/img/working.gif" width=16 height=16 alt="работаю"/>';req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.status==1){document.getElementById('pwdchanstatus').className='informer';document.getElementById('pwdchanstatus').style.color='#005592';}else{document.getElementById('pwdchanstatus').className='alerter';document.getElementById('pwdchanstatus').style.color='#F00';}
document.getElementById('pwdchanstatus').innerHTML=req.responseJS.txt;}}
req.open(null,"/ajax_chanmail.php",true);req.send({pw:1,pass:pval});}
function subm_pwdrepair(){var pval=document.getElementById('pnick').value;if(pval==''){alert('Вы не указали ник или e-mail');return false;}else{if(pval.indexOf('@')>-1){err=checkEmail(pval);if(err!=''){alert(err);return false;}}}
var req=new JsHttpRequest();document.getElementById('pwdchanstatus').innerHTML='<img src="/img/working.gif" width=16 height=16 alt="работаю"/>';req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.status==1){document.getElementById('pwdchanstatus').className='informer';document.getElementById('pwdchanstatus').style.color='#005592';}else{document.getElementById('pwdchanstatus').className='alerter';document.getElementById('pwdchanstatus').style.color='#F00';}
document.getElementById('pwdchanstatus').innerHTML=req.responseJS.txt;}}
req.open(null,"/ajax_chanmail.php",true);req.send({pw:2,pass:pval});}
function JsHttpRequest(){var t=this;t.onreadystatechange=null;t.readyState=0;t.responseText=null;t.responseXML=null;t.status=200;t.statusText="OK";t.responseJS=null;t.caching=false;t.loader=null;t.session_name="PHPSESSID";t._ldObj=null;t._reqHeaders=[];t._openArgs=null;t._errors={inv_form_el:"Invalid FORM element detected: name=%, tag=%",must_be_single_el:"If used, <form> must be a single HTML element in the list.",js_invalid:"JavaScript code generated by backend is invalid!\n%",url_too_long:"Cannot use so long query with GET request (URL is larger than % bytes)",unk_loader:"Unknown loader: %",no_loaders:"No loaders registered at all, please check JsHttpRequest.LOADERS array",no_loader_matched:"Cannot find a loader which may process the request. Notices are:\n%"};t.abort=function(){with(this){if(_ldObj&&_ldObj.abort){_ldObj.abort()}_cleanup();if(readyState==0){return}if(readyState==1&&!_ldObj){readyState=0;return}_changeReadyState(4,true)}};t.open=function(_2,_3,_4,_5,_6){with(this){if(_3.match(/^((\w+)\.)?(GET|POST)\s+(.*)/i)){this.loader=RegExp.$2?RegExp.$2:null;_2=RegExp.$3;_3=RegExp.$4}try{if(document.location.search.match(new RegExp("[&?]"+session_name+"=([^&?]*)"))||document.cookie.match(new RegExp("(?:;|^)\\s*"+session_name+"=([^;]*)"))){_3+=(_3.indexOf("?")>=0?"&":"?")+session_name+"="+this.escape(RegExp.$1)}}catch(e){}_openArgs={method:(_2||"").toUpperCase(),url:_3,asyncFlag:_4,username:_5!=null?_5:"",password:_6!=null?_6:""};_ldObj=null;_changeReadyState(1,true);return true}};t.send=function(_7){if(!this.readyState){return}this._changeReadyState(1,true);this._ldObj=null;var _8=[];var _9=[];if(!this._hash2query(_7,null,_8,_9)){return}var _a=null;if(this.caching&&!_9.length){_a=this._openArgs.username+":"+this._openArgs.password+"@"+this._openArgs.url+"|"+_8+"#"+this._openArgs.method;var _b=JsHttpRequest.CACHE[_a];if(_b){this._dataReady(_b[0],_b[1]);return false}}var _c=(this.loader||"").toLowerCase();if(_c&&!JsHttpRequest.LOADERS[_c]){return this._error("unk_loader",_c)}var _d=[];var _e=JsHttpRequest.LOADERS;for(var _f in _e){var ldr=_e[_f].loader;if(!ldr){continue}if(_c&&_f!=_c){continue}var _11=new ldr(this);JsHttpRequest.extend(_11,this._openArgs);JsHttpRequest.extend(_11,{queryText:_8.join("&"),queryElem:_9,id:(new Date().getTime())+""+JsHttpRequest.COUNT++,hash:_a,span:null});var _12=_11.load();if(!_12){this._ldObj=_11;JsHttpRequest.PENDING[_11.id]=this;return true}if(!_c){_d[_d.length]="- "+_f.toUpperCase()+": "+this._l(_12)}else{return this._error(_12)}}return _f?this._error("no_loader_matched",_d.join("\n")):this._error("no_loaders")};t.getAllResponseHeaders=function(){with(this){return _ldObj&&_ldObj.getAllResponseHeaders?_ldObj.getAllResponseHeaders():[]}};t.getResponseHeader=function(_13){with(this){return _ldObj&&_ldObj.getResponseHeader?_ldObj.getResponseHeader(_13):null}};t.setRequestHeader=function(_14,_15){with(this){_reqHeaders[_reqHeaders.length]=[_14,_15]}};t._dataReady=function(_16,js){with(this){if(caching&&_ldObj){JsHttpRequest.CACHE[_ldObj.hash]=[_16,js]}responseText=responseXML=_16;responseJS=js;if(js!==null){status=200;statusText="OK"}else{status=500;statusText="Internal Server Error"}_changeReadyState(2);_changeReadyState(3);_changeReadyState(4);_cleanup()}};t._l=function(_18){var i=0,p=0,msg=this._errors[_18[0]];while((p=msg.indexOf("%",p))>=0){var a=_18[++i]+"";msg=msg.substring(0,p)+a+msg.substring(p+1,msg.length);p+=1+a.length}return msg};t._error=function(msg){msg=this._l(typeof(msg)=="string"?arguments:msg);msg="JsHttpRequest: "+msg;if(!window.Error){throw msg}else{if((new Error(1,"test")).description=="test"){throw new Error(1,msg)}else{throw new Error(msg)}}};t._hash2query=function(_1e,_1f,_20,_21){if(_1f==null){_1f=""}if((""+typeof(_1e)).toLowerCase()=="object"){var _22=false;if(_1e&&_1e.parentNode&&_1e.parentNode.appendChild&&_1e.tagName&&_1e.tagName.toUpperCase()=="FORM"){_1e={form:_1e}}for(var k in _1e){var v=_1e[k];if(v instanceof Function){continue}var _25=_1f?_1f+"["+this.escape(k)+"]":this.escape(k);var _26=v&&v.parentNode&&v.parentNode.appendChild&&v.tagName;if(_26){var tn=v.tagName.toUpperCase();if(tn=="FORM"){_22=true}else{if(tn=="INPUT"||tn=="TEXTAREA"||tn=="SELECT"){}else{return this._error("inv_form_el",(v.name||""),v.tagName)}}_21[_21.length]={name:_25,e:v}}else{if(v instanceof Object){this._hash2query(v,_25,_20,_21)}else{if(v===null){continue}if(v===true){v=1}if(v===false){v=""}_20[_20.length]=_25+"="+this.escape(""+v)}}if(_22&&_21.length>1){return this._error("must_be_single_el")}}}else{_20[_20.length]=_1e}return true};t._cleanup=function(){var _28=this._ldObj;if(!_28){return}JsHttpRequest.PENDING[_28.id]=false;var _29=_28.span;if(!_29){return}_28.span=null;var _2a=function(){_29.parentNode.removeChild(_29)};JsHttpRequest.setTimeout(_2a,50)};t._changeReadyState=function(s,_2c){with(this){if(_2c){status=statusText=responseJS=null;responseText=""}readyState=s;if(onreadystatechange){onreadystatechange()}}};t.escape=function(s){return escape(s).replace(new RegExp("\\+","g"),"%2B")}}JsHttpRequest.COUNT=0;JsHttpRequest.MAX_URL_LEN=2000;JsHttpRequest.CACHE={};JsHttpRequest.PENDING={};JsHttpRequest.LOADERS={};JsHttpRequest._dummy=function(){};JsHttpRequest.TIMEOUTS={s:window.setTimeout,c:window.clearTimeout};JsHttpRequest.setTimeout=function(B,C){window.JsHttpRequest_tmp=JsHttpRequest.TIMEOUTS.s;if(typeof(B)=="string"){D=window.JsHttpRequest_tmp(B,C)}else{var D=null;var A=function(){B();delete JsHttpRequest.TIMEOUTS[D]};D=window.JsHttpRequest_tmp(A,C);JsHttpRequest.TIMEOUTS[D]=A}window.JsHttpRequest_tmp=null;return D};JsHttpRequest.clearTimeout=function(B){window.JsHttpRequest_tmp=JsHttpRequest.TIMEOUTS.c;delete JsHttpRequest.TIMEOUTS[B];var A=window.JsHttpRequest_tmp(B);window.JsHttpRequest_tmp=null;return A};JsHttpRequest.query=function(A,E,D,C){var B=new this();B.caching=!C;B.onreadystatechange=function(){if(B.readyState==4){D(B.responseJS,B.responseText)}};B.open(null,A,true);B.send(E)};JsHttpRequest.dataReady=function(B){var A=this.PENDING[B.id];delete this.PENDING[B.id];if(A){A._dataReady(B.text,B.js)}else{if(A!==false){throw"dataReady(): unknown pending id: "+B.id}}};JsHttpRequest.extend=function(B,C){for(var A in C){B[A]=C[A]}};JsHttpRequest.LOADERS.xml={loader:function(req){JsHttpRequest.extend(req._errors,{xml_no:"Cannot use XMLHttpRequest or ActiveX loader: not supported",xml_no_diffdom:"Cannot use XMLHttpRequest to load data from different domain %",xml_no_headers:"Cannot use XMLHttpRequest loader or ActiveX loader, POST method: headers setting is not supported, needed to work with encodings correctly",xml_no_form_upl:"Cannot use XMLHttpRequest loader: direct form elements using and uploading are not implemented"});this.load=function(){if(this.queryElem.length){return["xml_no_form_upl"]}if(this.url.match(new RegExp("^([a-z]+://[^\\/]+)(.*)","i"))){if(RegExp.$1.toLowerCase()!=document.location.protocol+"//"+document.location.hostname.toLowerCase()){return["xml_no_diffdom",RegExp.$1]}}var xr=null;if(window.XMLHttpRequest){try{xr=new XMLHttpRequest()}catch(e){}}else{if(window.ActiveXObject){try{xr=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}if(!xr){try{xr=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}}}}if(!xr){return["xml_no"]}var _40=window.ActiveXObject||xr.setRequestHeader;if(!this.method){this.method=_40&&this.queryText.length?"POST":"GET"}if(this.method=="GET"){if(this.queryText){this.url+=(this.url.indexOf("?")>=0?"&":"?")+this.queryText}this.queryText="";if(this.url.length>JsHttpRequest.MAX_URL_LEN){return["url_too_long",JsHttpRequest.MAX_URL_LEN]}}else{if(this.method=="POST"&&!_40){return["xml_no_headers"]}}this.url+=(this.url.indexOf("?")>=0?"&":"?")+"JsHttpRequest="+(req.caching?"0":this.id)+"-xml";var id=this.id;xr.onreadystatechange=function(){if(xr.readyState!=4){return}xr.onreadystatechange=JsHttpRequest._dummy;req.status=null;try{req.status=xr.status;req.responseText=xr.responseText}catch(e){}if(!req.status){return}try{eval("JsHttpRequest._tmp = function(id) { var d = "+req.responseText+"; d.id = id; JsHttpRequest.dataReady(d); }")}catch(e){return req._error("js_invalid",req.responseText)}JsHttpRequest._tmp(id);JsHttpRequest._tmp=null};xr.open(this.method,this.url,true,this.username,this.password);if(_40){for(var i=0;i<req._reqHeaders.length;i++){xr.setRequestHeader(req._reqHeaders[i][0],req._reqHeaders[i][1])}xr.setRequestHeader("Content-Type","application/octet-stream")}xr.send(this.queryText);this.span=null;this.xr=xr;return null};this.getAllResponseHeaders=function(){return this.xr.getAllResponseHeaders()};this.getResponseHeader=function(_43){return this.xr.getResponseHeader(_43)};this.abort=function(){this.xr.abort();this.xr=null}}};JsHttpRequest.LOADERS.script={loader:function(A){JsHttpRequest.extend(A._errors,{script_only_get:"Cannot use SCRIPT loader: it supports only GET method",script_no_form:"Cannot use SCRIPT loader: direct form elements using and uploading are not implemented"});this.load=function(){if(this.queryText){this.url+=(this.url.indexOf("?")>=0?"&":"?")+this.queryText}this.url+=(this.url.indexOf("?")>=0?"&":"?")+"JsHttpRequest="+this.id+"-script";this.queryText="";if(!this.method){this.method="GET"}if(this.method!=="GET"){return["script_only_get"]}if(this.queryElem.length){return["script_no_form"]}if(this.url.length>JsHttpRequest.MAX_URL_LEN){return["url_too_long",JsHttpRequest.MAX_URL_LEN]}var D=this,F=document,C=null,B=F.body;if(!window.opera){this.span=C=F.createElement("SCRIPT");var E=function(){C.language="JavaScript";if(C.setAttribute){C.setAttribute("src",D.url)}else{C.src=D.url}B.insertBefore(C,B.lastChild)}}else{this.span=C=F.createElement("SPAN");C.style.display="none";B.insertBefore(C,B.lastChild);C.innerHTML="Workaround for IE.<script><\/script>";var E=function(){C=C.getElementsByTagName("SCRIPT")[0];C.language="JavaScript";if(C.setAttribute){C.setAttribute("src",D.url)}else{C.src=D.url}}}JsHttpRequest.setTimeout(E,10);return null}}};JsHttpRequest.LOADERS.form={loader:function(A){JsHttpRequest.extend(A._errors,{form_el_not_belong:'Element "%" does not belong to any form!',form_el_belong_diff:'Element "%" belongs to a different form. All elements must belong to the same form!',form_el_inv_enctype:'Attribute "enctype" of the form must be "%" (for IE), "%" given.'});this.load=function(){var E=this;if(!E.method){E.method="POST"}E.url+=(E.url.indexOf("?")>=0?"&":"?")+"JsHttpRequest="+E.id+"-form";if(E.method=="GET"){if(E.queryText){E.url+=(E.url.indexOf("?")>=0?"&":"?")+E.queryText}if(E.url.length>JsHttpRequest.MAX_URL_LEN){return["url_too_long",JsHttpRequest.MAX_URL_LEN]}var D=E.url.split("?",2);E.url=D[0];E.queryText=D[1]||""}var G=null;var F=false;if(E.queryElem.length){if(E.queryElem[0].e.tagName.toUpperCase()=="FORM"){G=E.queryElem[0].e;F=true;E.queryElem=[]}else{G=E.queryElem[0].e.form;for(var H=0;H<E.queryElem.length;H++){var I=E.queryElem[H].e;if(!I.form){return["form_el_not_belong",I.name]}if(I.form!=G){return["form_el_belong_diff",I.name]}}}if(E.method=="POST"){var C="multipart/form-data";var B=(G.attributes.encType&&G.attributes.encType.nodeValue)||(G.attributes.enctype&&G.attributes.enctype.value)||G.enctype;if(B!=C){return["form_el_inv_enctype",C,B]}}}var J=G&&(G.ownerDocument||G.document)||document;var M="jshr_i_"+E.id;var N=E.span=J.createElement("DIV");N.style.position="absolute";N.style.display="none";N.style.visibility="hidden";N.innerHTML=(G?"":"<form"+(E.method=="POST"?' enctype="multipart/form-data" method="post"':"")+"></form>")+'<iframe name="'+M+'" id="'+M+'" style="width:0px; height:0px; overflow:hidden; border:none"></iframe>';if(!G){G=E.span.firstChild}J.body.insertBefore(N,J.body.lastChild);var L=function(T,U){var O=[];var R=T;if(T.mergeAttributes){var R=J.createElement("form");R.mergeAttributes(T,false)}for(var S=0;S<U.length;S++){var Q=U[S][0],P=U[S][1];O[O.length]=[Q,R.getAttribute(Q)];R.setAttribute(Q,P)}if(T.mergeAttributes){T.mergeAttributes(R,false)}return O};var K=function(){top.JsHttpRequestGlobal=JsHttpRequest;var S=[];if(!F){for(var P=0,U=G.elements.length;P<U;P++){S[P]=G.elements[P].name;G.elements[P].name=""}}var T=E.queryText.split("&");for(var P=T.length-1;P>=0;P--){var Q=T[P].split("=",2);var R=J.createElement("INPUT");R.type="hidden";R.name=unescape(Q[0]);R.value=Q[1]!=null?unescape(Q[1]):"";G.appendChild(R)}for(var P=0;P<E.queryElem.length;P++){E.queryElem[P].e.name=E.queryElem[P].name}var O=L(G,[["action",E.url],["method",E.method],["onsubmit",null],["target",M]]);G.submit();L(G,O);for(var P=0;P<T.length;P++){G.lastChild.parentNode.removeChild(G.lastChild)}if(!F){for(var P=0,U=G.elements.length;P<U;P++){G.elements[P].name=S[P]}}};JsHttpRequest.setTimeout(K,100);return null}}};

/*---------05_bsn.AutoSuggest_c_2.0.js---------*/

if(typeof(bsn)=="undefined")_b=bsn={};if(typeof(_b.Autosuggest)=="undefined")_b.Autosuggest={};else alert("Autosuggest is already set!");_b.AutoSuggest=function(b,c){if(!document.getElementById)return 0;this.fld=_b.DOM.gE(b);if(!this.fld)return 0;this.sInp="";this.nInpC=0;this.aSug=[];this.iHigh=0;this.oP=c?c:{};var k,def={minchars:1,meth:"get",varname:"input",className:"autosuggest",timeout:2500,delay:500,offsety:-5,shownoresults:true,noresults:"No results!",maxheight:250,cache:true,maxentries:25};for(k in def){if(typeof(this.oP[k])!=typeof(def[k]))this.oP[k]=def[k]}var p=this;this.fld.onkeypress=function(a){return p.onKeyPress(a)};this.fld.onkeyup=function(a){return p.onKeyUp(a)};this.fld.setAttribute("autocomplete","off")};_b.AutoSuggest.prototype.onKeyPress=function(a){var b=(window.event)?window.event.keyCode:a.keyCode;var c=13;var d=9;var e=27;var f=1;switch(b){case c:this.setHighlightedValue();f=0;break;case e:this.clearSuggestions();break}return f};_b.AutoSuggest.prototype.onKeyUp=function(a){var b=(window.event)?window.event.keyCode:a.keyCode;var c=38;var d=40;var e=1;switch(b){case c:this.changeHighlight(b);e=0;break;case d:this.changeHighlight(b);e=0;break;default:this.getSuggestions(this.fld.value)}return e};_b.AutoSuggest.prototype.getSuggestions=function(a){if(a==this.sInp)return 0;_b.DOM.remE(this.idAs);this.sInp=a;if(a.length<this.oP.minchars){this.aSug=[];this.nInpC=a.length;return 0}var b=this.nInpC;this.nInpC=a.length?a.length:0;var l=this.aSug.length;if(this.nInpC>b&&l&&l<this.oP.maxentries&&this.oP.cache){var c=[];for(var i=0;i<l;i++){if(this.aSug[i].value.substr(0,a.length).toLowerCase()==a.toLowerCase())c.push(this.aSug[i])}this.aSug=c;this.createList(this.aSug);return false}else{var d=this;var e=this.sInp;clearTimeout(this.ajID);this.ajID=setTimeout(function(){d.doAjaxRequest(e)},this.oP.delay)}return false};_b.AutoSuggest.prototype.doAjaxRequest=function(b){if(b!=this.fld.value)return false;var c=this;if(typeof(this.oP.script)=="function")var d=this.oP.script(encodeURIComponent(this.sInp));else var d=this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp);if(!d)return false;var e=this.oP.meth;var b=this.sInp;var f=function(a){c.setSuggestions(a,b)};var g=function(a){};var h=new _b.Ajax();h.makeRequest(d,e,f,g)};_b.AutoSuggest.prototype.setSuggestions=function(a,b){if(b!=this.fld.value)return false;this.aSug=[];if(this.oP.json){var c=eval('('+a.responseText+')');for(var i=0;i<c.results.length;i++){this.aSug.push({'id':c.results[i].id,'value':c.results[i].value,'info':c.results[i].info})}}else{var d=a.responseXML;var e=d.getElementsByTagName('results')[0].childNodes;for(var i=0;i<e.length;i++){if(e[i].hasChildNodes())this.aSug.push({'id':e[i].getAttribute('id'),'value':e[i].childNodes[0].nodeValue,'info':e[i].getAttribute('info')})}}this.idAs="as_"+this.fld.id;this.createList(this.aSug)};_b.AutoSuggest.prototype.createList=function(b){var c=this;_b.DOM.remE(this.idAs);this.killTimeout();if(b.length==0&&!this.oP.shownoresults)return false;var d=_b.DOM.cE("div",{id:this.idAs,className:this.oP.className});var e=_b.DOM.cE("div",{className:"as_corner"});var f=_b.DOM.cE("div",{className:"as_bar"});var g=_b.DOM.cE("div",{className:"as_header"});g.appendChild(e);g.appendChild(f);d.appendChild(g);var h=_b.DOM.cE("ul",{id:"as_ul"});for(var i=0;i<b.length;i++){var j=b[i].value;var k=j.toLowerCase().indexOf(this.sInp.toLowerCase());var l=j.substring(0,k)+"<em>"+j.substring(k,k+this.sInp.length)+"</em>"+j.substring(k+this.sInp.length);var m=_b.DOM.cE("span",{},l,true);if(b[i].info!=""){var n=_b.DOM.cE("br",{});m.appendChild(n);var o=_b.DOM.cE("small",{},b[i].info);m.appendChild(o)}var a=_b.DOM.cE("a",{href:"#"});var p=_b.DOM.cE("span",{className:"tl"}," ");var q=_b.DOM.cE("span",{className:"tr"}," ");a.appendChild(p);a.appendChild(q);a.appendChild(m);a.name=i+1;a.onclick=function(){c.setHighlightedValue();return false};a.onmouseover=function(){c.setHighlight(this.name)};var r=_b.DOM.cE("li",{},a);h.appendChild(r)}if(b.length==0&&this.oP.shownoresults){var r=_b.DOM.cE("li",{className:"as_warning"},this.oP.noresults);h.appendChild(r)}d.appendChild(h);var s=_b.DOM.cE("div",{className:"as_corner"});var t=_b.DOM.cE("div",{className:"as_bar"});var u=_b.DOM.cE("div",{className:"as_footer"});u.appendChild(s);u.appendChild(t);d.appendChild(u);var v=_b.DOM.getPos(this.fld);d.style.left=v.x+"px";d.style.top=(v.y+this.fld.offsetHeight+this.oP.offsety)+"px";d.style.width=this.fld.offsetWidth+"px";d.onmouseover=function(){c.killTimeout()};d.onmouseout=function(){c.resetTimeout()};document.getElementsByTagName("body")[0].appendChild(d);this.iHigh=0;var c=this;this.toID=setTimeout(function(){c.clearSuggestions()},this.oP.timeout)};_b.AutoSuggest.prototype.changeHighlight=function(a){var b=_b.DOM.gE("as_ul");if(!b)return false;var n;if(a==40)n=this.iHigh+1;else if(a==38)n=this.iHigh-1;if(n>b.childNodes.length)n=b.childNodes.length;if(n<1)n=1;this.setHighlight(n)};_b.AutoSuggest.prototype.setHighlight=function(n){var a=_b.DOM.gE("as_ul");if(!a)return false;if(this.iHigh>0)this.clearHighlight();this.iHigh=Number(n);a.childNodes[this.iHigh-1].className="as_highlight";this.killTimeout()};_b.AutoSuggest.prototype.clearHighlight=function(){var a=_b.DOM.gE("as_ul");if(!a)return false;if(this.iHigh>0){a.childNodes[this.iHigh-1].className="";this.iHigh=0}};_b.AutoSuggest.prototype.setHighlightedValue=function(){if(this.iHigh){this.sInp=this.fld.value=this.aSug[this.iHigh-1].value;this.fld.focus();if(this.fld.selectionStart)this.fld.setSelectionRange(this.sInp.length,this.sInp.length);this.clearSuggestions();if(typeof(this.oP.callback)=="function")this.oP.callback(this.aSug[this.iHigh-1])}};_b.AutoSuggest.prototype.killTimeout=function(){clearTimeout(this.toID)};_b.AutoSuggest.prototype.resetTimeout=function(){clearTimeout(this.toID);var a=this;this.toID=setTimeout(function(){a.clearSuggestions()},1000)};_b.AutoSuggest.prototype.clearSuggestions=function(){this.killTimeout();var a=_b.DOM.gE(this.idAs);var b=this;if(a){var c=new _b.Fader(a,1,0,250,function(){_b.DOM.remE(b.idAs)})}};if(typeof(_b.Ajax)=="undefined")_b.Ajax={};_b.Ajax=function(){this.req={};this.isIE=false};_b.Ajax.prototype.makeRequest=function(a,b,c,d){if(b!="POST")b="GET";this.onComplete=c;this.onError=d;var e=this;if(window.XMLHttpRequest){this.req=new XMLHttpRequest();this.req.onreadystatechange=function(){e.processReqChange()};this.req.open("GET",a,true);this.req.send(null)}else if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP");if(this.req){this.req.onreadystatechange=function(){e.processReqChange()};this.req.open(b,a,true);this.req.send()}}};_b.Ajax.prototype.processReqChange=function(){if(this.req.readyState==4){if(this.req.status==200){this.onComplete(this.req)}else{this.onError(this.req.status)}}};if(typeof(_b.DOM)=="undefined")_b.DOM={};_b.DOM.cE=function(b,c,d,e){var f=document.createElement(b);if(!f)return 0;for(var a in c)f[a]=c[a];var t=typeof(d);if(t=="string"&&!e)f.appendChild(document.createTextNode(d));else if(t=="string"&&e)f.innerHTML=d;else if(t=="object")f.appendChild(d);return f};_b.DOM.gE=function(e){var t=typeof(e);if(t=="undefined")return 0;else if(t=="string"){var a=document.getElementById(e);if(!a)return 0;else if(typeof(a.appendChild)!="undefined")return a;else return 0}else if(typeof(e.appendChild)!="undefined")return e;else return 0};_b.DOM.remE=function(a){var e=this.gE(a);if(!e)return 0;else if(e.parentNode.removeChild(e))return true;else return 0};_b.DOM.getPos=function(e){var e=this.gE(e);var a=e;var b=0;if(a.offsetParent){while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent}}else if(a.x)b+=a.x;var a=e;var c=0;if(a.offsetParent){while(a.offsetParent){c+=a.offsetTop;a=a.offsetParent}}else if(a.y)c+=a.y;return{x:b,y:c}};if(typeof(_b.Fader)=="undefined")_b.Fader={};_b.Fader=function(a,b,c,d,e){if(!a)return 0;this.e=a;this.from=b;this.to=c;this.cb=e;this.nDur=d;this.nInt=50;this.nTime=0;var p=this;this.nID=setInterval(function(){p._fade()},this.nInt)};_b.Fader.prototype._fade=function(){this.nTime+=this.nInt;var a=Math.round(this._tween(this.nTime,this.from,this.to,this.nDur)*100);var b=a/100;if(this.e.filters){try{this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity=a}catch(e){this.e.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+a+')'}}else{this.e.style.opacity=b}if(this.nTime==this.nDur){clearInterval(this.nID);if(this.cb!=undefined)this.cb()}};_b.Fader.prototype._tween=function(t,b,c,d){return b+((c-b)*(t/d))};

