var ENABLE_FF_DEBUG=false;(function(a){function b(e,c){var d=this,b=d.tooltipDIV=a("<div></div>").addClass(c.className).html(e.attr("title"));a("body").append(b);b.hide();e.removeAttr("title");function g(a,c){b.css({left:a,top:c})}function f(e){var j=b.outerWidth(),i=b.outerHeight(),d=a(window),k=d.width()+d.scrollLeft(),l=d.height()+d.scrollTop(),f=e.pageX+c.offset[0],h=e.pageY+c.offset[1];if(f+j>k)f=k-j;if(h+i>l)h=e.pageY-c.offset[1]-i;g(f,h)}e.hover(function(a){if(b.html().length==0)return false;d.isShow=true;f(a);clearTimeout(d.timeoutHandler);d.timeoutHandler=setTimeout(function(){d.isShow&&c.show(b)},c.showDelay)},function(){if(b.html().length==0)return false;d.isShow=false;clearTimeout(d.timeoutHandler);c.hide(b)})}b.prototype.isShow=false;b.prototype.timeoutHandler=null;b.prototype.tooltipDIV=null;b.prototype.setTitle=function(a){this.tooltipDIV.html(a)};a.fn.toolTipHover=function(d){var c={offset:[10,10],className:"DefaultToolTipHover",showDelay:200,show:function(a){a.fadeIn(150)},hide:function(a){a.fadeOut(150)}};a.extend(c,d);this.each(function(){var d=new b(a(this),c);a(this).data("ToolTipHover",d)})}})(jQuery);(function(a){a.fn.unselectable=function(c){var b=this;b=this.each(function(){a(this).css("-moz-user-select","none").css("-khtml-user-select","none").css("user-select","none").attr("unselectable","on")});(c||false)&&b.find("*").css("-moz-user-select","none").css("-khtml-user-select","none").css("user-select","none").attr("unselectable","on");return b}})(jQuery);(function(a){if(ENABLE_FF_DEBUG&&window.console&&window.console.log)a.debug={log:function(){console.log.apply(window.console,arguments)},time:function(){console.time.apply(window.console,arguments)},timeEnd:function(){console.timeEnd.apply(window.console,arguments)}};else a.debug={log:function(){},time:function(){},timeEnd:function(){}}})(jQuery);(function(a){a.fn.ProgressBar=function(c){var b=a.extend({},{classPrefix:"progress",height:null,value:0,tooltip:null,animation:0,maxLimit:100,onFinishClassExt:"_finished",forceFinish:false},c);return this.each(function(){var j=a(this);if(j.children().length==0){var k=b.height!=null?' style="height:'+b.height+'"':"";j.html('<div class="'+b.classPrefix+'_outer"><div class="'+b.classPrefix+'_inner"'+k+'><div class="'+b.classPrefix+'_indicator"'+k+"></div></div></div>")}var l=function(a){return b.maxLimit===100||b.maxLimit<=0?a:Math.floor(a*100/b.maxLimit)},e=function(){},c=j.find("."+b.classPrefix+"_indicator"),d=l(b.value),h=l(b.maxLimit);b.tooltip!=null&&c.attr("title",b.tooltip);if(b.maxLimit!=-1){if(d>h)d=h;if(b.onFinishClassExt!=null){var i=b.classPrefix+b.onFinishClassExt;if(d==h||b.forceFinish)e=function(){c.fadeOut("fast",function(){a(this).removeClass(i).addClass(i).fadeIn("slow")})};else d<h&&c.removeClass(i)}}if(b.animation==0){e();c.css({width:d+"%"})}else if(b.animation=="auto"){var g=0,f=c.data("valTarget");if(typeof f==="undefined"||f==null)f=0;try{g=parseFloat(c.css("width").replace("%",""))}catch(n){g=0}if(f!=g){c.stop();c.css({width:f+"%"});g=f}c.data("valTarget",d);var m=d-g;if(m>20)c.animate({width:d+"%"},"slow",e);else if(m>5)c.animate({width:d+"%"},"fast",e);else{e();c.css({width:d+"%"})}}else c.animate({width:d+"%"},b.animation,e)})}})(jQuery);(function(a){a.cookie=function(e,c,f){if(arguments.length>1){var b=a.extend({},a.cookie.defaults,f);if(b.encryption)c=a.EncryptStr(c,b.encrypKey);if(c===null||c===undefined){c="";b.expires=-1}if(b.expires.constructor!=Date){var d=new Date;d.setDate(d.getDate()+b.expires);b.expires=d}document.cookie=e+"="+c+"; expires="+b.expires.toUTCString()+(b.path?"; path="+b.path:"")+(b.domain?"; domain="+b.domain:"")+(b.secure?"; secure":"")}else return(result=(new RegExp(e+"=(.*?)(?:;|$)")).exec(document.cookie))?decodeURIComponent(result[1]):false};a.cookieDecrypt=function(c,d){if(result=(new RegExp(c+"=(.*?)(?:;|$)")).exec(document.cookie)){var b=a.DecryptStr(result[1],d||a.cookie.defaults.encrypKey);return b==null?false:decodeURIComponent(b)}return false};a.cookie.defaults={expires:365,path:"/",encryption:false,encrypKey:"$(this)"}})(jQuery);(function(a){a.fn.TBBehaviour=function(d){var c=$.extend({},a.fn.TBBehaviour.defaults,d),b=this;b.each(function(){var b=$(this),a=c.onEnter;a!=null&&b.keypress(function(c){if(c.keyCode=="13"&&$(this).attr("readonly")!==true)if($.isFunction(a)){a.call();return false}else{var b=$(a);if(b.is("input:button")||b.is("button")){b.click();return false}else if(b.is("input")){if(b.attr("readonly")!==true){b.select();return false}}else alert('$().TBBehaviour Error 007-568-382: No support for this "onEnter" target!')}});c.select&&b.focus(function(){if($.browser.webkit===true||$.browser.mozilla===true)$(this).one("mouseup",function(){$(this).select();return false});$(this).select();return false})});return b};a.fn.TBBehaviour.defaults={select:true,onEnter:null}})(jQuery);try{(function(a){if(typeof a.widget=="undefined")return;a.widget("ui.numeric",{version:"1.2",options:{disabled:false,keyboard:true,showCurrency:false,currencySymbol:"$",title:"Type a new value or use the buttons or keyboard arrow keys to change the value. Hold Ctrl or Shift for a smaller or larger increment, respectively.",buttons:true,upButtonIcon:"ui-icon-triangle-1-n",upButtonTitle:"Increment the value. Hold Ctrl or Shift for a smaller or larger increment, respectively.",downButtonIcon:"ui-icon-triangle-1-s",downButtonTitle:"Decrement the value. Hold Ctrl or Shift for a smaller or larger increment, respectively.",emptyValue:0,minValue:false,maxValue:false,smallIncrement:1,increment:5,largeIncrement:10,calc:null,format:{format:"0",decimalChar:".",thousandsChar:","}},_adjustmentFlag:false,_keyDownFlag:false,_timer:null,_name:"numeric",_value:0,_create:function(){var b=this,c=b.options,d=b.widget(),e=d.attr("type").toLowerCase();if(e!=="text"&&e!=="number")throw"numeric widget can only be applied to text and number inputs.";b._checkFormat();b._name=d.attr("id")||d.attr("name");b._value=b._getInputValue(d.attr("value"),true);if(c.minValue!==false&&b._value<c.minValue)b._value=c.minValue;if(c.maxValue!==false&&b._value>c.maxValue)b._value=c.maxValue;b._setInputValue(b._value);d.attr("title",c.title).wrap(a('<div class="ui-widget ui-widget-content ui-corner-all ui-numeric" />'));c.showCurrency&&b._createCurrency();c.buttons&&b._createButtons();d.bind({keydown:function(a){return b._onKeyDown(a)},keyup:function(a){return b._onKeyUp(a)},change:function(a){return b._onChange(a)}});(c.disabled||d.attr("disabled"))&&b._setOption("disabled",true);a(window).bind("unload",function(){b.destroy()})},destroy:function(){var b=this,c=b.widget();c.unbind({keydown:function(a){return b._onKeyDown(a)},keyup:function(a){return b._onKeyUp(a)},change:function(a){return b._onChange(a)}});b.options.showCurrency&&a("#"+b._name+"_currency").remove();b.options.buttons&&a("#"+b._name+"_buttons").remove();c.unwrap();a.Widget.prototype.destroy.apply(b);a(window).unbind("unload",function(){b.destroy()})},_createCurrency:function(){this.widget().before(a("<div/>").attr("id",this._name+"_currency").addClass("ui-numeric-currency").html(this.options.currencySymbol))},_createButtons:function(){var b=this,g=a('<button type="button"></button>').attr("title",b.options.upButtonTitle).bind({keydown:function(a){f(a,false)},keyup:function(){c()},mousedown:function(a){d(a,false)},mouseup:function(){c()}}).button({text:false,label:"U",icons:{primary:b.options.upButtonIcon}}),e=a('<button type="button"></button>').attr("title",b.options.downButtonTitle).bind({keydown:function(a){f(a,true)},keyup:function(){c()},mousedown:function(a){d(a,true)},mouseup:function(){c()}}).button({text:false,label:"D",icons:{primary:b.options.downButtonIcon}});b._addButtons(g,e);function f(a,b){if(a.which==32||a.which==13){d(a,b);a.target.focus()}}function d(c,d){(d?g:e).blur();var a=b._getIncrement(c.ctrlKey,c.shiftKey);b._adjustValueRecursive(d?-a.value:a.value,a.type)}function c(){clearTimeout(b._timer)}},_addButtons:function(c,b){this.widget().after(a("<div/>").attr("id",this._name+"_buttons").addClass("ui-numeric-buttons").append(c).append(b))},_setOption:function(g,b){var e=this,d=e.options;switch(g){case"disabled":var f=e.widget();f.parent()[b?"addClass":"removeClass"]("ui-numeric-disabled ui-state-disabled").attr("aria-disabled",b);e._adjustmentFlag=true;if(b)f.attr({disabled:"disabled",value:""});else f.removeAttr("disabled").attr("value",e._format(e._value));e._adjustmentFlag=false;d.buttons&&a("#"+e._name+"_buttons button").button(b?"disable":"enable");break;case"emptyValue":d.emptyValue=b;e._setValue(e._value);break;case"minValue":d.minValue=b===false?false:c(b);d.minValue!==false&&e._value<d.minValue&&e._setValue(d.minValue);break;case"maxValue":d.maxValue=b===false?false:c(b);d.maxValue!==false&&e._value>d.maxValue&&e._setValue(d.maxValue);break;case"format":d.format=b;e._checkFormat();e._setValue(e._value);break;case"title":d.title=b;e.widget().attr("title",b);break;case"showCurrency":if(b&&!d.showCurrency)e._createCurrency();else!b&&d.showCurrency&&a("#"+e._name+"_currency").remove();d.showCurrency=b;break;case"currencySymbol":d.currencySymbol=b;d.showCurrency&&a("#"+e._name+"_currency").html(b);break;case"buttons":if(b&&!d.buttons)e._createButtons();else!b&&d.buttons&&a("#"+e._name+"_buttons").remove();d.buttons=b;break;case"upButtonIcon":d.upButtonIcon=b;d.buttons&&a("#"+e._name+"_buttons").find("button:eq(0)").button("option","icons",{primary:b});break;case"upButtonTitle":d.upButtonTitle=b;d.buttons&&a("#"+e._name+"_buttons").find("button:eq(0)").attr("title",b);break;case"downButtonIcon":d.downButtonIcon=b;d.buttons&&a("#"+e._name+"_buttons").find("button:eq(1)").button("option","icons",{primary:b});break;case"downButtonTitle":d.downButtonTitle=b;d.buttons&&a("#"+e._name+"_buttons").find("button:eq(1)").attr("title",b);break;default:a.Widget.prototype._setOption.apply(e,g,b)}return e},_checkFormat:function(){var b=this.options;if(typeof b.format==="string")b.format={format:b.format,decimalChar:".",thousandsChar:","};else b.format=a.extend({format:"0",decimalChar:".",thousandsChar:","},b.format)},_getInputValue:function(a,d){a=a.replace(new RegExp(b(this.options.format.thousandsChar),"g"),"");if(this.options.format.decimalChar!==".")a=a.replace(new RegExp(b(this.options.format.decimalChar),"g"),".");return d?c(a):a},_setInputValue:function(a){this._adjustmentFlag=true;this.widget().attr("value",this._format(a)).change();this._adjustmentFlag=false},_setValue:function(b){var a=this;b=c(b);if(a.options.minValue!==false&&b<a.options.minValue)b=a.options.minValue;if(a.options.maxValue!==false&&b>a.options.maxValue)b=a.options.maxValue;a._value=b;!a.options.disabled&&a._setInputValue(b)},_format:function(b){var c=this.options;return isNaN(b)||c.emptyValue!==false&&b===c.emptyValue?"":a.formatNumber(b,c.format)},_getIncrement:function(b,a){return b?{value:this.options.smallIncrement,type:2}:a?{value:this.options.largeIncrement,type:3}:{value:this.options.increment,type:1}},_adjustValue:function(c,d){var b=this;if(b.options.disabled)return;b._setValue(a.isFunction(b.options.calc)?b.options.calc(b._value,d,c<0?2:1):b._value+c);b.select()},_adjustValueRecursive:function(b,c){a.ui.numeric._current=this;a.ui.numeric._timerCallback(b,c,true)},_onKeyDown:function(a){var c=this,b=c.options;if(b.disabled)return;switch(a.which){case 109:case 110:case 190:c._keyDownFlag=true;return;case 38:case 40:if(b.keyboard){var d=c._getIncrement(a.ctrlKey,a.shiftKey);c._adjustValue(a.which==40?-d.value:d.value,d.type)}return;case 33:b.keyboard&&c._adjustValue(b.largeIncrement,3);return;case 34:b.keyboard&&c._adjustValue(-b.largeIncrement,3);return;case 65:case 67:case 86:case 88:case 89:case 90:if(a.ctrlKey)return}if(f(a.which))return;if(!g(a.which)){a.preventDefault();a.stopPropagation();return}},_onKeyUp:function(){var a=this,b=parseFloat(a._getInputValue(a.widget().attr("value"),false));if(!isNaN(b))a._value=b;a._keyDownFlag=false},_onChange:function(a){!this._adjustmentFlag&&!this._keyDownFlag&&this._setValue(this._getInputValue(a.target.value),true)},value:function(a){if(a===undefined)return this._value;this._setValue(a);return this},select:function(){!this.options.disabled&&this.widget().select();return this}});a.ui=a.ui||{};a.ui.numeric._current=null;a.ui.numeric._timerCallback=function(b,c,d){clearTimeout(a.ui.numeric._current._timer);a.ui.numeric._current._adjustValue(b,c);a.ui.numeric._current._timer=setTimeout("jQuery.ui.numeric._timerCallback("+b+","+c+",false)",d?1e3:50)};function f(a){return a<=47&&a!=32||a>=91&&a<=95||a>=112&&[188,190,191,192,219,220,221,222].indexOf(a)==-1}function g(a){return a>=48&&a<=57||a>=96&&a<=105}function c(a){if(typeof a!=="number")a=Number(a);return isNaN(a)?0:a}function d(a){if(typeof a!=="number")a=Number(a);return isNaN(a)?0:a}function e(d,c){for(var a="",b=0;b<c;b++)a+=d;return a}var h=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\"].join("|\\")+")","g");function b(a){return a.replace(h,"\\$1")}a.formatNumber=function(g,d){g=c(g);if(typeof d==="string")d={format:d};d=a.extend({format:null,decimalChar:".",thousandsChar:","},d);if(typeof d.format!=="string"||d.format.length<=0)return g.toString();d.decimalChar=typeof d.decimalChar!=="string"||d.decimalChar.length<=0?".":d.decimalChar;d.thousandsChar=typeof d.thousandsChar!=="string"?",":d.thousandsChar;if(d.decimalChar.length>1)throw"NumberFormatException: Can not have multiple characters as the decimal character.";if(d.thousandsChar.length>1)throw"NumberFormatException: Can not have multiple characters as the thousands separator.";var l=d.format.indexOf(d.decimalChar);if(l>=0&&d.format.indexOf(d.decimalChar,l+1)>=0)throw"NumberFormatException: Format string has multiple decimal characters.";var j=g.toString().replace(/-/g,""),p=d.format.replace(new RegExp("[^0#"+b(d.decimalChar)+"]","g"),""),e=j.indexOf(d.decimalChar)<0?[j,""]:j.split(d.decimalChar),h=l<0?[p,""]:p.split(d.decimalChar);if(parseInt(g)===0)e[0]=h[0].indexOf("0")>=0?"0":"";if(d.format.indexOf(d.thousandsChar)>=0&&e[0].length>3){for(var i=[],r=e[0].length,s=Math.floor(r/3),n=e[0].length%3||3,f=0;f<r;f+=n){if(f!=0)n=3;i[i.length]=e[0].substr(f,n);s-=1}e[0]=i.join(d.thousandsChar)}if(h[1].length>0)if(e[1].length>0){for(var k=h[1].split(""),o=e[1].split(""),f=0;f<o.length;f++){if(f>=k.length)break;k[f]=o[f]}e[1]=k.join("").replace(/#/g,"")}else{var q=0;e[1]="";while(h[1].charAt(q)==="0"){e[1]+="0";q++}}else e[1]="";var m=e[1].length<=0?e[0]:e[0]+d.decimalChar+e[1];if(g<0)m="-"+m;return d.format.replace(new RegExp("[0|#|"+b(d.thousandsChar)+"|"+b(d.decimalChar)+"]+"),m)};Number.prototype.roundRight=function(a){a=d(a);var b=Math.pow(10,a);return Math.round(this*b)/b};Number.prototype.pad=function(a){a=d(a);var b=String(this.valueOf()),c=b.length;if(c<a)for(var e=c;e<a;e++)b="0"+b;return b};Number.prototype.padRight=function(a){a=d(a);var b=String(this.valueOf()),c=b.length-(this%1>0?1:0);if(c<a)for(var e=c;e<a;e++)b=b+"0";return b};Number.prototype.padDecimals=function(a){a=d(a);var b=String(this.valueOf()).split(".");return b.length<=0?a>0?"0."+e("0",a):"0":b.length==1?b[0]+(a>0?"."+e("0",a):""):b[0]+(a>0?"."+parseInt(b[1]).padRight(a):"")};Number.prototype.getOrdinal=function(){if(this>100)return(this%100).getOrdinal();if(this>=11&&this<=19)return"th";switch(this%10){case 1:return"st";case 2:return"nd";case 3:return"rd"}return"th"};Number.prototype.format=function(b){a.formatNumber(this,b)};Number.prototype.formatCurrency=function(b){b=a.extend({symbol:"$",noParens:false,format:"#,##0.00",decimalChar:".",thousandsChar:","},b);var c=Math.abs(this).format(b);return this<0?b.noParens?"-"+b.symbol+c:"("+b.symbol+c+")":c}})(jQuery)}catch(e){};if(!this.JSON)this.JSON={};(function(){function c(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+c(this.getUTCMonth()+1)+"-"+c(this.getUTCDate())+"T"+c(this.getUTCHours())+":"+c(this.getUTCMinutes())+":"+c(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var h=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a,d,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},b;function g(a){f.lastIndex=0;return f.test(a)?'"'+a.replace(f,function(a){var b=i[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(m,n){var i,j,h,k,l=a,f,c=n[m];if(c&&typeof c==="object"&&typeof c.toJSON==="function")c=c.toJSON(m);if(typeof b==="function")c=b.call(n,m,c);switch(typeof c){case"string":return g(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";a+=d;f=[];if(Object.prototype.toString.apply(c)==="[object Array]"){k=c.length;for(i=0;i<k;i+=1)f[i]=e(i,c)||"null";h=f.length===0?"[]":a?"[\n"+a+f.join(",\n"+a)+"\n"+l+"]":"["+f.join(",")+"]";a=l;return h}if(b&&typeof b==="object"){k=b.length;for(i=0;i<k;i+=1){j=b[i];if(typeof j==="string"){h=e(j,c);h&&f.push(g(j)+(a?": ":":")+h)}}}else for(j in c)if(Object.hasOwnProperty.call(c,j)){h=e(j,c);h&&f.push(g(j)+(a?": ":":")+h)}h=f.length===0?"{}":a?"{\n"+a+f.join(",\n"+a)+"\n"+l+"}":"{"+f.join(",")+"}";a=l;return h}}if(typeof JSON.stringify!=="function")JSON.stringify=function(h,c,f){var g;a="";d="";if(typeof f==="number")for(g=0;g<f;g+=1)d+=" ";else if(typeof f==="string")d=f;b=c;if(c&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return e("",{"":h})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){var b;function d(f,g){var b,e,a=f[g];if(a&&typeof a==="object")for(b in a)if(Object.hasOwnProperty.call(a,b)){e=d(a,b);if(e!==undefined)a[b]=e;else delete a[b]}return c.call(f,g,a)}h.lastIndex=0;if(h.test(a))a=a.replace(h,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){b=eval("("+a+")");return typeof c==="function"?d({"":b},""):b}throw new SyntaxError("JSON.parse");}})();String.prototype.format=function(){var a=/\{\d+\}/g,b=arguments;return this.replace(a,function(a){return b[a.match(/\d+/)]})};Date.prototype.fixToUTC=function(){var a=this;return new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds())};function UTILS(){}UTILS.StopAllOtherEvents=function(a){if(a)if(Sys.Browser.agent===Sys.Browser.InternetExplorer)a.cancelBubble=true;else{a.stopPropagation();a.preventDefault()}return false};UTILS.HTML={LinkLock:function(b,a,d,e,c){if(c!=undefined)if(b){if(a.BAK_onclick==undefined||a.BAK_onclick==null){a.BAK_onclick=a.onclick==undefined?function(){return false}:a.onclick;a.onclick=function(){if(c!=""){alert(c);return false}}}}else if(a.BAK_onclick!=undefined&&a.BAK_onclick!=null){a.onclick=a.BAK_onclick;a.BAK_onclick=null;a.removeAttribute("BAK_onclick")}a.className=b?e:d;a.style.cursor=b?"default":"pointer";a.setAttribute("unselectable",b?"on":"off");a.setAttribute("IsLocked",b?"true":"false")},AddOptionToSelect:function(c,b,d){var a=document.createElement("option");a.setAttribute("value",d);a.innerHTML=b;c.appendChild(a)},addPageOnLoadEvent:function(b){var a=window.onload;if(typeof window.onload!=="function")window.onload=b;else window.onload=function(){a&&a();b()}}};UTILS.CreateCookie=function(d,e,b){var c="";if(b){var a=new Date;a.setDate(a.getDate()+b);c="; expires="+a.toGMTString()}document.cookie=d+"="+e+c+"; path=/"};UTILS.ReadCookie=function(b){var a=""+document.cookie,c=a.indexOf(b);if(c==-1||b=="")return"";var d=a.indexOf(";",c);if(d==-1)d=a.length;return unescape(a.substring(c+b.length+1,d))};UTILS.GetQuery=function(e,b){var f=escape(unescape(e)),d=new RegExp("[?&]"+f+"(?:=([^&]*))?","i"),c=d.exec(window.location.search),a=null;if(c!=null)a=c[1];else if(b!=undefined)a=b;return a};UTILS.SelectSingleNode=function(a,b){if(window.ActiveXObject)return a.selectSingleNode(b);else{var c=new XPathEvaluator,d=c.createNSResolver(a.ownerDocument==null?a.documentElement:a.ownerDocument.documentElement),e=c.evaluate(b,a,d,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return e.singleNodeValue}};UTILS.String={HtmlEncode:function(a){return a?(""+a).replace(/[<>&\"]/g,function(a){switch(a){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return a}):a},HtmlEncodeBR:function(a){return this.HtmlEncode(a).replace(/\r?\n/g,"<br>")},Trim:function(a){return a.replace(/^[ \t]+|[ \t]+$/mg,"")}};UTILS.Fix={ToInt:function(a,b){b=b||0;a=parseInt(a);return typeof a==="number"&&isNaN(a)||a==null?b:a},ToRoundFloat:function(a,c,b){b=b||0;a=(new Number(a+"")).toFixed(parseInt(c));return isNaN(a)||a==null?b:parseFloat(a)}};UTILS.Validation={_isValid:function(a){if(a==undefined||a==null){alert("ERROR 666-029-182: Don't send me wrong parameters !!!");return false}return true},_isTestOk:function(a,b,d,c){if(!this._isValid(a))return false;if(!c()){b!=undefined&&alert(b);if(d!=undefined){a.focus();a.select()}return false}return true},IsEmptyString:function(a){return!this._isValid(a)?false:/^( |\t)*$/.test(a)},IsNumber:function(a){return!this._isValid(a)?false:/^ *([\-]?[0-9]+) *$/.test(a)},IsNumberRange:function(a,c,b){return!this.IsNumber(a)?false:Number(a)>=c&&Number(a)<=b},IsTime_HMM:function(a){return!this._isValid(a)?false:/^([0]?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/.test(a)},IsEMail:function(a){return!this._isValid(a)?false:/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b/i.test(a)},IsValueSetInElement:function(a,c,b){return this._isTestOk(a,c,b,function(){return!UTILS.Validation.IsEmptyString(a.value)})},IsNumberInElement:function(a,c,b){return this._isTestOk(a,c,b,function(){return UTILS.Validation.IsNumber(a.value)})},IsIsNumberRange_InElement:function(a,e,d,c,b){return this._isTestOk(a,c,b,function(){return UTILS.Validation.IsNumberRange(a.value,e,d)})},IsTime_HMM_InElement:function(a,c,b){return this._isTestOk(a,c,b,function(){return UTILS.Validation.IsTime_HMM(a.value)})},IsEMailInElement:function(a,c,b){return this._isTestOk(a,c,b,function(){return UTILS.Validation.IsEMail(a.value)})}};UTILS.jQuery={ConvertToDateJQ:function(a){return a.toLowerCase().replace(/yyyy/g,"yy")},ShowDialog:function(e,c,d,a){var b=document.createElement("div");b.title=e;a=a||{};if(typeof c=="object")b.appendChild(c);else b.innerHTML='<p style="padding-top:6px"><span class="ui-icon ui-icon-alert showDialogMsg"></span>'+c+"</p>";(a.unselectable||false)&&$(b).unselectable(true);$(function(){$(b).dialog({bgiframe:a.bgiframe||false,height:a.height||"auto",width:a.width||300,minWidth:a.minWidth||150,minHeight:a.minHeight||150,modal:a.modal==undefined||a.modal||false,resizable:a.resizable||false,show:a.show||null,hide:a.hide||null,autoOpen:a.autoOpen==undefined||a.autoOpen||false,beforeclose:function(a){a.stopPropagation()},buttons:d})});return b},ShowDialogYesNo:function(c,e,b,d){var a={};a[UTILS.Service.GetMSG("No")]=d;a[UTILS.Service.GetMSG("Yes")]=b;return this.ShowDialog(c,e,a)}};UTILS.DateTime={GetNowTime:function(e,d){var a=new Date;a.setHours(a.getHours()+(e||0),a.getMinutes()+(d||0),a.getSeconds(),a.getMilliseconds());var b=a.getHours();b=b<10?"0"+b:b;var c=a.getMinutes();c=c<10?"0"+c:c;return b+":"+c}};UTILS.Controls={GetHelpIconGlobal:function(f,g,c,d){var a=document.createElement("div");if(c!=undefined&&c!=null&&c!=0){var e=c==1?"left":"right";if(a.style.styleFloat!=undefined)a.style.styleFloat=e;else a.style.cssFloat=e}if(d!=undefined&&d!=null)a.className=d;var b=document.createElement("img");b.setAttribute("src",g);b.style.borderStyle="none";b.style.verticalAlign="middle";b.title=f;a.appendChild(b);$(function(){$(b).toolTipHover()});return a},GetHelpIconGMap:function(b,c,a){return this.GetHelpIconGlobal(b,a!=undefined&&a!=null?a:imagesRootPath+"HelpIcon.png",0,"floatE")}};UTILS.Service={GetMSG:function(a,b){return typeof JMSG!=="undefined"&&JMSG[a]!=undefined?JMSG[a]:b!=undefined?b:a},HandleErrorMSG:function(a,b){if(a.get_timedOut())alert(this.GetMSG("SERVER_Timeout","Timeout occurred while retrieving data from server.\n\nTry again or refresh page with F5"));else if(a.get_statusCode()==500&&a.get_message()=="777-666-555")alert(this.GetMSG("SERVER_SessionEnded","Your browser session has ended. Close browser and login again."));else if(a.get_statusCode()==500&&a.get_message()=="777-000-000")alert(this.GetMSG("SERVER_ReadOnlyUser","This option is not available! You are either a read-only user or not allowed for this feature.\nContact your service provider."));else if(a.get_statusCode()==503)alert("Service Unavailable (probably stoped for upgrade).\nClose browser and try again later.\n\n(Error code: "+b+")");else alert("There is a temporary problem with one of the map services. You may continue using the application or try again by refreshing the page with F5\n\nError "+b+":\n"+a.get_message())}};function LogOut_OnClientClick(){var a=document.getElementById(logoutClientID);if(a)a.value="1"}function OpenOneInstanceWindow(d,a){var c=navigator.userAgent.toLowerCase().indexOf("chrome/")>-1;function b(){return window.open(d,a,"top=1, left=1, height="+eval(screen.availHeight-60)+",width="+eval(screen.availWidth-12)+",status=yes,toolbar=no,menubar=no,location=no, resizable=yes")}if(typeof PopInsWinObj==="undefined")PopInsWinObj={};if(c){typeof PopInsWinObj[a]!=="undefined"&&!PopInsWinObj[a].closed&&PopInsWinObj[a].close();PopInsWinObj[a]=b()}else if(typeof PopInsWinObj[a]!=="undefined"&&!PopInsWinObj[a].closed)PopInsWinObj[a].blur();else PopInsWinObj[a]=b();typeof PopInsWinObj[a]!=="undefined"&&PopInsWinObj[a].focus()}function ShowHelp(){window.open(strHelpFilename,"",strRptWindowFeatures);return false}function ChangePasswordDialog(a){setTimeout(function(){var b=window.showModalDialog(strVirtualPathPrefix4Pages+"/Default/ChangePassword.aspx?tstamp="+(new Date).getTime(),"","dialogHeight:"+(a?450:200)+"px;dialogWidth:"+(a?800:500)+"px;center:yes;help:no;resizable:yes;status:no;scroll:0");if(b===true)document.location=document.location},1)}function TabsUC_OnWindowUnload(b){if(b)return;if(event.clientY<0&&event.clientY>-30||event.clientY<-65&&document.body.offsetWidth-event.clientX<20)if(window.XMLHttpRequest){var a=new XMLHttpRequest;a.open("GET",strVirtualPathPrefix4Pages+"/Default/root.aspx?PageUnloaded=1",false);a.send("")}}var oEventsXmlHttp,IsEventsDataRunning=false,eventsXmlURL="../maps/MapEventsXml.aspx?EventsCount=1",LastRedError=0,LastYellowError=0,LastGreenError=0,onlinePlaySound,FirstTimePageLoaded=true,randValue=0;function InitAlertsValuesDisplay(a){setInterval("loadEventsData()",a);loadEventsData()}function OnReponse_EventsXMLHttp(){var c=null,a;if(oEventsXmlHttp.readyState==4){if(window.ActiveXObject){a=new ActiveXObject("Microsoft.XMLDOM");a.async=false;a.loadXML(oEventsXmlHttp.responseText)}else{a=document.implementation.createDocument("","",null);var k=new DOMParser;a=k.parseFromString(oEventsXmlHttp.responseText,"text/xml")}c=a.documentElement;if(!c){IsEventsDataRunning=false;return}var i=document.getElementsByName("PriorityIcon");onlinePlaySound=false;for(var h=0;h<i.length;h++){var b="0",e=0,f=i.item(h).attributes.icon_id.value,g=UTILS.SelectSingleNode(c,"PRIORITY_COUNTS[PRIORITY_ID = "+f+"]");if(g!=null)if(window.ActiveXObject)b=UTILS.SelectSingleNode(g,"EVENTS_COUNT").text;else b=UTILS.SelectSingleNode(g,"EVENTS_COUNT").textContent;var d=UTILS.SelectSingleNode(c,"new_red_alerts_tbl");if(d!=null)if(window.ActiveXObject)e=UTILS.SelectSingleNode(d,"new_red_alerts").text;else e=UTILS.SelectSingleNode(d,"new_red_alerts").textContent;var j=document.getElementById("p"+f);j.innerHTML=b;if(f==10){if(e==1)onlinePlaySound=true;LastRedError=parseInt(b)}}if(onlinePlaySound&&!FirstTimePageLoaded)if(typeof showRedAlertConfirmation!="undefined"&&showRedAlertConfirmation.toLowerCase()=="true")showRedAlertPopup();else PlaySound();FirstTimePageLoaded=false}IsEventsDataRunning=false}var html5Audio=null,html5Flag=false;function showRedAlertPopup(){if(oPlaySound.value=="1")if(html5Audio==null||html5Flag){if(html5Audio==null){html5Audio=document.createElement("audio");html5Audio.src=sndAlertSoundSrc;html5Audio.loop="infinite"}try{html5Audio.play()}catch(a){playIESound()}html5Flag=true}else playIESound();mapFleetPage.RedAlertConfirmation(html5Audio,oIEBackgroundSound)}var oIEBackgroundSound=null;function playIESound(){oIEBackgroundSound=document.getElementById("sndAlertSound");oIEBackgroundSound.loop="infinite";oIEBackgroundSound.src="";oIEBackgroundSound.src=sndAlertSoundSrc}function loadEventsData(){if(IsEventsDataRunning)return;IsEventsDataRunning=true;if(oEventsXmlHttp==null)oEventsXmlHttp=new XMLHttpRequest;randValue+=1;if(this.location.href.toLowerCase().indexOf("mapfleet.aspx")>0)eventsXmlURL="../maps/MapEventsXml.aspx?EventsCount=1&IsOnline=1";oEventsXmlHttp.open("GET",eventsXmlURL+"&"+randValue.toString(),true);oEventsXmlHttp.onreadystatechange=OnReponse_EventsXMLHttp;oEventsXmlHttp.send(null);return}var oErrXmlHttp,oStatusXMLHTTP,sSoundStatCookieName="ALERT_SOUND_STATUS",showRedAlertConfirmation=false;function InitDisplayErrorsValue(a,d,e,b,c){sndAlertSoundSrc=d;oPlaySound=e;showRedAlertConfirmation=c;setInterval("UpdateUserStatus()",b);updateSoundIcon();if(a){setInterval("loadErrorSummary()",a);loadErrorSummary()}}function updateSoundIcon(){var a=document.getElementById("imgSoundIcon");if(sndAlertSoundSrc==""){a.src="../images/Icon_sound0.gif";oPlaySound.value="0";return}if(readCookie(sSoundStatCookieName)=="0"){a.src="../images/Icon_sound0.gif";oPlaySound.value="0"}else{a.src="../images/Icon_sound1.gif";oPlaySound.value="1"}}function UpdateUserStatus(){if(oStatusXMLHTTP==null)oStatusXMLHTTP=new XMLHttpRequest;oStatusXMLHTTP.open("POST","../CompanyManagement/UpdateUserStatus.aspx",true);oStatusXMLHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded");oStatusXMLHTTP.send("")}function OnReponse_ErrorsXMLHttp(){var a=document.getElementById("errSum"),c=document.getElementById("unprItemImg");if(oErrXmlHttp.readyState==4){var d,b=Number(oErrXmlHttp.responseText);if(isNaN(b))b="-";if(a.innerHTML!="")d=a.innerHTML;if(b===0){a.style.color="black";a.style.fontWeight="normal";c.setAttribute("src","../images/Icon_Orange.gif")}else{a.style.color="red";a.style.fontWeight="bold";c.setAttribute("src","../images/Icon_OrangeBlink.gif")}a.innerHTML=b}}function loadErrorSummary(){if(oErrXmlHttp==null)oErrXmlHttp=new XMLHttpRequest;oErrXmlHttp.onreadystatechange=OnReponse_ErrorsXMLHttp;oErrXmlHttp.open("POST","../CompanyManagement/ErrorsSummaryXML.aspx",true);oErrXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");oErrXmlHttp.send("");return}function PlaySound(){if(oPlaySound.value=="1"){var a=document.getElementById("sndAlertSound");a.src="";a.src=sndAlertSoundSrc}}function ChageSound(){if(sndAlertSoundSrc=="")return false;var a=document.getElementById("imgSoundIcon");if(a.src.indexOf("Icon_sound1")>-1){a.src="../images/Icon_sound0.gif";oPlaySound.value="0";SaveSoundStatCookie("0")}else{a.src="../images/Icon_sound1.gif";oPlaySound.value="1";SaveSoundStatCookie("1")}}function SaveSoundStatCookie(a){SaveCookie(sSoundStatCookieName,a,30)}function SaveCookie(e,d,c){var a;if(c){var b=new Date;b.setTime(b.getTime()+c*24*60*60*1e3);a="; expires="+b.toGMTString()}else a="";document.cookie=e+"="+d+a+"; path=/"}function readCookie(d){for(var b=document.cookie.split("; "),a=0;a<b.length;a++){var c=b[a].split("=");if(d==c[0])return unescape(c[1])}return"1"};String.prototype.format=function(){var a=/\{\d+\}/g,b=arguments;return this.replace(a,function(a){return b[a.match(/\d+/)]})};String.prototype.ToElement=function(){return document.getElementById(this)};String.prototype.Trim=function(){return this.replace(/^[ \t]+|[ \t]+$/mg,"")};Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++)if(this[a]==b)return a;return-1};Array.prototype.isHas=function(a){return this.indexOf(a)>=0};Array.prototype.SortBy=function(a,b){b=b||0;switch(b){case 0:this.sort(function(b,c){return b[a]<c[a]?-1:b[a]>c[a]?1:0});break;case 1:this.sort(function(b,c){return b[a]-c[a]})}return this};var MPage=function(){};MPage.GetMainForm=function(){return"myForm".ToElement()};MPage.IsRTL=false;MPage.CookieKEYS={Language:"LNG",StartCmd:"START"};MPage.Cookie={Get:function(d,b){var a=$.cookie(d);if(typeof b==="undefined")b=null;if(a!==false)try{return JSON.parse(a)}catch(e){if(typeof a==="string")return a}return b},Set:function(b,a){$.cookie(b,typeof a==="string"?a:JSON.stringify(a))},Delete:function(a){$.cookie(a,null)}};MPage.Util={FixAjaxPostBackData:function(a){try{for(d in a){a=a[d];break}if(typeof a==="string")if(a.indexOf("[")==0)return eval(a);else if(a.indexOf("{")==0)return(eval("["+a+"]"))[0];return a}catch(b){return null}},HandleAjaxErrorMSG:function(a,c){if(c=="timeout")alert("Timeout! Please try again...");else if(a.status==500&&a.statusText=="Internal Server Error")try{var b=(eval("["+a.responseText+"]"))[0].Message;switch(b){case"999-888-888":alert("User has no permission or not logged in!");break;case"777-666-555":alert("Your browser session has ended. Close browser and login again.");break;default:alert("Error 000-231-696! \n\n"+UTILS.String.HtmlEncode(b))}}catch(e){alert("Error 000-231-594!\n\n"+a.responseText)}else if(a.status==401&&a.statusText=="Unauthorized")alert("You are not logged in!");else if(a.status==503&&a.statusText=="Service Unavailable")alert("Service Unavailable (probably stoped for upgrade).\nPlease try again later.");else alert("Error 000-231-595 !!!\n\nCode: {0}\n{1}\n\n{2}".format(a.status,a.statusText,a.responseText))}};MPage.Page={addOnLoadEvent:function(b){var a=window.onload;if(typeof window.onload!=="function")window.onload=b;else window.onload=function(){a&&a();b()}},GetDocHeight:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},SetSubHeight:function(b,d){var a=document.getElementById(b);if(!a){alert('ERROR 694-093-553: Element ("{0}") not found!'.format(b));return false}var c=this.GetDocHeight()-a.offsetTop-(d===true?0:2);a.style.height=(c>0?c:0)+"px"},SetAllToPageHeight:function(c,b,a){var d=MPage.Page.GetDocHeight();$(c).each(function(){$(this).height(d-$(this).offset().top-(a===true?0:2)-(b||0))})},BlockBackspace:function(){document.onkeydown=function(b){var a=typeof event==="undefined"?{e:b,t:b.target}:{e:event,t:event.srcElement};if(a.t.nodeName.toUpperCase()!="INPUT")return a.e.keyCode!=8}},ShowToasterMsg:function(z,x){var A=this,b=x||{},o=b.target,r,n,p,d,c,h=null,v=b.delayInit||500,i=b.speedIn||1e3,f=b.delayShow||3e3,g=b.speedOut||1e3,e=b.isKeepOpen||false,u=b.title||" ",q=b.winContent||"";if(typeof o==="undefined"||o==null){d=(b.animation||"toaster").toLowerCase();var j=$([]),a=$([]),s,m,y=b.width||190,w=b.height||110,k=function(){j.css({top:A.GetDocHeight()-m-4,left:MPage.IsRTL?4:$(document.body).width()-s})},l=function(){k=function(){};a.hide();j.remove()};$(document.body).append(j=$("<div/>").addClass("toaster").append(a=$("<div/>").addClass("borRou12").css(p={width:y+"px",height:w+"px"}).css({overflow:"hidden"}).append($('<div class="title"/>').append($('<div class="txt floatB pad2B"/>').text(u),$('<div class="floatE"/>').append($('<a class="btnGDelete"/>').css("margin-top","-1px").click(function(){l()}))),$('<div class="msg"/>').append(q.length==0?(c=$("<label/>")):$('<a href="#"/>').append(c=$("<label/>")).click(function(){var a='<head><title>{0}</title><style type="text/css">body{background:#E0E9F8;padding:5px;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr="#FFE0E9F8",EndColorStr="#FFFFFFFF")}h1{font:bold 16px arial,sans-serif;color:#1F336B;text-align:center;margin:0px}p{font:14px arial,sans-serif;color:#1F336B}</style></head><body><h1>{0}</h1><p>{1}</p></body>'.format(u,q);h!=null&&h.close();h=window.open("","Notification","width={0},height={1},scrollbars=yes,menubar=no,resizable=no,status=no,toolbar=no,location=no".format(b.wWidth||400,b.wHeight||250));h.document.write(a);return false})))));j.css({width:s=a.outerWidth(),height:m=a.outerHeight()});$(window).resize(function(){k()});k();n={top:m,left:0};r={top:0,left:0}}else{d=(b.animation||"fade").toLowerCase();if(d!="slide"&&d!="fade")d="fade";a=$(o);if(a.length==0){alert("Error 025-935-381!");return}c=b.targetMsg;c=$(c);if(c.length==0)c=a}a.delay(v).queue(function(a){c.html(z);a()});switch(d){case"slide":a.slideDown(i);!e&&a.delay(f).slideUp(g);break;case"fade":a.fadeIn(i);!e&&a.delay(f).fadeOut(g);break;case"size":var t={width:"0px",height:"0px"};a.css(t).queue(function(a){$(this).show();a()}).animate(p,i);!e&&a.delay(f).animate(t,g,"",function(){$(this).hide()});break;default:a.css(n).show().animate(r,i);!e&&a.delay(f).animate(n,g)}typeof l!="undefined"&&!e&&a.hide(0,"",l)}};MPage.Fix={ToInt:function(a,b){b=b||0;a=parseInt(a);return typeof a==="number"&&isNaN(a)||a==null?b:a},ToRoundFloat:function(a,c,b){b=b||0;a=(new Number(a+"")).toFixed(parseInt(c));return isNaN(a)||a==null?b:parseFloat(a)}};typeof $!=="undefined"&&$(function(){MPage.IsRTL=$(document.body).attr("dir").toLowerCase()=="rtl"})
