mesa.WebUtils={};mesa.WebUtils._AGENT=navigator.userAgent.toLowerCase();mesa.WebUtils.isIE=function(){return/msie/.test(mesa.WebUtils._AGENT)&&!/opera/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isIE6=function(){return/msie 6/.test(mesa.WebUtils._AGENT)&&!/opera/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isIE7=function(){return/msie 7/.test(mesa.WebUtils._AGENT)&&!/opera/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isIE8=function(){return/msie 8/.test(mesa.WebUtils._AGENT)&&!/opera/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isFF=function(){return/firefox/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isFF2=function(){return/firefox\/2/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isFF3=function(){return/firefox\/3/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isChrome=function(){return/chrome/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isMozilla=function(){return/mozilla/.test(mesa.WebUtils._AGENT)&&!/(compatible|webkit)/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isMac=function(){return/mac/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.isSafari=function(){return/safari/.test(mesa.WebUtils._AGENT)};mesa.WebUtils.detectFlash=function(){if(mesa.WebUtils.isIE()){for(var b=10;b>0;--b){try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+b);return b}catch(c){}}}else{if(navigator.plugins&&navigator.plugins.length){var a=navigator.plugins["Shockwave Flash"];if(a){return/Shockwave Flash (\d+)\..+/.exec(a.description)[1]}}}return 0};mesa.WebUtils.getFlashScript=function(e,d,b,a,c){if(!c){c=new Object()}if(!c.allowScriptAccess){c.allowScriptAccess="sameDomain"}if(!c.quality){c.quality="high"}if(!c.wmode){c.wmode="transparent"}return mesa.WebUtils.applyTemplate("flash",{id:e,movieUrl:d,width:b,height:a,params:c})};mesa.WebUtils.writeFlashScript=function(e,d,b,a,c){document.write(mesa.WebUtils.getFlashScript(e,d,b,a,c))};mesa.WebUtils.getFlashObject=function(a){return mesa.WebUtils.isIE()?$(a):document[a]};mesa.WebUtils.findElementPosition=function(b,a){if(typeof(a)=="string"){a=$(a)}var c=curtop=0;for(;b.offsetParent;b=b.offsetParent){if(a&&b==a){break}c+=b.offsetLeft;curtop+=b.offsetTop}return{x:c,y:curtop}};mesa.WebUtils.getWindowSize=function(){if(mesa.WebUtils.isIE()){return{w:document.documentElement.clientWidth||document.body.clientWidth,h:document.documentElement.clientHeight||document.body.clientHeight}}else{return{w:window.innerWidth,h:window.innerHeight}}};mesa.WebUtils.getPageSize=function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}};mesa.WebUtils.getPageOffset=function(){if(mesa.WebUtils.isIE()){return{x:document.body.scrollLeft||document.documentElement.scrollLeft,y:document.body.scrollTop||document.documentElement.scrollTop}}else{return{x:window.pageXOffset,y:window.pageYOffset}}};mesa.WebUtils.getParameter=function(a){try{if(location.search){var c=location.search.substring(1).toQueryParams();if(typeof(c[a])=="string"){return c[a]}}}catch(b){}return null};mesa.WebUtils.setParameter=function(a,b){var c=new Object();c[a]=b;mesa.WebUtils.setParameters(c)};mesa.WebUtils.setParameters=function(c){var b=$H(c);var a="";if(location.search){a=location.search.substring(1);b.each(function(d){a=mesa.WebUtils.removeUrlParam(a,d.key)})}b.each(function(d){if(a.length>0){a+="&"}a+=encodeURIComponent(d.key)+"="+encodeURIComponent(d.value)});location.search=a};mesa.WebUtils.removeUrlParam=function(){var a=arguments[0];for(var b=1;b<arguments.length;++b){a=a.replace(new RegExp(arguments[b]+"=[^&]*&*"),"")}if(a.charAt(a.length-1)=="&"){a=a.substring(0,a.length-1)}return a};mesa.WebUtils.setRadioButtonValue=function(d,b,e){var a=d[b];if(a.length){for(var c=0;c<a.length;++c){if(a[c].value==e){a[c].checked=true;return}}}else{if(a.value&&a.value==e){a.checked=true}}};mesa.WebUtils.getRadioButtonValue=function(d,b){var a=d[b];if(a.length){for(var c=0;c<a.length;++c){if(a[c].checked){return a[c].value}}}else{if(a.checked&&a.value){return a.value}}return null};mesa.WebUtils.setSelectValue=function(b,d){var a=b.options;for(var c=0;c<a.length;++c){if(a[c].value==d){a[c].selected=true;return true}}return false};mesa.WebUtils.setSelectOptions=function(d,c,a){var b=d.options;b.length=0;for(var e=0;e<c.length;++e){b[e]=new Option(c[e].text,c[e].value);if(b[e].value==a){b[e].selected=true}}};mesa.WebUtils.readCookie=function(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null};mesa.WebUtils.createCookie=function(c,d,f,e){if(f){var b=new Date();if(0>=f){b.setTime(0)}else{b.setTime(b.getTime()+(f*24*60*60*1000))}var a="; expires="+b.toGMTString()}else{var a=""}if(!e){e="/"}document.cookie=c+"="+d+a+"; path="+e};mesa.WebUtils.reload=function(){mesa.WebUtils.setParameter("_timestamp",new Date().getTime())};mesa.WebUtils.nl2br=function(a){if(!a){return a}a=a.replace(/\r\n/g,"<br/>");a=a.replace(/\r/g,"<br/>");a=a.replace(/\n/g,"<br/>");return a};mesa.WebUtils.initSelect=function(b,a,e,f){if(typeof(b)=="string"){b=$(b)}if(!f){f=new Object()}if(!f.name){f.name="value"}b.options.length=0;if(f.allowNull){b.options[0]=new Option("Choose "+f.name+"..","")}for(var d=0;d<a.length;++d){if(a[d].text&&a[d].value){b.options[b.options.length]=new Option(a[d].text,a[d].value)}else{b.options[b.options.length]=new Option(a[d],a[d])}}for(var d=0;d<b.options.length;++d){if(b.options[d].value==e){b.selectedIndex=d;break}}if(f.allowNew){b.options[b.options.length]=new Option("Create New..","");var c=b.onchange;b.onchange=function(){var g=b.selectedIndex;if(g==b.options.length-1){mesa.Popup.prompt("Enter "+f.name+":",function(h){b.options[g]=new Option(h,h);b.options[b.options.length]=new Option("Create New..","");b.selectedIndex=g;if(c){c()}},function(){b.selectedIndex=0},f.maxLength,"","Create a New "+f.name)}else{if(c){c()}}}}};mesa.WebUtils.readRemoteFile=function(a){var b;if(window.XMLHttpRequest){b=new XMLHttpRequest()}else{if(window.ActiveXObject){b=new ActiveXObject("Microsoft.XMLHTTP")}}b.open("GET",a,false);b.send(null);if(b.status==200){return b.responseText}else{return null}};mesa.WebUtils.applyTemplate=function(h,b){var c=siteConfig.template;var a="{template "+h+"}";var d="{/template}";var f=c.indexOf(a);if(f>=0){var e=c.indexOf(d,f);if(e>f){var g=c.substring(f+a.length,e);var i=TrimPath.parseTemplate(g).process(b);i=i.replace(/\s+/gi," ").strip();return i}}throw"Template not available"};mesa.WebUtils.declareMouseExitHandler=function(a,b){if(typeof(a)=="string"){a=$(a)}if(a){a.onmouseout=function(c){c=c||window.event;for(var d=c.relatedTarget||c.toElement;d&&d!=document.documentElement;d=d.parentNode){if(d==a){return}}b(c)}}};mesa.WebUtils.trackPageview=function(a){try{pageTracker._trackPageview(a)}catch(b){}};