var Utils={keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,COMMA:188},intersect:function(b,a){if(!b){return false}if(!a){return false}if(b.left>a.right){return false}if(b.right<a.left){return false}if(b.top>a.bottom){return false}if(b.bottom<a.top){return false}return true},htmldecode:function(a){if(!a){return""}else{a=a.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'").replace(/&quot;/g,'"').replace(/&#xD;/g,"\n");return a}},htmlencode:function(a){if(!a){return""}else{a=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\'/g,"&#39;").replace(/"/g,"&quot;").replace(/\n/g,"&#xD;");return a}},texttohtml:function(a){a=a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br/>");return a},htmltotext:function(a){a=a.replace(/<br\/>/g,"\r\n");return a},htmlstriptags:function(d,a){var b=new Element("div",{html:d});var e=b.getElements(a);e.each(function(f){f.destroy()});var c=b.innerHTML;return c},outerHTML:function(d){if(d.outerHTML){return d.outerHTML}var c=d.parentNode;var b=document.createElement(c.tagName);b.appendChild(d);var a=b.innerHTML;c.appendChild(d);return a},alertObject:function(b){var c=[];for(var a in b){c.push(a+": "+b[a])}alert(c.join("\n"))},alphatize:function(a){return a.toLowerCase().replace(/ /g,"_").replace(/[^~0-9a-zA-Z_]*/g,"")},modalAlert:function(i,f){var h=f?f:window.translations["media-js-Error"];var d=new Modalbox({title:h});var c=new Element("div",{"class":"ig-modal-pad"});var a=new Element("form",{"class":"ig-form"});var b=new Element("p").set("html",i).inject(c,"bottom");var g=new Element("div",{"class":"ig-formitem buttons clearfix nomargin"}).inject(c,"bottom");var e=new Element("input",{"class":"ig-button ig-bold",type:"button",value:window.translations["media-js-continue"]}).inject(g,"bottom");e.addEvent("click",function(){d.close();d.fireEvent("onClose")});d.adopt(c);return d},item_url_available:function(b){var h=b.parentId;var a=b.urlTitle;var e=b.navItemId||null;var f=b.onSuccess||null;var c=b.onUnsuccess||null;var d=b.onFailure||null;var g=new ApiClient({apimethod:"nav/item_url_available",method:"get",queryparams:{parentId:h,urlTitle:a,navItemId:e},onRequest:function(){},onSuccess:function(l,j){var k=JSON.decode(l,true);if(k!=null){var i=k.response.value;if(i.toLowerCase()=="false"){c()}else{f()}}},onFailure:function(){d(arguments)}})},IARParse:function(c){var e="";var a="";var f=c.getElementsByTagName("object");for(var d=0;d<f.length;d++){var g=f[d].getElementsByTagName("name");var h=g[0];if(h&&h.firstChild&&h.firstChild.nodeValue){if(h.firstChild.nodeValue=="widgetHtml"){for(var b=0;b<f[d].getElementsByTagName("value")[0].childNodes.length;b++){e+=f[d].getElementsByTagName("value")[0].childNodes[b].nodeValue}}if(h.firstChild.nodeValue=="widgetXml"){for(var b=0;b<f[d].getElementsByTagName("value")[0].childNodes.length;b++){a+=f[d].getElementsByTagName("value")[0].childNodes[b].nodeValue}}}else{}}return{apihtml:e,apixml:a}},Utf8:{encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b},decimal:function(b){var a="";return a}},formatBytes:function(b,a){if(!a){a=0}var c=[window.translations["media-js-filesize_bytes"],window.translations["media-js-filesize_kilobyte_abbr"],window.translations["media-js-filesize_megabyte_abbr"],window.translations["media-js-filesize_gigabyte_abbr"]];b=Math.max(b,0);var d=Math.floor((b?Math.log(b):0)/Math.log(1024));d=Math.min(d,c.length-1);b/=Math.pow(1024,d);return b.round(a)+c[d]},sprintf:function(a,b){return a.replace(/{(\d+)}/g,function(c,d){return typeof b[d]!="undefined"?b[d]:c})},timeSince:function(a){var c=0;var b="";if(a>31556926000){c=Math.round(a/31556926000);b=this.sprintf((c==1?c+" "+window.translations["funct-date-year_ago"]:window.translations["funct-date-years_ago"]),[c])}else{if(a>2629743000){c=Math.round(a/2629743000);b=this.sprintf((c==1?c+" "+window.translations["funct-date-month_ago"]:window.translations["funct-date-months_ago"]),[c])}else{if(a>604800000){c=Math.round(a/604800000);b=this.sprintf((c==1?c+" "+window.translations["funct-date-week_ago"]:window.translations["funct-date-weeks_ago"]),[c])}else{if(a>86400000){c=Math.round(a/86400000);b=this.sprintf((c==1?c+" "+window.translations["funct-date-day_ago"]:window.translations["funct-date-days_ago"]),[c])}else{if(a>3600000){c=Math.round(a/3600000);b=this.sprintf((c==1?c+" "+window.translations["funct-date-hour_ago"]:window.translations["funct-date-hours_ago"]),[c])}else{if(a>60000){c=Math.round(a/60000);b=this.sprintf((c==1?window.translations["funct-date-minute_ago"]:window.translations["funct-date-minutes_ago"]),[c])}else{b=window.translations["funct-date-moments_ago"]}}}}}}return b},debounce:function(b,a){if(this.toDebounce[b]){clearTimeout(this.toDebounce[b])}this.toDebounce[b]=setTimeout(b,a)},toDebounce:[],zeroPad:function(a,b){var c=a+"";while(c.length<b){c="0"+c}return c},fixFlash:function(){$$("object").each(function(c){if(!Browser.Engine.trident){var e=(c.getProperty("width")!="")?'width="'+c.getProperty("width")+'"':"";var a=(c.getProperty("height")!="")?'height="'+c.getProperty("height")+'"':"";var b=c.getProperty("data");var d='<param name="movie" value="'+b+'" />';d+='<object type="application/x-shockwave-flash" data="'+b+'" '+e+" "+a+" />";d+='<param name="movie" value="'+b+'" />';d+="</object>";c.innerHTML=d}})},getIgPaneObject:function(b){var b=$(b);var a=null;$each(window.igPaneObjects,function(c){if(c.getMenu().get("id")==b.get("id")){a=c}});return a}};Element.implement({redraw:function(){var b=this;var c=b.getStyle("display");b.style.display="none";var a=b.offsetHeight;b.style.display=c;return this}});String.implement({parseQueryString:function(d,a){if(d==null){d=true}if(a==null){a=true}var c=this.split(/[&;]/),b={};if(!c.length){return b}c.each(function(i){var e=i.indexOf("=")+1,g=e?i.substr(e):"",f=e?i.substr(0,e-1).match(/([^\]\[]+|(\B)(?=\]))/g):[i],h=b;if(!f){return}if(a){g=decodeURIComponent(g)}f.each(function(k,j){if(d){k=decodeURIComponent(k)}var l=h[k];if(j<f.length-1){h=h[k]=l||{}}else{if(typeof(l)=="array"){l.push(g)}else{h[k]=l!=null?[l,g]:g}}})});return b},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1);return a?a.call(null,c,d):(d||d===0)}).join("&")}});window.mousex=0;window.mousey=0;window.mouse={};window.addEvent("load",function(){document.addEvent("mousemove",function(a){if(a&&a.page){window.mousex=a.page.x;window.mousey=a.page.y;window.mouse.left=a.page.x;window.mouse.right=a.page.x;window.mouse.top=a.page.y;window.mouse.bottom=a.page.y}})});window.addEvent("domready",function(){Utils.fixFlash()});
