﻿var a,wp_Prototypes=true;Array.prototype.find=function(e){for(count=0;count<this.length;count++)if(this[count]==e)return count;return-1};Array.prototype.intersection=function(e){var l=[];if(typeof e!="object")e=new Array(e);for(var k=0;k<this.length;k++)for(var b=0;b<e.length;b++)this[k]==e[b]&&l.push_back(e[b]);return l};Array.prototype.push_back=function(e){if(typeof e=="object"&&e.length)for(var l=0;l<e.length;l++)this[this.length]=e[l];else this[this.length]=e};
Array.prototype.remove=function(e){var l=[];for(count=0;count<this.length;count++)if(e!=count)l[l.length]=this[count];return l};a=String.prototype;a.isMatch=function(e){for(count=0;count<this.length;count++)if(e.indexOf(this.substring(count,count+1))==-1)return false;return true};
a.isPattern=function(e){if(typeof e=="string"){var l="/^",k="";for(count=0;count<e.length;count++){k=e.substring(count,count+1);l+=k=="?"?".{1}":k=="."?"\\.{1}":k=="*"?".{0,}":k=="("||k==")"||k=="+"?"\\"+k+"{1}":k+"{1}"}l+="$/";e=eval(l)}if(this.search(e)==0)return true;return false};a.isNum=function(){return this.isMatch("1234567890")};a.isDec=function(){return this.isMatch("1234567890,.")};a.isAlpha=function(){return this.isMatch("abcdefghijklmnopqrstuvwxyz\u00e5\u00e4\u00f6\u00e6\u00f8\u00fcABCDEFGHIJKLMNOPQRSTUVWXYZ\u00c5\u00c4\u00d6\u00c6\u00d8\u00dc ")};
a.isEmail=function(){return this.match(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i)?true:false};a.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")};a.right=function(e){return this.substring(this.length-e,this.length)};
Date.prototype.getWeek=function(){var e=new Date;e.setFullYear(this.getFullYear(),this.getMonth(),this.getDate());var l=e.getDay();if(l==0)l=7;e.setDate(e.getDate()+(4-l));l=e.getFullYear();e=Math.floor((e.getTime()-new Date(l,0,1,-6))/864E5);return 1+Math.floor(e/7)};Date.prototype.originalToString=Date.prototype.toString;
Date.prototype.toString=function(e){function l(b){b=b.toString();b=b.length==0?"0000"+b:b;b=b.length==1?"000"+b:b;b=b.length==2?"00"+b:b;return b=b.length==3?"0"+b:b}function k(b){b=b.toString();b=b.length==0?"00"+b:b;return b=b.length==1?"0"+b:b}if(typeof e=="undefined")return this.originalToString();e=e;e=e.replace(/yyyy/g,l(this.getFullYear()));e=e.replace(/yy/g,k(this.getFullYear().toString().substring(2,4)));e=e.replace(/MM/g,k(this.getMonth()+1));e=e.replace(/dd/g,k(this.getDate()));e=e.replace(/HH/g,
k(this.getHours()));e=e.replace(/hh/g,k(this.getHours()>11?this.getHours()-12:this.getHours()));e=e.replace(/mm/g,k(this.getMinutes()));return e=e.replace(/ss/g,k(this.getSeconds()))};
Date.prototype.parseDate=function(e){e=e.replace(/\s/g,"").replace(/-/g,"").replace(/\./g,"").replace(/:/g,"");e.length>=4&&this.setFullYear(e.substring(0,4));e.length>=6?this.setMonth(new Number(e.substring(4,6)-1)):this.setMonth(0);e.length>=8?this.setDate(new Number(e.substring(6,8))):this.setDate(1);e.length>=10?this.setHours(new Number(e.substring(8,10))):this.setHours(0);e.length>=12?this.setMinutes(new Number(e.substring(10,12))):this.setMinutes(0);e.length>=14?this.setSeconds(new Number(e.substring(12,
14))):this.setSeconds(0)};
window.getSize=function(){if(typeof window.innerWidth=="number"){myWidth=window.innerWidth;myHeight=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight}return{width:myWidth,height:myHeight}};
function wp_XMLHttpRequest(e){function l(){j.log(i,"createConnection()");if(window.XMLHttpRequest&&!window.ActiveXObject){j.log(i,"...with XMLHttpRequest");c=new XMLHttpRequest}else if(window.ActiveXObject){j.log(i,"...with ActiveXObject");var o=new Array("Msxml6","Msxml5","Msxml3","Msxml2","Msxml4","Microsoft"),h=0;do{j.log(i,"Trying to create instance of "+o[h++]+".XMLHTTP");try{c=new ActiveXObject(o[h++]+".XMLHTTP")}catch(m){c=null}}while(!c&&h<o.length)}if(c)c.onreadystatechange=g;else return false;
return true}function k(o,h){if(f.onerror){var m={},p=0;m.error=o;m.response={};m.response.http=c;m.response.text=h?h.text:null;m.response.dom=h?h.dom:null;m.request=i;m.config=f;f.onerror(m)}}function b(o){var h=null;for(field in o)if(typeof o[field]!="function"){if(h)h+="&";else h="";j.log(i,"adding field: "+field);j.log(i,"datatype: "+typeof o[field]);if(typeof o[field]=="string"){h+=field+"="+encodeURI(o[field]).replace(/&/g,"%26").replace(/\+/g,"%2b");j.log(i,"type: string")}else{j.log(i,"type: array, length: "+
o[field].length);if(o[field].length>0)for(var m=0;m<o[field].length;m++){if(h&&m)h+="&";h+=field+"="+encodeURI(o[field][m]).replace(/&/g,"%26").replace(/\+/g,"%2b")}else h+=field+"="}}j.log(i,"Constructed query string: "+h);return h}function g(){f.onstatechange&&f.onstatechange(c.readyState);c.readyState==4&&n()}function n(){var o={},h={};j.log(i,"receiving: ");if(typeof window.DOMParser!="undefined"){j.log(i,"using DOMParser");o=(new DOMParser).parseFromString(c.responseText,"text/xml");h.dom=o.documentElement}else if(window.ActiveXObject){j.log(i,
"using ActiveXObject");o=new ActiveXObject("Microsoft.XMLDOM");o.async="false";o.loadXML(c.responseText);h.dom=o.documentElement}else{j.log(i,"XML: "+o.responseXml);j.log(i,"Cant parse XML!");h.dom=o.responseXML}h.text=c.responseText;h.xml=h.dom;h.html=h.text;j.log(i,"Recieving "+h.text.length+" bytes of data");if(c.status!=200)k(new Error("HTTP error"),h);else f.onload&&f.onload(h)}var i=this,c=null,d=null,f={uri:e.uri?e.uri:"",query_string:e.query_string?e.query_string:"",data:e.data?e.data:"",
form:e.form?e.form:"",method:e.method||"",field:e.field||"",cache:e.cache==false?false:true,onload:e.onload,onerror:e.onerror};try{var j=new wp_Log}catch(s){j={};j.log=function(){}}this._function="wp_XMLHttpRequest";this.debug=j;this.cancel=function(){c&&c.abort()};this.execute=function(){if(!f.uri&&!f.form){k(f.method.toUpperCase()=="GET"?new Error("No URI in GET request"):new Error("No action in POST request"));return false}var o=null,h=null,m=null,p=null,r=null;if(f.form&&document.getElementById(f.form)){j.log(i,
"Fetch values from cfg.form");o=(f.method||document.getElementById(f.form).method||"POST").toUpperCase();h=f.uri||document.getElementById(f.form).action;try{p=new wp_Form({id:f.form})}catch(w){j.log(i,"FATAL: wp_Form missing...");k(new Error("wp_Form.js is missing"));return}if(!p||!f.form||f.field&&!document[f.form][f.field]){j.log(i,"Failed to send request...");k(new Error((f.field?"Field":"Form")+" does not exist"));return}r=f.field?p.collect(f.field):p.collect();m=b(r)}else if(f.uri&&!f.form){j.log(i,
"Fetch values from cfg.uri");o=(f.method||"GET").toUpperCase();h=f.uri;m=f.data?b(f.data):f.query_string}else{j.log(i,"No uri and no form. Failed to send request...");k(new Error("Form not found"))}if(!f.cache){if(m.length)m+="&";m+="__wp_nocache=";m+=Math.random()}if(l()){j.log(i,"Connection created, sending request");j.log(i,"Method: "+o);j.log(i,"Action: "+h);j.log(i,"Data: "+m);if(o=="GET"){h+=m.length?"?"+m:"";try{c.open("GET",h,true);c.send(null)}catch(t){k(t)}}else if(o=="POST")try{c.open("POST",
h,true);c.setRequestHeader("Content-type","application/x-www-form-urlencoded");c.setRequestHeader("Content-length",m.length);c.setRequestHeader("Connection","close");c.send(m)}catch(u){k(u)}}else{j.log(i,"Could not create connection");k(new Error("Could not create XML HTTP Object"));return false}}}
function wp_XMLParser(e){function l(d){i.log(k,"cleaning node: "+d.nodeName+" (children: "+(d.hasChildNodes()?d.childNodes.length:0)+")");if(d.hasChildNodes()&&d.childNodes.length>1){i.log(k,"node has childnodes: "+d.childNodes.length);for(var f=d.childNodes.length-1;f>-1;f--){i.log(k,"trying node: "+d.childNodes[f].nodeName);if(d.childNodes[f].nodeType==n.text){i.log(k,"removing: "+d.nodeName+"--"+d.childNodes[f].nodeName+" value: "+d.childNodes[f].nodeValue);d.removeChild(d.childNodes[f])}}}}var k=
this,b=e.parentNode,g=b,n={text:3,cdata:4};try{var i=new wp_Log}catch(c){i={};i.log=function(){}}this._function="wp_XMLParser";this.debug=i;this.init=function(){g=e};this.moveInto=function(d){i.log(k,"moveInto("+(d?"'"+d+"'":"")+")");l(g);if(g.hasChildNodes()&&g.childNodes[0].nodeType!=n.text&&g.childNodes[0].nodeType!=n.cdata){i.log(k,"node: "+g.nodeName+" has "+g.childNodes.length+" child nodes");var f=0;if(d){f=g.childNodes.length;do f--;while(f>-1&&g.childNodes[f].nodeName!=d)}if(f>-1){g=g.childNodes[f];
i.log(k,"found node: "+g.nodeName);return true}i.log(k,"did not find node")}return false};this.moveNext=function(){if(g.nextSibling){g=g.nextSibling;return true}return false};this.getName=function(){return g.nodeName};this.getValue=function(){l(g);i.log(k,"getValue() of node "+g.nodeName);if(g&&g.hasChildNodes()&&(g.childNodes[0].nodeType==n.text||g.childNodes[0].nodeType==n.cdata))return g.childNodes[0].nodeValue;else if(g&&!g.hasChildNodes())return"";return null};this.getFirstValueOf=function(d){i.log(k,
"getFirstValueOf('"+d+"');");var f=g,j=null;if(k.goTo(d))j=k.getValue();g=f;return j};this.goTo=function(d){var f=g;d=d.split("/");for(var j=0;j<d.length;j++){i.log(k,"Searching for node: '"+d[j]+"'");if(j==0&&d[j]=="")g=b;else if(!k.moveInto(d[j])){g=f;return false}i.log(k,"Current: '"+g.nodeName+"' , type: "+g.nodeType);i.log(k,"value: '"+g.nodeValue+"'")}return true};this.getAttribute=function(d){return g.getAttribute(d)};this.getAttributeBool=function(d){var f=true;d=k.getAttribute(d);if(d=="false"||
d==false||d==0||d=="0")f=false;return f};g.childNodes[0].nodeType==3&&l(g)}
function wp_FX(){var e=this;try{var l=new wp_Log}catch(k){l={};l.log=function(){}}this._function="wp_FX";this.debug=l;this.fade=function(b){if(!b.__is_initialized){b={id:b.id,opacity:b.start_opacity,finish_opacity:b.finish_opacity,step:typeof b.step=="undefined"?10:b.step,interval:typeof b.interval=="undefined"?100:b.interval,type:typeof b.type=="undefined"?"out":b.type,onfinish:typeof b.onfinish=="undefined"?null:b.onfinish};if(typeof b.opacity!="undefined"&&typeof b.finish_opacity!="undefined")b.type=
b.opacity>b.finish_opacity?"out":"in";if(!b.opacity)b.opacity=b.type=="out"?100:0;if(!b.finish_opacity)b.finish_opacity=b.type=="out"?0:100;b.__is_initialized=true}if(b.__is_initialized){try{document.getElementById(b.id).style.filter="alpha(opacity="+b.opacity+")";document.getElementById(b.id).style.opacity=b.opacity/100}catch(g){return}var n=b.opacity,i=b.finish_opacity,c=b.type=="out"?true:false,d=b.step;if(c&&n>i||!c&&n<i){b.opacity=c?n-d<i?0:n-d:n+d>i?i:n+d;n=setTimeout(function(){e.fade(b)},
b.interval)}else b.onfinish&&b.onfinish();return true}else return false};this.reflectImage=function(b){var g=b.element;g=g?g:document.getElementById(b.id);var n=b.height==null?g.offsetHeight/2:b.height;e.debug.log(e,"Beg\u00e4ran om 'reflectImage' f\u00f6r id: "+b.id);if(document.createElement("canvas").getContext){e.debug.log(e,"Har st\u00f6d f\u00f6r canvas: true");var i=b.alpha,c=document.createElement("canvas");c.width=g.offsetWidth;c.height=n;e.debug.log(e,"Dimensioner f\u00f6r canvas angivna");
var d=c.getContext("2d");e.debug.log(e,"H\u00e4mtar context f\u00f6r canvas");e.debug.log(e,"Har st\u00f6d f\u00f6r context.drawImage: "+typeof d.drawImage);for(var f=0;f<n;f++){alpha=(f!=0?(n-f)/n:n)*i;d.globalAlpha=alpha;try{e.debug.log(e,"Ritar linje: "+f+", med alpha: "+d.globalAlpha);d.drawImage(g,0,g.offsetHeight-f,g.offsetWidth,1,0,f,g.offsetWidth,1)}catch(j){e.debug.log(e,"Misslyckades med linje: "+f)}}}else{e.debug.log(e,"Har EJ st\u00f6d f\u00f6r canvas");c=document.createElement("img");
c.src=g.src;c.style.filter="FlipV alpha(Opacity="+b.alpha*100+",FinishOpacity=0,Style=1,StartY=0,FinishY="+n+",StartX=0,FinishX=0)";c.style.marginTop=-(n-1)+"px";c.style.display="block";c.style.clip="rect(0px auto "+n+"px 0px)";c.style.position="absolute";c.style.width=g.width+"px";c.style.height=g.height+"px";g.style.marginBottom=n+"px"}b.append!=false&&g.parentNode.insertBefore(c,g.nextSibling);return c};this.resize=function(b){if(!b.__is_initialized){b={id:b.id,finish_width:b.width||-1,width:b.start_width||
document.getElementById(b.id).offsetWidth,finish_height:b.height||-1,height:b.start_height||document.getElementById(b.id).offsetHeight,step:b.step||10,align:b.align||"center",element:document.getElementById(b.id),left:new Number(b.left||-1),top:new Number(b.top||-1),onfinish:b.onfinish||null,interval:b.interval||50,window:window.getSize()};b.getLeft=function(){return b.left!=-1?b.left:b.align=="left"?0:b.align=="right"?b.window.width-b.width:b.window.width/2-b.width/2};b.getTop=function(){return b.top!=
-1?b.top:b.align=="top"?0:b.align=="bottom"?b.window.height-b.height:b.window.height/2-b.height/2};b.expandWidth=b.finish_width<b.width?false:true;b.expandHeight=b.finish_height<b.height?false:true;b.__is_initialized=true}if(b.__is_initialized){if(b.finish_width!=-1){if(b.expandWidth){b.width+=b.step;if(b.width>b.finish_width)b.width=b.finish_width}else{b.width-=b.step;if(b.width<b.finish_width)b.width=b.finish_width}b.element.style.width=b.width+"px";b.element.style.left=b.getLeft()+"px"}if(b.finish_height!=
-1){if(b.expandHeight){b.height+=b.step;if(b.height>b.finish_height)b.height=b.finish_height}else{b.height-=b.step;if(b.height<b.finish_height)b.height=b.finish_height}b.element.style.height=b.height+"px";b.element.style.top=b.getTop()+"px"}if(b.finish_width!=-1&&b.width!=b.finish_width||b.finish_height!=-1&&b.height!=b.finish_height)var g=setTimeout(function(){e.resize(b)},b.interval);else b.onfinish&&b.onfinish()}}}
function wp_SlideShow(e){function l(){u.log(c,"Error loading image: "+(f+1));j.splice(f,1);f--;k()}function k(){f++;f!=0&&u.log(c,f+" images loaded");if(f<j.length){u.log(c,"Initalizing loading image: "+(f+1)+" of "+j.length);j[f].image=new Image;j[f].image.onload=k;j[f].image.onerror=l;j[f].image.onabort=l;j[f].image.src=j[f].src}else u.log(c,"All images loaded")}function b(){if(i.scene.parentNode.tagName=="A"){i.scene.parentNode.href=j[d].href||"JavaScript:void(0);";i.scene.parentNode.title=j[d].alt||
""}i.scene.alt=j[d].alt||""}function g(q){if(q&&t){var v=new wp_Element({element:i.scene});t.src=q.src;t.style.top=i.status_icon_top=="bottom"?v.top+v.height-r.height-i.status_icon_padding+"px":i.status_icon_top=="center"?v.top+v.height/2-r.height/2+"px":v.top+i.status_icon_padding+"px";t.style.left=i.status_icon_left=="right"?v.left+v.width-r.width-i.status_icon_padding+"px":i.status_icon_left=="center"?v.left+v.width/2-r.width/2+"px":v.left+i.status_icon_padding+"px";t.style.display="block"}}function n(){if(t)t.style.display=
"none"}var i={id:e.id,speed:e.speed||50,pause:e.pause||5E3,manual:e.manual||false,pause_on_hover:typeof e.pause_on_hover!="undefined"?e.pause_on_hover:true,status_pause_icon_src:e.status_pause_icon_src,status_play_icon_src:e.status_play_icon_src,status_icon_padding:e.status_icon_padding||10,status_icon_top:e.status_icon_top||"bottom",status_icon_left:e.status_icon_left||"right",status_icon_opacity:e.status_icon_opacity||100},c=this,d=0,f=-1,j=[];j[0]={};var s=null;e=null;var o=100,h=null,m=0,p=false,
r=null,w=null,t=null;try{var u=new wp_Log}catch(x){u={};u.log=function(){}}this._function="wp_SlideShow";this.debug=u;this.add=function(q,v){j[typeof v=="number"?v:j.length]=q};this.init=function(){i.scene=document.getElementById(i.id);var q={src:i.scene.src,alt:i.scene.alt,href:i.scene.parentNode.href};c.add(q,0);k();h=document.createElement("IMG");if(i.pause_on_hover){h.onmouseover=c.pause;h.onmouseout=c.start}h.src=q.src;h.style.position="absolute";i.scene.parentNode.insertBefore(h,i.scene);if(i.status_pause_icon_src){r=
new Image;r.src=i.status_pause_icon_src}if(i.status_play_icon_src){w=new Image;w.src=i.status_play_icon_src}if(r||w){t=document.createElement("IMG");t.style.position="absolute";t.style.opacity=i.status_icon_opacity/100;t.style.filter="alpha(opacity="+i.status_icon_opacity+")";t.style.display="none";i.scene.parentNode.insertBefore(t,i.scene)}i.manual||(s=window.setTimeout(c.next,i.pause))};this.next=function(){window.clearTimeout(s);m=d;d++;if(d>=j.length)d=0;c.show(d)};this.previous=function(){window.clearTimeout(s);
m=d;d--;if(d<0)d=j.length;c.show(d)};this.show=function(q){window.clearTimeout(s);u.log(c,"item: "+q+", src: "+j[q].image.src);if(typeof j[q].image.naturalWidth!="undefined"&&j[q].image.naturalWidth<1||typeof j[q].image.fileSize!="undefined"&&j[q].image.fileSize<1){u.log(c,"Image does not exist. Deleting...");j.splice(q,1);d=q=m}if(j[q].image.complete)i.scene.src=j[q].image.src;else d=m;c.process()};this.process=function(){if(!p||o!=100){o-=5;o=o>0?o:0;if(o>0){h.style.opacity=o?o/100:0;h.style.filter=
"alpha(opacity="+o+")";s=setTimeout(c.process,i.speed)}else{h.src=i.scene.src;b();window.setTimeout(function(){o=100;h.style.opacity=o/100;h.style.filter="alpha(opacity="+o+")"},100);i.manual||(s=window.setTimeout(c.next,i.pause))}}else d=m};this.pause=function(){u.log(c,"pausing...");p=true;g(r)};this.start=function(){p=false;g(w);window.setTimeout(n,2E3);if(o==100){window.clearTimeout(s);u.log(c,"starting...");s=window.setTimeout(c.next,i.pause)}};(new wp_Event).add(window,"load",c.init)}
function wp_Event(e){var l=e||{},k=this;this.add=function(b,g,n){if(!b)return false;if(document.addEventListener)b.addEventListener(g,n,false);else if(document.attachEvent)b.attachEvent("on"+g,n);else b["on"+g]=n};this.remove=function(b,g,n){if(!b)return false;if(document.removeEventListener)b.removeEventListener(g,n,false);else if(document.detachEvent)b.detachEvent("on"+g,n);else b["on"+g]=null};this.get=function(b){var g={};b=b?b:window.event;g.event=b;g.type=b.type;g.keycode=b.keyCode;g.keyctrl=
b.ctrlKey;g.element=b.target?b.target:b.srcElement;var n=document.documentElement?document.documentElement.scrollTop:document.body.scrollTop,i=document.documentElement?document.documentElement.scrollLeft:document.body.scrollLeft,c=document.documentElement?document.documentElement.clientTop:document.body.clientTop,d=document.documentElement?document.documentElement.clientLeft:document.body.clientLeft;g.mousetop=b.pageY?b.pageY:b.clientY+n-c;g.mouseleft=b.pageX?b.pageX:b.clientX+i-d;return g};this.clear=
function(){l.element&&l.event&&l.handler&&k.remove(l.element,l.event,l.handler)};l.element&&l.event&&l.handler&&k.add(l.element,l.event,l.handler)}
function wp_Element(e){function l(){k.top=0;k.left=0;for(var b=k.element;b;){k.top+=b.offsetTop;k.left+=b.offsetLeft;b=b.offsetParent}}var k=this;e=e||{element:document.body};this.element=e.element||document.getElementById(e.id);if(!this.element)return null;this.left=this.top=0;this.height=this.element.offsetHeight;this.width=this.element.offsetWidth;l();this.getOffsetTop=function(b){for(var g=0,n=k.element;n&&n.id!=b;){g+=n.offsetTop;n=n.offsetParent}return g};this.bottom=this.top+this.height;this.right=
this.left+this.width;this.getClasses=function(){return k.element.className?k.element.className.split(" "):[]};this.setClass=function(b){k.element.className=b.trim()};this.addClass=function(b){var g=(k.element.className||"").split(" ");g.intersection(b).length==0&&g.push_back(b);k.element.className=g.join(" ")};this.removeClass=function(b){var g=(k.element.className||"").split(" ");b=g.find(b);if(b!=-1)g=g.remove(b);k.element.className=g.join(" ")};this.hasClass=function(b){return(k.element.className||
"").split(" ").find(b)==-1?false:true};this.setContent=function(b){k.element.innerHTML=b};this.setWidth=function(b){k.element.style.width=b+"px"};this.setHeight=function(b){k.element.style.height=b+"px"};this.isChildOf=function(b){for(var g=false,n=k.element;n=n.offsetParent;)if(n.id==b)g=true;return g}}
var wp_Form=function(e){var l=this,k=null,b={id:e.id?e.id:"",count:typeof e.count!="undefined"?e.count:null},g=[];try{var n=new wp_Log}catch(i){n={};n.log=function(){}}this._function="wp_Form";this.debug=n;!b.id&&!b.count&&n.log(l,"FATAL! id is missing");this.init=function(){for(var c=l.form(),d=0;d<g.length;d++)if(c[g[d].name]){c[g[d].name].value=g[d].text;c[g[d].name].onfocus=Function("if( this.value == '"+g[d].text+"' ) {this.value = '';}");c[g[d].name].onblur=Function("if( this.value == '' ) {this.value = '"+
g[d].text+"';}")}};if(document.addEventListener)window.addEventListener("load",l.init,true);else if(document.attachEvent)window.attachEvent("onload",l.init);else window.onload=this.init;this.addPlaceHolder=function(c){g.push_back({name:c.name||c.field,text:c.text||c.value})};this.get=function(c){if(!c)return null;c=l.form()[c];var d,f=null;if(c&&c.length&&c.length>1){d=0;d=c.type?c.type:c[0].type;f=[];switch(d){case "checkbox":case "radio":for(d=0;d<c.length;d++)c[d].checked&&c[d].value.length&&f.push_back(c[d].value);
break;case "hidden":case "password":case "text":case "textarea":for(d=0;d<c.length;d++)c[d].value.length&&f.push_back(c[d].value);break;case "select":case "select-one":f.push_back(c.options[c.selectedIndex].value);break;case "select-multiple":for(d=0;d<c.length;d++)c.options[d].selected&&c.options[d].value.length&&f.push_back(c.options[d].value);break}}else if(c){d=c.type;switch(d){case "checkbox":case "radio":f=c.checked?c.value:"";break;case "hidden":case "password":case "text":case "textarea":f=
c.value;break;case "select":case "select-one":try{f=c.options[c.selectedIndex].value}catch(j){f=""}break;case "select-multiple":f=c.options[0].selected?c.options[0].value:""}}return f};this.set=function(c,d){var f=l.form()[c],j;if(typeof d=="string")d=new Array(d);if(f){j=f.type?f.type:f[0].type;n.log(l,"setting value of: "+c+" to: '"+d+"'");switch(j){case "checkbox":case "radio":if(f.length)for(c=0;c<f.length;c++)f[c].checked=d.find(f[c].value)!=-1?true:false;else f.checked=d.find(f.value)!=-1?true:
false;break;case "hidden":case "password":case "text":case "textarea":if(f.length)for(c=0;c<f.length;c++)f[c].value=d[0];else f.value=d[0];break;case "select":case "select-one":case "select-multiple":for(c=0;c<f.options.length;c++)f.options[c].selected=d.find(f.options[c].value)!=-1?true:false;break}}};this.disable=function(c){var d=l.form().elements;if(typeof c!="undefined"){c=c.split(",");for(var f=[],j=0;j<d.length;j++)c.find(d[j].name)!=-1&&f.push_back(d[j]);d=f}c=d.length;for(j=0;j<c;j++)d[j].disabled=
true};this.enable=function(c){var d=l.form().elements;if(typeof c!="undefined"){c=c.split(",");for(var f=[],j=0;j<d.length;j++)c.find(d[j].name)!=-1&&f.push_back(d[j]);d=f}c=d.length;for(j=0;j<c;j++)d[j].disabled=false};this.submit=function(){l.form().submit()};this.reset=function(){l.form().reset()};this.form=function(){if(k)return k;else if(b.count!=null)k=document.forms[b.count];else if(b.id){for(var c=document.getElementsByTagName("form"),d=0;d<c.length;){n.log(l,"scanning forms, index: "+d);
if(c[d]==document.getElementById(b.id)){n.log(l,"found!");k=c[d];break}d++}if(!k&&b.name)k=document[b.name]}return k};this.collect=function(c){document[b.id]||n.log(l,"FATAL! form is missing");var d=l.form(),f=d.length,j="",s={},o=["input","textarea","select"],h="";if(c&&c.lastIndexOf("*")==c.length-1)h=c.substring(0,c.length-1);n.log(l,"form length: "+f);for(var m=0;m<f;m++)if(o.find(d[m].tagName.toLowerCase())!=-1)if(j=d[m].name?d[m].name:d[m][0].name)if(!c||c==j||h&&j.indexOf(h)==0)if(typeof s[j]==
"undefined"){s[j]=l.get(j);n.log(l,"name: "+j+", value: "+s[j])}return s}},wp_FormValidator=function(e){function l(){if(f.id)for(var h=document.getElementsByTagName("form"),m=0;m<h.length;){if(h[m]==document.getElementById(f.id))return h[m];m++}return document[f.name]}function k(h,m,p){if(document.addEventListener)h.addEventListener(m,p,true);else if(document.attachEvent)h.attachEvent("on"+m,p);else h["on"+m]=p}function b(h,m,p){if(document.removeEventListener)h.removeEventListener(m,p,true);else if(document.detachEvent)h.detachEvent("on"+
m,p);else h["on"+m]=null}function g(h,m){j.log(i,"find event: "+h+", "+m);var p=null,r=0;do{if(d[r].event==m&&d[r].field==h)p=d[r];r++}while(!p&&r<d.length);p.element=l()[p.field];return p}function n(h,m){if(typeof h!="undefined")m=h?m:!m;return m}var i=this,c=[],d=[];this.initWatchInterval=this.form=null;var f=e;try{var j=new wp_Log}catch(s){j={};j.log=function(){}}this._function="wp_FormValidator";this.debug=j;var o=new this.validator(e.id,i);this.execEvent=function(h){h=h?h:window.event;h=g((h.srcElement?
h.srcElement:h.target).name,h.type);var m=true;if(h.condition&&o[h.condition.type])m=o[h.condition.type](h.condition);m&&h.func(h)};this.addCondition=function(h){if(o[h.type]&&h.field)c[c.length]=h;else j.log(i,"addCondition(), missing or invalid argument ('field' or 'type').")};this.registerCustomValidation=function(h){o[h.type]=h.func};this.registerEvent=function(h){if(h.event&&h.func)d[d.length]=h;else j.log(i,"registerEvent(), missing or invalid argument ('event' or 'func').")};this.validate=
function(){j.log(i,"validating...");for(var h=true,m=true,p=0;h&&p<c.length;){j.log(i,"condition: '"+c[p].type+"' on field: '"+c[p].field+"'");m=true;if(c[p].condition){j.log(i,"checking conditions...");m=o[c[p].condition.type](c[p].condition)?true:false;m=n(c[p].condition["boolean"],m)}if(m)if(o[c[p].type]){h=o[c[p].type](c[p])?true:false;h=n(c[p]["boolean"],h)}else j.log(i,"unknown condition: '"+c[p].type+"'");p++}j.log(i,"validating result: "+h);if(!h&&e.onerror){c[p-1].element=l()[c[p-1].field];
return e.onerror(c[p-1])}if(h&&e.onsuccess)return e.onsuccess();return h};this.init=function(){j.log(i,"initializing form: "+f.id);i.form=l();if(i.form){if(e.autovalidate!=false)i.form.onsubmit=i.validate;for(var h=0;h<d.length;h++){var m=i.form[d[h].field];if(parseInt(d[h].index)==d[h].index&&m[d[h].index])m=m[d[h].index];k(m,d[h].event,i.execEvent)}}else j.log(i,"form: '"+f.id+"' does not exist.")};this.initWatch=function(){if(document.getElementById(f.id)&&!i.form){i.init();clearInterval(initWatchInterval);
b(window,"load",i.init)}};if(document.getElementById(f.id))this.init();else{k(window,"load",i.init);initWatchInterval=setInterval(i.initWatch,10)}};
wp_FormValidator.prototype.validator=function(e,l){var k=new wp_Form({id:e});this._function="wp_FormValidator";this.debug=l.debug;this.email=function(b){b=k.get(b.field);var g=false;if(b.isEmail()||!b.length)g=true;return g};this.empty=function(b){var g=false;if(k.get(b.field).length==0)g=true;return g};this.equal=function(b){var g=k.get(b.field),n=false;if(g==b.value||!g.length)n=true;return n};this.mandatory=function(b){var g=false;if(k.get(b.field).length)g=true;return g};this.match=function(b){var g=
k.get(b.field),n=false;if(g.isMatch(b.value)||!g.length)n=true;return n};this.pattern=function(b){var g=k.get(b.field),n=false;if(g.isPattern(b.value)||!g.length)n=true;return n}};