function fValConfig(){this.code="alt";this.emsg="emsg";this.pattern="pattern";this.errorClass="errHilite";this.useSingleClassNames=false;this.clearEvent="change";this.eventOverride=false;this.confirmMsg=fvalidate.i18n.config.confirmMsg;this.confirmAbortMsg=fvalidate.i18n.config.confirmAbortMsg;this.submitButton=["Submit","Submit2"];this.resetButton="Reset";this.ccType="Credit_Card_Type";this.ccTypeObj="form1.Credit_Card_Type";this.boxError="errors";this.boxErrorPrefix="fv_error_"}if(typeof fvalidate=="undefined"){var fvalidate=new Object()}fvalidate.addEvent=function(d,b,c,a){if(typeof d.attachEvent!="undefined"){d.attachEvent("on"+b,c)}else{if(typeof d.attachEventListener!="undefined"){d.addEventListener(b,c,Boolean(a))}}};fvalidate.addEvents=function(f,c,e,a){var d=0,b;while(b=c[d++]){this.addEvent(f,b,e,Boolean(a))}};function validateForm(m,r,o,a,s,b){r=Boolean(r);o=Boolean(o);a=Boolean(a);s=Boolean(s);b=(typeof b!="undefined")?parseInt(b,10):0;var e,l,p;if(typeof m.fv=="undefined"){m.fv=new fValidate(m,b,s)}else{m.fv._reset();m.fv.errorMode=b}var d,k=0,n=m.fv.config.code;while(d=m.elements[k++]){if(d.nodeName=="FIELDSET"){continue}l=(d[n])?d[n]:d.getAttribute(n);if(!(typeof l=="undefined"||l==null||l=="")){e=l.split("|");p=e[0];d.validated=true;if(typeof m.fv[p]=="undefined"){m.fv.devError([p,d.name],"notFound");return false}switch(e.last()){case"bok":e=e.reduce(1,1);d.bok=true;break;case"if":e=e.reduce(1,1);d._if_=true;break;case"then":e=e.reduce(1,1);d._then_=true;break;default:e=e.reduce(1,0)}if(/radio|checkbox/.test(d.type)){d.group=m.elements[d.name]}if(typeof d.fName=="undefined"){if(typeof d.group!="undefined"){for(var h=0;h<d.group.length;h++){if(m.fv.config.clearEvent!=null){g(d.group.item(h),m.fv.config.clearEvent,m.fv,"revertError",false)}}}else{g(d,m.fv.config.clearEvent,m.fv,"revertError",false)}}d.fName=d.name.format();m.fv.elem=d;m.fv.type=p;var c=new Function("obj","method","obj[method]( "+e.toArgString()+" );");c(m.fv,p);if(d.validated==false&&s==false){return false}if(d.validated==true){m.fv.revertError()}}}if(s){m.fv.showGroupError()}if(m.fv.errors.length>0){return false}if(r&&!confirm(m.fv.config.confirmMsg)){if(m.fv.config.confirmAbortMsg!=""){alert(m.fv.config.confirmAbortMsg)}return false}if(o){if(typeof m.fv.config.submitButton=="object"){var q,h=0;while(q=m.fv.config.submitButton[h++]){if(m.fv.elementExists(q)){m.elements[q].disabled=true}}}else{if(m.fv.elementExists(m.fv.config.submitButton)){m.elements[m.fv.config.submitButton].disabled=true}}}if(a&&m.fv.elementExists(m.fv.config.resetButton)){m.elements[m.fv.config.resetButton].disabled=true}return true;function g(v,f,w,x,u){var t=v;if(typeof v.attachEvent!="undefined"){v.attachEvent("on"+f,function(){w[x](t)})}else{if(typeof v.addEventListener!="undefined"){v.addEventListener(f,function(){w[x](t)},u)}else{if(m.fv.config.eventOverride){eleme["on"+f]=function(){w[x](t)}}}}}}function fValidate(e,a,d){var b=this;this.form=e;this.errorMode=a;this.groupError=d;this.errors=new Array();this.validated=true;this.config=new fValConfig();this.i18n=fvalidate.i18n;e.onreset=function(){var g,f=0;while(g=this.elements[f++]){b.revertError(g)}};c();function c(){if(typeof e.getElementsByTagName=="undefined"){return}var k=e.getElementsByTagName("label");var f,g=j=0;var h;while(f=k[g++]){if(typeof f.htmlFor=="undefined"){return}h=e.elements[f.htmlFor];if(typeof h=="undefined"){b.devError([f.htmlFor],"noLabel")}else{if(typeof h.label!="undefined"){continue}else{if(typeof h.length!="undefined"&&h.length>1&&h.nodeName!="SELECT"){for(j=0;j<h.length;j++){h.item(j).label=f}}}}h.label=f}}}fValidate.prototype._reset=function(){this.errors=new Array();this.showErrors=new Array()};fValidate.prototype.elementExists=function(a){return Boolean(typeof this.form.elements[a]!="undefined")};fValidate.prototype.throwError=function(b,e){var c=this.elem;if(typeof c.name=="undefined"){c=c[0]}if(c.bok&&this.isBlank()){c.validated=true;return}if(c.cv){return}c.validated=false;e=this.setArg(e,0);b=this.setArg(b,[]);emsgElem=(typeof this.elem.getAttribute=="undefined")?this.elem[0]:this.elem;if(emsgElem.getAttribute(this.config.emsg)){var a=emsgElem.getAttribute(this.config.emsg)}var a=this.translateMessage(b,this.i18n.errors[this.type][e]);if(this.groupError){this.errors.push({elem:c,msg:a})}else{this.showError(a,false,emsgElem);var d=(typeof c.fields!="undefined")?c.fields[0]:c;this.selectFocus(d)}};fValidate.prototype.showError=function(n,m,f){var o=this,f=this.setArg(f,this.elem),c=Boolean(f.type=="hidden"),k=(c)?null:f.label||null,n=(f.getAttribute(this.config.emsg))?f.getAttribute(this.config.emsg).replace(/\\n/g,"\n"):n,h=this.config.errorClass,g=this.config.useSingleClassNames;if(typeof this.showErrors=="undefined"){this.showErrors=new Array()}switch(this.errorMode){case 0:e();break;case 1:b();break;case 2:d();break;case 3:l();break;case 4:a();break;case 5:b();d();break;case 6:b();l();break;case 7:b();a();break;case 8:b();e();break;case 9:d();l();break;case 10:d();a();break;case 11:d();e();break;case 12:l();a();break;case 13:l();e();break;case 14:a();e();break;case 15:b();d();l();break;case 16:b();d();a();break;case 17:b();d();e();break;case 18:b();l();a();break;case 19:b();l();e();break;case 20:b();a();e();break;case 21:d();l();a();break;case 22:d();l();e();break;case 23:l();a();e();break;case 24:b();d();l();a();break;case 25:b();d();l();e();break;case 26:b();l();a();e();break;case 27:d();l();a();e();break;case 28:b();d();l();a();e();break}function e(){if(o.groupError){o.showErrors.push(n)}else{alert(n)}if(m){alert(o.i18n.groupAlert+o.showErrors.join("\n\n- "))}}function b(){if((typeof f.length!="undefined"&&f.length>1&&f.nodeName!="SELECT")||c){if(!f.fields){f.fields=new Array()}var p,q=0;while(p=(c)?f.fields[q++]:f.item(q++)){if(p.className!=""&&g){p.revertClass=p.className;p.className=h}else{o.addCSSClass(p,h)}}}else{if(g){f.revertClass=f.className;f.className=h}else{o.addCSSClass(f,h)}}}function d(){if(k==null){return}if(o.config.useSingleClassNames){k.className=h}else{o.addCSSClass(k,h)}}function l(){if(k==null||typeof k.innerHTML=="undefined"){return}if(typeof k.original=="undefined"){k.original=k.innerHTML}k.innerHTML=k.original+" - "+n.toHTML()}function a(){if(typeof o.boxError=="undefined"){o.boxError=document.getElementById(o.config.boxError)}if(o.boxError==null){o.devError([o.config.boxError],"noBox");return}if(typeof o.elem.name=="undefined"||o.elem.name==""){o.devError([o.elem[o.config.code]],"missingName");return}var p=o.config.boxErrorPrefix+o.elem.name,q;if(q=document.getElementById(p)){q.firstChild.nodeValue=n.toHTML()}else{q=document.createHTMLElement("li",{id:p,innerHTML:n.toHTML(),title:o.i18n.boxToolTip});o.boxError.appendChild(q);q.onclick=function(){var r=o.form.elements[this.id.replace(o.config.boxErrorPrefix,"")];if(typeof r.fields!="undefined"){r=r.fields[0]}if(typeof r.select!="undefined"){r.select()}if(typeof r.focus!="undefined"){r.focus()}}}o.boxError.style.display="block"}};fValidate.prototype.removeCSSClass=function(b,a){b.className=b.className.replace(a,"").trim()};fValidate.prototype.addCSSClass=function(b,a){this.removeCSSClass(b,a);b.className=(b.className+" "+a).trim()};fValidate.prototype.showGroupError=function(){for(var a,c,b=0;(a=this.errors[b]);b++){if(b==0){c=a.elem}this.elem=a.elem;this.showError(a.msg,Boolean(b==(this.errors.length-1)))}if(c&&c.getAttribute("fields")){var d=(typeof c.fields!="undefined")?c.fields[0]:c;this.selectFocus(d)}};fValidate.prototype.revertError=function(e){e=this.setArg(e,this.elem);var d=Boolean(e.type=="hidden"),a=this.config.errorClass,c=0,f,b;if((typeof e.length!="undefined"&&e.length>1&&e.nodeName!="SELECT")||d){if(d&&typeof e.fields!="undefined"){while(b=(d)?e.fields[c++]:e.item(c++)){if(typeof b.revertClass!="undefined"){b.className=b.revertClass}}}}else{if(this.config.useSingleClassNames){if(typeof subElement.revertClass!="undefined"){e.className=e.revertClass}}else{this.removeCSSClass(e,a)}}if(typeof e.label!="undefined"){if(this.config.useSingleClassNames){e.label.className=""}else{this.removeCSSClass(e.label,a)}e.label.innerHTML=(e.label.original||e.label.innerHTML)}if(typeof this.boxError!="undefined"){if(typeof this.boxError.normalize!="undefined"){this.boxError.normalize()}if(f=document.getElementById(this.config.boxErrorPrefix+e.name)){this.boxError.removeChild(f)}if(this.boxError.childNodes.length==0){this.boxError.style.display="none"}}};fValidate.prototype.selectFocus=function(a){if(!a){return}if(typeof a.select!="undefined"){a.select()}if(typeof a.focus!="undefined"){a.focus()}};fValidate.prototype.typeMismatch=function(){var e={text:"text|password|textarea",ta:"textarea",hidden:"hidden",s1:"select-one",sm:"select-multiple",select:"select-one|select-multiple",rg:"radio",radio:"radio",cb:"checkbox",file:"file"};var b=false,d=new Array(),a=key=type=regex="";for(var c=0;c<arguments.length;c++){type=e[arguments[c]];regex=new RegExp(type);a+=(regex.test(this.elem.type))?"1":"0";key+="0";d.push(type)}if(key^a==0){this.devError([this.elem.fName,this.elem.type,d.join("|").replace(/\|/g,this.i18n.or)],"mismatch");this.elem.validated=false;return true}return false};fValidate.prototype.getValue=function(c){switch(c.type){case"text":case"password":case"textarea":case"hidden":case"file":return c.value;case"radio":case"select-single":if(typeof c.length=="undefined"){return c.value}else{for(var b=0;b<c.length;b++){choice=(c.type=="radio")?"checked":"selected";if(c[b][choice]){return c[b].value}}}case"select-multiple":case"checkbox":if(typeof c.length=="undefined"){return c.value}else{var a=new Array();for(var b=0;b<c.length;b++){choice=(c.type=="checkbox")?"checked":"selected";if(c[b][choice]){a.push(c[b].value)}}return a}default:return null}};fValidate.prototype.setArg=function(a,b){return(typeof a=="undefined"||a==""||a==null)?b:a};fValidate.prototype.isBlank=function(a){var b=this.form.elements[a]||this.elem;return Boolean(/^\s*$/.test(b.value))};fValidate.prototype.translateMessage=function(a,c){var d="";for(var b=0;b<c.length;b++){d+=(typeof c[b]=="number")?a[c[b]]:c[b]}return d};fValidate.prototype.devError=function(c,e){if(typeof c=="string"){e=c;c=[]}e=this.setArg(e,this.type);var d=this.i18n.devErrors[e];var b=[this.i18n.devErrors.lines[0],"----------------------------------------------------------------------------------------------",this.translateMessage(c,d),"----------------------------------------------------------------------------------------------",this.i18n.devErrors.lines[1]];alert(b.join("\n"))};fValidate.prototype.paramError=function(b,a){a=this.setArg(a,this.elem.name);this.devError([b,this.type,a],"paramError")};document.createHTMLElement=function(c,d){if(typeof document.createElement=="undefined"){return}var b=document.createElement(c);if(typeof d!="undefined"){for(var a in d){switch(true){case (a=="text"):b.appendChild(document.createTextNode(d[a]));break;case (a=="class"):b.className=d[a];break;default:b.setAttribute(a,"");b[a]=d[a]}}}return b};Array.prototype.reduce=function(c,h){var d=new Array();var g=0;for(var f=c;f<this.length-h;f++){d[g++]=this[f]}return d};Array.prototype.toArgString=function(){var b=new Array();for(var c=0;c<this.length;c++){b.push("'"+this[c]+"'")}return b.toString()};if(typeof Array.push=="undefined"){Array.prototype.push=function(){var a,b=0;while(a=arguments[b++]){this[this.length]=a}return this.length}}Array.prototype.last=function(){return this[this.length-1]};String.prototype.format=function(){return this.replace(/\_/g," ").replace(/\[|\]/g,"")};String.prototype.toHTML=function(){return this.replace(/\n/g,"<br />").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;")};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,"")};String.prototype.toPattern=function(){return this.replace(/([\.\*\+\{\}\(\)\<\>\^\$\\])/g,"\\$1")};if(typeof fvalidate=="undefined"){var fvalidate=new Object()}fvalidate.i18n={errors:{hblank:[["Поле не может быть пустым ",0]],blank:[["Поле не может быть пустым ",0]],notequal:[["Такое значение уже существует ",0]],ischecked:[["Ты должен быть согласны с ",0]],length:[[0," must be at least ",1," characters long"],[0," must be no more than ",1," characters long.\nThe current text is ",2," characters long."]],equalto:[[0," must be equal to ",1]],number:[["The number you entered for ",0," is not valid"]],numeric:[["Only numeric values are valid for the ",0],["A minimum of ",0," numeric values are required for the ",1]],alnum:[['The data you entered, "',0,'", does not match the requested format for ',1,"\nMinimum Length: ",2,"\nCase: ",3,"\nNumbers allowed: ",4,"\nSpaces allowed: ",5,"\nPunctuation characters allowed: ",6,"\n"]],decimal:[["The data you entered,",0," is not valid.  Please re-enter the ",1]],decimalr:[[0," is not a valid. Please re-enter."]],ip:[["Please enter a valid IP"],["The port number you specified, ",0,",  is out of range.\nIt must be between ",1," and ",2]],ssn:[["You need to enter a valid Social Security Number.\nYour SSN must be entered in 'XXX-XX-XXXX' format."]],money:[[0," does not match the required format of ",1]],cc:[["The ",0," you entered is not valid. Please check again and re-enter."]],ccDate:[["You credit card has expired! Please use a different card."]],zip:[["Please enter a valid 5 or 9 digit Zip code."]],phone:[["Please enter a valid phone number plus Area Code."],["Please enter a valid phone number - seven or ten digits."]],email:[["Please enter a valid email address"]],url:[[0," is not a valid domain"]],date:[["The data entered for ",0," is not a valid date\nPlease enter a date using the following format: ",1],["Date must be before ",0],["Date must be on or before ",0],["Date must be after ",0],["Date must be on or after ",0]],select:[["Please select a valid option for ",0]],selectm:[["Please select between ",0," and ",1," options for ",2,".\nYou currently have ",3," selected"]],selecti:[["Please select a valid option for ",0]],checkbox:[["Please check ",0," before continuing"],["Please select between ",0," and ",1," options for ",2,".\nYou currently have ",3," selected"]],radio:[["Please check ",0," before continuing"],["Please select an option for ",0]],comparison:[[0," must be ",1," ",2]],eitheror:[["One and only one of the following fields must be entered:\n\t-",0,"\n"]],atleast:[["At least ",0," of the following fields must be entered:\n\t-",1,"\n\nYou have only ",2," filled in.\n"]],allornone:[["All or none of the following fields must be entered and accurate:\n\t-",0,"\nYou have only ",1," accurate field entered.\n"]],file:[["The file must be one of the following types:\n",0,"\nNote: File extension may be case-sensitive."]],custom:[[0," is invalid."]],cazip:[["Please enter a valid postal code."]],ukpost:[["Please enter a valid postcode."]],germanpost:[["Please enter a valid postcode."]],swisspost:[["Please enter a valid postcode."]]},comparison:{gt:"greater than",lt:"less than",gte:"greater than or equal to",lte:"less than or equal to",eq:"equal to",neq:"not equal to"},devErrors:{number:["The lower-bound (",0,") is greater than the upper-bound (",1,") on this element: ",2],length:["The minimum length (",0,") is greater than the maxiumum legnth (",1,") on this element: ",2],cc:["Credit Card type (",0,") not found."],lines:["! WARNING ! -- fValidate developer-assist error\n","\nIf you are not the developer, please contact the website administrator regarding this error."],paramError:["You must include the '",0,"' parameter for the '",1,"' validator type on this field: ",2],notFound:["The validator '",0,"' was not found.\nRequested by: ",1],noLabel:["No element found for label: ",0],noBox:["An element with the requested id '",0,"' was not found for the 'boxError' config value."],missingName:["The hidden input calling the following logical validator must have a valid name\nattribute when used in conjunction with the 'box' error-type.\n\t",0],mismatch:["Validator/Element type mismatch.\n\nElement: ",0,"\nElement type: ",1,"\nType required by validator: ",2],noCCType:["You must include a SELECT item with Credit Card type choices!"]},config:{confirmMsg:"Your data is about to be sent.\nPlease click 'Ok' to proceed or 'Cancel' to abort.",confirmAbortMsg:"Submission cancelled.  Data has not been sent."},boxToolTip:"Click to target field",groupAlert:FVALIDATE_ERRORS_OCCURED+"\n\n- ",or:" or "};fValidate.prototype.blank=function(){if(this.typeMismatch("text")){return}if(this.isBlank()){this.throwError([this.elem.fName])}};fValidate.prototype.notequal=function(b){if(this.typeMismatch("text")){return}if(typeof b=="undefined"){this.paramError("oName")}var a=this.form.elements[b];if(this.elem.value==a.value){this.throwError([this.elem.fName])}};fValidate.prototype.hblank=function(){if(this.typeMismatch("hidden")){return}if(this.isBlank()){this.throwError([this.elem.fName])}};fValidate.prototype.number=function(d,e,c){if(this.typeMismatch("text")){return}var b=(d==0)?parseInt(this.elem.value,10):parseFloat(this.elem.value);e=this.setArg(e,0);c=this.setArg(c,Number.infinity);if(e>c){this.devError([e,c,this.elem.name]);return}var a=Boolean(isNaN(b)||b!=this.elem.value);if(!a){switch(true){case (e!=false&&c!=false):a=!Boolean(e<=b&&b<=c);break;case (e!=false):a=Boolean(b<e);break;case (c!=false):a=Boolean(b>c);break}}if(a){this.throwError([this.elem.fName]);return}this.elemPass=true};fValidate.prototype.numeric=function(a){if(this.typeMismatch("text")){return}a=this.setArg(a,"*");var b=new RegExp((a=="*")?"^\\d+$":"^\\d{"+parseInt(a,10)+"}\\d*$");if(!b.test(this.elem.value)){if(a=="*"){this.throwError([this.elem.fName])}else{this.throwError([a,this.elem.fName],1)}}};fValidate.prototype.length=function(a,b){if(this.typeMismatch("text")){return}var c=this.elem.value.length;a=Math.abs(a);b=Math.abs(this.setArg(b,Number.infinity));if(a>b){this.devError([a,b,this.elem.name]);return}if(a>parseInt(c,10)){this.throwError([this.elem.fName,a])}if(c>b){this.throwError([this.elem.fName,b,c],1)}};fValidate.prototype.alnum=function(d,a,k,f,c){if(this.typeMismatch("text")){return}a=this.setArg(a,"a");k=(k=="true"||k=="1");f=(f=="true"||f=="1");var e="",h=["None","Any","No","No","Any"];if(d!="*"){d=parseInt(d,10);h[0]=d}else{d=0}switch(a.toUpperCase()){case"U":e+="A-Z";h[1]="UPPER";break;case"L":e+="a-z";h[1]="lower";break;case"C":e+="A-Z][a-z";h[1]="Intial capital";d--;break;default:e+="a-zA-Z";break}if(k==true){e+="0-9";h[2]="Yes"}if(f==true){e+=" ";h[3]="Yes"}if(c=="any"){h[4]="Any"}else{if(c=="none"){h[4]="None"}else{c=c.replace(/pipe/g,"|");e+=c;h[4]=c}}var b=(d!="*")?"{"+d+",}":"+";var g=(c=="any")?new RegExp("^(["+e+"]|[^a-zA-Z0-9\\s])"+b+"$"):new RegExp("^["+e+"]"+b+"$");if(!g.test(this.elem.value)){this.throwError([this.elem.value,this.elem.fName,h[0],h[1],h[2],h[3],h[4]])}};fValidate.prototype.equalto=function(b){if(this.typeMismatch("text")){return}if(typeof b=="undefined"){this.paramError("oName")}var a=this.form.elements[b];if(this.elem.value!=a.value){this.throwError([this.elem.fName,a.fName])}};fValidate.prototype.ssn=function(){if(this.typeMismatch("text")){return}if(!(/^\d{3}\-\d{2}\-\d{4}$/.test(this.elem.value))){this.throwError()}};fValidate.prototype.select=function(){if(this.typeMismatch("s1")){return}if(this.elem.selectedIndex==0){this.throwError([this.elem.fName])}};fValidate.prototype.selectm=function(d,a){if(this.typeMismatch("sm")){return}if(typeof d=="undefined"){this.paramError("minS")}if(a==999||a=="*"||typeof a=="undefined"||a>this.elem.length){a=this.elem.length}var e=0;for(var c,b=0;(c=this.elem.options[b]);b++){if(c.selected){e++}}if(e<d||e>a){this.throwError([d,a,this.elem.fName,e])}};fValidate.prototype.selecti=function(a){if(this.typeMismatch("s1")){return}if(typeof a=="undefined"){this.paramError("indexes");return}a=a.split(",");var c=true;for(var b=0;b<a.length;b++){if(this.elem.options[a[b]].selected){c=false;break}}if(!c){this.throwError([this.elem.fName])}};fValidate.prototype.cazip=function(){var a=this.elem;if(this.typeMismatch("text")){return}a.value=a.value.toUpperCase();if(!(/^[A-Z][0-9][A-Z] [0-9][A-Z][0-9]$/.test(a.value))){this.throwError()}};fValidate.prototype.capost=fValidate.prototype.cazip;fValidate.prototype.ukpost=function(){var a=this.elem;if(this.typeMismatch("text")){return}a.value=a.value.toUpperCase();if(!(/^[A-Z]{1,2}\d[\dA-Z] ?\d[A-Z]{2}$/.test(a.value))){this.throwError()}};fValidate.prototype.germanpost=function(){var a=this.elem;if(this.typeMismatch("text")){return}a.value=a.value.toUpperCase();if(!(/^(?:CH\-)\d{4}$/.test(a.value))){this.throwError()}};fValidate.prototype.swisspost=function(){var a=this.elem;if(this.typeMismatch("text")){return}a.value=a.value.toUpperCase();if(!(/^(?:D\-)\d{5}$/.test(this.elem.value))){this.throwError()}};fValidate.prototype.email=function(c){if(this.typeMismatch("text")){return}if(typeof c=="undefined"){c=0}var a=[/.+@.+\..+$/i,/^\w.+@\w.+\.[a-z]+$/i,/^\w[-_a-z~.]+@\w[-_a-z~.]+\.[a-z]{2}[a-z]*$/i,/^\w[\w\d\.\-]+([\.\w\d]+)*@\w[-\w\d]+(\.[\w\d]+)*\.[a-z]{2,7}$/i];var b=this.elem.value.replace(/^\s+/,"");b=b.replace(/\s+$/,"");if(!a[c].test(b)){this.throwError()}};fValidate.prototype.url=function(b,c,f){if(this.typeMismatch("text")){return}this.setArg(b,"http");var e="^(?:("+b.replace(/\,/g,"|")+")\\:\\/\\/)";var a=(Boolean(f)==true)?"(\\?.*)?$":"$";if(Boolean(c)==true){e+="?"}var d=new RegExp(e+"([\\w\\d-]+\\.?)+"+a);if(!d.test(this.elem.value)){this.throwError([this.elem.fName])}};fValidate.prototype.ip=function(d,a){if(this.typeMismatch("text")){return}d=this.setArg(d,0);a=this.setArg(a,99999);if(!(/^\d{1,3}(\.\d{1,3}){3}(:\d+)?$/.test(this.elem.value))){this.throwError()}else{var b,c=0,e=this.elem.value.split(/[.:]/);while(b=e[c++]){if(c==5){if(b<d||b>a){this.throwError([b,d,a],1)}}else{if(b<0||b>255){this.throwError()}}}}};fValidate.prototype.decimal=function(a,d){if(this.typeMismatch("text")){return}var c="",b=this.elem;if(a!="*"){a=parseInt(a,10)}if(d!="*"){d=parseInt(d,10)}if(a==0){c="^\\.[0-9]{1,"+d+"}$"}else{if(a=="*"&&d!="*"){c="^[0-9]+\\.[0-9]{1,"+d+"}$"}else{if(a!="*"&&d=="*"){c="^[0-9]{1,"+a+"}\\.{0,1}[0-9]*$"}else{if(a=="*"&&d=="*"){c="^[0-9]+(\\.{0,1})[0-9]*$"}else{if(d=="*"){c="^[0-9]{1,"+a+"}\\.[0-9]*$"}else{c="^[0-9]{1,"+a+"}\\.{0,1}[0-9]{0,"+d+"}$"}}}}}c=new RegExp(c);if(!c.test(b.value)){this.throwError([b.value,b.fName])}};fValidate.prototype.decimalr=function(f,d,b,e){if(this.typeMismatch("text")){return}f=(f=="*")?0:parseInt(f,10);d=(d=="*")?"":parseInt(d,10);b=(b=="*")?0:parseInt(b,10);e=(e=="*")?"":parseInt(e,10);var a="^[0-9]{"+f+","+d+"}\\.[0-9]{"+b+","+e+"}$";var c=new RegExp(a);if(!c.test(this.elem.value)){this.throwError([this.elem.fName])}return true};fValidate.prototype.zip=function(a){if(this.typeMismatch("text")){return}a=this.setArg(a,"- ");var b=new RegExp("^[0-9]{5}(|["+a.toPattern()+"][0-9]{4})?$");if(!b.test(this.elem.value)){this.throwError()}};fValidate.prototype.phone=function(b){if(this.typeMismatch("text")){return}b=this.setArg(b,0);var a=[/^(\(?\d\d\d\)?)?[ -]?\d\d\d[ -]?\d\d\d\d$/,/^(\(\d\d\d\) )?\d\d\d[ -]\d\d\d\d$/];if(!a[b].test(this.elem.value)){if(b==1){this.throwError()}else{this.throwError([],1)}}};fValidate.prototype.date=function(m,f,e,g){if(this.typeMismatch("text")){return}if(typeof m=="undefined"){this.paramError("formatStr");return}f=this.setArg(f,"/");var n=[this.elem.fName,m.replace(/\//g,f)];var p=m.split("/");var d=this.elem.value.split(f);var h=new Object();for(var l=0;l<p.length;l++){switch(p[l].charAt(0).toLowerCase()){case"m":h.months=l;break;case"d":h.days=l;break;case"y":h.years=l;break}}var k=new Date(d[h.years],d[h.months]-1,d[h.days]);if(isNaN(k)||k.getDate()!=d[h.days]||k.getMonth()!=d[h.months]-1||k.getFullYear().toString().length!=m.match(/y/g).length){this.throwError(n);return}var c=this.form.elements[g];if(typeof c!="undefined"){g=c.validDate||c.value}var b=(g=="today")?new Date():new Date(g);b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0);var a=b.getTime()-k.getTime();var o=false;switch(parseInt(e)){case 1:o=Boolean(a>0);n=1;break;case 2:o=Boolean((a+86400000)>0);n=2;break;case 3:o=Boolean(a<0);n=3;break;case 4:o=Boolean((a-86400000)<0);n=4;break;default:o=true}if(!o){this.throwError([g],n)}this.elem.validDate=k.toString()};fValidate.prototype.money=function(f,a,d){if(this.typeMismatch("text")){return}f=(f==" ")?false:f.toPattern();a=(a==" ")?false:a.toPattern();d=(d==" ")?false:d.toPattern();var b,e;switch(true){case Boolean(f&&a&&d):e="^"+f+"(?:(?:[0-9]{1,3}"+a+")(?:[0-9]{3}"+a+")*[0-9]{3}|[0-9]{1,3})("+d+"[0-9]{2})$";b=f+"XX"+a+"XXX"+d+"XX";break;case Boolean(f&&a&&!d):e="^"+f+"(?:(?:[0-9]{1,3}"+a+")(?:[0-9]{3}"+a+")*[0-9]{3}|[0-9]{1,3})$";b=""+f+"XX"+a+"XXX";break;case Boolean(f&&!a&&d):e="^"+f+"[0-9]*(\\.[0-9]{2})$";b=""+f+"XXXXX"+d+"XX";break;case Boolean(!f&&a&&d):e="^(?:(?:[0-9]{1,3}"+a+")(?:[0-9]{3}"+a+")*[0-9]{3}|[0-9]{1,3})("+d+"[0-9]{2})?$";b="XX"+a+"XXX"+d+"XX";break;case Boolean(f&&!a&&!d):e="^"+f+"[0-9]*$";b=""+f+"XXXXX";break;case Boolean(!f&&a&&!d):e="^(?:(?:[0-9]{1,3}"+a+")(?:[0-9]{3}"+a+")*[0-9]{3}|[0-9]{1,3})$";b="XX"+a+"XXX";break;case Boolean(!f&&!a&&d):e="^[0-9]*("+d+"[0-9]{2})$";b="XXXXX"+d+"XX";break;case Boolean(!f&&!a&&!d):e="^.?(?:(?:[0-9]{1,3}.?)(?:[0-9]{3}.?)*[0-9]{3}|[0-9]{1,3})(.[0-9]{2})?$";b="[?]XX[?]XXX[?XX]"}var c=new RegExp(e);if(!c.test(this.elem.value)){this.throwError([this.elem.fName,b.replace(/\\/g,"")])}};fValidate.prototype.checkbox=function(e,d){if(this.typeMismatch("cb")){return}if(typeof e=="undefined"){this.paramError("minC");return}if(this.elem==this.form.elements[this.elem.name]&&!this.elem.checked){this.throwError([this.elem.fName])}else{this.elem=this.form.elements[this.elem.name];var a=this.elem.length;if(!a){return}var c=0;if(d==999||d=="*"||typeof d=="undefined"||d>this.elem.length){d==a}var b=a;while(b-->0){if(this.elem[b].checked){c++}}if(c<e||c>d){this.throwError([e,d,this.elem[0].fName,c])}}};fValidate.prototype.ischecked=function(){if(this.typeMismatch("cb")){return}if(!this.elem.checked){this.throwError([this.elem.fName])}else{return}};fValidate.prototype.radio=function(){if(this.typeMismatch("rg")){return}if(this.elem==this.form.elements[this.elem.name]&&!this.elem.checked){this.throwError([this.elem.fName])}else{this.elem=this.form.elements[this.elem.name];for(var a=0;a<this.elem.length;a++){if(this.elem.item(a).checked){return}}this.throwError([this.elem[0].fName])}};fValidate.prototype.eitheror=function(){if(this.typeMismatch("hidden")){return}if(typeof arguments[0]=="undefined"){this.paramError("delim");return}if(typeof arguments[1]=="undefined"){this.paramError("fields");return}var b,d=0,a=new Array(),f,e=0,c=arguments[1].split(arguments[0]);this.elem.fields=new Array();while(b=c[d++]){f=this.form.elements[b];a.push(f.fName);this.elem.fields.push(f);if(!this.isBlank(b)){e++}}if(e!=1){this.throwError([a.join("\n\t-")])}};fValidate.prototype.atleast=function(){if(this.typeMismatch("hidden")){return}if(typeof arguments[0]==undefined){this.paramError("qty");return}if(typeof arguments[1]==undefined){this.paramError("delim");return}if(typeof arguments[2]==undefined){this.paramError("fields");return}var b,d=0,a=new Array(),f,e=0,c=arguments[2].split(arguments[1]);this.elem.fields=new Array();while(b=c[d++]){f=this.form.elements[b];a.push(f.fName);this.elem.fields.push(f);if(!this.isBlank(b)){e++}}if(e<arguments[0]){this.throwError([arguments[0],a.join("\n\t-"),e])}};fValidate.prototype.allornone=function(){if(this.typeMismatch("hidden")){return}if(typeof arguments[0]=="undefined"){this.paramError("delim");return}if(typeof arguments[1]=="undefined"){this.paramError("fields");return}var b,d=0,a=new Array(),f,e=0,c=arguments[1].split(arguments[0]);this.elem.fields=new Array();while(b=c[d++]){f=this.form.elements[b];a.push(f.fName);this.elem.fields.push(f);if(!this.isBlank(b)){e++}}if(e>0&&e<c.length){this.throwError([a.join("\n\t-"),e])}};fValidate.prototype.comparison=function(field1,operator,field2){if(this.typeMismatch("hidden")){return}var elem1=this.form.elements[field1],elem2=this.form.elements[field2],value1=this.getValue(elem1),value2=this.getValue(elem2);i18n=this.i18n.comparison;i=-1;var operators=[[">",i18n.gt],["<",i18n.lt],[">=",i18n.gte],["<=",i18n.lte],["==",i18n.eq],["!=",i18n.neq]];while(operators[++i][0]!=operator){}this.elem.fields=[elem1,elem2];if(!eval(value1+operator+value2)){this.throwError([elem1.fName,operators[i][1],elem2.fName])}};fValidate.prototype.file=function(b,a){if(this.typeMismatch("file")){return}if(typeof b=="undefined"){this.paramError("extensions");return}a=Boolean(a)?"":"i";var c=new RegExp("^.+\\.("+b.replace(/,/g,"|")+")$",a);if(!c.test(this.elem.value)){this.throwError([b.replace(/,/g,"\n")])}};fValidate.prototype.custom=function(a,c){if(this.typeMismatch("text")){return}a=(a)?a.replace(/[^gim]/ig):"";var b=new RegExp(this.elem.getAttribute(this.config.pattern),a);if(!b.test(this.elem.value)){this.throwError([this.elem.fName])}};fValidate.prototype.cc=function(){if(this.typeMismatch("text")){return}var c=this.form.elements[this.config.ccType];if(!c){this.devError("noCCType");return}var b=c.options[c.selectedIndex].value.toUpperCase();var a={VISA:/^4\d{12}(\d{3})?$/,MC:/^5[1-5]\d{14}$/,DISC:/^6011\d{12}$/,AMEX:/^3[4|7]\d{13}$/,DINERS:/^3[0|6|8]\d{12}$/,ENROUTE:/^2[014|149]\d{11}$/,JCB:/^3[088|096|112|158|337|528]\d{12}$/,SWITCH:/^(49030[2-9]|49033[5-9]|49110[1-2]|4911(7[4-9]|8[1-2])|4936[0-9]{2}|564182|6333[0-4][0-9]|6759[0-9]{2})\d{10}(\d{2,3})?$/,DELTA:/^4(1373[3-7]|462[0-9]{2}|5397[8|9]|54313|5443[2-5]|54742|567(2[5-9]|3[0-9]|4[0-5])|658[3-7][0-9]|659(0[1-9]|[1-4][0-9]|50)|844[09|10]|909[6-7][0-9]|9218[1|2]|98824)\d{10}$/,SOLO:/^(6334[5-9][0-9]|6767[0-9]{2})\d{10}(\d{2,3})?$/};if(c.validated==false&&this.groupError==true){return}if(typeof a[b]=="undefined"&&c.validated==false&&this.groupError==false){this.devError([b]);return}this.elem.value=this.elem.value.replace(/[^\d]/g,"");if(!a[b].test(this.elem.value)||!this.elem.value.luhn()){this.throwError([this.elem.fName])}};String.prototype.luhn=function(){var i=this.length;var checkSum="",digit;while(digit=this.charAt(--i)){checkSum+=(i%2==0)?digit*2:digit}checkSum=eval(checkSum.split("").join("+"));return(checkSum%10==0)};fValidate.prototype.ccDate=function(d,c){if(this.typeMismatch("s1")){return}c=parseInt(this.getValue(this.form.elements[c]),10)+2000;d=parseInt(this.getValue(this.form.elements[d]),10);var a=new Date();var b=new Date(c,d);if(b<a){alert(["Card Expired",a,b].join("\n"))}};function eDefault(){var b=this;b.copyObj=d;b.toJSON=a;b.getType=c;function d(g){if(g){switch(c(g)){case"object":var f,e={};for(f in g){e[f]=arguments.callee(g[f])}return e;break;case"array":var f,e=new Array(g.length);for(f=0;f<g.length;f++){e[f]=arguments.callee(g[f])}return e;break}}return g}function a(k){var h,f=[],e=[];switch(c(k)){case"object":e[e.length]="{";for(h in k){f[f.length]=['"',h,'":',arguments.callee(k[h])].join("")}e[e.length]=f.join(",");e[e.length]="}";break;case"array":e[e.length]="[";for(h=0;h<k.length;h++){f[f.length]=arguments.callee(k[h])}e[e.length]=f.join(",");e[e.length]="]";break;case"string":var g=new RegExp(String.fromCharCode(13,10),"gi");var l=k.replace(g,"\\n");l=l.replace(/\"/gi,'\\"');e[e.length]=["",l,""].join('"');break;case"number":e[e.length]=k;break;default:e[e.length]='""';break}return e.join("")}function c(f){var e=typeof(f);if(e=="object"){if(f){if(!f.nodeType){e=(f.window&&f==f.window);if(!e){e=Object.prototype.toString.apply(f);e=e.substring(8,e.length-1)}else{e="window"}}else{e=f.nodeName}}else{e="null"}}return e.toLowerCase()}}function createSuggest(c,d){if(d.container){c=document.getElementById(d.container)}if(c){if(!d.default_name){d.default_name=""}var e=(d&&d.output&&d.output.id)?d.output.id:new Date()-0;var b=d.template;if(!b){b="suggest"}switch(b){case"window":var a=document.createElement("DIV");a.id="suggest_popup"+e;a.className="suggest_window";c.appendChild(a);a=null;break;case"select_places":c.innerHTML+=['<select id="suggest_region_',e,'"></select>&nbsp;<select id="suggest_city_',e,'" disabled>',((!d.data2)?'<option value="">&nbsp;'+d.default_name2+"</option>":""),"</select>"].join("");break;case"select":c.innerHTML+=['<select id="suggest_select_',e,'" disabled><option value="">&nbsp;',d.default_name,"</option></select>"].join("");break}window["json_"+e]=d;initSuggest(e,c)}else{alert("Произошла ошибка. Нет контейнера.")}}function initSuggest(c,a){var b=selectTemplate(window["json_"+c].template);if(b){window[c]=new b(c,a);window[c].init()}else{alert("Произошла ошибка. Нет объекта.")}}function selectTemplate(b){if(!b){b="suggest"}var a=null;switch(b){case"tags":a=eTags;break;case"suggest":a=eSuggest;break;case"select_places":a=eSelectPlaces;break;case"select":a=eSelect;break;case"window":a=eWindow;break}return a}function eBase(f){var h=this;eDefault.call(h);h.prefix=f;h.params=window["json_"+h.prefix];h.timer=null;h.active=null;h.selected=0;h.canSubmit=true;h.enabled=true;if(!h.params.default_name){h.params.default_name=""}h.init=g;h.kill=e;h.reloadData=c;h.updateParams=k;h.setEnable=b;h.setDisable=d;h.setNextField=n;h._setActive=a;h._setOutput=l;h._clearTimer=m;function g(){}function a(){if(h.active){if(!h.active.id){h.active.id=""}if(!h.active.name){h.active.name=""}h.active.cont=h.cont}else{h.active={id:0,name:"",cont:h.cont}}}function l(){if(h.params.output){var p,o=h.params.output;if(o.id&&(p=document.getElementById(o.id))){p.value=h.active.id}if(o.name&&(p=document.getElementById(o.name))){p.value=h.active.name}}}function c(){n()}function n(){var p=h.cont.parentNode.getAttribute("nextField");if(p&&window[p]){var q=window[p];var o=q.params.input.extend.split("/");o[0]=h.active.id;q.params.input.extend=o.join("/");q.reloadData();if(h.active.id){q.setEnable()}else{q.setDisable()}}}function k(r){var p,q,o;for(p in r){o=r[p];if(h.getType(o)=="object"){for(q in o){if(!h.params[p]){h.params[p]={}}h.params[p][q]=o[q]}}else{h.params[p]=o}}}function m(){if(h.timer){window.clearTimeout(h.timer);h.timer=null}}function d(){}function b(){}function e(){PuskFramework.evt.remove(document.body,"beforeunload",window[h.prefix].kill);window[h.prefix]=null;for(var o in h){delete h[o]}h=null}}function eSelect(prefix){var me=this;eBase.call(me,prefix);me.init=_init;me.data=[];me.__reloadData=me.reloadData;me.reloadData=_reloadData;function _init(){if(!PuskFramework){return alert("Произошла ошибка.")}me.select=document.getElementById("suggest_select_"+me.prefix);me.cont=me.select;if(me.params.input){me.active=me.params.input}PuskFramework.evt.add(me.select,"change",_onChange);_fillSelect(me.select,me.params.data,me.params.default_name)}function _fillSelect(el,data,defaultName){if(!data){data=[]}el.options.length=data.length+1;var ii,len=0;el.options[len].value="";el.options[len].innerHTML="&nbsp;"+defaultName;for(ii=0;ii<data.length;ii++){len++;el.options[len].value=data[ii].id;el.options[len].innerHTML="&nbsp;"+data[ii].name}me.select.value=me.active.id;if(data.length){me.select.disabled=false;me.data=data}}function _onChange(e){me.active=null;me._setActive();me._setOutput();var res=$event(e);me.active=me.data[res.target.selectedIndex-1];me._setActive();me._setOutput();if(res.target.selectedIndex>0&&me.params.callback&&me.getType(window[me.params.callback])=="function"){window[me.params.callback](me.active)}}function _reloadData(obj){me.select.disabled=true;me.updateParams(obj);me.active=null;me._setActive();me._setOutput();var component=me.params.input.component;var action=me.params.input.method;var extend=me.params.input.extend;if(!action){action="GetSuggest"}var url=[mainUrl.replace("admin/",""),component,action,extend,"?xml=1"].join("/");PuskFramework.ajax.get({url:url,onSuccess:_callback,onError:function(req){debugError("Ошибка запроса!\nСтат. ="+req.statusText);serverSetStatus("error");if(onerror){onerror(req)}}});me.__reloadData()}function _callback(req){try{eval("me.data = "+req.responseText);if(!me.data.length){me.data=[]}}catch(e){me.data=[]}_fillSelect(me.select,me.data,me.params.default_name)}}function eSelectPlaces(prefix){var me=this;eBase.call(me,prefix);me.init=_init;me.cityData=null;function _init(){if(!PuskFramework){return alert("Произошла ошибка.")}me.cont=document.getElementById("suggest_"+me.prefix);me.region=document.getElementById("suggest_region_"+me.prefix);me.city=document.getElementById("suggest_city_"+me.prefix);PuskFramework.evt.add(me.region,"change",_onChange);PuskFramework.evt.add(me.city,"change",_onChange);if(me.params.input){me.active=me.params.input}_fillSelect(me.region,me.params.data,me.params.default_name,me.active.parent_id);if(me.params.data2){me.cityData=me.params.data2;_fillSelect(me.city,me.params.data2,me.params.default_name2,me.active.id);me.city.disabled=!(me.region.value)}me._setActive();me._setOutput()}function _fillSelect(el,data,defaultName,selectedId){el.selectedIndex=0;el.options.length=data.length+1;var ii,len=0;el.options[len].value="";el.options[len].innerHTML="&nbsp;"+defaultName;for(ii=0;ii<data.length;ii++){len++;el.options[len].value=data[ii].id;el.options[len].innerHTML="&nbsp;"+data[ii].name;if(selectedId&&data[ii].id==selectedId){el.options[len].selected=true}}}function _onChange(e){me.active=null;me._setActive();me._setOutput();var res=$event(e);if(res.target.id=="suggest_region_"+me.prefix){me.city.disabled=true;var component=me.params.input.component;var action=me.params.input.method;var extend=me.params.input.extend;if(!action){action="GetSuggest"}var url=[mainUrl.replace("admin/",""),component,action,res.target.value,extend,"?xml=1"].join("/");PuskFramework.ajax.get({url:url,onSuccess:_callback,onError:function(req){debugError("Ошибка запроса!\nСтат. ="+req.statusText);serverSetStatus("error");if(onerror){onerror(req)}}})}else{me.active=me.cityData[res.target.selectedIndex-1];me._setActive();me._setOutput();if(res.target.selectedIndex>0&&me.params.callback&&me.getType(window[me.params.callback])=="function"){window[me.params.callback](me.active)}}}function _callback(req){try{eval("me.cityData = "+req.responseText);if(!me.cityData.length){me.cityData=[]}}catch(e){me.cityData=[]}_fillSelect(me.city,me.cityData,me.params.default_name2);me.city.disabled=!(me.region.value)}}function eSuggest(prefix,container){var me=this;eBase.call(me,prefix);me.cont=container;me.popupData=[];try{var ua=navigator.userAgent.toLowerCase(),isIE=/msie/.test(ua)&&!/opera/.test(ua),ver=(ua.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],ie6=isIE&&parseInt(ver)<7}catch(e){var ie6=false}me.ie6=ie6;me.init=_init;me.__setActive=me._setActive;me._setActive=_setActive;me.clear=_clear;function _init(){if(!PuskFramework){return alert("Произошла ошибка.")}var ii,tmp=null;me.id=document.createElement("INPUT");me.id.type="hidden";me.id.style.display="none";me.cont.appendChild(me.id);me.name=document.createElement("INPUT");me.name.type="text";me.name.autocomplete="off";if(me.params.fvalidate){tmp=me.params.fvalidate;for(ii in tmp){me.name.setAttribute(ii,tmp[ii])}}me.cont.appendChild(me.name);if(me.ie6){me.bgr=document.createElement("IFRAME");with(me.bgr){style.display="none";style.position="absolute";style.zIndex=998;style.left=0;style.top="20px";style.height=0;style.width="202px";style.border=0;style.frameBorder=0}me.cont.appendChild(me.bgr)}me.popup=document.createElement("UL");me.cont.appendChild(me.popup);tmp=me.cont;while(tmp.tagName!="FORM"){if(tmp.tagName=="BODY"){break}tmp=tmp.parentNode}if(tmp.tagName=="FORM"){PuskFramework.evt.add(tmp,"submit",_onFormSubmit)}_hidePopup();if(me.params.input){me.active=me.params.input}table=tr=td=tmp=null;_initName();_initPopup();me._setActive();me._setOutput()}function _initName(){PuskFramework.evt.add(me.name,"keyup",_onNameKeyUp);PuskFramework.evt.add(me.name,"keydown",_onNameKeyDown);PuskFramework.evt.add(me.name,"blur",_onNameBlur);PuskFramework.evt.add(me.name,"cut",_defaultEvent);PuskFramework.evt.add(me.name,"paste",_defaultEvent)}function _onNameKeyDown(e){var res=$event(e);switch(res.keyCode){case 13:var tmp=(me.popup.parentNode.style.display=="none");__onPopupClick();me.canSubmit=tmp;window.setTimeout(function(){_setFocus()},100);break}}function _onNameKeyUp(e){var res=$event(e);switch(res.keyCode){case 27:_hidePopup();case 13:case 37:case 39:break;case 38:_setUnSelected();if(me.selected==0){me.selected=me.popupData.length-1}else{me.selected--}_setSelected();break;case 40:_setUnSelected();if(me.selected==me.popupData.length-1){me.selected=0}else{me.selected++}_setSelected();break;default:_default();break}}function _defaultEvent(){window.setTimeout(function(){_default()},0)}function _default(){me.active=null;me._setActive();var val=PuskFramework.str.trim(me.name.value);me.active.name=val;me._setOutput();me._clearTimer();me.popupData=[];_fillPopup();if(val.length>1){me.timer=window.setTimeout(function(){_getSuggest(val)},300)}}function _onNameBlur(e){window.setTimeout(function(){_hidePopup()},500)}function _onFormSubmit(e){return me.canSubmit}function _setSelected(){if(me.popup.parentNode.style.display=="none"&&me.popupData.length){_showPopup()}me.popup.childNodes[me.selected].className+=" hover"}function _setUnSelected(){var el=me.popup.childNodes[me.selected];el.className=el.className.replace(" hover","");el=null}function _setFocus(){me.name.focus();me.name.value+=""}function _setActive(){me.__setActive();me.id.value="";if(me.active.id){me.id.value=me.active.id}if(me.active.name){me.name.value=me.active.name.replace(/<[\/\!]*?[^<>]*?>/gi," ")}}function _clear(){me.active=null;me.id.value="";me.name.value="";_setActive()}function _initPopup(){PuskFramework.evt.add(me.popup,"mouseover",_onPopupMouseOver);PuskFramework.evt.add(me.popup,"click",_onPopupClick)}function _getEl(el,className){var res=null;if(el.className.indexOf(className)!=-1){res=el}if(!res&&el.parentNode.className.indexOf(className)!=-1){res=el.parentNode}return res}function _onPopupMouseOver(e){var res=$event(e);var el=_getEl(res.target,"suggest_line");if(el){_setUnSelected();me.selected=parseInt(el.getAttribute("pos"));if(el.getAttribute("sid")==0){el.style.cursor="default"}else{el.className+=" hover"}}}function _onPopupMouseOut(e){me.selected=0;var res=$event(e);var el=_getEl(res.target,"hover");if(el){el.className=el.className.replace(" hover","")}}function _onPopupClick(e){var res=$event(e);var el=_getEl(res.target,"hover");if(el){__onPopupClick()}}function __onPopupClick(){me.active=me.copyObj(me.popupData[me.selected]);me.active.name=me.active.name.replace(/<[\/\!]*?[^<>]*?>/gi," ");me._setActive();me._setOutput();_hidePopup();if(me.params.callback&&me.getType(window[me.params.callback])=="function"){window[me.params.callback](me.active)}_setFocus()}function _fillPopup(){var tmp,result=[];me.popup.innerHTML="";for(var ii=0;ii<me.popupData.length;ii++){tmp=document.createElement("LI");tmp.setAttribute("pos",ii);tmp.setAttribute("sid",me.popupData[ii].id);tmp.className="suggest_line";tmp.innerHTML=me.popupData[ii].name;me.popup.appendChild(tmp)}if(me.popupData.length!=0){_showPopup();if(me.popupData[0].id!=0){me.selected=0;_setSelected()}}else{_hidePopup()}}function _showPopup(){me.popup.style.display="";if(me.ie6){me.bgr.style.height=me.popup.clientHeight+"px";me.bgr.style.display=""}me.cont.style.zIndex=60;me.canSubmit=false}function _hidePopup(){me.popup.style.display="none";me.ie6&&(me.bgr.style.display="none");me.cont.style.zIndex=0;me.canSubmit=true}function _showSelect(){var ii,els=document.getElementsByTagName("SELECT");for(ii=0;ii<els.length;ii++){if(els[ii].getAttribute("visib")!=null){els[ii].style.visibility=els[ii].getAttribute("visib")}}}function _hideSelect(){var ii,els=document.getElementsByTagName("SELECT");for(ii=0;ii<els.length;ii++){if(els[ii].getAttribute("visib")==null){els[ii].setAttribute("visib",(els[ii].style.visibility)?els[ii].style.visibility:"")}els[ii].style.visibility="hidden"}}function _getSuggest(val){me._clearTimer();var component=me.params.input.component;var action=me.params.input.method;var extend=me.params.input.extend;if(!action){action="GetSuggest"}if(me.getType(extend)=="undefined"){extend=""}var url=[mainUrl.replace("admin/",""),component,action,encodeURIComponent(val),extend,"?xml=1"].join("/");PuskFramework.ajax.get({url:url,onSuccess:_callback,onError:function(req){debugError("Ошибка запроса!\nСтат. ="+req.statusText);serverSetStatus("error");if(onerror){onerror(req)}}})}function _callback(req){try{eval("me.popupData = "+req.responseText);if(!me.popupData.length){me.popupData=[{id:"0",name:CFG_LANG_NO_MATCHES}]}}catch(e){me.popupData=[{id:"0",name:CFG_LANG_NO_MATCHES}]}_fillPopup()}}function eWindow(h){var m=this;eBase.call(m,h);m.page=0;m.init=l;m.data=[];m.filter="";m.__reloadData=m.reloadData;m.reloadData=d;m.getPage=n;m.setFilter=o;m.__setActive=m._setActive;m._setActive=a;m.setEnable=c;m.setDisable=e;function l(){if(!PuskFramework){return alert("Произошла ошибка.")}m.cont=document.getElementById("suggest_popup"+m.prefix);m.table=document.createElement("TABLE");m.table.border=0;m.cont.appendChild(m.table);var q=m.table.insertRow(-1);m.name2=q.insertCell(-1);m.name2.style.display="none";var r=q.insertCell(-1);r.style.textAlign="right";m.name=document.createElement("A");m.name.href="#";m.name.innerHTML=m.params.default_name;if(m.params.output.enabled===true){m.setEnable()}else{m.setDisable()}r.appendChild(m.name);if(m.params.input){m.active=m.params.input}m._setActive();m._setOutput();PuskFramework.evt.add(m.name,"click",k)}function k(q){if(m.enabled){CreateWindow(b("suggest","AjaxWindow"),"",882,520,"");PuskFramework.evt.add(document.getElementById("windowContent"+(windowsCounter-1)),"click",p)}return false}function n(r){var q=document.getElementById(r);if(q){m.page=q.value;f()}}function o(q){m._clearTimer();m.filter=q.value;m.page=0;if(m.filter.length>1||m.filter.length==0){m.timer=window.setTimeout(function(){f()},300)}}function a(){m.__setActive();if(m.active.name){m.table.style.width="100%";m.name.innerHTML=CFG_LANG_EDIT_TITLE;if(m.active.name.length>22){m.name2.innerHTML=m.active.name.substr(0,19)+" ..."}else{m.name2.innerHTML=m.active.name}m.name2.style.display=""}else{m.name.innerHTML=m.params.default_name;m.table.style.width="";m.name2.style.display="none"}}function b(r,s){var q=[mainUrl.replace("admin/","")];if(r){q[q.length]=r}if(s){q[q.length]=s}q[q.length]=g();return q.join("/")}function g(){var q=m.params.input.component;var r=m.params.input.method;var s=m.params.input.extend;if(!r){r="GetSuggest"}return[q,r,encodeURIComponent(m.filter),s,m.page,m.params.template,m.prefix,""].join("/")}function p(r){var q=$event(r);if(q.target.className=="suggest_popup_link"){m.active=null;m._setActive();m._setOutput();m.active=m.data[q.target.getAttribute("pos")];m._setActive();m._setOutput();m.setNextField();if(m.params.callback&&m.getType(window[m.params.callback])=="function"){window[m.params.callback](m.active)}$_($("mainWindow"+(windowsCounter-1)))}}function d(q){m.updateParams(q);m.active=null;m.page=0;m.filter="";m._setActive();m._setOutput();m.__reloadData()}function f(){m._clearTimer();m.active=null;m._setActive();m._setOutput();PuskFramework.srvapi.invoke(b())}function e(){m.enabled=false;m.name.className="disabled"}function c(){m.enabled=true;m.name.className=""}}function eTags(prefix,container){var me=this;eBase.call(me,prefix);me.cont=container;me.popupData=[];me.init=_init;function _init(){if(!PuskFramework){return alert("Произошла ошибка. Нет PuskFramework.")}PuskFramework.evt.add(document.body,"beforeunload",window[me.prefix].kill);me.name=document.getElementById(me.params.output.id);me.name.autocomplete="off";me.popup=me.cont.getElementsByTagName("SPAN")[0];PuskFramework.evt.add(me.name,"keyup",_onNameKeyUp);PuskFramework.evt.add(me.name,"blur",_onNameBlur);PuskFramework.evt.add(me.name,"cut",_defaultEvent);PuskFramework.evt.add(me.name,"paste",_defaultEvent);PuskFramework.evt.add(me.popup,"click",_onPopupClick)}function _onNameKeyUp(e){var res=$event(e);switch(res.keyCode){case 27:_hidePopup();break;default:var key=String.fromCharCode(res.keyCode);if(key==" "||res.keyCode==8||(key>="0"&&key<="9")||(key>="A"&&key<="Z")||(key>="a"&&key<="z")||(key>="А"&&key<="Я")||(key>="а"&&key<="я")){_default()}break}}function _defaultEvent(){window.setTimeout(function(){_default()},0)}function _default(){var tmp=me.name.value.split(",");me.active=PuskFramework.str.trim(tmp.pop().replace(/<[\/\!]*?[^<>]*?>/gi,""));if(me.active.length>1){me._clearTimer();me.timer=window.setTimeout(function(){_getSuggest()},300)}}function _onNameBlur(e){window.setTimeout(function(){_hidePopup()},500)}function _onPopupClick(e){var res=$event(e);var el=res.target;if(el.tagName=="B"){el=el.parentNode}if(el.tagName=="A"){me.active=me.popupData[Number(el.getAttribute("pos"))].name;if(me.active!=0){var tmp=me.name.value.split(",");tmp.pop();tmp.push(me.active);for(var ii=0;ii<tmp.length;ii++){tmp[ii]=PuskFramework.str.trim(tmp[ii])}me.name.value=tmp.join(", ");_hidePopup();if(me.params.callback&&me.getType(window[me.params.callback])=="function"){window[me.params.callback](me.active)}}_setFocus()}return PuskFramework.evt.stop(res)}function _setFocus(){me.name.focus();me.name.value+=""}function _fillPopup(){var tmp,sep="";me.popup.innerHTML="";for(var ii=0;ii<me.popupData.length;ii++){me.popup.innerHTML+=sep;tmp=document.createElement("A");if(me.popupData[ii].id!=0){tmp.setAttribute("href","#")}tmp.setAttribute("pos",ii);tmp.setAttribute("sid",me.popupData[ii].id);tmp.innerHTML=me.popupData[ii].name.replace(me.active,"<b>"+me.active+"</b>");me.popup.appendChild(tmp);sep=", "}if(me.popupData.length>0){_showPopup()}else{_hidePopup()}tmp=null}function _showPopup(){me.cont.style.display="";me.cont.style.zIndex=60}function _hidePopup(){me.cont.style.display="none";me.cont.style.zIndex=0}function _getSuggest(){me.popupData=[];var component=me.params.input.component;var action=me.params.input.method;var extend=me.params.input.extend;if(!action){action="GetSuggest"}if(me.getType(extend)=="undefined"){extend=""}var url=[mainUrl.replace("admin/",""),component,action,encodeURIComponent(me.active),extend,"?xml=1"].join("/");PuskFramework.ajax.get({url:url,onSuccess:_callback,onError:function(req){debugError("Ошибка запроса!\nСтат. ="+req.statusText);serverSetStatus("error");if(onerror){onerror(req)}}})}function _callback(req){try{eval("me.popupData = "+req.responseText);if(!me.popupData.length){me.popupData=[{id:"0",name:CFG_LANG_NO_MATCHES}]}}catch(e){me.popupData=[{id:"0",name:CFG_LANG_NO_MATCHES}]}_fillPopup()}}function openPopularCities(){var b=document.getElementById("popular_cities");var a=b.innerHTML.replace(/ /,"");if(a!=""){resizePopularCities(b,8)}else{if(PuskFramework.ajax.cnActive==0){PuskFramework.srvapi.invoke(mainUrl+"/places/GetPopularCities/")}}return false}function openPage(a){document.location.href=a.href+"/"+componentParams;return false}function showPopularCities(){resizePopularCities(document.getElementById("popular_cities"),8);createSuggest(document.getElementById("popularPlaceContainer"),{input:{component:"places"},callback:"callBackPopularPlace"});return false}function hidePopularCities(){var a=document.getElementById("popular_cities");a.style.overflow="hidden";resizePopularCities(a,-8);return false}function resizePopularCities(b,c){if(c>0){b.style.display=""}var a=parseInt(b.style.height)+c;if(a>0&&a<180){b.style.height=a+"px";window.setTimeout(function(){resizePopularCities(b,c)},5)}else{if(c<0){b.style.display="none";document.getElementById("openPopularCities").style.display="";document.getElementById("closePopularCities").style.display="none"}else{b.style.overflow="";document.getElementById("openPopularCities").style.display="none";document.getElementById("closePopularCities").style.display=""}}}function callBackPopularPlace(b){var a=mainUrl.split("/");a[1]=b.translite;mainUrl=a.join("/");document.location.href=mainUrl+"/"+componentParams}if(typeof(addCodeToOnload)=="function"){addCodeToOnload(function(){if(hideDropDown){PuskFramework.evt.add(document,"mouseover",hideDropDown)}})}function createDropDown(b){if(b.id){var a=document.getElementById(b.id);if(a){if(dropDown&&dropDown.id!=b.id){hideDropDown()}if(!dropDown){dropDown=a;dropDown.style.display=""}}PuskFramework.evt.stop(b.e)}}function hideDropDown(){if(dropDown){dropDown.style.display="none";dropDown=null}}isDOM=document.getElementById;isOpera=isOpera5=window.opera&&isDOM;isOpera6=isOpera&&window.print;isOpera7=isOpera&&document.readyState;isMSIE=document.all&&document.all.item&&!isOpera;isMSIE5=isDOM&&isMSIE;isNetscape4=document.layers;isMozilla=isDOM&&navigator.appName=="Netscape";function getClientWidth(){var a=0;if(self.innerHeight){a=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){a=document.documentElement.clientWidth}else{if(document.body){a=document.body.clientWidth}}}return a}function getClientHeight(){var a=0;if(self.innerHeight){a=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else{if(document.body){a=document.body.clientHeight}}}return a}function getAbsolutePos(b){var c={x:b.offsetLeft,y:b.offsetTop};if(b.offsetParent){var a=getAbsolutePos(b.offsetParent);c.x+=a.x;c.y+=a.y}return c}function AddResource(a,b){loaded=0;while(document.getElementById("preview"+loaded)!=null&&loaded<=a){loaded++}if(loaded>=a){return false}if(!document.getElementById("resources_table")||document.getElementById("resources_table").nodeName!="TABLE"){return false}newObj=document.getElementById("resources_table").insertRow(-1);newObj.id="resource_num_"+loaded;newObj=document.getElementById("resource_num_"+loaded).insertCell(-1);newObj.innerHTML='<a href="#" onclick="ClearFile('+loaded+'); return false;"><img src="/admin/resources/design/icons/delete.gif"></a><a href="#" onclick="window.open(mainUrl+\'/manager/getfiles/selector/'+loaded+"/', '', 'width=890, height=520, toolbar=no, scrollbars=yes, resizable=yes, status=no'); return false;\"><img src=\"/admin/resources/design/icons/add.gif\" id=\"preview"+loaded+'" width="32" height="32"></a><input type="hidden" name="'+b+'[]" value="0" id="resource'+loaded+'">&nbsp;';return}function ClearFile(b,a){document.getElementById("preview"+b).style.backgroundImage="url("+a+")";document.getElementById("resource"+b).value=0}function getBodyScrollTop(){return self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop)}var windowsCounter=1;function showWindow(d,a,g){v$addClass(document.body,"windowIsOpen");var f=((getClientWidth()-d)/2);var c=50;var b=windowsCounter;windowsCounter++;var e=600;ifr='<iframe src="javascript:\'&lt;html&gt;&lt;body style=\\\'background:transparent\\\'&gt&lt;/html&gt;\';" scrolling="no" frameborder="0" class="" style="position: absolute; width:'+d+"px;height:"+e+"px;left:"+f+"px;top:"+(getBodyScrollTop()+c)+'px;"></iframe>';tpl='<div id="mainWindow'+b+'" style="line-height:140%;"><div class="eclipse">';tpl=tpl+"</div>";tpl=tpl+'<div class="eclipse_window" style="width:'+d+"px;height:"+a+"px;left:"+f+"px;top:"+(getBodyScrollTop()+c)+'px;">';tpl=tpl+'   <span class="edge1">&nbsp;</span><span class="edge2">&nbsp;</span><span class="edge3">&nbsp;</span><span class="edge4">&nbsp;</span>';tpl=tpl+'      <div class="text">';tpl=tpl+'         <div class="close" id="mainWindowClose'+b+"\" onclick=\"document.body.className = 'windowIsClose';$_($('mainWindow"+b+"'));\"></div>";tpl=tpl+'         <h1 id="mainWindowTitle'+b+'" class="font_size120 color_orange"></h1>';tpl=tpl+'         <div style="width:'+(d-36)+"px;height:"+a+'px;" id="windowContent'+b+'"></div>';tpl=tpl+"      </div>";tpl=tpl+'   <span class="edge4">&nbsp;</span><span class="edge3">&nbsp;</span><span class="edge2">&nbsp;</span><span class="edge1">&nbsp;</span>';tpl=tpl+"</div></div>";tpl=ifr+'<table id="mainWindow'+b+'" class="b-pop-up" style="left:'+f+"px;top:"+(getBodyScrollTop()+c)+"px; width: "+d+'px">';tpl=tpl+"	<tr>";tpl=tpl+'		<td class="angle"></td>';tpl=tpl+'		<td class="edge"></td>';tpl=tpl+'		<td class="angle"></td>';tpl=tpl+"	</tr>";tpl=tpl+"	<tr>";tpl=tpl+'		<td class="edge"></td>';tpl=tpl+'		<td class="load-content"><div id="windowContent'+b+'"></div></td>';tpl=tpl+'		<td class="edge"></td>';tpl=tpl+"	</tr>";tpl=tpl+"	<tr>";tpl=tpl+'		<td class="angle"></td>';tpl=tpl+'		<td class="edge"></td>';tpl=tpl+'		<td class="angle"></td>';tpl=tpl+"	</tr>";tpl=tpl+"</table>";$("windows").innerHTML=$("windows").innerHTML+tpl;return b}function getClientWidth(){var a=0;if(self.innerHeight){a=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){a=document.documentElement.clientWidth}else{if(document.body){a=document.body.clientWidth}}}return a}function CreateWindow(c,g,e,a,h){var b=showWindow(e,a,h);if(g!=""){g=g.split(";");var d=0,f=g.length;for(d=0;d<f;d++){c=c+g[d]+"/"}}c=c+b+"/";PuskFramework.srvapi.invoke(c);return}function setEventByParentId(g,d,f,c,e){if(!c){c="click"}function a(l){var k=$event(l);var h=k.target;while(h.id==""&&h.parentNode){h=h.parentNode}var m=h.id.replace(d,"");if(m!=h.id){if(!f(m,h.innerHTML,h,k,e)){return PuskFramework.evt.stop(k)}}}var b=document.getElementById(g);if(b){PuskFramework.evt.add(b,c,a)}}var FeedBack_radio=3;function AddFeedBack(id,url){var form=document.getElementById(id+"_form");var feedback_user_name=document.getElementById(id+"_user_name");var feedback_user_email=document.getElementById(id+"_user_email");var feedback_data_text=document.getElementById(id+"_data_text");var feedback_mycity_value="";if(document.getElementById(id+"_mycity")){feedback_mycity_value=document.getElementById(id+"_mycity").value}var callback=document.getElementById(id+"_callback");if(!window.validateForm||validateForm(form,0,0,0,1,8)){v$delClass(document.body,"windowIsOpen");PuskFramework.ajax.post({url:url,"data[window]":windowsCounter-1,"data[user_name]":feedback_user_name.value,"data[user_email]":feedback_user_email.value,"data[text]":feedback_data_text.value,"data[mycity]":feedback_mycity_value,"data[user_aim]":FeedBack_radio,"data[url]":document.location.href,onSuccess:function(req){eval(req.responseText)},onError:function(req){debugError("Ошибка запроса!\nСтат. ="+req.statusText);serverSetStatus("error");if(onerror){onError(req)}}})}}function sendUserMessage(b,d){if(!d.sex){d.sex=""}if(!d.fvalidate_text_alt){d.fvalidate_text_alt="blank";d.fvalidate_text_emsg="Введите текст сообщения."}b.innerHTML=['<form id="sendUserMessageForm"><ul><li class="ugol_block"><span class="angle_left_top">&nbsp;</span><span class="angle_right_top">&nbsp;</span></li>','<li class="padding10px margin_top-10px">',d.title,'&nbsp;&nbsp;<span class="ico10_',d.sex,'">&nbsp;</span>&nbsp;<a href="#">',d.name,"</a></li>",((d.type=="message")?'<li class="padding10px margin_top-10px"><input type="text" class="width98" id="sendUserMessageTitle" alt="blank" emsg="Введите тему сообщения."></li>':""),'<li class="padding10px margin_top-10px"><textarea class="width98 height80px" id="sendUserMessageText" alt="',d.fvalidate_text_alt,'" emsg="',d.fvalidate_text_emsg,'">',d.text,'</textarea></li><li class="padding_0_15px"><a href="#" onclick="return false;" class="float_left line_height180">Закрыть</a>','<span class="button float_right"><span><input type="button"id="sendUserMessageButton" value="Отправить" /></span></span>','<div class="end"></div></li>','<li class="ugol_block"><span class="angle_left_bottom">&nbsp;</span><span class="angle_right_bottom">&nbsp;</span><div class="end"></div></li>',"</ul></form>"].join("");b.style.display="";PuskFramework.evt.add(b,"click",a);function a(l){var k=$event(l);var g=k.target;if(g.tagName=="A"){c()}if(d.callback&&g.id=="sendUserMessageButton"){var h=document.getElementById("sendUserMessageForm");if(validateForm(h,0,0,0,1,8)){var f=document.getElementById("sendUserMessageTitle");if(f){d.title=f.value}d.value=document.getElementById("sendUserMessageText").value;d.callback(d);c()}}}function c(){b.innerHTML="";b.style.display="none";PuskFramework.evt.del(b,"click",a)}}function submit_post_request(e,d,c){var a=mainUrl+e+"/?xml=1";d.url=a;d.onSuccess=function(g){try{debugResult("Пришел ответ от сервера, задержка "+$time(b)+"мс.");PuskFramework.srvapi.parseResponse(g,a)}catch(f){debugError("Не получается выполнить коллбэк!");serverSetStatus("error")}};d.onError=function(f){debugError("Ошибка запроса!\nСтатус="+f.statusText);serverSetStatus("error")};var b=$time();PuskFramework.ajax.post(d);if(c){document.body.className="windowIsClose";$_($("mainWindow"+c))}return false}function sendMessageFromComments(e,a,b,d){var c={name:b,sex:d,id:a,type:"message",title:"Сообщение для",callback:callbackSendMessageFromComments};sendUserMessage(document.getElementById("sendMessageFromComments"+e),c)}function callbackSendMessageFromComments(b){var a={"data[msg_user_id]":b.id,"data[title]":b.title,"data[text]":b.value,ajax:1};submit_post_request("/mymessages/send",a)}function checkUserOnline(){var b=document.getElementsByTagName("span");if(b.length){var d,g,c=[];var a={};var e="online_";for(d=0;d<b.length;d++){if(b[d].id.indexOf(e)!=-1){g=b[d].id.replace(e,"");c[c.length]=g;a[g]=b[d]}}if(c.length){var f={url:mainUrl+"/online/post/?xml=1",user_ids:c.join(",")};f.onSuccess=function(m){try{var l=m.responseXML.documentElement;var h=l.getElementsByTagName("user");var k;for(d=0;d<h.length;d++){k=a[h[d].getAttribute("id")];k&&(k.className="online")}}catch(n){}b=a=null};PuskFramework.ajax.post(f)}}}function callBack_place_street(b){var a=b.cont.getAttribute("nextField");setNextFieldId(b.id,a);window[a].clear()}function setNextFieldId(c,b){var a=window[b].params.input.extend.split("/");a[0]=c;window[b].params.input.extend=a.join("/")}function ShowQuickForm(d,g,e){var b=null;var a=null;var f=null;switch(d){case"compliment":b=document.getElementById("complimentBase");a=document.getElementById("sendComplimentFromComments"+g);f=function(h,l){var k=h.getElementsByTagName("INPUT");for(ii=0;ii<k.length;ii++){if(k[ii].id=="comm_obj_id"){k[ii].value=l.userId}}k=null};break;case"answer":b=document.getElementById("commentsAnswerBase");a=document.getElementById("sendAnswerFromComments"+g);f=function(h){var k=h.getElementsByTagName("INPUT");for(ii=0;ii<k.length;ii++){if(k[ii].id=="parent_id"){k[ii].value=g}}k=null};break}if(!b||!a){return}var c=b.cloneNode(true);c.id=a.id+String(new Date()-0);a.appendChild(c);c.style.display="block";if(f){f(c,e)}b=a=c=f=null;return}function GetDiv(a){PuskFramework.srvapi.invoke(a)}function populationHover(c,b){c=c||event;c=c.target||c.srcElement;while(c&&c.tagName!="A"){c=c.parentNode}c&&(c.className=b)}function v$(a){return document.getElementById(a)}function v$$(f,d,b){var d=(f||v$(f)||document).getElementsByTagName(d||"*");var c=d.length,a=[];if(!b){return d}b=" "+b+" ";while(c--){if(d[c].className&&(" "+d[c].className+" ").indexOf(b)>=0){a.push(d[c])}}return a}function v$$$(c,b,d){c=document.createElement(c);for(var a in b){c[a]=b[a]}return d?d.appendChild(c):c}function v$attachEvent(c,b,a){typeof(c)=="string"&&(c=v$(c));if(c.addEventListener){c.addEventListener(b,a,false)}else{c.attachEvent("on"+b,a)}}function v$detachEvent(c,b,a){if(c.removeEventListener){c.removeEventListener(b,a,false)}else{c.detachEvent("on"+b,a)}}function v$trim(a){return(a||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}function v$testClass(b,a){return(" "+b.className+" ").indexOf(" "+a+" ")>=0}function v$addClass(b,a){var c=b.className;c+=v$testClass(b,a)?"":(" "+a);b.className=v$trim(c)}function v$delClass(b,a){var c=b.className;c=c.replace(new RegExp("(^|\\s)"+a+"(?:\\s|$)"),"$1");b.className=v$trim(c)}function v$query(c,h,e){h=h||{};h.xml=0;var b=[],d="g.js."+new Date().getTime();if(e){h.call=d;window[d]=function(a){e&&e(a);document.body.removeChild(v$(d+".script"));window[d]=null}}for(var g in h){b.push(encodeURIComponent(g)+"="+encodeURIComponent(h[g]))}c+=(c.indexOf("?")>-1?"&":"?")+b.join("&").replace(/%20/g,"+");v$$$("script",{type:"text/javascript",src:c,id:d+".script"},document.body)}function v$coords(g,a){var c=g.offsetLeft,d=g.offsetTop,b=g.offsetWidth,f=g.offsetHeight;a=a?1:0;while(g=g.offsetParent){c+=g.offsetLeft-a*g.scrollLeft;d+=g.offsetTop-a*g.scrollTop}return{l:c,t:d,r:c+b,b:d+f}}function textAreaInsert(a,b){a.focus();var c=document.selection;if(c){c.createRange().text=b}else{if("selectionStart" in a){a.value=a.value.substring(0,a.selectionStart)+b+a.value.substr(a.selectionEnd)}else{a.value+=b}}}function v$plural(c,a){c=parseInt(c)||0;c=Math.abs(c)%100;var b=c%10;if(c>10&&c<20){return a[2]}if(b>1&&b<5){return a[1]}if(b==1){return a[0]}return a[2]}function modalWnd(){var g=this;this.over=v$$$("div",{className:"b-modal-overlay"},document.body);this.modal=v$$$("div",{className:"b-modal"},document.body);this.brd=v$$$("div",{className:"b-modal-brd"},this.modal);this.box=v$$$("div",{className:"b-modal-box"},this.modal);this.btn=v$$$("div",{className:"b-modal-btn"},this.modal);v$attachEvent(this.btn,"click",function(h){g.hide()});this._hide=function(h){if((h||event).keyCode==27){g.hide()}};try{var c=navigator.userAgent.toLowerCase(),d=/msie/.test(c)&&!/opera/.test(c),a=(c.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],b=d&&parseInt(a)<7}catch(f){var b=false}this.ie6=b;return this}var ptp=modalWnd.prototype;ptp.show=function(e,t){with(this.box){while(firstChild){removeChild(firstChild)}}if(typeof e=="object"){this.box.appendChild(e)}else{if(typeof e=="string"){this.box.innerHTML=e}}if(!this.ie6){if(t){v$addClass(this.modal,"b-modal-scroll");var off=v$coords(t);with(this.modal.style){left=off.l+t.scrollLeft+"px";top=off.b+t.scrollTop+"px"}}else{v$delClass(this.modal,"b-modal-scroll");with(this.modal.style){left=top="50%"}}}v$attachEvent(document,"keyup",this._hide);v$addClass(document.body,"b-modal-show")};ptp.hide=function(){v$detachEvent(document,"keyup",this._hide);v$delClass(document.body,"b-modal-show");if(this.box.childNodes.length==1){return document.body.appendChild(this.box.firstChild)}else{this.box.innerHTML=""}};function userMenu(a){if(!a){return}var b=this;a.onselectstart=function(c){return false};this.menu=a;this.avt=v$(a.id+".avt");this.frnd=v$(a.id+".friend");this.msg=v$(a.id+".message");this.links=a.getElementsByTagName("A");v$attachEvent(a,"click",function(c){b.mhide(c)})}userMenu.prototype={mshow:function(e){var _this=this;e=e||event,e=e.target||e.srcElement;var a=e.onblur;a&&(a=a());if(!a){return}var i=this.links.length;while(i--){with(this.links[i]){href=href.replace(/\d{4,}/,a.user.id)}}this.avt.src=a.user.avt;this.frnd.className=(a.user.friend||currentUserId==a.user.id)?"g-none":"";this.avt.alt=a.user.name;if(!currentUserId){this.msg.onblur=function(){document.location.href=mainUrl+"/users/auth_edit/"};this.frnd.onblur=function(){document.location.href=mainUrl+"/users/auth_edit/"}}else{this.msg.onblur=e.onblur;var user=e.onblur().user;this.frnd.style.display="";this.frnd.onblur=function(){return{type:"friend",user:user}}}var ulink=e.parentNode.parentNode.parentNode;ulink.appendChild(this.menu);this.timer&&window.clearTimeout(this.timer);this.timer=window.setTimeout(function(){_this.mhide()},10000)},mhide:function(){this.timer&&window.clearTimeout(this.timer);document.body.appendChild(this.menu)}};function Rating(b,a){var c=this;this.box=b;this.overall=a;this.title=b.getElementsByTagName("B")[0];this.line=b.getElementsByTagName("DIV")[0];this.stars=b.getElementsByTagName("SPAN");this.hint=b.getElementsByTagName("I")[0];v$attachEvent(b,"mouseover",function(d){c.over(d)});v$attachEvent(b,"mouseout",function(d){c.out(d)});v$attachEvent(b,"click",function(d){c.click(d)});this.rated=false;this.rating=0;return this}Rating.prototype={over:function(b){if(this.rated){return}b=b||event,b=b.target||b.srcElement;var a=this.stars.length;while(a--){if(b==this.stars[a]){break}}this.rating=(a+1);this.line.className="stars"+this.rating},out:function(){if(this.rated){return}this.line.className="stars0"},click:function(b){this.redirect&&(window.location=this.redirect);if(!this.rating||this.rated){return}this.rated=true;v$addClass(this.box,"b-rating-voted");var d=this,a=g_js_base+"/rating_stars/vote/",c={rating_id:this.box.onclick().fid,rating:this.rating};v$query(a,c,function(e){if(e){d.overall&&(d.overall.className=d.overall.className.replace(/\d{1}/,e))}})}};function imgGallery(c,a){var d=this;this.g=c;this.config={itemsShow:4,itemWidth:140,slideStep:10,slideInterval:5,stepInterval:500};this.items=this.g.getElementsByTagName("LI");this.imgs=this.g.getElementsByTagName("IMG");for(var b=0;b<2;b++){a[b].step=b?1:-1;v$attachEvent(a[b],"mousedown",function(f){d.btnDown(f)})}v$attachEvent(document,"mousedown",function(f){d.btnPressed(f)});v$attachEvent(document,"mouseup",function(){if(d.shifting){window.clearInterval(d.shifting);d.shifting=null}})}imgGallery.prototype={btnDown:function(a){if(this.sliding){return}a=a||event;a=a.target||a.srcElement;while(a&&!a.id){a=a.parentNode}a.step&&this.slideTo(a.step)},btnPressed:function(b){var c=this,a;b=b||event;b=b.target||b.srcElement;while(b&&!b.id){b=b.parentNode}if(!b.step){return}var a=function(){c.slideTo(b.step)};this.shifting=window.setInterval(a,this.config.stepInterval)},slideTo:function(a){if(a>0){this.loadImage(this.config.itemsShow);this.slide(0,-this.config.itemWidth,this.stepNext)}else{this.stepBack();this.slide(-this.config.itemWidth,0)}},stepNext:function(){this.loadImage(this.config.itemsShow);this.g.appendChild(this.g.removeChild(this.items[0]));this.g.style.left=0},stepBack:function(){this.loadImage(this.items.length-1);this.g.style.left=-this.config.itemWidth;this.g.insertBefore(this.g.removeChild(this.items[this.items.length-1]),this.items[0])},slide:function(b,a,g){this.sliding=1;var e=this;var c=(a-b)>0?+1:-1;c*=this.config.slideStep;this.g.style.left=b+"px";if(a-b){var d=function(){e.slide(b+c,a,g)};window.setTimeout(d,this.config.slideInterval)}else{this.sliding=0;g&&g.apply(this)}},loadImage:function(b){var a=this.imgs[b];a.src||(a.lang&&(a.src=a.lang,a.removeAttribute("lang",0)))}};function smiles(d,b,c){var a=v$("smiles.list"),b=v$(b);if(!b){b=v$("posting.message.form.text")}if(!a||!b||b.tagName!="TEXTAREA"){return}a.ta=b;if(!window.smilesPopup){v$attachEvent(a,"click",function(h){h=h||event;h.preventDefault?h.preventDefault():(h.returnValue=false);h.stopPropagation?h.stopPropagation():(h.cancelBubble=true);h=h.target||h.srcElement;if(!(h.tagName=="A"||(h=h.parentNode).tagName=="A")){return}if(h.onclick){return}var g=(h.className=="close")?true:false;h=v$$(h,"i")[0];var f=h.innerText||h.textContent||"";if(!g){textAreaInsert(a.ta," "+f+" ")}document.body.appendChild(a);$("smiles.list").style.display="none"});window.smilesPopup=a}if(a.parentNode==d){document.body.appendChild(a);$("smiles.list").style.display="none"}else{if(!c){d.appendChild(a);$("smiles.list").style.display="block"}}}function eventsGallery(a,c,b){this.hintUp=+5;this.hintDown=-3;this.hintSize=35;this.hintTime=5;this.src=c;this.data=b;this.events=this.initEvents(a);this.cells=this.getCells(this.events);this.initButtons(a);this.startIndex=0}eventsGallery.prototype={initEvents:function(c){var e=this;var a=c.getElementsByTagName("DIV");var d=[];for(var b=0;b<a.length;b++){d.push(a[b]);d[b].number=b;d[b].image=d[b].getElementsByTagName("IMG")[0];d[b].hint=d[b].getElementsByTagName("P")[0];d[b].image.removeAttribute("alt",0)}return d},getCells:function(c){var b=[];var d=this;for(var a=0;a<c.length;a++){b.push(c[a].parentNode);v$attachEvent(b[a],"mouseover",function(f){d.showHint(f)});v$attachEvent(b[a],"mouseout",function(f){d.hideHints(f)})}return b},initButtons:function(c){var d=this;var a=[];a[0]=c.cells[0];a[1]=c.cells[c.cells.length-1];for(var b=0;b<2;b++){a[b]=a[b].getElementsByTagName("I")[0];a[b].step=b?1:-1;v$attachEvent(a[b],"click",function(f){return d.btnClick(f)})}},showHint:function(a){a=a||event;a=a.target||a.srcElement;while(a.tagName!="DIV"&&a.parentNode){a=a.parentNode}if(typeof a.number=="undefined"){return}this.slideHint(a.hint,this.hintSize)},hideHints:function(){for(var a=0;a<this.events.length;a++){this.events[a]&&this.slideHint(this.events[a].hint,0)}},slideHint:function(c,a){var d=this;if(c.timerId){window.clearTimeout(c.timerId);c.timerId=null}var b=parseInt(c.style.height)||0;b+=(a>b)?this.hintUp:this.hintDown;b=(b<0)?0:(b>this.hintSize)?this.hintSize:b;c.style.height=b+"px";if(b==a){return}c.timerId=window.setTimeout(function(){d.slideHint(c,a)},this.hintTime)},btnClick:function(a){a=a||event;a=a.target||a.srcElement;while(!a.step&&a.parentNode){a=a.parentNode}this.scrollBy(a.step);return false},scrollBy:function(step){this.startIndex+=step;for(var i=0;i<this.cells.length;i++){with(this.cells[i]){while(firstChild){removeChild(firstChild)}appendChild(this.getEvent(this.getIndex(this.startIndex+i)))}}},getIndex:function(b){var a=this.src.length;while(b<0){b+=a}while(b>=a){b-=a}return b},getEvent:function(a){if(this.events[a]){return this.events[a]}var b=this.events[0].cloneNode(1);b.number=a;b.image=b.getElementsByTagName("IMG")[0];b.hint=b.getElementsByTagName("P")[0];b.image.src=this.src[a].tizer;b.getElementsByTagName("A")[0].href=mainUrl+"/events/show/"+this.src[a].event_id;b.getElementsByTagName("B")[0].innerHTML=this.data[this.src[a].event_id].category_title+":";b.getElementsByTagName("I")[1].innerHTML=this.src[a].alt;return this.events[a]=b}};init.add(function(){var b=v$$(document.body,"a","j-posting"),a=b.length;while(a--){v$attachEvent(b[a],"click",function(m){m=m||event;m.preventDefault?m.preventDefault():(m.returnValue=false);m=m.target||m.srcElement;var g=m.onblur;g&&(g=g());if(!g){return}var l=v$("posting."+g.type+".form");if(!l){return}l.reset();l.uid&&(l.uid.value=g.user.id);l["data[parent]"]&&(l["data[parent]"].value=g.parent);l.link=m;try{var h=l.getElementsByTagName("address")[0];var d=l.getElementsByTagName("span")[0];d.innerHTML=g.user.name}catch(k){}window.gModal||(gModal=new modalWnd());gModal.show(l)}),v$delClass(b[a],"b-posting-link")}if(!a){return}var c=v$("posting.message.form");c&&(c.onsubmit=function(){var e=this.uid.value,h=v$trim(this.title.value),g=v$trim(this.text.value);if(!h&&!g){alert("Сообщение не отправлено. Вам нечего написать? )");return false}if(g.length>500){alert("Сообщение не отправлено. Пожалуйста, сделайте текст короче.");return false}h=h||g.slice(0,30)+"...";g=g||h.slice(0,30)+"...";var k=this,d=g_js_base+"/mymessages/sendMessage",f={"data[msg_user_id]":e,"data[title]":h,"data[text]":g};v$query(d,f,function(l){!!l&&alert(l);!l&&(alert("Сообщение отправлено"),gModal.hide())});return false});c=v$("posting.answer.form");c&&(c.onsubmit=function(){if(!v$trim(this["data[text]"].value)){alert("Напишите, пожалуйста, ответ");return false}gModal.hide();return true});var c=v$("posting.friend.form");c&&(c.onsubmit=function(){var h=this,e=this.uid.value,g=v$trim(this.text.value);if(!g){alert("Напишите, пожалуйста, комментарий");return false}if(g.length>500){alert("Сообщение не отправлено. Пожалуйста, сделайте текст короче.");return false}var h=this,d=g_js_base+"/mymessages/SendInviteJS",f={"data[msg_user_id]":e,"data[text]":g};v$query(d,f,function(k){!!k&&alert("Не удалось отправить предложение.\n\n"+k);!k&&(alert("Предложение отправлено"),gModal.hide(),v$addClass(h.link,"g-hidden"))});return false});c=v$("posting.compliment.form");c&&(c.onsubmit=function(){var f=this.uid.value,g=this.compl,e=g.length,k=v$trim(this.text.value);while(e--&&!g[e].checked){continue}g=(e>=0)?g[e].value:null;if(!g){alert("Надо выбрать тип комплимента..");return false}if(!k){alert("Напишите комплимент..");return false}if(k.length>500){alert("Комплимент не отправлен. Пожалуйста, сделайте текст короче.");return false}var l=this,d=g_js_base+"/comments/sendComplimentJS",h={"data[uid]":f,"data[compl]":g,"data[text]":k};v$query(d,h,function(m){!!m&&alert("Не удалось отправить комплимент \n\n"+m);!m&&(alert("Комплимент отправлен"),gModal.hide())});return false});c=v$("posting.request.form");c&&(c.onsubmit=function(){var e=this.uid.value,g=v$trim(this.text.value);if(g.length<10){alert("Напишите, пожалуйста, несколько слов заявки.");return false}if(g.length>200){alert("Заявка не отправлена. Пожалуйста, сделайте текст короче.");return false}var h=this,d=g_js_base+"/mymessages/SendCommunityRequest",f={"data[community_id]":e,"data[text]":g};v$query(d,f,function(k){!!k&&alert("Не удалось отправить заявку \n\n"+k);!k&&(alert("Заявка отправлена на рассмотрение модератора"),gModal.hide())});return false})});function doSubmitGuestBookMessageForm(d){if(!validateForm(d,0,0,0,1,8)){return false}var c=$("data_text").value;var a=d.action.replace(/\s/g,""),b={"data[text]":c};v$query(a,b,function(e){!!e&&alert(e);if(!e){(alert("Сообщение отправлено"))}var f=$("curwindow").value;$_($("mainWindow"+f))});return false}function doSubmitMailInviteQuery(f,e){$("ajaxErrorContainer").style.display="none";if($("mlogin").value=="адрес"){displayImportError("Вы должны ввести адрес");return false}if($("mpass").value=="пароль"){displayImportError("Вы должны ввести пароль");return false}var b=f.action.replace(/\s/g,"");var a=$("mlogin").value+"@"+$("system").value;var c=$("mpass").value;var d={"data[login]":a.replace(/\s/g,""),"data[pass]":c};$("wait_block").style.display="block";v$query(b,d,function(g){!!g&&displayImportError(g);if(!g){(displayImportError("Контакты получены"));$("wait_block").style.display="none";document.location.href=e+"/profile/inviteall/"+(($("reg").value=="on")?"reg/":"")}$("wait_block").style.display="none"});return false}function doSubmitVideoImportQuery(f,e){$("ajaxErrorContainer").style.display="none";if($("slogin").value=="логин"){displayImportError("Вы должны ввести логин");return false}if($("spass").value=="пароль"){displayImportError("Вы должны ввести пароль");return false}var b=f.action.replace(/\s/g,"");var a=$("slogin").value;var c=$("spass").value;var d={"data[login]":a.replace(/\s/g,""),"data[pass]":c};$("wait_block").style.display="block";v$query(b,d,function(g){!!g&&displayImportError(g);if(!g){document.location.href=document.location.href}$("wait_block").style.display="none"});return false}function doSubmitPhotoImportQuery(f,e){$("ajaxErrorContainer").style.display="none";if($("slogin").value=="логин"){displayImportError("Вы должны ввести логин");return false}if($("spass").value=="пароль"){displayImportError("Вы должны ввести пароль");return false}var b=f.action.replace(/\s/g,"");var a=$("slogin").value;var c=$("spass").value;var d={"data[login]":a.replace(/\s/g,""),"data[pass]":c};$("wait_block").style.display="block";v$query(b,d,function(g){!!g&&displayImportError(g);if(!g){document.location.href=document.location.href}$("wait_block").style.display="none"});return false}function doSubmitPhotoExportQuery(f,e){$("ajaxErrorContainer").style.display="none";if($("slogin").value=="логин"){displayImportError("Вы должны ввести логин");return false}if($("spass").value=="пароль"){displayImportError("Вы должны ввести пароль");return false}var b=f.action.replace(/\s/g,"");var a=$("slogin").value;var c=$("spass").value;var d={"data[login]":a.replace(/\s/g,""),"data[pass]":c};$("b-wait-loading").style.display="block";v$query(b,d,function(g){if(!!g&&g.substr(0,4)=="http"){$("link_export_album").href=g;$("link_export_album").innerHTML=g;$("b-wait-loading").style.display="none";$("form_export").style.display="none";$("b-export_photo-link").style.display="block"}else{if(!!g){displayImportError(g)}else{displayImportError("Нет ответа")}}$("b-wait-loading").style.display="none"});return false}function doSubmitInvite(d){var b=d.action;var a=d["data[login]"].value;var c=d["data[pass]"].value;var f=d["data[text]"].value;$("ajaxErrorContainer").style.display="none";if(""==a){displayImportError("Вы должны ввести логин");return false}if(""==c){displayImportError("Вы должны ввести пароль");return false}var e={"data[login]":a,"data[pass]":c,"data[text]":f};$("blogImportWaitMessage").style.display="block";v$query(b,e,function(g){$("blogImportWaitMessage").style.display="none";if(!g){document.location.href=document.location.href}displayImportError(g)})}function displayImportError(a){$("ajaxErrorContainer").style.display="block";$("ajaxError").innerHTML=a}function doSubmitProfileMessageForm(g){var b=g.user_id.value,f=v$trim(g.title.value),e=g.text.value,c=v$trim(g.parent_id.value);if(!f&&!e){alert("Сообщение не отправлено. Вам нечего написать? )");return false}if(e.length>7000){alert("Сообщение не отправлено. Пожалуйста, сделайте текст короче.");return false}f=f||e.slice(0,30)+"...";e=e||f.slice(0,30)+"...";var a=g_js_base+"/mymessages/sendMessage",d={"data[msg_user_id]":b,"data[title]":f,"data[text]":e,"data[parent_id]":c};v$query(a,d,function(h){!!h&&alert(h);if(!h){(alert("Сообщение отправлено"))}var k=$("window").value;$_($("mainWindow"+k))});return false}function doSubmitProfileInviteForm(d){uid=d.user_id.value,text=v$trim(d.text.value),parent_id=v$trim(d.parent_id.value);if(!text){alert("Напишите, пожалуйста, комментарий");return false}if(text.length>500){alert("Сообщение не отправлено. Пожалуйста, сделайте текст короче.");return false}var c=this,a=g_js_base+"/mymessages/SendInviteJS",b={"data[msg_user_id]":uid,"data[text]":text,"data[parent_id]":parent_id};v$query(a,b,function(e){!!e&&alert(e);if(!e){(alert("Предложение отправлено"))}var f=$("window").value;$_($("mainWindow"+f))});return false}function SaveDataByAjax(h,a){post_obj={data:[]};var f=document.getElementById(a);if(validateForm(f,0,0,0,1,8)){var d=/^data\[(\w+)\]$/;var b=/^data\[(\w+)\]\[\]$/;for(var c=0;c<f.elements.length;c++){var g=d.exec(f.elements[c].name);if(null!=g&&2==g.length){var e=GetElemValue(f.elements[c]);if(null!=e){post_obj.data[g[1]]=e}}else{g=b.exec(f.elements[c].name);if(null!=g&&2==g.length){var e=GetElemValue(f.elements[c]);if(null!=e){if(null==post_obj.data[g[1]]){post_obj.data[g[1]]=[]}post_obj.data[g[1]][post_obj.data[g[1]].length]=e}}}}submit_post_request(h,post_obj,false)}return false}function GetElemValue(a){var b;if(!a.type){b=null}else{if("checkbox"==a.type||"radio"==a.type){b=null;if(a.checked){b=a.value}}else{b=a.value}}return b};