(function(g){function a(){g.fn.ajaxSubmit.debug&&window.console&&window.console.log&&window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}g.fn.ajaxSubmit=function(m){function r(){function c(){if(!y++){v.detachEvent?v.detachEvent("onload",c):v.removeEventListener("load",c,false);var D=true;try{if(A)throw"timeout";var B,C;C=v.contentWindow?v.contentWindow.document:v.contentDocument?v.contentDocument:v.document;var H=o.dataType=="xml"||C.XMLDocument||g.isXMLDoc(C);a("isXml="+
H);if(!H&&(C.body==null||C.body.innerHTML=="")){if(--G){y=0;setTimeout(c,100);return}a("Could not access iframe DOM after 50 tries.");return}u.responseText=C.body?C.body.innerHTML:null;u.responseXML=C.XMLDocument?C.XMLDocument:C;u.getResponseHeader=function(F){var I={"content-type":o.dataType};return I[F]};if(o.dataType=="json"||o.dataType=="script"){var J=C.getElementsByTagName("textarea")[0];if(J)u.responseText=J.value;else{var x=C.getElementsByTagName("pre")[0];if(x)u.responseText=x.innerHTML}}else if(o.dataType==
"xml"&&!u.responseXML&&u.responseText!=null)u.responseXML=j(u.responseText);B=g.httpData(u,o.dataType)}catch(E){D=false;g.handleError(o,u,"error",E)}if(D){o.success(B,"success");w&&g.event.trigger("ajaxSuccess",[u,o])}w&&g.event.trigger("ajaxComplete",[u,o]);w&&!--g.active&&g.event.trigger("ajaxStop");if(o.complete)o.complete(u,D?"success":"error");setTimeout(function(){t.remove();u.responseXML=null},100)}}function j(D,B){if(window.ActiveXObject){B=new ActiveXObject("Microsoft.XMLDOM");B.async="false";
B.loadXML(D)}else B=(new DOMParser).parseFromString(D,"text/xml");return B&&B.documentElement&&B.documentElement.tagName!="parsererror"?B:null}var k=i[0];if(g(":input[name=submit]",k).length)alert('Error: Form elements must not be named "submit".');else{var o=g.extend({},g.ajaxSettings,m),p=g.extend(true,{},g.extend(true,{},g.ajaxSettings),o),q="jqFormIO"+(new Date).getTime(),t=g('<iframe id="'+q+'" name="'+q+'" src="about:blank" />'),v=t[0];t.css({position:"absolute",top:"-1000px",left:"-1000px"});
var u={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;t.attr("src","about:blank")}},w=o.global;w&&!g.active++&&g.event.trigger("ajaxStart");w&&g.event.trigger("ajaxSend",[u,o]);if(p.beforeSend&&p.beforeSend(u,p)===false)p.global&&g.active--;else if(!u.aborted){var y=0,A=0;if(p=k.clk){var z=p.name;if(z&&!p.disabled){m.extraData=m.extraData||{};m.extraData[z]=
p.value;if(p.type=="image"){m.extraData[name+".x"]=k.clk_x;m.extraData[name+".y"]=k.clk_y}}}setTimeout(function(){var D=i.attr("target"),B=i.attr("action");k.setAttribute("target",q);k.getAttribute("method")!="POST"&&k.setAttribute("method","POST");k.getAttribute("action")!=o.url&&k.setAttribute("action",o.url);m.skipEncodingOverride||i.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});o.timeout&&setTimeout(function(){A=true;c()},o.timeout);var C=[];try{if(m.extraData)for(var H in m.extraData)C.push(g('<input type="hidden" name="'+
H+'" value="'+m.extraData[H]+'" />').appendTo(k)[0]);t.appendTo("body");v.attachEvent?v.attachEvent("onload",c):v.addEventListener("load",c,false);k.submit()}finally{k.setAttribute("action",B);D?k.setAttribute("target",D):i.removeAttr("target");g(C).remove()}},10);var G=50}}}if(!this.length){a("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof m=="function")m={success:m};var e=g.trim(this.attr("action"));if(e)e=(e.match(/^([^#]+)/)||[])[1];e=e||window.location.href||
"";m=g.extend({url:e,type:this.attr("method")||"GET"},m||{});e={};this.trigger("form-pre-serialize",[this,m,e]);if(e.veto){a("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(m.beforeSerialize&&m.beforeSerialize(this,m)===false){a("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var b=this.formToArray(m.semantic);if(m.data){m.extraData=m.data;for(var h in m.data)if(m.data[h]instanceof Array)for(var f in m.data[h])b.push({name:h,value:m.data[h][f]});else b.push({name:h,
value:m.data[h]})}if(m.beforeSubmit&&m.beforeSubmit(b,this,m)===false){a("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[b,this,m,e]);if(e.veto){a("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}h=g.param(b);if(m.type.toUpperCase()=="GET"){m.url+=(m.url.indexOf("?")>=0?"&":"?")+h;m.data=null}else m.data=h;var i=this,n=[];m.resetForm&&n.push(function(){i.resetForm()});m.clearForm&&n.push(function(){i.clearForm()});if(!m.dataType&&
m.target){var d=m.success||function(){};n.push(function(c){g(m.target).html(c).each(d,arguments)})}else m.success&&n.push(m.success);m.success=function(c,j){for(var k=0,o=n.length;k<o;k++)n[k].apply(m,[c,j,i])};f=g("input:file",this).fieldValue();h=false;for(e=0;e<f.length;e++)if(f[e])h=true;f=false;if(m.iframe||h||f)m.closeKeepAlive?g.get(m.closeKeepAlive,r):r();else g.ajax(m);this.trigger("form-submit-notify",[this,m]);return this};g.fn.ajaxForm=function(m){return this.ajaxFormUnbind().bind("submit.form-plugin",
function(){g(this).ajaxSubmit(m);return false}).bind("click.form-plugin",function(r){var e=g(r.target);if(e.is(":submit,input:image")){var b=this;b.clk=r.target;if(r.target.type=="image")if(r.offsetX!=undefined){b.clk_x=r.offsetX;b.clk_y=r.offsetY}else if(typeof g.fn.offset=="function"){e=e.offset();b.clk_x=r.pageX-e.left;b.clk_y=r.pageY-e.top}else{b.clk_x=r.pageX-r.target.offsetLeft;b.clk_y=r.pageY-r.target.offsetTop}setTimeout(function(){b.clk=b.clk_x=b.clk_y=null},10)}})};g.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};
g.fn.formToArray=function(m){var r=[];if(this.length==0)return r;var e=this[0],b=m?e.getElementsByTagName("*"):e.elements;if(!b)return r;for(var h=0,f=b.length;h<f;h++){var i=b[h],n=i.name;if(n)if(m&&e.clk&&i.type=="image"){if(!i.disabled&&e.clk==i){r.push({name:n,value:g(i).val()});r.push({name:n+".x",value:e.clk_x},{name:n+".y",value:e.clk_y})}}else if((i=g.fieldValue(i,true))&&i.constructor==Array)for(var d=0,c=i.length;d<c;d++)r.push({name:n,value:i[d]});else i!==null&&typeof i!="undefined"&&
r.push({name:n,value:i})}if(!m&&e.clk){m=g(e.clk);b=m[0];if((n=b.name)&&!b.disabled&&b.type=="image"){r.push({name:n,value:m.val()});r.push({name:n+".x",value:e.clk_x},{name:n+".y",value:e.clk_y})}}return r};g.fn.formSerialize=function(m){return g.param(this.formToArray(m))};g.fn.fieldSerialize=function(m){var r=[];this.each(function(){var e=this.name;if(e){var b=g.fieldValue(this,m);if(b&&b.constructor==Array)for(var h=0,f=b.length;h<f;h++)r.push({name:e,value:b[h]});else b!==null&&typeof b!="undefined"&&
r.push({name:this.name,value:b})}});return g.param(r)};g.fn.fieldValue=function(m){for(var r=[],e=0,b=this.length;e<b;e++){var h=this[e];h=g.fieldValue(h,m);h===null||typeof h=="undefined"||h.constructor==Array&&!h.length||(h.constructor==Array?g.merge(r,h):r.push(h))}return r};g.fieldValue=function(m,r){var e=m.name,b=m.type,h=m.tagName.toLowerCase();if(typeof r=="undefined")r=true;if(r&&(!e||m.disabled||b=="reset"||b=="button"||(b=="checkbox"||b=="radio")&&!m.checked||(b=="submit"||b=="image")&&
m.form&&m.form.clk!=m||h=="select"&&m.selectedIndex==-1))return null;if(h=="select"){h=m.selectedIndex;if(h<0)return null;r=[];m=m.options;e=(b=b=="select-one")?h+1:m.length;for(h=b?h:0;h<e;h++){var f=m[h];if(f.selected){var i=f.value;i||(i=f.attributes&&f.attributes.value&&!f.attributes.value.specified?f.text:f.value);if(b)return i;r.push(i)}}return r}return m.value};g.fn.clearForm=function(){return this.each(function(){g("input,select,textarea",this).clearFields()})};g.fn.clearFields=g.fn.clearInputs=
function(){return this.each(function(){var m=this.type,r=this.tagName.toLowerCase();if(m=="text"||m=="password"||r=="textarea")this.value="";else if(m=="checkbox"||m=="radio")this.checked=false;else if(r=="select")this.selectedIndex=-1})};g.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};g.fn.enable=function(m){if(m==undefined)m=true;return this.each(function(){this.disabled=!m})};g.fn.selected=
function(m){if(m==undefined)m=true;return this.each(function(){var r=this.type;if(r=="checkbox"||r=="radio")this.checked=m;else if(this.tagName.toLowerCase()=="option"){r=g(this).parent("select");m&&r[0]&&r[0].type=="select-one"&&r.find("option").selected(false);this.selected=m}})}})(jQuery);(function(){var g=this,a=jQuery,m;a.create=function(b){var h=b;b=h&&h.tagName?h.tagName:"div";var f=b=document.createElement(b),i,n,d=h.repeat;h.type&&f.setAttribute("type",h.type);if(h)for(i in h)if(/(tagName|appendChildren|type|repeat)/.test(i)){if(i==="appendChildren")if(typeof h[i]==="object"&&h[i].length)for(n=0;n<h[i].length;n+=1)f.appendChild(a.create(h[i][n]));else typeof h[i]==="object"&&f.appendChild(a.create(h[i]))}else if(typeof f.style[i]==="string")f.style[i]=h[i];else f[i]=h[i];if(d){h=
document.createDocumentFragment();for(n=0;n<d;n+=1){i=b.cloneNode(true);h.appendChild(i)}b=h}return b};m=a.create;a.log=function(b){if(g.console&&g.console.debug)console.debug(arguments);else g.console&&g.console.log?console.log(arguments):alert(b)};var r={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e={array:function(b){var h=["["],f,i,n,d=b.length,c;for(n=0;n<d;n+=1){c=b[n];if(i=e[typeof c]){c=i(c);if(typeof c=="string"){if(f)h[h.length]=",";h[h.length]=
c;f=true}}}h[h.length]="]";return h.join("")},"boolean":function(b){return String(b)},"null":function(){return"null"},number:function(b){return isFinite(b)?String(b):"null"},object:function(b){if(b){if(b instanceof Array)return e.array(b);var h=["{"],f,i,n,d;for(n in b){d=b[n];if(i=e[typeof d]){d=i(d);if(typeof d=="string"){if(f)h[h.length]=",";h.push(e.string(n),":",d);f=true}}}h[h.length]="}";return h.join("")}return"null"},string:function(b){if(/["\\\x00-\x1f]/.test(b))b=b.replace(/([\x00-\x1f\\"])/g,
function(h,f){if(h=r[f])return h;h=f.charCodeAt();return"\\u00"+Math.floor(h/16).toString(16)+(h%16).toString(16)});return'"'+b+'"'}};a.toJSON=function(b){var h=isNaN(b)?e[typeof b]:e.number;if(h)return h(b)};a.parseJSON=function(b,h){if(h===undefined)h=a.parseJSON.safe;if(!(h&&!/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(b)))return eval("("+b+")")};a.parseJSON.safe=false;g.JSON={eval:function(b){return b},stringify:function(b){return a.toJSON(b)}};a.customHover=function(b,
h){var f=h?h:"omo";a(b).live("mouseover",function(){a(this).addClass(f)}).live("mouseout",function(){a(this).removeClass(f)})};a.uniqueId=function(b){var h=0;if(document.getElementById(b+h))for(;document.getElementById(b+h);)h+=1;return b=b+h};a.customConfirm=function(b,h,f){var i=false,n=a.uniqueId(h?h:"ui_");if(!b)throw new Error("'confirmText' is not specified");if(typeof b!=="string")throw new Error(b+" is not a string");if(typeof h!=="string")throw new Error(h+" is not a string");if(!f||typeof f!==
"object")f={height:"auto",width:"auto"};document.getElementById(n)||a("body").append(m({id:n,appendChildren:[{className:"box",appendChildren:[{tagName:"p",fontWeight:"bold",innerHTML:b},{className:"buttonRow",textAlign:"center",margin:"0",appendChildren:[{tagName:"button",className:"small",id:"ok_"+n+"_btn",innerHTML:a.store.common.deletetext},{tagName:"button",className:"small",id:"cancel_"+n+"_btn",innerHTML:a.store.common.cancel}]}]}]}));a("#"+n).dialog({autoOpen:true,closeText:"",modal:true,width:f.width?
f.width:"auto",height:f.height?f.height:"auto",open:function(){var d=function(){a("#ok_"+n+"_btn").unbind("click");a("#cancel_"+n+"_btn").unbind("click");a(".ui-widget-overlay").unbind("click")};a("#ok_"+n+"_btn").click(function(){d();a("#aspnetForm").submit()});a(".ui-widget-overlay, #cancel_"+n+"_btn").click(function(){a("#"+n).dialog("close");d()})}});a("#"+n).css({minHeight:0}).parent().css({minHeight:0});a("#"+n).dialog("open");return i};a.fn.extend({normalize:function(){a(this).each(function(){var b=
this,h=b.childNodes,f;for(f=h.length-1;f>-1;f-=1)h[f].tagName||b.removeChild(h[f])})},singleElement:function(b){return this.length===1?this[0]:b&&this[b]?this[b]:this},bindMulti:function(b,h){var f=this,i;if(typeof b==="string"){i=b.replace(/\s/g,"").split(",");for(b=0;b<i.length;b+=1)f.live(i[b],h)}return f}});a.alertObject=function(b,h,f){var i,n="";if(a.isArray(b))for(i=0;i<b.length;i+=1)n+=i+" : "+b[i]+"\n ";else if(typeof b==="string")n+=b;else for(i in b)if(!h||typeof b[i]===h||h==="all")if(!f||
typeof b[i]!==f)n+=i+" : "+b[i]+",\n";alert(n.replace(/,\s+$/,""))};a.isIE=/MSIE\s/.test(navigator.userAgent);a.isIE7=/MSIE\s[7]/.test(navigator.userAgent);a.parse=function(b){return parseInt(b,10)?parseInt(b,10):0};a.uniqueName=function(b){var h=0;if(document.getElementsByName(b+h).length)for(;document.getElementsByName(b+h).length;)h+=1;return b=b+h};a.runAll=function(b,h){var f;if(b)for(f in this)if(b==="all"){if((!h||f!==h)&&typeof this[f]==="function")this[f]()}else b&&this[f][b]&&typeof this[f][b]===
"function"&&this[f][b]();else throw new Error("function/method name: $.runAll. A methodName has to be specified");};a.addInit=function(){var b=this,h;for(h in b)b[h].init||function(){b[h].init=function(){a.runAll.apply(this,["all","init","submit"])}}()};a.runFunction=function(){var b=arguments[0],h=[],f,i=arguments[arguments.length-1];for(f=1;f<arguments.length-1;f+=1)h.push(arguments[f]);if(b.length||!b.length&&b.length!==0)for(f=0;f<b.length;f+=1)i.apply(b[f],h);else i.apply(b,h)};a.getLang=function(){var b=
a("meta[http-equiv='Content-Language']").attr("content"),h,f;if(!b){h=a("meta");for(f=0;f<h.length;f+=1)if(h[f].httpEquiv&&h[f].httpEquiv==="Content-Language"){b=h[f].content;break}}return b};a.translate=function(b,h,f,i){var n=typeof b==="object"?b:document.getElementById(b),d=a.getLang();b=new JsonServerObject;b.translate(h,d,function(c){c=a.parseJSON(c);if(!f||!/^(innerHTML|title|alt)$/.test(f)||f==="innerHTML")n.innerHTML=c.result;else if(f==="title")n.title=c.result;else if(f==="alt")n.alt=c.result;
if(typeof f==="function")i=f;i&&i.call(n)})};a.objectWalk=function(b,h,f){var i;f=f?f:[];if(typeof h!=="function")throw new Error("file: custom.js, Error: "+h+" is not a function");h.apply(b,f);for(i in b)b[i]&&typeof b[i]==="object"&&!b[i].length&&b[i].length!==0&&a.objectWalk(b[i],h,f)};a.addFunction=function(b,h,f){var i=arguments;a.objectWalk(b,function(){this[h]||(this[h]=f)},i)};a.fn.bindEvent=function(b){var h=b.event;b=b.callback;var f=b.length,i,n;for(n=0;n<f;n+=1){i=b[n];a(this).bind(h,
i,function(d){try{d.data.n[d.data.f](arguments)}catch(c){}})}};a.fn.stripTags=function(){return this.html().replace(/<\/?[^>]+>/gi,"")};a.fn.toggleText=function(b,h){return this.each(function(){a(this).text(a(this).text()==b?h:b)})};a.stripHTML=function(b){return b.replace(/(<[\/]?([hH][1-6]|[a-zA-Z]+)(\s[a-zA-Z]+(\=[^>]+)?)?(>))/g,"")};a.fn.ajaxFileUpload=function(b){var h=a(this),f=a.uniqueId(h.attr("id")),i=typeof b.submit!=="undefined"?b.submit:h.attr("id")+"_btn",n=typeof b.onStart!=="undefined"?
b.onStart:false;document.getElementById("aspnetForm");var d=b.elements?b.elements:h,c=b.ignoreTypes?b.ignoreTypes.replace(/\s/g,"").replace(/,/g,"|"):"",j=b.acceptMedia?b.acceptMedia.replace(/\s/g,"").replace(/\./g,"\\.").replace(/,/g,"|"):"",k,o;a.extend(true,h,b);if(h.attr("type")!=="file")throw new Error("Elem is not input of type file");else if(a("#"+i).length){h.form=function(p){p=a('<form action="'+h.url+'" method="POST" name="'+p+'" id="'+p+'" enctype="multipart/form-data"></form>');p.css({left:"-9999px",
position:"absolute",top:"-9999px"});return p}(f);a("#"+i).click(function(p){p.preventDefault();if(h.val()!==""){n&&n(this);a("#"+h.formId).html("");var q=h.clone(),t=h.form,v,u,w=function(A){v=A.cloneNode(true);if(!v.value)v.value=A.value;t.append(v)},y=[];h.before(q);h.appendTo(t);for(p=0;p<d.length;p+=1){if(c){u=new RegExp("^("+c+")$");u.test(d[p].type)||w(d[p])}else w(d[p]);/^file$/i.test(d[p].type)&&y.push(d[p])}if(j)for(p=0;p<y.length;p+=1){u=new RegExp("("+j+")$","i");if(!u.test(y[p].value)){k=
y[p].value.match(/[a-zA-Z0-9]+$/g);o=k+" is not a supported media format";throw new Error(o);}}t.appendTo("body");a(t).attr("action",h.url);a(t).ajaxSubmit({success:function(A){h.form.remove();h.success(A,q)}})}})}else throw new Error("No submit button is specified, standard is elem id + _btn");};a.fn.outerSize=function(){var b=a(this),h=b.height()+parseInt(b.css("marginTop"),10)+parseInt(b.css("marginBottom"),10)+parseInt(b.css("paddingTop"),10)+parseInt(b.css("paddingBottom"),10);b=b.height()+parseInt(b.css("marginLeft"),
10)+parseInt(b.css("marginRight"),10)+parseInt(b.css("paddingLeft"),10)+parseInt(b.css("paddingRight"),10);return{height:h,width:b}};a.widget("ui.addResultList",{_init:function(){var b;this.template=typeof this.options.template!=="undefined"?this.options.template:a("<ul></ul>");typeof this.options.methods!=="undefined"&&a.extend(true,this,this.options.methods);this.template.addClass(this.options.className);this.template.attr("id",this.options.id);this.inputId=typeof this.options.inputId==="undefined"?
this.template.attr("id")+"_inputid":this.options.inputId;this.template.css({display:"none",position:"absolute",zIndex:"10"});this.keyListner=false;modalObjects.push(this.element);a(this.template).hover(function(){mouse_is_inside=true},function(){mouse_is_inside=false});if(typeof this.options.inputId==="undefined"){this.input=a('<input type="hidden" />');this.input.attr("id",this.inputId);this.input.attr("name",this.inputId+"_inputid");a(this.element).after(this.input)}a(this.element).after(this.template);
if(this.options.positionOutside===true){b=this.template.show().offset();this.left=b.left;this.template.css({left:this.left+"px"});a(this.template).hide()}},addListItemSelected:function(b){return'<li id="result_'+b.id+'" class="selected"><a href="javascript:void(0)">'+b.name+"</a></li>"},addListItem:function(b){return'<li id="result_'+b.id+'"><a href="javascript:void(0)">'+b.name+"</a></li>"},updateList:function(b){b=b.result;var h=b.length,f=this.template.get(0).tagName!=="UL"?this.template.find("ul"):
this.template,i,n;f.html("");for(n=0;n<h;n+=1){i=b[n];n===0?f.append(this.addListItemSelected(i)):f.append(this.addListItem(i))}},_addKeyEvents:function(){var b=this,h,f,i=0;this.keyListner=true;this.element.keydown(function(n){f=b.template.get(0).tagName!=="UL"?b.template.find("ul"):b.template;h=f.find(".selected");i=f.find("li:first").outerSize().height*2;if(f.is(":visible")&&(n.keyCode===40||n.keyCode===38)){if(n.keyCode===40){if(h.is(":last-child"))return;h.next("li").addClass("selected");i+=
h.next("li").outerSize().height}else if(n.keyCode===38){if(h.is(":first-child"))return;h.prev("li").addClass("selected")}h.prevAll().each(function(d,c){i+=a(c).outerSize().height});i-=b.template.height();f.get(0).scrollTop=i;h.removeClass("selected")}if(n.keyCode===13){n.preventDefault();n.stopPropagation&&n.stopPropagation();b.onSelect(h);b.close();return false}});a("#"+this.options.id+" li a").live("click",function(n){n.preventDefault();b.onClick(this);b.close()});this.template.find("li a").live("mouseover",
function(){b.template.find("li").removeClass("selected");a(this.parentNode).addClass("selected")})},onSelect:function(b){a("#"+this.inputId).val(b.attr("id").split("_")[1]);this.element.val(b.find("a").html())},onClick:function(b){a("#"+this.inputId).val(a(b.parentNode).attr("id").split("_")[1]);this.element.val(a(b).html())},checkListHeight:function(b){var h=a(this.template).find("ul").length?a(this.template).find("ul"):a(this.template),f=h.find("li:first").height()*6===0?100:h.find("li:first").height()*
6;b>6?h.css({height:f+"px"}):h.css({height:"auto"})},open:function(b){this.template.get(0).scrollTop=0;if(b.data.result.length){this.updateList(b.data);this.keyListner||this._addKeyEvents();if(this.options.positionOutside===true){offset=this.template.show().offset();this.template.css({position:"absolute",top:parseInt(offset.top,10)+"px"});a("body").append(this.template)}else{this.template.css({position:"absolute",top:"auto"});this.template.show()}this.checkListHeight(b.data.result.length)}else this.close()},
close:function(){a(this.element).after(this.template);this.template.css({position:"static",top:"0px"});this.template.hide()},destroy:function(){this.close();this.element.unbind("keydown");a(this.template).remove();this.input&&a(this.input).remove()}});a.j=function(b,h){var f=[],i=[],n,d=false,c=false,j=b.split(" "),k,o,p,q,t,v;k=function(u,w){d?f.push(u):f.push(u[w])};o=function(u,w,y){if(typeof w=="array"||typeof w.length=="number")for(t=0;t<w.length;t++)c&&w[t]==n?k(w,t):o(u,w[t],y);else if(typeof w==
"object")for(v in w)if(typeof v!="undefined")if(!y&&!c&&v==u&&typeof w[v]!="string")i.push(w[v]);else if(!c&&v==u&&y)k(w,v);else if(c&&v==u&&w[v]==n)k(w,v);else if(typeof w[v]=="object"||typeof w[v]=="array")o(u,w[v],y)};t=0;for(l=j.length;t<l;t++){b=j[t];if(b.indexOf(":")!=-1){d=true;b=b.substring(0,b.indexOf(":"))}p=/\[[a-zA-Z]+\]/;if(c=p.test(b)){n=b.substring(p.exec(b).index+1,b.length-1);b=b.substring(0,p.exec(b).index)}p=t==l-1&&i.length!=0?i:h;q=t==l-1?true:false;o(b,p,q)}return f.length==
1?f[0]:f};a.translateNode=function(b,h,f){var i=a.getLang(),n;n=b.replace(/(^\/|\/$)/g,"").split("/");var d,c,j=[];a.translateQue=typeof a.translateQue==="undefined"?[]:a.translateQue;if(f)for(d=0;d<n.length;d+=1)c=c?c[n[d]]:a.store[n[d]];else{for(d=0;d<arguments.length;d+=1)j.push(arguments[d]);j.push(true);a.translateQue.push(j);if(!a.store)a.store={};for(d=0;d<n.length;d+=1)if(c){if(c&&!c[n[d]])c=c[n[d]]={}}else{a.store[n[d]]||(a.store[n[d]]={});c=a.store[n[d]]}}if(a.translateQueRuns)return false;
a.translateQueRuns=true;n=new JsonServerObject;n.translateNode(b,i,function(k){k=a.parseJSON(k);var o;if(k&&k.result){for(o in k.result)if(typeof k.result[o]==="string")c[o]=k.result[o];typeof h==="function"&&h()}a.translateQueRuns=false;a.translateQue.shift();a.translateQue.length>=1&&a.translateNode.apply(a.translateNode,a.translateQue[0])});return true};a.translateNode("common");a("button, input[type=submit], input[type=button], input[type=reset], a, select").bindMulti("mouseover, focus, click",
function(){a.lastClick=this})})();var mouse_is_inside=false,modalObjects=[];$(document).ready(function(){$("body").mouseup(function(){if(!mouse_is_inside){var g;g=0;for(l=modalObjects.length;g<l;g+=1)$(modalObjects[g]).addResultList("close")}})});(function(){var g=this,a=jQuery,m,r,e,b,h;e={addButtonHrefEvent:function(){a(".btnHref").click(function(){document.location.href=a(this).attr("id")})},addLoginDialogEvent:function(){a("#login_dialog_button").live("click",function(){a.view.user.doLogin()});a("#show_new_user_window").live("click",function(){a("#login_window").addClass("hidden");a("#new_user_window").removeClass("hidden")});a(".userActivated_dialog_btn").click(function(){a.view.user.openUserLogin()});a(".forgot_password_open").click(function(f){f.preventDefault();
a("#forgot_password_dialog").dialog("open")});a.isIE&&a(".userLogin input[id$=username], .userLogin input[id$=password]").keydown(function(f){var i=f.charCode||f.keyCode||f.which;if(i===13){f.preventDefault();a(".userLogin input[id$=btnLogin]").trigger("click")}})},addSearchEvents:function(){a("input[id$=tbQuickSearch]").keydown(function(f){var i=f.charCode||f.keyCode||f.which;if(i===13){f.preventDefault();a(this).val().toLowerCase()==="lemmings"?a.lemmings.init():a("button.butQuickSearch").trigger("click")}});
a("#wordlistSearch input").keydown(function(f){var i=f.charCode||f.keyCode||f.which;if(i===13){f.preventDefault();a("#ctl00_FullRegion_MainRegion_ctl02_btnWordSearch").trigger("click")}})},addAutoCompleteAttr:function(){a("input:text, input:password").each(function(){a(this).attr("autocomplete")||a(this).attr("autocomplete","off")})},form:{addImageUploadEvents:function(){a(".image_product_name").each(function(f,i){r.form.addNewResultList(a(i),f)});a(".image_add_product").each(function(f,i){r.form.addNewProductLink(a(i))});
a(".image_product_data .delete_link").click(function(){r.form.deleteProductLink(a(this))});a(".imageRow .move_up").live("click",function(){if(!a(this).hasClass("disabled")){var f=a(this.parentNode.parentNode.parentNode);a(this.parentNode.parentNode.parentNode).prev().before(f);a(".imageRow h3").each(function(i,n){a(n).html(a.store.ui.usercontrols.addimages.image+(i+1));a.view.form.toggleUpDown(i,n)})}});a(".imageRow .move_down").live("click",function(){if(!a(this).hasClass("disabled")){var f=a(this.parentNode.parentNode.parentNode);
a(this.parentNode.parentNode.parentNode).next().after(f);a(".imageRow h3").each(function(i,n){a(n).html(a.store.ui.usercontrols.addimages.image+(i+1));a.view.form.toggleUpDown(i,n)})}});a(".imageRow .move_delete_ajax_uploaded").live("click",function(){a(this.parentNode.parentNode.parentNode).remove();a(".imageRow h3").each(function(f,i){a(i).html(a.store.ui.usercontrols.addimages.image+(f+1));a.view.form.toggleUpDown(f,i)});m.jso.removeImage(parseInt(a(this.parentNode.parentNode).find(".image_container img").attr("alt"),
10))})},addImageSubmitEvent:function(){a(".addImagesForm").length&&a("#aspnetForm").submit(function(){if(!a("#imageJSONObject").length){var f={};f.images=[];a(".imageRow img").each(function(i,n){f.images.push({id:n.alt,text:a(n.parentNode).find("input.image_text").val().replace(/'/g,"&amp;#39;").replace(/"/g,"&amp;quot;"),products:function(d){var c=[];a(d).parent().parent().find(".image_product_data").each(function(j,k){c.push({id:a(k).find("input.image_product_pri").val()?a(k).find("input.image_product_pri").val():
"0",productId:a(k).find("input.image_product_pid").val(),productName:a(k).find("input.image_product_name").val().replace(/'/g,"&amp;#39;").replace(/"/g,"&amp;quot;"),productLink:a(k).find("input.image_product_link").val(),isByggmaxProduct:/^(http:\/\/www\.byggmax\.com)(\/)([a-zA-Z]{2}\-[a-zA-Z]{2})(\/)(Prod)(\/)(PID\-\d+)(\.aspx)$/.test(a(k).find("input.image_product_link").val())})});return c}(n)})});a("form:first").append('<input type="hidden" id="imageJSONObject" name="imageJSONObject" value=\''+
a.toJSON(f)+"' />")}})}},addUpdateSubscriptionEvent:function(){a(".updateSubscription").attr("autocomplete","off").change(function(){var f=this.checked,i=parseInt(a(this).attr("id"),10);m.jso.updateDiscussionSubscription(f,i)})},addNoPostOnEnterEvent:function(){a(".no-post-on-enter").keypress(function(){return!(g.event&&g.event.keyCode==13)})}};r={init:function(){e.addButtonHrefEvent();e.addLoginDialogEvent();e.addSearchEvents();e.addAutoCompleteAttr();e.addUpdateSubscriptionEvent();e.addNoPostOnEnterEvent()},
dialog:{open:function(){var f=a("#standard_dialog").hasClass("userActivated")?false:true;a("#standard_dialog").dialog({autoOpen:f,closeText:"",modal:true,closeOnEscape:false,width:465,open:function(){a("object").hide();var i=a(".ui-widget-overlay"),n=a("div.ui-dialog"),d=document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop?document.documentElement.scrollTop:g.pageYOffset;d||(d=0);a("#close_dialog, #close_dialog_login").click(function(){a("#standard_dialog").dialog("close");
a("body").removeClass("hasOverlay")});a(".ui-widget-overlay").click(function(){a("#standard_dialog").dialog("close");a("#standard_dialog button.goBack").length&&history.back();a("body").removeClass("hasOverlay")});a("#standard_dialog #username, #standard_dialog #password").keydown(function(c){var j=c.charCode||c.keyCode||c.which;if(j===13){c.preventDefault();a("#login_dialog_button").trigger("click")}});a("#standard_dialog #firstname, #standard_dialog #lastname, #standard_dialog #email, #standard_dialog #password1, #standard_dialog #password2").keydown(function(c){var j=
c.charCode||c.keyCode||c.which;if(j===13){c.preventDefault();a("#become_a_member").trigger("click")}});a("#become_a_member").click(function(c){c.preventDefault();a("#standard_dialog #general_error").addClass("hidden");a("#standard_dialog #user_exists_error").addClass("hidden");a("#standard_dialog input, #standard_dialog label").each(function(p,q){a(q).removeClass("error")});c=a("#standard_dialog #firstname").val();var j=a("#standard_dialog #lastname").val(),k=a("#standard_dialog #email").val(),o=
a("#standard_dialog #password1").val();if(c.length<1){a("#standard_dialog label[for=firstname]").addClass("error");a("#standard_dialog #firstname").addClass("error").focus();a("#standard_dialog #general_error").removeClass("hidden")}else if(j.length<1){a("#standard_dialog label[for=lastname]").addClass("error");a("#standard_dialog #lastname").addClass("error").focus();a("#standard_dialog #general_error").removeClass("hidden")}else if(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i.test(k))if(o!==
a("#standard_dialog #password2").val()||o===""||o.length<4){a("#standard_dialog label[for=password1]").addClass("error");a("#standard_dialog #password1").addClass("error").focus();a("#standard_dialog label[for=password2]").addClass("error");a("#standard_dialog #password2").addClass("error");a("#standard_dialog #general_error").removeClass("hidden")}else if(a("#standard_dialog input:checked").length)m.jso.doSignUpAndLogIn(c,j,false,"",k,o,false,r.user.newUser);else{a("#standard_dialog label[for=cbApproved]").addClass("error");
a("#standard_dialog #general_error").removeClass("hidden")}else{a("#standard_dialog label[for=email]").addClass("error");a("#standard_dialog #email").addClass("error").focus();a("#standard_dialog #general_error").removeClass("hidden")}});i.length&&setTimeout(function(){var c=g.screen.height,j=document.body.offsetHeight;a("body").addClass("hasOverlay");j>c?i.css({height:a.parse(j)+"px"}):i.css({height:a.parse(c)+"px"});n.find("input[type=text]:visible").eq(0).focus();n.find("button, input[type=button], input[type=submit], a").live("click",
function(){a(this).attr("id")!=="become_a_member"&&n.find("input[type=text]:visible").eq(0).focus()});if(d||!d&&d===0)scrollTo(0,d)},1)},close:function(){a(".ui-widget-overlay, #become_a_member").unbind("click");a("#standard_dialog #username, #standard_dialog #password").unbind("keydown");a("object").show()}});a("#forgot_password_dialog").dialog({autoOpen:false,closeText:"",modal:true,width:465,open:function(){a("object").hide();a(".ui-widget-overlay");a("div.ui-dialog");a("#close_dialog, #close_forgot_dialog_login").click(function(){a("#forgot_password_dialog").dialog("close");
a("body").removeClass("hasOverlay");a("#close_dialog, #close_forgot_dialog_login").unbind("click")});a("#forgot_password_btn").click(function(i){i.preventDefault();a.view.user.doForgotPassword()});a(".ui-widget-overlay").click(function(){a("#forgot_password_dialog").dialog("close");a(".ui-widget-overlay, #forgot_password_btn").unbind("click");a("#forgot_password_dialog #forgot_pw_email").unbind("keydown");a("#close_dialog, #close_forgot_dialog_login").unbind("click");a("body").removeClass("hasOverlay")});
a("#forgot_password_dialog #forgot_pw_email").keydown(function(i){var n=i.charCode||i.keyCode||i.which;if(n===13){a("#forgot_password_dialog #forgot_pw_email").unbind("keydown");a("body").removeClass("hasOverlay");i.preventDefault();a("#forgot_password_btn").trigger("click");a(".ui-widget-overlay, #forgot_password_btn").unbind("click");a("#close_dialog, #close_forgot_dialog_login").unbind("click")}})},close:function(){a("object").show()}})}},user:{openUserLogin:function(){a("#standard_dialog").length&&
a("#standard_dialog").dialog("open")},doLogin:function(){var f=a("#standard_dialog #username").val(),i=a("#standard_dialog #password").val(),n=a("#standard_dialog #remember_me").get(0).checked;m.jso.doLogin(f,i,n,function(d){d=a.parseJSON(d);if(d.result)document.location.href=document.location.href.replace(/#(\w)+/,"");else{a("#standard_dialog label[for=username]").addClass("error");a("#standard_dialog #username").addClass("error");a("#standard_dialog label[for=password]").addClass("error");a("#standard_dialog #password").addClass("error");
a(".error_message").removeClass("hidden")}})},doForgotPassword:function(){var f=a("#forgot_password_dialog #forgot_pw_email").val();m.jso.doSendPassword(f,function(i){i=a.parseJSON(i);if(i.result)document.location.href=document.location.href;else a(".error_message").removeClass("hidden")})},newUser:function(f){f=a.parseJSON(f);if(f.result)document.location.href=document.location.href;else a("#standard_dialog #user_exists_error").removeClass("hidden")}},form:{resultListIndex:0,addImageUpload:function(){if(a(".imageRow").length&&
a("#addImage_file").length){a.translateNode("ui/usercontrols/addimages");var f=function(i,n){i=a.parseJSON(i);if(!i.success){a(n).parent().find("button").show();a("#spin_loader").remove();a(n).parent().append('<p id="file_upload_error" class="error">'+i.errormessage+"</p>")}var d,c,j=n.get(0).parentNode;n=a(".imageRow").length+1;n="image_file_"+n;var k='<div class="row imageRow"><div class="left corners styleA"><span class="crLeft"><!-- Cheeky corner --\></span><span class="crRight"><!-- Cheeky corner --\></span><div class="move_controller"><a href="javascript:void(0)" class="move_down" title="'+
a.store.ui.usercontrols.addimages.movedown+'">'+a.store.ui.usercontrols.addimages.movedown+'</a><a href="javascript:void(0)" class="move_up" title="'+a.store.ui.usercontrols.addimages.moveup+'">'+a.store.ui.usercontrols.addimages.moveup+'</a><a href="javascript:void(0)" class="move_delete disabled" title="'+a.store.common.remove+'">'+a.store.common.remove+'</a></div><h3></h3><input type="file" name="'+n+'" id="'+n+'"/><button class="large block" id="'+n+'_btn">'+a.store.ui.usercontrols.addimages.uploadimage+
'</button><span class="crLeftBottom"><!-- Cheeky corner --\></span><span class="crRightBottom"><!-- Cheeky corner --\></span></div></div>';for(d in i.images){c=i.images[d];c=a('<span class="crLeft"><!-- Cheeky corner --\></span><span class="crRight"><!-- Cheeky corner --\></span><div class="move_controller"><a href="javascript:void(0)" class="move_down" title="'+a.store.ui.usercontrols.addimages.movedown+'">'+a.store.ui.usercontrols.addimages.movedown+'</a><a href="javascript:void(0)" class="move_up" title="'+
a.store.ui.usercontrols.addimages.moveup+'">'+a.store.ui.usercontrols.addimages.moveup+'</a><a href="javascript:void(0)" class="move_delete move_delete_ajax_uploaded" title="'+a.store.common.remove+'">'+a.store.common.remove+'</a></div><h3></h3><div class="image_container" style="display:none"><img src="'+c.url+'" alt="'+c.id+'" /><label>'+a.store.ui.usercontrols.addimages.imagedescription+':</label><input type="text" class="image_text" /></div><label>'+a.store.ui.usercontrols.addimages.productsheading+
'</label><div class="image_product_links"><div class="image_product_data"><input type="text" class="small image_product_name" /><label>'+a.store.ui.usercontrols.addimages.producturl+': </label><input type="text" class="small image_product_link" /><div class="delete_box"><a href="javascript:void(0)" class="delete_link" title="'+a.store.common.remove+'">'+a.store.common.remove+'</a><input type="hidden" class="image_product_pri" value="0" /><input type="hidden" class="image_product_pid" value="0" /></div></div></div><a href="javascript:void(0)" class="create image_add_product">'+
a.store.ui.usercontrols.addimages.addanotherproduct+'</a><span class="crLeftBottom"><!-- Cheeky corner --\></span><span class="crRightBottom"><!-- Cheeky corner --\></span>');a(j).html("").append(c).find("img:first").load(function(){a(this).parent().slideDown(function(){r.form.addNewResultList(a(j).find(".image_product_name"),a(".image_product_name").length)})})}r.form.addNewProductLink(a(j).find(".image_add_product"));a(j).find(".delete_link").click(function(){r.form.deleteProductLink(a(this))});
a(j.parentNode).after(k);a(".imageRow h3").each(function(o,p){a(p).html(a.store.ui.usercontrols.addimages.image+(o+1));a.view.form.toggleUpDown(o,p)});a("#"+n).ajaxFileUpload({url:"/ui/ajax/addImage.ashx",acceptMedia:"jpg, jpeg, gif, bmp, png",success:f,onStart:function(o){a(o).after('<span id="spin_loader"><img src="/UI/Images/framework/ajax-loader.gif" /></span>');a(o).hide();a("#file_upload_error").remove()}})};a("#addImage_file").ajaxFileUpload({url:"/ui/ajax/addImage.ashx",acceptMedia:"jpg, jpeg, gif, bmp, png",
success:f,onStart:function(i){a(i).after('<span id="spin_loader"><img src="/UI/Images/framework/ajax-loader.gif" /></span>');a(i).hide();a("#file_upload_error").remove()}});e.form.addImageUploadEvents();e.form.addImageSubmitEvent()}},toggleUpDown:function(f,i){f===0?a(i.parentNode).find(".move_up").addClass("disabled"):a(i.parentNode).find(".move_up").removeClass("disabled");f+1===a(".imageRow h3").length?a(i.parentNode).find(".move_down").addClass("disabled"):a(i.parentNode).find(".move_down").removeClass("disabled")},
addNewResultList:function(f){a(f).keyup(function(i){if(i.keyCode===13){i.preventDefault();i.stopPropagation&&i.stopPropagation();return false}if(i.keyCode!==38&&i.keyCode!==40)a(this).val().length>1?m.jso.getProducts(a(this).val(),function(n){a(f).addResultList("open",{data:a.parseJSON(n)})}):a(f).addResultList("close")});a(f).addResultList({className:"related_result_list",id:"related_product_qs"+(this.resultListIndex+=1),positionOutside:true,inputId:false,template:a('<div class="product_link_wrapper rs_pi_outside"><p>Om produkten finns p\u00e5 Byggmax V\u00e4ljer du den nedan f\u00f6r automatisk l\u00e4nkning.</p><ul></ul></div>'),
methods:{addListItemSelected:function(i){return'<li id="result_'+i.productID+'" class="selected"><a href="'+i.url+'">'+i.name+" - "+i.description+"</a></li>"},addListItem:function(i){return'<li id="result_'+i.productID+'"><a href="'+i.url+'">'+i.name+" - "+i.description+"</a></li>"},onSelect:function(i){this.element.val(i.find("a").html().replace(/&amp;/g,"&"));i=a(i).attr("id").split("_")[1];a(this.element).parent().find("input.image_product_pid").val(i);a(this.element).parent().find("input.image_product_link").val("http://www.byggmax.com/se-sv/Prod/PID-"+
i+".aspx")},onClick:function(i){this.element.val(a(i).html().replace(/&amp;/g,"&"));i=a(i.parentNode).attr("id").split("_")[1];a(this.element).parent().find("input.image_product_pid").val(i);a(this.element).parent().find("input.image_product_link").val("http://www.byggmax.com/se-sv/Prod/PID-"+i+".aspx")}}})},addNewProductLink:function(f){a(f).click(function(){var i=a(this).parent().find(".image_product_data:first").clone();i.find("input").val("");i.find("ul").remove();a(this).parent().find(".image_product_links").append(i);
i.find("input:hidden").val("0");r.form.addNewResultList(a(i).find(".image_product_name"),a(".image_product_name").length);i.find(".delete_link").click(function(){r.form.deleteProductLink(a(this))})})},deleteProductLink:function(f){f=f.parent().parent();f.parent().find(".image_product_data").length===1?f.parent().find("input").val(""):f.remove()}},map:{geocoder:null,mapCanvas:null,marker:null,init:function(){},getProjectLocation:function(f){f=f+" Sweden";this.geocoder&&this.geocoder.geocode({address:f},
function(i,n){if(n==google.maps.GeocoderStatus.OK){a("#project_location_map").show();if(r.map.mapCanvas)r.map.mapCanvas.setCenter(i[0].geometry.location);else{n={zoom:12,center:i[0].geometry.location,mapTypeId:google.maps.MapTypeId.ROADMAP};r.map.mapCanvas=new google.maps.Map(document.getElementById("project_location_map_canvas"),n)}r.map.marker&&r.map.marker.setMap(null);r.map.marker=new google.maps.Marker({map:r.map.mapCanvas,position:i[0].geometry.location})}else alert("Geocode was not successful for the following reason: "+
n)})}}};m={jso:new JsonServerObject};b=function(){var f=this;this.startX=a("#lemmings_cave").offset().left+5;this.startY=a("#lemmings_cave").offset().top+3;this.elem=a('<div class="lemming" id="lemming_'+h.n+'"><!-- lemming --\></div>');a(this.elem).css({left:this.startX+"px",top:"-40px"});a("body").append(this.elem);a(this.elem).animate({top:"68px"},1500,"linear",function(){a(this).css({backgroundImage:"url(/UI/images/lemmings.gif)"});a(this).animate({left:h.edge.x-21+"px"},15E3,"linear",function(){a(this).unbind("click");
a(this).css({cursor:"default"});a(this).css({backgroundImage:"url(/UI/images/lemmings_fall.gif)"});a(this).animate({top:h.edge.h+"px"},1E4,"linear",function(){a(this).css({backgroundImage:"url(/UI/images/lemmings_sploff.gif?"+h.n+Math.random()+")"})})})});a(this.elem).click(function(){a(this).unbind("click");a(this).css({cursor:"default"});f.dig()})};b.prototype.dig=function(){var f=a(this.elem).offset().left,i=a(this.elem).offset().top;backgroundOffset=parseInt(f-Math.floor(f/94)*94,10);a(this.elem).stop();
this.digElem=a('<div class="lemming_dig" id="lemming_'+h.n+'_dig"><!-- lemming --\></div>');this.digElem.css({backgroundPosition:"-"+backgroundOffset+"px 0",left:f+"px",top:i+"px",zIndex:h.zd+=1});a(this.elem).css({backgroundImage:"url(/UI/images/lemmings_dig.gif)",zIndex:h.z+=1});a("body").append(this.digElem);a(this.digElem).animate({height:h.edge.h-32+"px"},2E4,"linear");a(this.elem).animate({top:h.edge.h+"px"},2E4,"linear",function(){a(this).css({backgroundImage:"url(/UI/images/lemmings.gif)"});
a(this).animate({left:"-40px"},Math.floor(a(this).offset().left)*20,"linear")})};h={n:0,z:100,zd:20,l:[],edge:{x:a("#top").offset().left,y:a("#top").offset().top,h:a("body").height()+68},init:function(){a("#mainWrap").prepend('<div id="lemmings_cave"></div>');this.interval=setInterval(function(){h.l.push(new b);h.n+=1;h.n===10&&clearInterval(h.interval)},3E3)}};a.extend({view:r});a.extend({view:r});a.extend({lemmings:h});a(g).bindEvent({event:"dom:ready",callback:[{n:a.view,f:"init"},{n:a.view.dialog,
f:"open"},{n:a.view.form,f:"addImageUpload"},{n:a.view.map,f:"init"}]})})();function __doPostBack(g,a){if(!theForm.onsubmit||theForm.onsubmit()!=false){theForm.__EVENTTARGET.value=g;theForm.__EVENTARGUMENT.value=a;$("#uploadVideo input[type=radio]").each(function(){var m=this;m.disabled=false});$("#aspnetForm").trigger("submit")}}$(document).ready(function(){$(window).trigger("dom:ready")});(function(){var g=this,a=jQuery,m,r;r={addPostReplyEvent:function(){a("#ctl00_FullRegion_MainRegion_cbConstructionCompleted").click(function(){a("#ctl00_FullRegion_MainRegion_cbConstructionCompleted:checked").length?a(".endDateWrapper").removeClass("hidden"):a(".endDateWrapper").addClass("hidden")});a(".discussion_reply_btn").click(function(e){e.preventDefault();if(a("#standard_dialog #login_window").length)a.view.user.openUserLogin();else{a(".discussion_reply_btn").hide();a("#rtb").removeClass("hidden");
g.scrollTo(0,a("#rtb").offset().top)}});a(".discussion_reply_quote").click(function(e){e.preventDefault();if(a("#standard_dialog #login_window").length)a.view.user.openUserLogin();else{a("#rtb").removeClass("hidden");g.scrollTo(0,a("#rtb").offset().top);e=a("#discussion_post_"+a(this).attr("rel")).html();var b=a("#discussion_post_date_"+a(this).attr("rel")).html(),h=a("#discussion_post_user_"+a(this).attr("rel")).html();a(".discussion_reply_btn").hide();tinymce.EditorManager.activeEditor.setContent("");
tinymce.EditorManager.activeEditor.focus();tinymce.EditorManager.activeEditor.setContent('<blockquote><div class="discussion_quote_header">'+h+" skrev "+b+'</div><div class="discussion_quote_content">'+e+"</div></blockquote><p></p>");a("iframe:last").get(0).contentWindow.scrollTo(0,9999)}});a(".discussion_edit_post").live("click",function(e){e.preventDefault();e=typeof a(this).attr("rel")!=="undefined"?a(this).attr("rel"):a(this).attr("id").split("_")[3];m.discussion.editDiscussionPost("post",e)});
a(".discussion_edit_reply").live("click",function(e){e.preventDefault();e=typeof a(this).attr("rel")!=="undefined"?a(this).attr("rel"):a(this).attr("id").split("_")[3];m.discussion.editDiscussionPost("reply",e)});a(".discussion_post_btn_cancel").live("click",function(){var e=a(this).attr("id").split("_")[4],b=a(this).hasClass("post")?"post":"reply";m.discussion.cancelEditDiscussionPost(b,e)});a(".discussion_post_btn_save").live("click",function(){var e=a(this).attr("id").split("_")[4],b=a(this).hasClass("post")?
"post":"reply";m.discussion.saveDiscussionPost(b,e)});a("#btnSaveReply").live("click",function(){var e=a("#discussion_topic_id").val(),b=a("#discussion_reply_textarea").val();model.jso.addReply(e,b,function(){document.location=document.location})});a("#btnCancelReply").live("click",function(e){e.preventDefault();tinymce.EditorManager.activeEditor.setContent("");a("#rtb").addClass("hidden");a(".discussion_reply_btn").show()})}};m={discussion:{editDiscussionPost:function(e,b){var h=e==="post"?"discussion_edit_post":
"discussion_edit_reply",f=a("#discussion_post_"+b).html();a("."+h).each(function(i,n){i=a(n);i.attr("rel")==b&&i.addClass("hidden")});a("#discussion_post_"+b).find("p.error").remove();a(".discussion_reply_btn").hide();if(h==="discussion_edit_post"){header=a(".discussion h1").html();a(".discussion h1").html('<div class="hidden" id="discussion_post_oldHeader_'+b+'">'+header+'</div><input id="discussion_post_headerTextarea_'+b+'" value="'+header+'" />')}a("#discussion_post_"+b).html('<div class="hidden" id="discussion_post_oldContent_'+
b+'">'+f+'</div><textarea id="discussion_post_textarea_'+b+'">'+f+'</textarea><button id="discussion_post_btn_save_'+b+'" class="medium '+e+' discussion_post_btn_save" type="button">'+a.store.common.save+'</button> <button type="button" id="discussion_post_btn_cancel_'+b+'" class="cancelButton '+e+' discussion_post_btn_cancel">'+a.store.common.cancel+"</button>");m.editor.applyEditorToTextarea("discussion_post_textarea_"+b)},cancelEditDiscussionPost:function(e,b){e=e==="post"?"discussion_edit_post":
"discussion_edit_reply";var h=a("#discussion_post_oldContent_"+b).html();a("#discussion_post_textarea_"+b).tinymce().remove();a("#discussion_post_textarea_"+b).remove();a("."+e).each(function(f,i){f=a(i);f.attr("rel")==b&&f.removeClass("hidden")});a("#discussion_post_"+b).html(h);a(".discussion_reply_btn").show();if(e==="discussion_edit_post"){e=a("#discussion_post_oldHeader_"+b).html();a(".discussion h1").html(e)}},saveDiscussionPost:function(e,b){e=e==="post"?"discussion_edit_post":"discussion_edit_reply";
var h=a("#discussion_topic_id").val(),f=a("#discussion_post_textarea_"+b).val(),i;a("#discussion_post_textarea_"+b).tinymce().remove();a("#discussion_post_textarea_"+b).remove();a("."+e).each(function(n,d){n=a(d);n.attr("rel")==b&&n.removeClass("hidden")});a(".discussion_reply_btn").show();if(e==="discussion_edit_post"){i=a("#discussion_post_headerTextarea_"+b).val();model.jso.updateTopic(h,i,f,function(n){n=a.parseJSON(n);if(n.result){a(".discussion h1").html(i);a("#discussion_post_"+b).html(f)}else{a(".discussion h1").html(a("#discussion_post_oldHeader_"+
b).html());a("#discussion_post_"+b).html('<p class="error">Tyv\u00e4rr gick n\u00e5got fel n\u00e4r ditt svara skulle updateras. <button id="discussion_edit_reply_'+b+'" class="medium discussion_edit_reply">F\u00f6rs\u00f6k igen</button></p>'+a("#discussion_post_oldContent_"+b).html())}})}else model.jso.updateReply(b,h,f,function(n){n=a.parseJSON(n);n.result?a("#discussion_post_"+b).html(f):a("#discussion_post_"+b).html('<p class="error">Tyv\u00e4rr gick n\u00e5got fel n\u00e4r ditt svara skulle updateras. <button id="discussion_edit_reply_'+
b+'" class="medium discussion_edit_reply">F\u00f6rs\u00f6k igen</button></p>'+a("#discussion_post_oldContent_"+b).html())})}},editor:{init:function(){if(a(".tiny_mce_editor textarea").length){m.editor.addButton();m.editor.controller=a(".tiny_mce_editor textarea").tinymce({script_url:"/UI/scripts/lib/tiny_mce.js",mode:"textareas",theme:"advanced",plugins:"-product, -listSmiles, paste",setup:function(e){e.onPaste.add(function(b,h){a.view.editor.storeBookmark();a.view.editor.openPasteDialog();return tinymce.dom.Event.cancel(h)});
e.onEvent.add(function(){})},height:"350",paste_use_dialog:true,theme_advanced_buttons1:"bold,italic,underline,strikethrough,bullist,numlist,listSmiles",theme_advanced_buttons2:"addText,product, exlink",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left"});!a("#post_dialog").length&&typeof a.store.common.pasteheading!=="undefined"&&m.editor.addPasteDialog()}r.addPostReplyEvent()},editor_bookmark:false,storeBookmark:function(){if(tinymce.isIE)this.editor_bookmark=
this.editor_bookmark=tinymce.EditorManager.activeEditor.selection.getBookmark()},restoreBookmark:function(){tinymce.isIE&&tinymce.EditorManager.activeEditor.selection.moveToBookmark(this.editor_bookmark)},findProducts:function(e){if(!(e[1].keyCode!==32||a.isIE)){var b=e[0];b.selection.getSel();var h=b.selection.getStart().innerHTML;e=a(b.selection.getStart()).text();var f=b.selection.getSel().focusOffset-1,i="",n,d=0,c=e.length;if(!(f<=0)){for(n=f-1;n!==0;n-=1)if(e[n]===" "){d=n;break}if(e[f]===" ")for(n=
n=d===0?d:(d+=1);n<f;n+=1)i+=e[n];i&&model.jso.getProducts(i,function(j){j=a.parseJSON(j);if(j.result.length===1&&j.result[0].name.toLowerCase()===i.toLowerCase()){b.selection.select(b.selection.getStart());b.selection.setContent(h.substring(0,d)+'<a rel="'+j.result[0].name+'" class="byggmax_product" href="'+j.result[0].url+'">'+j.result[0].name+"</a> "+h.substring(f,c))}})}}},applyEditorToTextarea:function(e){a("#"+e).tinymce({script_url:"/UI/scripts/lib/tiny_mce.js",mode:"textareas",theme:"advanced",
plugins:"-product, -listSmiles, paste",setup:function(b){b.onPaste.add(function(h,f){a.view.editor.openPasteDialog();return tinymce.dom.Event.cancel(f)});b.onEvent.add(function(){a.view.editor.storeBookmark()})},height:"350",paste_use_dialog:true,theme_advanced_buttons1:"bold,italic,underline,strikethrough,bullist,numlist,listSmiles",theme_advanced_buttons2:"addText,product, exlink",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left"})},addPasteDialog:function(){a("body form:first").append('<div id="post_dialog"><div class="box"><h2>'+
a.store.common.pasteheading+"</h2><p>"+a.store.common.pastecontent+'</p><textarea id="post_dialog_textarea"></textarea><button id="post_dialog_btn" class="medium">'+a.store.common.pasteheading+'</button><button id="post_dialog_cancel_btn" class="cancelButton">'+a.store.common.cancel+"</button></div></div>");a("#post_dialog").dialog({autoOpen:false,closeText:"",modal:true,width:465,open:function(){a.isIE&&setTimeout(function(){a("#post_dialog_textarea").get(0).focus()},100);a("#post_dialog_textarea").val("");
a("#post_dialog_btn").click(function(){a.view.editor.restoreBookmark();tinymce.EditorManager.activeEditor.execCommand("mceInsertContent",false,a("#post_dialog_textarea").val());a("#post_dialog").dialog("close");a("#post_dialog_btn").unbind("click");a("#post_dialog_cancel_btn").unbind("click");a(".ui-widget-overlay").unbind("click")});a("#post_dialog_cancel_btn").click(function(){a("#post_dialog").dialog("close");a("#post_dialog_btn").unbind("click");a("#post_dialog_cancel_btn").unbind("click");a(".ui-widget-overlay").unbind("click")});
a(".ui-widget-overlay").click(function(){a("#post_dialog").dialog("close");a("#post_dialog_btn").unbind("click");a("#post_dialog_cancel_btn").unbind("click");a(".ui-widget-overlay").unbind("click")})}})},openPasteDialog:function(){!a("#post_dialog").length&&typeof a.store.common.pasteheading!=="undefined"&&m.editor.addPasteDialog();typeof a.store.common.pasteheading!=="undefined"&&a("#post_dialog").dialog("open")},toggleExternalLink:function(){if(a("#external_link_tr").length)a("#external_link_tr").remove();
else{a.view.editor.storeBookmark();a("#product_link_tr").remove();var e=tinymce.EditorManager.activeEditor,b=e.selection.getContent(),h=e.selection.getContent({format:"text"});b=typeof b==="undefined"?a(b).get(0).nodeName==="A"?a(b).attr("href"):a(e.selection.getNode()).get(0).nodeName==="A"?a(e.selection.getNode()).attr("href"):"":"";var f=function(){var i=/(ftp|http|https):\/\//i.test(a("#external_link_href").val())?a("#external_link_href").val():"http://"+a("#external_link_href").val();a.view.editor.restoreBookmark();
tinymce.EditorManager.activeEditor.execCommand("mceInsertContent",false,'<a class="external_link" href="'+i+'">'+a("#external_link").val()+"</a>");a("#external_link_btn").unbind("click");a("#external_link_tr").remove()};a("#"+e.editorContainer).find("tr:first").after('<tr id="external_link_tr" style="background-color:#e8d2b4"><td><label for="external_link" class="first">Namn: </label><input class="small" autocomplete="off" id="external_link" type="text" value="'+h+'" /><label for="external_link_href">L\u00e4nk: </label><input class="small" autocomplete="off" id="external_link_href" value="'+
b+'" type="text" /><button id="external_link_btn" type="button" class="small">L\u00e4gg till</button></td></tr>');a("#external_link, #external_link_href").keypress(function(i){if(i.keyCode===13){i.preventDefault();i.stopPropagation&&i.stopPropagation();f();return false}});a("#external_link_btn").click(function(){f()})}},toggleProductLink:function(){if(a("#product_link_tr").length)a("#product_link_tr").remove();else{a.view.editor.storeBookmark();a("#external_link_tr").remove();var e=tinymce.EditorManager.activeEditor,
b=e.selection.getContent(),h=e.selection.getContent({format:"text"});b=typeof b==="undefined"?a(b).get(0).nodeName==="A"?a(b).attr("href"):a(e.selection.getNode()).get(0).nodeName==="A"?a(e.selection.getNode()).attr("href"):"":"";a("#"+e.editorContainer).find("tr:first").after('<tr id="product_link_tr" style="background-color:#e8d2b4"><td><label for="product_link" class="first">Namn: </label><input class="small" autocomplete="off" id="product_link" type="text" value="'+h+'" /><label for="product_link_href">L\u00e4nk: </label><input class="small" autocomplete="off" id="product_link_href" value="'+
b+'" type="text" /><input type="hidden" id="external_link_id" /><button type="button" id="product_link_btn" class="small">L\u00e4gg till</button></td></tr>');a("#product_link_btn").click(function(){var f=/byggmax/i.test(a("#product_link_href").val())?"byggmax_product":"external_product",i=/(ftp|http|https):\/\//i.test(a("#product_link_href").val())?a("#product_link_href").val():"http://"+a("#product_link_href").val();a.view.editor.restoreBookmark();tinymce.EditorManager.activeEditor.execCommand("mceInsertContent",
false,'<a rel="'+a("#external_link_id").val()+'" class="'+f+'" href="'+i+'">'+a("#product_link").val()+"</a>");a("#product_link_btn").unbind("click");a("#external_link_id").val("");a("#product_link_tr").remove()});a(".related_result_list li").live("mouseover",function(){a(this.parentNode).find("li.selected").removeClass("selected");a(this).addClass("selected")});a("#product_link").addResultList({className:"related_result_list",id:"related_product_qs",inputId:"product_link_href",template:a('<div class="product_link_wrapper"><p>Om produkten finns p\u00e5 Byggmax V\u00e4ljer du den nedan f\u00f6r automatisk l\u00e4nkning.</p><ul></ul></div>'),
methods:{addListItemSelected:function(f){return'<li id="result_'+f.productID+'" class="selected"><a class="product_name" href="javascript:void(0)">'+f.name+'</a><a href="javascript:void(0)"> - '+f.description+"</a></li>"},addListItem:function(f){return'<li id="result_'+f.productID+'"><a class="product_name" href="javascript:void(0)">'+f.name+'</a><a href="javascript:void(0)"> - '+f.description+"</a></li>"},onSelect:function(f){a("#"+this.inputId).val("http://www.byggmax.com/se-sv/Prod/PID-"+f.attr("id").split("_")[1]+
".aspx");a("#external_link_id").val(f.attr("id").split("_")[1]);this.element.val(f.find("a:first").html())},onClick:function(f){a("#"+this.inputId).val("http://www.byggmax.com/se-sv/Prod/PID-"+a(f.parentNode).attr("id").split("_")[1]+".aspx");a("#external_link_id").val(a(f.parentNode).attr("id").split("_")[1]);this.element.val(a(f).parent().find("a:first").html())}}});a("#product_link").keyup(function(f){if(f.keyCode===13){f.preventDefault();f.stopPropagation&&f.stopPropagation();return false}if(f.keyCode!==
38&&f.keyCode!==40)a(this).val().length>1?model.jso.getProducts(a(this).val(),m.editor.showProductList):a("#product_link").addResultList("close")});a("#product_link").val().length>0&&model.jso.getProducts(a("#product_link").val(),m.editor.showProductList)}},addButton:function(){tinymce.create("tinymce.plugins.ProductLinkPlugin",{init:function(e){e.addCommand("ProductLinkCommand",a.view.editor.toggleProductLink,a.view.editor);e.addCommand("ExLinkCommand",a.view.editor.toggleExternalLink,a.view.editor);
e.addButton("product",{title:"Add product link",cmd:"ProductLinkCommand","class":"mce_product"});e.addButton("exlink",{title:"Add link",cmd:"ExLinkCommand","class":"mce_exlink"});e.addButton("addText",{title:"L\u00e4gg till","class":"mce_addtext"})}});tinymce.PluginManager.add("product",tinymce.plugins.ProductLinkPlugin)},showProductList:function(e){a("#product_link").addResultList("open",{data:a.parseJSON(e)})}}};model={jso:new JsonServerObject};a.extend(true,a.view,m);a(g).bindEvent({event:"dom:ready",
callback:[{n:a.view.editor,f:"init"}]})})();(function(){var g=jQuery,a,m,r;a={addRelatedLinksEvent:function(){g("#related_links_new").live("click",function(){if(g("#standard_dialog #login_window").length)g.view.user.openUserLogin();else{g("#related_links_form").toggleClass("hidden");g(this).hide()}});g("#related_links_add").click(function(e){e.preventDefault();e=g("#ctl00_FullRegion_MainRegion_ucRelatedExternalLinksBox_tbLinkUrl").val();var b=g("#ctl00_FullRegion_MainRegion_ucRelatedExternalLinksBox_tbLinkName").val(),h=parseInt(g("#currentTopic").val(),
10);r.jso.addRelatedLink(e,b,h,m.related.addRelatedExternalLinks)})},addRelatedProductEvent:function(){g("#related_product_new").click(function(){if(g("#standard_dialog #login_window").length)g.view.user.openUserLogin();else{g("#related_product_form").toggleClass("hidden");g(this).toggleText("D\u00f6lj L\u00e4gg till produkt","L\u00e4gg till produkt")}});g("#related_product_form li[id^result_] a").live("click",function(e){e.preventDefault()});g("#related_product_add").click(function(e){e.preventDefault();
e=/byggmax/i.test(g("#related_product_url").val())?true:false;var b=g("#related_product_name").val(),h=g("#related_product_url").val(),f=parseInt(g("#currentTopic").val(),10),i=parseInt(g("#currentConstruction").val(),10),n=parseInt(g("#currentWord").val(),10);r.jso.addRelatedProduct(b,h,e,f,i,n,m.related.showRelatedProducts)});g(".related_result_list li").live("mouseover",function(){g(this.parentNode).find("li.selected").removeClass("selected");g(this).addClass("selected")});g("#related_product_name").addResultList({className:"related_result_list",
id:"related_product_qs",template:g('<div class="product_link_wrapper rs_pi_outside"><p>Om produkten finns p\u00e5 Byggmax V\u00e4ljer du den nedan f\u00f6r automatisk l\u00e4nkning.</p><ul></ul></div>'),methods:{addListItemSelected:function(e){return'<li id="result_'+e.productID+'" class="selected"><a class="product_name" href="javascript:void(0)">'+e.name+'</a><a href="javascript:void(0)"> - '+e.description+"</a></li>"},addListItem:function(e){return'<li id="result_'+e.productID+'"><a class="product_name" href="javascript:void(0)">'+
e.name+'</a><a href="javascript:void(0)"> - '+e.description+"</a></li>"},onSelect:function(e){g("#"+this.inputId).val(e.attr("id").split("_")[1]);this.element.val(e.find("a").html().replace(/&amp;/g,"&"));e=g(e).attr("id").split("_")[1];g("#related_product_url").val("http://www.byggmax.com/se-sv/Prod/PID-"+e+".aspx")},onClick:function(e){g("#"+this.inputId).val(g(e.parentNode).attr("id").split("_")[1]);this.element.val(g(e).html().replace(/&amp;/g,"&"));e=g(e.parentNode).attr("id").split("_")[1];
g("#related_product_url").val("http://www.byggmax.com/se-sv/Prod/PID-"+e+".aspx")}}});g("#related_product_name").keyup(function(e){if(e.keyCode===13){e.preventDefault();e.stopPropagation&&e.stopPropagation();return false}if(e.keyCode!==38&&e.keyCode!==40)g(this).val().length>1?r.jso.getProducts(g(this).val(),m.related.showProductList):g("#related_product_name").addResultList("close")})},addRelatedProjectEvent:function(){g("#related_project_new").click(function(){if(g("#standard_dialog #login_window").length)g.view.user.openUserLogin();
else{var e=g("#related_project_form");e.toggleClass("hidden");e.find("input[type=text]").attr("value","");g(this).hide()}});g("#related_project_add").click(function(e){e.preventDefault();r.jso.addRelatedConstruction(g("#related_project_qs_inputid").val(),g("#currentTopic").val(),g("#currentConstruction").val(),m.related.addRelatedProjectLink)});g("#related_project_name").addResultList({className:"related_result_list",id:"related_project_qs",template:g('<div class="product_link_wrapper rs_pi_outside"><ul></ul></div>'),
methods:{addListItemSelected:function(e){return'<li id="result_'+e.id+'" class="selected"><a href="/">'+e.name+"</a></li>"},addListItem:function(e){return'<li id="result_'+e.id+'"><a href="/">'+e.name+"</a></li>"}}});g("#related_project_name").keyup(function(e){if(e.keyCode===13){e.preventDefault();e.stopPropagation&&e.stopPropagation();return false}if(e.keyCode!==38&&e.keyCode!==40)g(this).val().length>1?r.jso.getConstructions(g(this).val(),g("#currentConstruction").val(),m.related.showProjectList):
g("#related_project_name").addResultList("close")})},addRelatedDiscussionEvent:function(){g("#related_discussion_new").click(function(e){e.preventDefault();if(g("#standard_dialog #login_window").length)g.view.user.openUserLogin();else{g("#related_discussion_form").toggleClass("hidden");g(this).hide()}});g("#related_discussion_add").click(function(e){e.preventDefault();r.jso.addRelatedTopic(g("#related_discussion_qs_inputid").val(),g("#currentTopic").val(),g("#currentConstruction").val(),g("#currentWord").val(),
m.related.addRelatedDiscussionLink)});g("#related_discussion_name").addResultList({className:"related_result_list",id:"related_discussion_qs",template:g('<div class="product_link_wrapper rs_pi_outside"><ul></ul></div>'),methods:{addListItemSelected:function(e){return'<li id="result_'+e.id+'" class="selected"><a href="/">'+e.subject+"</a></li>"},addListItem:function(e){return'<li id="result_'+e.id+'"><a href="/">'+e.subject+"</a></li>"}}});g("#related_discussion_name").keyup(function(e){if(e.keyCode===
13){e.preventDefault();e.stopPropagation&&e.stopPropagation();return false}if(e.keyCode!==38&&e.keyCode!==40)g(this).val().length>1?r.jso.getTopics(g(this).val(),m.related.showDiscussionList):g("#related_discussion_name").addResultList("close")})},addRelatedTagEvent:function(){g("#related_tag_new").click(function(e){e.preventDefault();if(g("#standard_dialog #login_window").length)g.view.user.openUserLogin();else{g("#related_tag_form").toggleClass("hidden");g(this).hide()}});g("#related_tag_add").click(function(e){e.preventDefault();
r.jso.addRelatedTag(g("#related_tag_name").val(),g("#currentConstruction").val(),m.related.addRelatedTagLink)});g("#related_tag_name").addResultList({className:"related_result_list",id:"related_tag_qs",template:g('<div class="product_link_wrapper rs_pi_outside"><ul></ul></div>'),methods:{addListItemSelected:function(e){return'<li id="result_'+e.name+'" class="selected"><a href="/">'+e.name+"</a></li>"},addListItem:function(e){return'<li id="result_'+e.name+'"><a href="/">'+e.name+"</a></li>"}}});
g("#related_tag_name").keyup(function(e){if(e.keyCode===13){e.preventDefault();e.stopPropagation&&e.stopPropagation();g(this).val().length>1&&r.jso.addRelatedTag(g("#related_tag_name").val(),g("#currentConstruction").val(),m.related.addRelatedTagLink);return false}else if(e.keyCode!==38&&e.keyCode!==40)g(this).val().length>1?r.jso.getTags(g(this).val(),g("#currentConstruction").val(),m.related.showTagList):g("#related_tag_name").addResultList("close")})},removeRelatedTagEvent:function(){g("#related_tag_list .x-icon").live("click",
function(e){e.preventDefault();e=g("#currentConstruction").val();var b=g(this).next().text(),h=g(this);r.jso.removeTag(b,e,function(f){(f=g.parseJSON(f).result)&&h.parent().remove()})})}};m={related:{init:function(){g(".related_links_box").length&&a.addRelatedLinksEvent();g(".related_project_box").length&&a.addRelatedProjectEvent();g(".related_discussion_box").length&&a.addRelatedDiscussionEvent();g(".related_product_box").length&&a.addRelatedProductEvent();g(".related_tag_box").length&&a.addRelatedTagEvent();
document.getElementById("related_tag_list")&&a.removeRelatedTagEvent()},addRelatedProjectLink:function(e){e=g.parseJSON(e).result;g("#related_project_form").toggleClass("hidden");g("#related_project_new").show();g("#related_project_form input").val("");g(".related_project_list").length?g("#related_project_list").append('<li><a href="'+e.url+'">'+e.name+"</a></li>"):g(".related_project_box h3").after('<ul id="related_project_list"><li><a href="'+e.url+'">'+e.name+"</a></li></ul>")},addRelatedDiscussionLink:function(e){e=
g.parseJSON(e).result;g("#related_discussion_form").toggleClass("hidden");g("#related_discussion_new").show();g("#related_discussion_form input").val("");g(".related_discussion_list").length?g("#related_discussion_list").append('<li><a href="'+e.url+'">'+e.subject+"</a></li>"):g(".related_discussion_box h3").after('<ul id="related_discussion_list"><li><a href="'+e.url+'">'+e.subject+"</a></li></ul>")},addRelatedExternalLinks:function(e){e=g.parseJSON(e);e=e.result;g("#ctl00_FullRegion_MainRegion_ucRelatedExternalLinksBox_tbLinkUrl").val("http://");
g("#ctl00_FullRegion_MainRegion_ucRelatedExternalLinksBox_tbLinkName").val("");g("#related_links_list").length||g(".related_links_box h3").after('<ul id="related_links_list"></ul>');g("#related_links_list").append('<li><a href="'+e.url+'">'+e.linkName+"</a></li>");g("#related_links_form").addClass("hidden");g("#related_links_new").show()},addRelatedTagLink:function(e){e=g.parseJSON(e).result;var b="";g("#related_tag_form").toggleClass("hidden");g("#related_tag_new").show();g("#related_tag_form input").val("");
if(e.success){if(g("#can_be_deleted").val().toLowerCase()==="true")b='<a href="#" class="x-icon sprite"><!--X--\></a>';g(".related_tag_list").length?g("#related_tag_list").append("<li>"+b+'<a href="'+e.url+'">'+e.name+"</a></li>"):g(".related_tag_box h3").after('<ul id="related_tag_list"><li>'+b+'<a href="'+e.url+'">'+e.name+"</a></li></ul>")}},showProjectList:function(e){g("#related_project_name").addResultList("open",{data:g.parseJSON(e)})},showDiscussionList:function(e){g("#related_discussion_name").addResultList("open",
{data:g.parseJSON(e)})},showProductList:function(e){g("#related_product_name").addResultList("open",{data:g.parseJSON(e)})},showRelatedTopics:function(e){var b=g("div.related_discussion_box"),h=b.find("> ul");e=g.parseJSON(e);h.length?h.append('<li><a href="'+e.result.url+'">'+e.result.subject+"</a></li>"):b.append('<ul><li><a href="'+e.result.url+'">'+e.result.subject+"</a></li></ul>");if((b=b.find("input[type=text]").singleElement())&&!b.length){b.value="";b.focus()}},showRelatedProducts:function(e){e=
g.parseJSON(e).result;g("#related_product_list").show().append('<li><a href="'+e.url+'">'+e.name+"</a></li>");g("#related_product_name").val("");g("#related_product_url").val("")},showTagList:function(e){g("#related_tag_name").addResultList("open",{data:g.parseJSON(e)})}}};r={jso:new JsonServerObject};g.extend(true,g.view,m);m.related.init()})();(function(){var g=this,a=jQuery,m,r;m={toggleHiddenProfileBoxes:function(){a("#ctl00_FullRegion_MainRegion_showEmailBox, #ctl00_FullRegion_MainRegion_showPasswordBox").click(function(e,b){e.preventDefault();b=this.id;if(b=="ctl00_FullRegion_MainRegion_showEmailBox")a("#ctl00_FullRegion_MainRegion_pnlEmailBox").toggle();else b=="ctl00_FullRegion_MainRegion_showPasswordBox"&&a("#changePasswordBox").toggle()})},targetBlank:function(){a("a[rel=external]").attr("target","_blank")},toggleCommentBox:function(){a("#box4Comments .commentTextBox").hide();
a("#box4Comments .butComment").click(function(e){e.preventDefault();a(this).siblings(".commentTextBox").show()})}};r={misc:{init:function(){r.misc.login();m.targetBlank();m.toggleCommentBox();if(a("#changePasswordBox")||a("#emailBox"))m.toggleHiddenProfileBoxes()},login:function(){}}};a.extend(true,a.view,r);a(g).bindEvent({event:"dom:ready",callback:[{n:a.view.misc,f:"init"}]})})();(function(){var g,a,m=$.create,r=function(d,c){var j,k=0,o=[],p=function(q){var t,v=0;for(t=0;t<q.length;t+=1)if(q[t].offsetHeight>v)v=q[t].offsetHeight;for(t=0;t<q.length;t+=1)q[t].style.height=v+"px"};if(c)for(j=0;j<d.length;j+=1){o.push(d[j]);if(k<c-1){k+=1;j===d.length-1&&p(o)}else{p(o);o=[];k=0}}else p(d)},e=function(d,c){c={tagName:"select",appendChildren:[{tagName:"option",innerHTML:c?$.store.ui.categoryselect.choosetopic:$.store.ui.categoryselect.choosesubcategory,value:0}]};var j=d.result?
d.result:d.categoryList;for(d=0;d<j.length;d+=1)c.appendChildren.push({tagName:"option",innerHTML:j[d].name,value:j[d].id});return m(c)},b=function(d){var c={tagName:"ul",appendChildren:{tagName:"li",className:d?"root first-child":"first-child only-child"}};if(d){c.className="topUL";c.id=$.uniqueId("categoryUL_")}else c.appendChildren=[{tagName:"li"}];return m(c)},h=function(){return m({className:"cb",innerHTML:" <!-- --\> "})},f=function(){return m({tagName:"li",className:"addButton",appendChildren:{tagName:"input",
type:"button",value:$.store.ui.categoryselect.addcategory}})},i=function(d,c,j){c=$("fieldset.newRelatedCategories");var k,o,p,q=function(t){var v=d.result?d.result:d.categoryList,u;t.find("+ ul").remove();for(u=0;u<v.length;u+=1)$.parse(v[u].id)===$.parse(this.value)&&i(v[u],this.value,t)};if(d.result){p=b("first");c.find("div.row").before(p).parent().find("li:empty").append(e(d,"first")).append(h());k=c.find("#"+p.id).find("select");k.change(function(){q.apply(this,[k])})}else if(d.categoryList){j.after(b());
j.find("+ ul").find("li:empty").addClass("first-child only-child").append(e(d)).append(h()).prepend(m({tagName:"span",className:"top-span"})).parent().addClass("only-child");k=j.find("+ ul").find("> li select");o=j.find("+ ul").find("> li input");k.change(function(){var t=this;q.apply(this,[k]);if($.parse(t.value)){$(t).parent().parent().removeClass("only-child").find("> li:only-child").removeClass("only-child").after(f());o=j.find("+ ul").find("> li input").unbind("click");o.click(function(){var v=
$(this),u;v.parent().before("<li></li>").parent().find("li:empty").append(e(d)).append(h());u=v.parent().prev().find("select");u.change(function(){q.apply(this,[u])})})}else if($(t).parent().parent().find("> li").length===2){$(t).parent().parent().find("> li input").parent().remove();$(t).parent().parent().find("> li:only-child").addClass("only-child").parent().addClass("only-child")}})}},n=function(d){var c=$("div.relatedCategoriesBox"),j=d.result?d.result:d.categoryList,k=function(){for(var z=this.parentNode;z.nextSibling;)z.nextSibling.parentNode.removeChild(z.nextSibling);
for(z=0;z<j.length;z+=1)$.parse(j[z].id)===$.parse(this.value)&&j[z]&&n(j[z],this.value,this)},o=0,p,q,t,v,u=0,w,y,A;if(j)if(d.result){d=e(d,"first");c.find("> p").after(b()).parent().find("ul:last li").append(d).find("select").change(function(){k.call(this)});c.append(m({tagName:"button",className:"medium",innerHTML:$.store.common.save}));c.find("> p").hide();c.find("button").click(function(z){var G=document.getElementById("currentTopic").value,D=c.find("select");z.preventDefault();for(z=D.length-
1;z>-1;z-=1)if($.parse(D[z].value)){o=D[z].value;break}p=model.jso.addRelatedCategory($.parse(o),G,function(B){p=$.parseJSON(B);if(p.result.success){q=p.result.categoryList;u=q.length;for(categoryItem=q.pop();categoryItem;){if(!$("#relatedCategory_"+categoryItem.id).length){t=m({tagName:"li",id:"relatedCategory_"+categoryItem.id,className:"categoryAdded listIndent_"+(u-q.length-1),appendChildren:[{tagName:"a",href:categoryItem.url,innerHTML:categoryItem.name}]});if(q.length===u-1)c.find("ul:first").append(t);
else{y=$("#relatedCategory_"+v.id).nextAll(".listIndent_"+(u-q.length-2)+":first");A=$("#relatedCategory_"+v.id).nextAll(".listIndent_"+(u-q.length-3)+":first");w=y.length&&A.length?y.index()<A.index()?y:A:y.length?y:A;w.length?w.before(t):c.find("ul:first").append(t)}}v=categoryItem;categoryItem=q.pop()}c.find("ul:last li:not(:first)").remove();c.find("ul:last select option[value='0']").attr("selected","selected");c.find("> p").show().next("ul").remove().next("button").remove();c.find("> p").show().next("button").remove();
setTimeout(function(){c.find(".categoryAdded").removeClass("categoryAdded")},2E3)}else p.result.errormessage&&$.log(p.result.errormessage)})})}else if(d.categoryList){d=e(d);c.find("ul:last").append(m({tagName:"li"})).find("li:last").addClass("test").append(d).find("select").change(function(){k.call(this)})}};if(!window.model)window.model={};if(!model.jso)model.jso=new JsonServerObject;g={tabs:{members:function(){var d=$("div.membersTopList div.lists ul");$("div.membersTopList ul.tabs li a").each(function(c){$(this).click(function(j){var k=
$(this);j.preventDefault();k.parents("ul").find("li").removeClass("active");k.parent().addClass("active");d.removeClass("active");$(d[c]).addClass("active")})})},discussion:function(){var d=$("div.discussion div.tables div");$("div.discussion ul.tabs li a").each(function(c){$(this).click(function(j){var k=$(this);j.preventDefault();k.parents("ul").find("li").removeClass("active");k.parent().addClass("active");d.removeClass("active");$(d[c]).addClass("active")})})}},wordList:{synonym:{addRemoveButton:function(){var d=
this,c=function(){return m({tagName:"span",className:"remove",title:$.store.common.remove,appendChildren:[{tagName:"span",className:"start",innerHTML:" <!-- --\>"},{tagName:"span",className:"end",innerHTML:" <!-- --\>"}]})};d.length&&d.each?d.each(function(){$(this).append(c())}):$(this).append(c())},addRow:function(){var d=this,c=$.uniqueName("synonym"),j=function(){var k=m({tagName:"li",appendChildren:[{tagName:"input",name:c,type:"text",className:"large"}]});g.wordList.synonym.addRemoveButton.call(k);
return k};d.length&&d.each?d.each(function(){$(this).append(j())}):$(this).append(j())},removeRow:function(d,c){var j=$(this);if(j.parent().find("li").length===1){j.remove();d.addRow.call(c.find("ul"))}else j.remove()},init:function(){var d=this,c=$("fieldset#synonymsHolder");d.addRemoveButton.apply(c.find("li"));c.find("span.remove").live("click",function(){d.removeRow.apply(this.parentNode,[d,c])});c.find("button.create").live("click",function(){d.addRow.call(c.find("ul"))})}},init:function(){var d=
$("div.fullWordList"),c=d.find("> ol"),j=4,k=c.length?c[0].offsetHeight:0,o=k?parseInt(k/j,10):0,p=k=0,q,t=$("div.synonym");if(d.length){c.find("> li").normalize();c.find("> li > ol").normalize();for(k=0;k<j;k+=1)d.append('<div id="col'+k+'" class="col"></div>');q=document.getElementById("col"+p);c.find("> li > ol").each(function(){var v=this,u=v.previousSibling;q.appendChild(u);q.appendChild(v);if(q.offsetHeight>o){p+=1;q=document.getElementById("col"+p)}});d.append('<div class="cb"> <!-- --\> </div>');
c.remove()}t.length&&this.synonym.init()}},exLinks:{init:function(){$("a[rel~=external]").attr("target","_blank")}},categories:{initCategories:function(d){a=$.parseJSON(d);i(a,0);$("fieldset.newRelatedCategories").parent().find("> input[type=hidden][id$=InitializeCategories]").each(function(){var c=new RegExp("([^,]\\d+)+","g");c=this.value.replace(/(\[|\])/g,"").match(c);var j,k,o=$("fieldset.newRelatedCategories"),p,q;if(c){for(j=0;j<c.length;j+=1){p=o.find("select option");for(k=0;k<p.length;k+=
1)if(!$.parse(p[k].parentNode.value)&&p[k].value===c[j]){p[k].selected=true;q=$(p[k]).parent();$.parse(p[k].parentNode.value)&&q.trigger("change");break}else if($.parse(p[k].parentNode.value)&&p[k].value===c[j]){if($(p[k].parentNode.parentNode).hasClass("root"))q=o.find("> div.row > a.create").trigger("click").parent().prev("ul").find("select option[value="+c[j]+"]").attr("selected","selected").parent();else{k=$($.parse(p[k].parentNode.parentNode)).find("ul > li.addButton input").trigger("click");
q=k.parent().prev("li").find("select option[value="+c[j]+"]").attr("selected","selected").parent()}$.parse(q.singleElement().value)&&q.trigger("change");break}}o.find("ul ul li:not(:only-child) > select[value='0']").remove()}})},submit:function(){var d=$("fieldset.newRelatedCategories").parent().find("> input[type=hidden][id$=SelectedCategories]"),c="",j,k=true,o=$("button.submit_aspnet_button"),p=document.getElementById("synonymsHolder"),q=$("fieldset.newRelatedCategories select");if(d.length&&o){q.each(function(){j=
new RegExp("(^|,)"+this.value+"(,|$)");if($.parse(this.value)&&!j.test(c))c+=this.value+","});c=c.replace(/\,$/,"");if(!c&&!p&&$($.lastClick).hasClass("submit_aspnet_button"))k=true;else if(c){d.attr("value",c);k=true}}else if(o.length)k=true;return k},init:function(){var d=this,c=$("fieldset.newRelatedCategories"),j=c.length,k,o,p=null,q=function(){c.normalize();o=c.find("input[type=hidden]").attr("value");k=o==="True"?true:false;model.jso.getAllCategories(k,d.initCategories);$("fieldset.newRelatedCategories > .row > a.create").click(function(t){t.preventDefault();
i(a,0)});$("button, select, input[type=button], input[type=submit]").live("click",function(){p=this;d.submit.storeFormElement=p})};if(j){!$.store.ui||$.store.ui&&!$.store.ui.categoryselect?$.translateNode("ui/categoryselect",function(){q()}):q();$("#aspnetForm").submit(function(t){d.submit()||t.preventDefault()})}}},relatedCategories:{initRelatedCategories:function(d){a=$.parseJSON(d);n(a,0)},init:function(){var d=this,c=$("div.relatedCategoriesBox"),j=c.length,k=function(){c.normalize();c.find("p > a").click(function(o){o.preventDefault();
$("#standard_dialog #login_window").length?$.view.user.openUserLogin():model.jso.getAllCategories(false,d.initRelatedCategories)})};if(j)!$.store.ui||$.store.ui&&!$.store.ui.categoryselect?$.translateNode("ui/categoryselect",function(){k()}):k()}},report:{discussionPost:function(){var d;$("div.reportEntity a.report").click(function(c){c.preventDefault();if($("#standard_dialog #login_window").length)$.view.user.openUserLogin();else{var j=$(this).parent(),k=j.find("input[type=hidden]"),o;j.find("> *:not(select):not(input)").hide();
j.find("select").show().change(function(p){p.preventDefault();var q,t,v=document.location.toString(),u=this.value;for(p=0;p<k.length;p+=1)if(/(hfTopicID|hfEntityID)$/.test(k[p].id))t=$.parse(k[p].value);else if(/(hfReportEntityType|hfReportTypeTopic)$/.test(k[p].id))q=$.parse(k[p].value);model.jso.reportEntity(q,v,u,t,function(){o=$.uniqueId("reported_");j.append(m({tagName:"span",id:o,className:"report",innerHTML:d?d:""})).find("> select").hide().parent().find("div").show();d||$.translate(o,"/common/reported",
function(){d=this.innerHTML})})})}})}},phases:{first:function(d){var c=function(){d.find("span.firstPhase").remove();d.find("li:first").append('<span class="firstPhase">'+$.store.ui.pages.newconstructionpage.firstphase+"</span>")};if(d.attr("id")==="phases")!$.store.ui||$.store.ui&&!$.store.ui.pages||$.store.ui&&$.store.ui.pages&&!$.store.ui.pages.newconstructionpage?$.translateNode("ui/pages/newconstructionpage",function(){c()}):c()},setClasses:function(d){var c=d.find("ol, ul"),j=c.find("li:only-child");
c.find("li").removeClass("first-child").removeClass("last-child").removeClass("only-child");if(j.length)j.addClass("only-child");else{c.find("li:first-child").addClass("first-child");c.find("li:last-child").addClass("last-child")}c.find("span").removeClass("omo");this.first(d)},addButtons:function(d,c,j){j=j?$(j):c.find("ol li, ul li");j.append(m({tagName:"span",className:"buttons",appendChildren:[{tagName:"span",className:"down",innerHTML:" <!-- --\> "},{tagName:"span",className:"up",innerHTML:" <!-- --\> "},
{tagName:"span",className:"remove",innerHTML:" <!-- --\> "}]}));d.setClasses(c)},addPhase:function(d,c){c.find("ol").append(m({tagName:"li",appendChildren:[{tagName:"input",type:"text"}]}));c.find("ol").find("li:last").each(function(){d.addButtons(d,c,this);$(this).find("span.buttons span").click(function(){d.movePhase.apply(this,[c,d])})})},movePhase:function(d,c){var j=$(this),k=j.parents("li");k=k[0];if(j.hasClass("down")&&k.nextSibling)k.nextSibling.nextSibling?k.parentNode.insertBefore(k,k.nextSibling.nextSibling):
k.parentNode.appendChild(k);else if(j.hasClass("up")&&k.previousSibling)k.parentNode.insertBefore(k,k.previousSibling);else if(j.hasClass("remove")){j.parents("li").remove();d.find("li").length||d.find("input[type=checkbox]:checked").each(function(){$(this).trigger("click")})}c.setClasses(d)},postPhases:function(d){var c='{"phases":[',j,k=d.find("li input[type=text]"),o,p;for(j=0;j<k.length;j+=1){o=k[j].id?k[j].id.replace(/^p/,""):"0";p=k[j].value;c+='{"id":"'+o+'","text":"'+p+'"},'}c=c.replace(/,$/,
"");c+="]}";d.find("input[type=hidden]").attr("value",c)},submit:function(){g.phases.postPhases(g.phases.pFs);return true},init:function(){var d=this,c=$("fieldset#phases"),j=c.find("input[type=checkbox]"),k=c.find("ol, p, div.cb");d.pFs=c;if(c.length){j.bindMulti("click, change",function(){if(this.checked){k.show();c.find("ol li").length||d.addPhase(d,c)}else k.hide()});j.length&&!j[0].checked&&k.hide();c.find("ol, li").normalize();this.addButtons(d,c);c.find("span.buttons span").click(function(){d.movePhase.apply(this,
[c,d])}).live("mouseover",function(){$(this).addClass("omo")}).live("mouseout",function(){$(this).removeClass("omo")});c.find("div.cb > a").click(function(o){o.preventDefault();d.addPhase(d,c)});$("#aspnetForm").submit(function(){d.submit()})}}},websites:{postWebsites:function(d){var c='{"websites":[',j,k=d.find("li"),o,p;for(j=0;j<k.length;j+=1){o=$(k[j]).find("input:first").attr("value");p=$(k[j]).find("input:last").attr("value");if(o&&p)c+='{"text":"'+o+'","url":"'+p+'"},'}c=c.replace(/,$/,"");
c+="]}";d.find("input[type=hidden]").attr("value",c)},addRow:function(d,c){c.row?d.find("ul").append(c.row.cloneNode(true)):$.translateNode("ui/pages/newmemberpage",function(){d.find("ul").length||d.prepend("<ul>");d.find("ul").append(m({tagName:"li",appendChildren:[{tagName:"label",innerHTML:$.store.ui.pages.newmemberpage.personalwebpage},{tagName:"input",type:"text",className:"xs defaultValue",value:$.store.ui.pages.newmemberpage.linkname},{tagName:"span",innerHTML:$.store.ui.pages.newmemberpage.link},
{tagName:"input",type:"text",className:"xs defaultValue",value:"http://"},{tagName:"span",className:"remove",title:$.store.common.remove,appendChildren:[{tagName:"span",className:"start",innerHTML:" <!-- --\>"},{tagName:"span",className:"end",innerHTML:" <!-- --\>"}]}]}));var j=d.find("ul li:last")[0];c.row=j.cloneNode(true)})},submit:function(){g.websites.postWebsites(g.websites.wFs);return true},init:function(){var d=this,c=$("fieldset.websites:not(.craftsman)");d.wFs=c;if(c.length){c.find("ul, li").normalize();
c.find("> p a").live("click",function(j){j.preventDefault();d.addRow(c,d)});c.find("span.remove").live("click",function(){var j=$(this).parent();if(c.find("li").length===1){j.find("input").attr("value","").addClass("defaultValue");j.find("input:last").attr("value","http://").addClass("defaultValue")}else j.remove()});$("#aspnetForm").submit(function(){d.submit()});c.find("li label + input").live("click",function(){var j=$(this);if(j.hasClass("defaultValue")){this.value="";j.removeClass("defaultValue")}});
c.find("li input:last").live("click",function(){$(this).removeClass("defaultValue")})}}},members:{addButton:function(d,c){var j={tagName:"span",className:"remove",title:$.store.common.remove,appendChildren:[{tagName:"span",className:"start",innerHTML:" <!-- --\>"},{tagName:"span",className:"end",innerHTML:" <!-- --\>"}]};c?c.append(m(j)):d.find("li").append(m(j))},addMember:function(d,c){var j=this,k=g.phases;if(j.row){c.find("ul").append(j.row.cloneNode(true));k.setClasses(c);c.find("li input.defaultValue").focus(function(){this.value=
"";$(this).removeClass("defaultValue");$(this).unbind("focus")})}else $.translateNode("ui/usercontrols/addprojectmembers",function(){c.find("ul").append(m({tagName:"li",appendChildren:[{tagName:"label",appendChildren:[{tagName:"input",type:"text",value:$.store.common.name,className:"small userName defaultValue"}]},{tagName:"label",appendChildren:[{tagName:"input",type:"text",value:$.store.ui.usercontrols.addprojectmembers.role,className:"small first role defaultValue"}]}]}));d.addButton(c,c.find("ul li:last"));
j.row=c.find("ul li:last")[0].cloneNode(true);c.find("li input.defaultValue").focus(function(){this.value="";$(this).removeClass("defaultValue");$(this).unbind("focus")})})},liveSearch:function(d){var c=this,j=function(k){var o=k.result,p,q="addMemberDropDown",t,v=function(w,y){var A=$(w).offset(),z=3;w=$.parse(A.top+$.parse(w.offsetHeight))-z+"px";A=$.parse(A.left)+"px";y.css({top:w,left:A})},u=function(w){/^(38|40)$/.test(w.keyCode)&&w.preventDefault()};$("#addMemberDropDown").remove();if(o.length){p=
{tagName:"ul",id:q,className:"dropDown",appendChildren:[]};for(k=0;k<o.length;k+=1){p.appendChildren.push({tagName:"li",appendChildren:[{tagName:"a",href:o[k].url,innerHTML:o[k].name,className:"userId"+o[k].id}]});g.members.list[o[k].id]=o[k].name}}$("body").append(m(p));t=$("#"+q);v(c,t);$(window).resize(function(){v(c,t)});t.find("a").click(function(w){w.preventDefault();c.value=this.innerHTML;c.id="u"+this.className.toString().replace(/\D/g,"");$(document).unbind("keydown",u);$(c).attr("readonly",
"readonly").addClass("readonly").focus(function(){this.blur()}).parents("li").find("input.role").focus();t.remove()});t.find("a").mouseover(function(){$(this).focus()});t.find("a").focus(function(){t.find("a").removeClass("focus");$(this).addClass("focus")});t.find("a").keydown(function(w){var y=this;if(w.keyCode===40){w=$(y).parent().next("li");w.length?w.find("a").focus():t.find("a:eq(0)").focus()}else if(w.keyCode===38){w=$(y).parent().prev("li");w.length?w.find("a").focus():t.find("a:last").focus()}});
if(d.keyCode===40){$(document).bind("keydown",u);t.find("a:first").focus()}};model.jso.getUsers($.trim(c.value),function(k){k=$.parseJSON(k);j(k)})},submit:function(){var d=g.members,c=new d.UserList;d.mFs.find("input[type=hidden]").attr("value",c.getJson());return true},init:function(){var d=this,c=$("fieldset.members"),j=c.find("ul li"),k=function(q,t,v){var u=this,w=$(q);q=w.find("input.userName");w=w.find("input.role");var y=0,A=q.attr("id")?d.list[$.parse(q.attr("id").replace(/\D/g,""))]:false,
z=false;if(A&&A===$.trim(q.attr("value"))){z=true;y=$.parse(q.attr("id").replace(/\D/g,""))}else if(!A&&v&&$(q).hasClass("user")){d.list[$.parse(q.attr("id").replace(/\D/g,""))]=$.trim(q.attr("value"));z=true;y=$.parse(q.attr("id").replace(/\D/g,""))}u[t]={userName:$.trim(q.attr("value")),id:y,role:$.trim(w.attr("value")),isUser:z,defaultValue:/(^|\s)defaultValue(\s|$)/.test(q.attr("class"))}},o=function(q){var t=this;t.setUsers=function(){var v,u=c.find("ul li");for(v=0;v<u.length;v+=1)k.apply(t,
[u[v],v,q]);t.length=u.length};t.getJson=function(){var v="{members:[",u;for(u=0;u<t.length;u+=1)if(t[u].userName&&t[u].role&&!t[u].defaultValue)v+='{"id":"'+t[u].id+'","name":"'+t[u].userName+'","role":"'+t[u].role+'","isUser":'+t[u].isUser+"},";v=v.replace(/,$/,"");v+="]}";return v};t.setUsers()},p;d.mFs=c;d.UserList=o;if(c.length){j.normalize();j.find("input[type=text]:first").addClass("userName");j.find("input[type=text]:last").addClass("first role");g.members.list={};p=new o("load");d.addButton(c);
c.find("div.cb > a").click(function(q){q.preventDefault();d.addMember(d,c);p=new o});c.find("li input.defaultValue").focus(function(){this.value="";$(this).removeClass("defaultValue");$(this).unbind("focus")});c.find("li input.userName").live("keyup",function(q){if(this.value&&this.value.length>=3)d.liveSearch.apply(this,[q]);else if(!this.value||this.value&&this.value.length<3)$("#addMemberDropDown").remove();p=new o});c.find("span.remove").live("click",function(){var q=$(this).parent();if(q.parent().find("li").length===
1){q.remove();d.addMember(d,c)}else q.remove();p=new o});$("#aspnetForm").submit(function(){d.submit()})}}},constructionDefaultImg:{init:function(){var d=$("div.constructionDefaultImg"),c=d.find("img");d=d.find("li");var j,k=0;$("div.constructionDefaultImg img[src='']").parent().remove();c.click(function(){c.removeClass("selected");var o=$(this);o.addClass("selected")});for(j=0;j<d.length;j+=1)if(d[j].offsetHeight>k)k=d[j].offsetHeight;for(j=0;j<d.length;j+=1)d[j].style.height=k+"px"}},imageRotator:{SliderControl:function(d){var c=
this,j=$(d),k=false;c.slideImage=function(o){var p=c[c.currentImage].cloneNode(true),q=$(d).find("div.image")[0],t=500,v;if(!k){k=true;c.currentImageSpan.innerHTML=$.parse(c.currentImage+1);$(p).css({position:"absolute",visibility:"hidden",top:0});if(o==="next"){j.prepend(p);p.style.left=parseInt(q.offsetLeft-p.offsetWidth,10)+"px";v=q.offsetWidth+"px"}else if(o==="prev"){j.append(p);p.style.left=parseInt(q.offsetWidth,10)+"px";v=parseInt(q.offsetLeft-q.offsetWidth,10)+"px"}setTimeout(function(){p.style.visibility=
"visible";$(p).animate({left:"0px"},t);j.animate({height:$(p).height()+"px"},t);$(q).animate({left:v},t,function(){p.style.position="relative";$(q).remove();setTimeout(function(){k=false},10)})},100)}};c.prev=function(){c.lastImage=c.currentImage;c.currentImage-=1;if(c.currentImage<0)c.currentImage=c.length-1;c.slideImage("next")};c.next=function(){c.lastImage=c.currentImage;c.currentImage+=1;if(c.currentImage>c.length-1)c.currentImage=0;c.slideImage("prev")};c.showAll=function(){var o;j.find("div.image").remove();
for(o=0;o<c.length;o+=1)j.append(c[o].cloneNode(true));j.css({height:"auto"});j.find("div.image").css({minHeight:"0"})};c.hideAll=function(){j.find("div.image").remove();j.append(c[c.currentImage].cloneNode(true))};c.init=function(){var o=$(d).next("div.sliderControl"),p=true;o.hide();o.append(m({appendChildren:[{appendChildren:[{tagName:"button",type:"button",className:"prev",innerHTML:"<!-- &lt; --\>",title:$.store.common.previouspage},{tagName:"span",className:"showImageOfImages",innerHTML:'<span class="currentImageNbr">1</span> '+
$.store.common.outof+" "+c.length},{tagName:"button",type:"button",className:"next",innerHTML:"<!-- &gt; --\>",title:$.store.common.nextpage}]},{className:"showAllText",appendChildren:{tagName:"p",appendChildren:{tagName:"a",href:"/",innerHTML:$.store.ui.usercontrols.imagerotator.showall}}}]}));c.currentImageSpan=o.find("span.currentImageNbr")[0];o.find("button:first").click(function(q){q.preventDefault();p&&c.prev()});o.find("button:last").click(function(q){q.preventDefault();p&&c.next()});o.find("p > a").click(function(q){var t=
$(this);q.preventDefault();if(p){p=false;t.parent().parent().prev("div").hide();j.addClass("showAll");this.innerHTML=$.store.ui.usercontrols.imagerotator.showimagegallery;c.showAll()}else{p=true;t.parent().parent().prev("div").show();j.removeClass("showAll");this.innerHTML=$.store.ui.usercontrols.imagerotator.showall;c.hideAll()}});o.show()};c.init()},ImageRotator:function(d){var c=this,j,k=d[0].parentNode;c.lastImage=0;c.height=0;c.width=0;c.imgHolder={height:0,width:0};c.init=function(){var o,p;
for(j=0;j<d.length;j+=1){$(d[j]).css({display:"block"});o=d[j];p=$(o).find("div.imageHolder")[0];c.cImageHolder=p;if(p.offsetHeight>c.imgHolder.height)c.imgHolder.height=p.offsetHeight;if($.parse(o.offsetHeight)>c.height)c.height=$.parse(o.offsetHeight);c[j]=d[j].cloneNode(true);$(c[j]).removeClass("notFirst")}c.length=d.length;c.currentImage=0;k.appendChild(c[0].cloneNode(true));d.remove();d.length>1&&g.imageRotator.SliderControl.apply(c,[k])};c.init()},init:function(){var d=this,c=$("div.imageRotator"),
j,k,o;if(c.length){$("div.imageRotator").normalize();$.translateNode("ui/usercontrols/imagerotator",function(){for(k=0;k<c.length;k+=1){o=$(c[k]).find("div.image").css({position:"relative",top:"0"});j=new d.ImageRotator(o,k)}})}}},emptyForm:{init:function(){$("div.comments textarea").attr("value","")}},updatedBy:{init:function(){var d=$("div.updatedBy"),c;if(d.length){c=$.uniqueId("seeUsers_");d.find("div").append('<a style="display: none;" id="'+c+'" href="/"></a>').find("a").click(function(j){j.preventDefault();
d.find("ul").toggle("slow")});$.translate(c,"/ui/pages/wordlistpage/seeusers",function(){this.style.display="inline"})}}},removeBookmark:{init:function(){$(".bookmarks button").click(function(d){d.preventDefault();var c=this,j=$(this).parent().find("a")[0],k=$("select[id$=lvHeaderLogin_ddlMyBookmarks]");$(this).parent().animate({height:0},"slow",function(){$(this).remove();k.find("option").each(function(){$.trim(this.innerHTML)===$.trim(j.innerHTML)&&$(this).remove()});k.find("option").length<=1&&
k.remove();model.jso.doRemoveBookMark($.parse(c.id.replace(/^b/,"")))})})}},removeProject:{submit:function(d){var c=$("button[id$=butRemoveConstruction], button[id$=butRemoveEntry]").singleElement(),j=c?true:false;if(j&&$.lastClick===c)if(!this.returnValue){d.preventDefault();d=$(c).attr("id").indexOf("butRemoveEntry")!==-1?$.store.common.confirmremovepost:$.store.common.confirmremoveproject;if($.customConfirm(d,"deleteProject_")){this.returnValue=true;$("#aspnetForm").submit()}else this.returnValue=
false}},init:function(){var d=this,c=$("button[id$=butRemoveConstruction], button[id$=butRemoveEntry]");c.length&&$("#aspnetForm").submit(function(j){d.submit(j)})}},video:{init:function(){var d=$("#fileUploadProgress_Bar"),c=$("#fileUploadProgress"),j=c.find("span.current"),k=c.find("span.total"),o=d.find("div.start"),p,q=true,t,v=0,u=v,w,y=500,A=function(x){y=x},z=0,G=$("fieldset#uploadVideo, fieldset#youTubeVideo"),D=$("#fileUploadProgress_name"),B=function(){clearInterval(w)},C=false,H=[],J;p=
$("#uploadedVideo:visible").length?true:false;if(G.length){G.each(function(){var x=$(this);if(x.hasClass("hidden")||this.style.display==="none")x.find("input, textara, select, button").attr("disabled","disabled")});p&&$("#uploadVideo input[type=radio]").attr("disabled","disabled");$("#uploadedVideo p.fileName").each(function(){$(this).append(m({tagName:"span",className:"remove",title:$.store.common.remove,innerHTML:"<!-- --\>"}))})}if(d.length){p=$("button[id$=fuVideo_btn]");G.find("input[type=radio]").click(function(){var x=
$("#youTubeVideo"),E=$("#uploadVideo div.formContent"),F=$(this).closest("div");F.css({height:F.height()+"px"});if(/rbYouTube$/.test(this.id)){x.find("input").each(function(){this.disabled=false});x.removeClass("hidden");E.find("input").attr("disabled","disabled");E.addClass("hidden")}else{x.find("input").attr("disabled","disabled");x.addClass("hidden");E.find("input").each(function(){this.disabled=false});E.removeClass("hidden")}F.animate({height:function(){var I=10;F.find("h3, fieldset:visible").each(function(){I+=
$(this).height()});return I}()})});$.translateNode("addvideo");$("div.ratio input[type=radio]").click(function(){var x=$(this).parent();x.closest("ul").find("label").removeClass("selected");x.addClass("selected")});$("#uploadedVideo span.remove, #uploadVideo span.remove").live("click",function(){var x=$(this),E=$("#uploadVideo input[type=hidden][id$=hfAddedVideoID]"),F=E.attr("value");model.jso.removeVideo($.parse(F),function(){E.attr("value","");x.closest("div.corners").find("div.formContent").removeClass("hidden").parent().find("input, button").each(function(){this.disabled=
false;this.style.display="";if(/^(text|file)$/i.test(this.type))this.value=""});x.closest("div.corners").find("div[id^=fileUploadProgress]").hide();x.closest("div.corners").find("img[id$=imgVideo]").hide();x.parent().hide()})});if(p.length){p.live("click",function(){$(this).hide();G.find("input[type=file]").hide().prev().hide()});p=function(){d.show();c.show();D.show();y=500;z=0;C=false;q=true;document.getElementById("videodescription").disabled=true;$(document.forms[0].elements).each(function(){if(/^(button|input)$/i.test(this.tagName)&&
(!this.type||/^(submit|button|reset|file|radio)$/i.test(this.type))){this.disabled="disabled";H.push(this)}});d.find("div > span.start").css({position:"relative",visibility:"hidden"});d.find("div > span").each(function(){var x=this.parentNode.parentNode.offsetWidth,E=this.offsetWidth;x=(x-E)/2;this.style.left=x+"px"});d.find("div > span.start").css({position:"absolute",visibility:"visible"});o.css({width:"0%"});j.text("0 Mb");d.find("div > span").text("0%");w=setInterval(function(){model.jso.uploadVideoProgress(function(x){x=
$.parseJSON(x);var E,F,I;x.error&&B();E=x.result.percent;F=x.result.current;I=x.result.total;t=$.parse(E);if(t===v)u+=1;else u=0;if(q){k.text(I+" Mb");if(/\\/.test(x.result.name)){J=x.result.name.split("\\");D.find(".fileName").removeClass("ready").show().text(J[J.length-1])}else D.find(".fileName").removeClass("ready").show().text(x.result.name);q=false}o.css({width:E+"%"});j.text(F+" Mb");d.find("div > span").text(E+"%");if(u>10)A(1E3);else if(z>1)A(1E3);else if(z>5)A(5E3);else z>20&&A(1E4);if($.parse(E)===
100&&!C){B();j.text(I+" Mb");C=true;model.jso.addedVideoID(function(K){K=$.parseJSON(K);if(K.result){D.find(".fileName").append(m({tagName:"span",className:"remove",title:$.store.common.remove})).addClass("ready");G.find("input[id$=hfAddedVideoID]").attr("value",K.result)}});$.runFunction(H,function(){this.disabled=false});$("input[id$=rbYouTube], #youTubeVideo").attr("disabled","disabled")}u>60&&B();z+=1;v=t})},y)};$("input[id$=fuVideo]").ajaxFileUpload({url:"/ui/ajax/videoupload.aspx",elements:$("fieldset#uploadVideo").find("input, button, select, textarea"),
ignoreTypes:"file, submit, button",acceptMedia:"3gp, asf, avi, dv, mov, mp2, mp4, mpg, m4v, wmv",submit:"fuVideo_btn",success:p})}}}},projectList:{setLast:function(d,c){var j=c?c:$("div.projects li, div.projectListingPage li"),k,o;c=function(){var p=0,q="";for(k=0;k<j.length;k+=1){o=new RegExp("(^|,)"+j[k].offsetLeft+"(,|$)");if(q)o.test(q)||(q+=","+j[k].offsetLeft);else q+=j[k].offsetLeft}q=q.split(",");for(k=0;k<q.length;k+=1)if($.parse(q[k])>$.parse(p))p=$.parse(q[k]);return p};if(j.length)if(d===
"row"){d=j[j.length-1];for(k=j.length-1;k>-1;k-=1)j[k].offsetTop===d.offsetTop&&$(j[k]).addClass("lastRow")}else if(d==="col"){d=c();for(k=0;k<j.length;k+=1)$.parse(j[k].offsetLeft)===$.parse(d)&&$(j[k]).addClass("lastCol")}},init:function(){var d=$("div.projects.fourCols li"),c=$("div.twoCols.projects div.col ul li"),j=$("div.projectListingPage ul li"),k=1,o;$("div.projects li.last").removeClass("last");if(d.length){r(d.find("h3"),4);r(d,4)}if(c.length)for(d=0;d<c.length;d+=2){o=$(".twoCols.projects li:nth-child("+
k+"), .twoCols.projects li:nth-child("+$.parse(k+1)+")");r(o.find("h3"));r(o.find("img"));r(o);k+=2}if(j.length){r(j.find("h3"),4);r(j.find("img"),4);r(j,4)}}},projectIsCompleded:{init:function(){$("input[type=checkbox][id$=cbConstructionCompleted]").click(function(){var d=$(this).parent().next("div.completedDate");this.checked?d.removeClass("hidden"):d.addClass("hidden")})}},customPublishDate:{init:function(){$("input[type=checkbox][id$=cbDateLater]").click(function(){var d=$(this).parent().next("div.customDatedPublication");
this.checked?d.removeClass("hidden"):d.addClass("hidden")})}},memberPolicyPage:{init:function(){var d=$("a.memberPolicyPage"),c=109,j=function(k){if(k.get(0).offsetHeight)k.animate({height:0},"slow",function(){$(this).css({display:"none"})});else{k.css({height:0,display:"block"});k.animate({height:c+"px"},"slow")}};d.length&&d.click(function(k){k.preventDefault();k=this.href;var o=$("#memberPolicyPageContainer");o[0].innerHTML?j(o):o.load(k+" #content > div:not(.breadcrumbs):not(.pageHeader)",function(){j(o)})})}},
craftsMan:{init:function(){$("input[type=checkbox][id$=cbIsCraftsman]").click(function(){var d=$(this).parent().next();if(this.checked){d.hide();d.removeClass("hidden");d.show("slow")}else d.hide("slow")})}},cancelPassWord:{init:function(){$("button[id$=btnAbortChange]").click(function(d){d.preventDefault();d=$("#changePasswordBox");d.hide();d.find("input").each(function(){this.value=""});d.find("p.error").remove();d.find(".error").removeClass("error")})}},misc:{init:function(){$("input[id$=cbAlias]").click(function(){var d=
$(this).parent().next("div.aliasBox");this.checked?d.show("slow"):d.hide("slow")});$("div.searchResult li a").each(function(){var d=this,c=$(this).closest("li");c.css({cursor:"pointer"});c.mouseover(function(){$(this).css({backgroundColor:"#f6efe5"})}).mouseout(function(){$(this).css({backgroundColor:"transparent"})}).click(function(){document.location=d})});$("#close_dialog_login.cancelButton.goBack, #close_dialog.cancelButton.goBack").live("click",function(d){d.preventDefault();history.back()});
$("div.constructionPage h2.outcast").each(function(){var d=this,c=$(d),j=d.innerHTML,k=m({tagName:"span",className:"repeaterWrap"}),o=m({tagName:"span",innerHTML:j}),p=0,q;c.css({overflow:"hidden"});d.innerHTML="";d.appendChild(k);if($.isIE7){k.appendChild(o.cloneNode(true));q=setInterval(function(){k.appendChild(o.cloneNode(true));p+=1;p>20&&clearInterval(q)},50)}else for(;k.offsetWidth<$.parse(d.offsetWidth+100);)k.appendChild(o.cloneNode(true));$(d).css({visibility:"visible"})})}},init:function(){$.addInit.call(this);
$.runAll.apply(this,["init"]);$.customHover("span.remove");if($.isIE){$("div.projects li:nth-child(2), div.discussion div.bottomLinks li:nth-child(2)").addClass("nth-child2");$("table tr:nth-child(odd)").addClass("odd");$("table tr:nth-child(even)").addClass("even")}$.isIE&&$("body").addClass("ie");$.isIE7&&$("body").addClass("ie7")}};$(document).ready(function(){g.init()})})();

