function MasternautWindows(b,F,J,A,C,Y,k,a,d,e,H,n,Z,l,I,T,V,N,h,U){var L=this;var c=A;var E=0;var W=false;this.destroyOnClose=true;this.SuppressShim=false;if(N){F=(GetBodyWidth()-A)/2;J=(GetBodyHeight()-C)/2}this.container=document.createElement("div");this.container.objRef=this;this.container.style.cssText="position:absolute; left:"+F+"px; top:"+J+"px; width:"+A+"px; "+Y;this.onClose=function(){};this.close=function(){if(L.container==null){return }if(L.container.shimElement){D();for(var q=0;q<document.maps.length;q++){document.maps[q].DetachEvent("oninitmode",R)}}if(L.container.parentNode){if(true&&L.destroyOnClose){if(L.container.divBackground){try{L.container.parentNode.removeChild(L.container.divBackground)}catch(p){}}var o=L.container;o.parentNode.removeChild(o);L.container=null}else{if(L.container.divBackground){L.container.divBackground.style.visibility="hidden"}L.container.style.visibility="hidden"}L.onClose()}};this.show=function(){if(this.container.divBackground){this.container.divBackground.style.visibility="visible"}this.container.style.visibility="visible"};this.onBeforePrint=function(){};this.onResize=function(){};this.maximize=function(p,o){try{if(!p){this.divContent.style.width=((document.body.clientWidth==0?document.documentElement.clientWidth-12:document.body.clientWidth)-parseInt(this.container.style.left,10))+"px"}if(!o){this.divContent.style.height=(GetBodyHeight()-parseInt(this.container.style.top,10)-20-this.divHeader.offsetHeight-18-4)+"px"}}catch(i){this.divContent.style.width="800px";this.divContent.style.height="600px"}this.updateContentSize();this.onResize()};this.onMinimize=function(){};this.onRestore=function(){};this.minimizeRestore=function(){if(L.divContent.style.visibility=="hidden"){L.divContent.style.visibility="visible";L.divFooter.style.visibility="visible";L.onRestore();this.src="/common/images/windows/barMinimize.gif"}else{L.divContent.style.visibility="hidden";L.divFooter.style.visibility="hidden";L.onMinimize();this.src="/common/images/windows/barRestore.gif"}};b.appendChild(this.container);if(Z){var m=document.createElement("img");m.width=27;var X=(GetBodyWidth()-Z[0]<=c+m.width);var g=(Z[1]<=C);m.src="/common/images/windows/"+(X?"arrowRight":"arrowLeft")+".gif";this.container.style.width=(c+m.width)+"px";if(!X){E+=m.width}m.style.cssText="position:absolute; top:"+(g?C-30:30)+"px; left:"+(X?c:0)+"px";this.container.style.top=(g?Z[1]-C+30:Z[1]-30)+"px";this.container.style.left=(X?Z[0]-c-m.width:Z[0])+"px";this.container.appendChild(m)}var P=document.createElement("img");P.src="/common/images/windows/barLeft.gif";P.width=7;P.style.cssText="position:absolute; top:0px; left:"+E+"px";var K=document.createElement("img");K.src="/common/images/windows/barRight.gif";K.width=6;K.style.cssText="position:absolute; top:0px; left:"+(E+c-K.width)+"px";this.divBar=document.createElement("div");this.divBar.style.cssText="position:absolute; top:0px; left:"+(E+P.width)+"px; width:"+(c-P.width-K.width-5)+"px; height:20px; padding-top:2px; padding-left:5px; background-image:url(/common/images/windows/barBack.gif); background-repeat:repeat-x;color:white;";this.divBar.parentContainer=this.container;addChildObj("span",this.divBar,"font:italic bold 9pt verdana;",d);var f=addChildObj("span",this.divBar,"position:absolute; right:0px; top:5px");if(h){addImage(f,"/common/images/windows/print.gif","Print",function(){L.onBeforePrint();window.print()},"width:11px; height:10px")}if(U){addImage(f,"/common/images/windows/barMinimize.gif","Minimise/restore",L.minimizeRestore)}if(I){var G=addImage(f,"/common/images/windows/barMaximize.gif","Full screen",L.maximize)}if(n){var M=addImage(f,"/common/images/windows/barClose.gif","Close",L.close)}if(H){this.divBar.style.cursor="move";this.divBar.onmousedown=function(o){var i=(o?o:window.event);document.dragedObject=this.parentContainer;document.leftBeforeDrag=this.parentContainer.offsetLeft;document.topBeforeDrag=this.parentContainer.offsetTop;document.initMouseLeft=i.clientX;document.initMouseTop=i.clientY;document.onmousemove=function(q){var p=(q?q:window.event);this.dragedObject.style.left=(this.leftBeforeDrag+p.clientX-this.initMouseLeft)+"px";this.dragedObject.style.top=(this.topBeforeDrag+p.clientY-this.initMouseTop)+"px";return false};document.onmouseup=function(){if(parseInt(this.dragedObject.style.top,10)<0){this.dragedObject.style.top=0+"px"}if(parseInt(this.dragedObject.style.left,10)<0){this.dragedObject.style.left=0+"px"}this.dragedObject=null;this.onmousemove=null;this.onmouseup=null};return false}}this.container.appendChild(P);this.container.appendChild(this.divBar);this.container.appendChild(K);this.divHeader=document.createElement("div");this.divHeader.style.cssText="z-index:2; overflow:visible; position:absolute; top:"+parseInt(this.divBar.style.height,10)+"px; left:"+E+"px; width:"+c+"px; height:"+V+"px; background-color:white;";this.container.appendChild(this.divHeader);var O=parseInt(this.divBar.style.height,10)+parseInt(this.divHeader.style.height,10);for(var j=0;document.getElementById("masternautWindowsContent"+j)!==null;j++){}if(k){this.divContent=k}else{this.divContent=document.createElement("div")}this.divContent.id="masternautWindowsContent"+j;this.divContent.style.cssText="z-index:3; position:absolute; left:"+E+"px; top:"+O+"px; width:"+(c-(Z?0:8))+"px; border-left:solid 4px white; border-right:solid 4px white; background-color:white;";if(C){this.divContent.style.height=(C-O-18)+"px"}if(a){this.divContent.style.overflowY="auto";this.divContent.style.overflowX="hidden"}this.container.appendChild(this.divContent);this.container.divContent=this.divContent;var Q=(O+this.divContent.offsetHeight);this.divFooter=document.createElement("div");this.divFooter.style.cssText="z-index:1; position:absolute; left:"+(E+6)+"px; top:"+Q+"px; width:"+(c-12)+"px; height:18px;  background-image:url(/common/images/windows/footerBack.gif); background-repeat:repeat-x;";addChildObj("div",this.divFooter,"position:absolute; left:-6px; width:6px; height:100%; background-image:url(/common/images/windows/footerLeft.gif)");addChildObj("div",this.divFooter,"position:absolute; right:-6px; width:6px; height:100%; background-image:url(/common/images/windows/footerRight.gif)");if(e){var S=addImage(this.divFooter,"/common/images/windows/resize.gif","",null,"position: absolute; cursor: nw-resize; right: 0px; top:3px;");S.onmousedown=function(o){var i=(o?o:window.event);document.dragedObject=addChildObj("div",document.body,"z-index:100; position:absolute; left:"+L.container.offsetLeft+"px; top:"+L.container.offsetTop+"px; height:"+L.container.offsetHeight+"px; width:"+L.container.offsetWidth+"px; border:2px #555555 dotted;");document.dragedObject.win=L;document.widthBeforeDrag=L.container.offsetWidth;document.heightBeforeDrag=L.container.offsetHeight;document.initMouseLeft=i.clientX;document.initMouseTop=i.clientY;document.onmousemove=function(s){var q=(s?s:window.event);var r=this.widthBeforeDrag+q.clientX-this.initMouseLeft;var p=this.heightBeforeDrag+q.clientY-this.initMouseTop;this.dragedObject.style.width=r+"px";this.dragedObject.style.height=p+"px";return false};document.onmouseup=function(q){var p=(q?q:window.event);document.body.removeChild(this.dragedObject);this.dragedObject.win.divContent.style.width=(this.dragedObject.win.divContent.offsetWidth+p.clientX-this.initMouseLeft)+"px";this.dragedObject.win.divContent.style.height=(this.dragedObject.win.divContent.offsetHeight+p.clientY-this.initMouseTop)+"px";this.dragedObject.win.updateContentSize();this.dragedObject=null;this.onmousemove=null;this.onmouseup=null};return false}}this.container.appendChild(this.divFooter);this.container.style.height=(Q+this.divFooter.offsetHeight)+"px";if(T){this.container.divBackground=document.createElement("div");this.container.divBackground.style.cssText="visibility:hidden; z-index:"+(this.container.style.zIndex-1)+"; position:absolute; top:0px; left:0px; right:0px; bottom:0px; opacity:0.30; filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=30); background-color:darkblue;";b.appendChild(this.container.divBackground);this.container.divBackground.style.visibility="visible"}this.resizeTo=function(o,i){if(o){this.divContent.style.width=(o-(Z?0:8))+"px"}if(i){this.divContent.style.height=(i-O-18)+"px"}this.updateContentSize()};this.updateContentSize=function(q){if(q!==null&&q!==undefined){this.divContent.innerHTML=q}var p=(O+this.divContent.offsetHeight);c=this.divContent.offsetWidth;this.divFooter.style.top=p+"px";this.divFooter.style.width=(c-12)+"px";K.style.left=(E+c-K.width)+"px";var i=c-P.width-K.width-5;this.divBar.style.width=(i>0?i:0)+"px";this.divHeader.style.width=c+"px";var o=p+this.divFooter.offsetHeight;this.container.style.height=o+"px";this.container.style.width=(c)+"px";if(Z&&Z[1]>=o){m.style.top=o-30+"px";this.container.style.top=Z[1]-o+30+"px"}this.onResize()};function R(){if(b&&L.container&&!L.SuppressShim){for(var o=0;o<document.maps.length;o++){if(document.maps[o].GetMapMode()==VEMapMode.Mode3D){B();return }}D()}}function D(){if(L.container.shimElement){L.container.shimElement.parentNode.removeChild(L.container.shimElement);L.container.shimElement=null}}function B(){if(L.container.shimElement==null){AddShim(L.container)}}if(document.maps){for(var j=0;j<document.maps.length;j++){document.maps[j].AttachEvent("oninitmode",R);R()}}}function MasternautSkillPicker(C){var B=this;var G=C;var D=null;var A=null;var F=null;this.SelectedSkills=[];function E(){addChildObj("span",G,null,"&nbsp;Filter by skill&nbsp;&nbsp;&nbsp;");D=new MasternautCombo(addChildObj("input",G),250,true);D.SetComboToAutoLoad("loadSkills","skill","id","name");D.onchange=function(){B.SelectedSkills=this.values};A=addRadio(G,"andOr","and",true,"And");F=addRadio(G,"andOr","or",false,"Or")}this.AllSkill=function(){return A.checked?1:0};this.Dispose=function(){D.Dispose();this.onfilter=null};E()}function MasternautTypeAndAttributePicker(B){var A=this;var G=B;var E=null;var C=null;this.SelectedTypes=[];this.SelectedAttributes=[];function F(){addChildObj("span",G,null,"&nbsp;Filter by type&nbsp;&nbsp;&nbsp;");E=new MasternautCombo(addChildObj("input",G),250,true);E.SetComboToAutoLoad("loadTypes","type","id","name");E.onchange=function(){A.SelectedTypes=this.values;A.SelectedAttributes=[];C.options.length=0;C.loadContent(false,null,"&vehicleTypeIds="+A.SelectedTypes);C.setSelectedText()};addChildObj("span",G,null,"<br>");addChildObj("span",G,null,"&nbsp;Filter by attributes&nbsp;&nbsp;&nbsp;");C=new MasternautCombo(addChildObj("input",G),250,true);C.SetComboToAutoLoad("loadAttributes","attribute","id","name");C.onchange=function(){A.SelectedAttributes=this.values}}function D(){A.SelectedAttributes=C.values}this.Dispose=function(){E.Dispose();C.Dispose();this.onfilter=null};F()}function MasternautCombo(G,P,A,F,J){this.value=null;this.selectedIndex=null;this.options=new Array();this.loaded=false;var O=this;var M=A;var N=F;var E=J;var L=false;var Q=G;Q.readOnly=!N;Q.style.cursor="default";if(E){Q.className="miniCombo"}Q.onclick=function(T){if(N){R(0,Q.value.length)}else{O.hideShow(T)}};Q.onkeyup=function(T){O.show(T)};this.style=Q.style;var C=document.createElement("img");C.src="/common/images/downArrow.gif";C.style.cssText="height:"+Q.offsetHeight+"px; margin-left:-1px; vertical-align:"+(document.all?"text-bottom;":"bottom");C.onclick=function(T){O.hideShow(T)};C.onmouseover=function(){this.src="/common/images/downArrowOn.gif"};C.onmouseout=function(){this.src="/common/images/downArrow.gif"};if(!E){Q.parentNode.appendChild(C)}var B=addChildObj("div",Q.parentNode,"z-index:1000; position:absolute; visibility:hidden; width:"+(P?P:Q.offsetWidth+C.offsetWidth-1)+"px; overflow-x:hidden;");B.hideWithParent=true;this.onchange=function(){};this.onclick=function(){};this.onContentLoaded=function(){};function D(){var U=O.options.length;for(var T=0;T<U;T++){if(O.options[T].chkBox){O.options[T].chkBox.checked=false}}}function K(){O.value=null;O.values=[];var U=O.options.length;for(var T=0;T<U;T++){if(O.options[T].chkBox&&O.options[T].chkBox.checked){O.values.push(O.options[T].value)}}}function I(U){var V=O.options.length;for(var T=0;T<V;T++){if(O.options[T].value==U){return O.options[T].innerText}}}this.loadContent=function(U,T,V){var W="";if(V){W=V}addToQueue(this.refreshParam.url+W,3,false,function(Z){O.loaded=true;O.options.length=0;if(O.refreshParam.firstLine){O.options.add(new Option(O.refreshParam.firstLine,0))}var X=Z.getElementsByTagName(O.refreshParam.tagName);for(var a=0;a<X.length;a++){var Y=(O.refreshParam.gif?"<img src='/common/images/map/location_"+X[a].getAttribute(O.refreshParam.gif)+".gif' align='absmiddle'> ":"");O.options.add(new Option(Y+X[a].getAttribute(O.refreshParam.attName),X[a].getAttribute(O.refreshParam.attId)))}if(U){O.show()}if(T){O.selectValue(T)}O.onContentLoaded(Z)})};this.SetComboToAutoLoad=function(Y,W,T,X,V,U){if(V){O.options.add(new Option(V,0));O.selectItem(0)}this.refreshParam={url:"map_xml.aspx?mode="+Y,tagName:W,attId:T,attName:X,firstLine:V,gif:U};this.onclick=function(){if(!O.loaded){this.loadContent(true)}};this.SetComboToRefreshContent()};this.SetComboToRefreshContent=function(){this.loaded=false;this.options.length=0;this.options.add(new Option("<i> Please wait<br> while loading...</i>",0))};this.SetComboToAutoComplete=function(U,V,T,W){Q.readOnly=false;C.style.display="none";Q.onkeyup=function(){if(Q.value.length>0){O.refreshParam={url:U.replace("[value]",escape(Q.value)),tagName:V,attId:T,attName:W};O.loadContent(true)}}};this.options.add=function(T){T.innerHTML=T.text;this.push(T)};this.options.addBatch=function(T){for(var U=0;U<T.length;U++){T[U].innerHTML=T[U].text;this.push(T[U])}};this.hideShow=function(T){if(B.style.visibility=="visible"){this.close(T)}else{this.show(T)}};this.show=function(U){var T=(U?U:window.event);if(T){T.cancelBubble=true}H((T&&T.srcElement?T.srcElement.tagName:""));B.style.left=getLeft(Q,B.offsetParent)+"px";B.style.top=getTop(Q,B.offsetParent)+Q.offsetHeight+"px";if(getTop(B)+parseInt(B.style.height,10)>GetBodyHeight()){B.style.top=getTop(Q,B.offsetParent)-parseInt(B.style.height,10)+"px"}if(getLeft(B)+parseInt(B.style.width,10)>GetBodyWidth()){B.style.left=getLeft(Q,B.offsetParent)+Q.offsetWidth+C.offsetWidth-parseInt(B.style.width,10)+"px"}B.style.visibility="visible";if(document.body.currentMasternautCombo&&!L&&document.body.currentMasternautCombo!=this){document.body.currentMasternautCombo.close()}document.body.currentMasternautCombo=this;document.body.onclick=function(){if(this.currentMasternautCombo&&!L){this.currentMasternautCombo.close()}L=false};this.onclick()};this.close=function(){B.style.visibility="hidden";document.body.currentMasternautCombo=null};this.setSelectedText=function(){K();switch(O.values.length){case 0:Q.value="";break;case 1:Q.value=I(O.values[0]);break;default:Q.value="[Multiple selection]"}};function H(V){B.innerHTML="";var Y=addChildObj("table",B,"border:solid 1px #7F9DB9");Y.bgColor="#FFFFFF";Y.border=0;Y.cellSpacing=0;Y.cellPadding=(E?0:1);Y.width="100%";var T=addChildObj("tbody",Y);var a=O.options.length;for(var W=0;W<a;W++){if(!N||V!="INPUT"||(N&&O.options[W].innerHTML.toLowerCase().indexOf(Q.value.toLowerCase())>=0)){if(M&&O.options[W].chkBox==undefined){O.options[W].chkBox=document.createElement("input");O.options[W].chkBox.type="checkbox";O.options[W].chkBox.index=W;O.options[W].chkBox.onclick=function(){L=true;O.setSelectedText();O.onchange(this.index)}}var Z=addChildObj("tr",T,"cursor:default;");Z.itemId=W;Z.onclick=function(){if(M){if(!L){var b=O.options[this.itemId].chkBox;b.checked=!b.checked;b.onclick()}}else{O.selectItem(this.itemId)}};var X=addChildObj("td",Z);X.style.fontFamily=Q.style.fontFamily;X.style.fontSize=Q.style.fontSize;if(M){var U=O.options[W].chkBox.checked;X.appendChild(O.options[W].chkBox);O.options[W].chkBox.checked=U}addChildObj("span",X,"white-space:nowrap;",O.options[W].innerHTML,(E?"linkSmall":null));X.onmouseover=function(){this.parentNode.bgColor=(J?"#DDDDDD":"#316AC5");this.style.color="white"};X.onmouseout=function(){this.parentNode.bgColor=this.parentNode.parentNode.parentNode.bgColor;this.style.color="black"}}}if(Y.offsetHeight>215){B.style.overflowY="scroll";B.style.height="215px"}else{B.style.overflowY="hidden";B.style.height=Y.offsetHeight+"px"}}this.selectItem=function(U,T){B.style.visibility="hidden";if(U!==null&&U!==undefined&&this.options[U].value!==null&&this.options[U].value!==undefined){if(this.value!=this.options[U].value){Q.value=this.options[U].innerText;this.value=this.options[U].value;this.values=[this.options[U].value];this.selectedIndex=U;D();if(!T){this.onchange()}}}};this.selectValue=function(V,U){for(var T=0;T<this.options.length;T++){if(this.options[T].value==V){this.selectItem(T,U)}}};this.setText=function(T){Q.value=T};function S(U,T){return(T.text<U.text?1:-1)}this.sortByText=function(){this.options=this.options.sort(S)};this.changeDisplay=function(T){Q.style.display=T;B.style.display=T;C.style.display=T};function R(V,T){if(Q.createTextRange){var U=Q.createTextRange();U.moveStart("character",V);U.moveEnd("character",-Q.value.length+T);U.select()}else{if(Q.setSelectionRange){Q.setSelectionRange(V,T)}}}this.Dispose=function(){this.onclick=null;this.onchange=null;this.options=null;B=null}}function MasternautCalendar(B,E,D){var I=this;var H=D;var F=E;var G=B;G.readOnly=true;G.style.cursor="default";G.onclick=function(){I.show()};this.selectedDate=(G.value.length>0?new Date(G.value):null);var C=document.createElement("img");C.src="/common/images/downArrow.gif";C.style.cssText="height:"+G.offsetHeight+"px; margin-left:-1px; vertical-align:"+(document.all?"text-bottom;":"bottom");C.onclick=function(){I.show()};C.onmouseover=function(){this.src="/common/images/downArrowOn.gif"};C.onmouseout=function(){this.src="/common/images/downArrow.gif"};G.parentNode.appendChild(C);var A=addChildObj("div",G.parentNode,"z-index:1000; position:absolute; visibility:hidden; width:"+(G.offsetWidth+C.offsetWidth-1)+"px;");A.hideWithParent=true;this.onSelectDate=function(){};this.show=function(){if(A.style.visibility=="visible"){A.style.visibility="hidden"}else{if(G.value.length>0){this.drawCal(new Date(G.value))}else{this.drawCal(new Date())}A.style.left=getLeft(G,A.offsetParent)+"px";A.style.top=(getTop(G,A.offsetParent)+G.offsetHeight)+"px";A.style.visibility="visible"}};this.selectCal=function(J){A.style.visibility="hidden";if(J!==null&&J!==undefined){G.value=week(J.getDay())+" "+J.getDate()+" "+month(J.getMonth())+" "+J.getUTCFullYear();this.selectedDate=J}else{G.value="";this.selectedDate=null}this.onSelectDate();if(F){document.Forms[0].submit()}};this.drawCal=function(X){var W=new Date();var V=document.createElement("table");V.width="100%";V.cellSpacing=0;V.cellPadding=1;V.border=0;V.bgColor="#B3BDCA";V.style.cssText="z-index:1100; BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-BOTTOM: #666666 1px solid;";var J=addChildObj("tbody",V);var L=addChildObj("tr",J);L.bgColor="#FFFFFF";var U=addChildObj("a",null,"cursor:pointer;","&lt;","calH");U.onclick=function(){I.drawCal(new Date(X.getUTCFullYear(),X.getMonth()-1,1))};var S=addChildObj("a",null,"cursor:pointer;","&gt;","calH");S.onclick=function(){I.drawCal(new Date(X.getUTCFullYear(),X.getMonth()+1,1))};var M=addChildObj("span",null,null,"<b>"+month(X.getMonth())+" "+X.getUTCFullYear()+" </b>");if(H){var Q=addChildObj("td",L,"text-align:left");Q.colSpan=4;Q.appendChild(U);Q.appendChild(M);Q.appendChild(S);var O=addChildObj("td",L,"text-align:right");O.colSpan=3;var Y=addChildObj("span",O,"cursor:pointer;","No date","calH");Y.onclick=function(){I.selectCal()}}else{var P=addChildObj("td",L,"text-align:left");P.appendChild(U);var O=addChildObj("td",L,"text-align:center");O.colSpan=5;O.appendChild(M);var N=addChildObj("td",L,"text-align:right");N.appendChild(S)}var T=addChildObj("tr",J,"background:color:#939DAA");addChildObj("td",T,"text-align:center","<b>M</b>");addChildObj("td",T,"text-align:center","<b>T</b>");addChildObj("td",T,"text-align:center","<b>W</b>");addChildObj("td",T,"text-align:center","<b>T</b>");addChildObj("td",T,"text-align:center","<b>F</b>");addChildObj("td",T,"text-align:center","<b>S</b>");addChildObj("td",T,"text-align:center","<b>S</b>");var a=new Date(X.getUTCFullYear(),X.getMonth(),1);a.setDate(1-(a.getDay()===0?6:a.getDay()-1));var Z=new Date(X.getUTCFullYear(),X.getMonth()+1,1);Z.setDate(Z.getDay()===0?1:(Z.getDay()==1?0:8-Z.getDay()));var K=document.createElement("tr");while(a<=Z){var Q=addChildObj("td",K,"text-align:center");var R=addChildObj("a",Q,"cursor:pointer;",a.getDate());R.className=(a.getDate()==W.getDate()&&a.getMonth()==W.getMonth()?"calD":(a.getDay()===0||a.getDay()==6?"calW":(a.getMonth()==X.getMonth()?"cal":"calM")));R.date=new Date(a);R.onclick=function(){I.selectCal(this.date)};if(a.getDay()===0){J.appendChild(K);K=document.createElement("tr")}a.setDate(a.getDate()+1)}J.appendChild(K);A.innerHTML="";A.appendChild(V)}}function MasternautTimePicker(A,H,D,G,F){var I=this;this.value=null;this.onchange=function(){};addChildObj("span",A,null,H);var C=new MasternautCombo(addChildObj("input",A,"width:34px;"));for(var E=0;E<24;E++){var B=(E<10?"0"+E:E);C.options.add(new Option(B+":00",B+":00"));if(D){C.options.add(new Option(B+":30",B+":30"))}}if(G){C.options.add(new Option("24:00","24:00"))}C.onchange=function(){I.value=this.value;I.onchange()};C.selectValue(F)}function MasternautContextMenu(D,C,A,B,E){MasternautContextMenuWithWidth(D,C,A,230,B,E)}function MasternautContextMenuWithWidth(event,clickedItem,caption,width,xml,param){if(document.contextMenu){document.onclick()}var table=document.createElement("table");table.width="100%";table.cellSpacing=0;table.cellPadding=0;table.border=0;table.id="contextMenu";var tbody=addChildObj("tbody",table);var menuXml=null;try{menuXml=new ActiveXObject("Msxml2.DOMDocument");menuXml.async=false;menuXml.loadXML(xml)}catch(ex){var domParser=new DOMParser();menuXml=domParser.parseFromString(xml,"application/xml")}var header=menuXml.getElementsByTagName("header");var menuItems=menuXml.getElementsByTagName("menuItem");for(var i=0;i<header.length;i++){var tr=addChildObj("tr",tbody);var td=addChildObj("td",tr,(header[i].getAttribute("height")?"height:"+header[i].getAttribute("height")+"px;":""),unescape(header[i].getAttribute("value")));td.colSpan=2;if(header[i].getAttribute("changeAfterCallback")){document.divToChangeAfterCallback=td}}if(header.length>0&&menuItems.length>0){var td=addChildObj("td",addChildObj("tr",tbody),"height:14px","<hr>");td.colSpan=2;td.valign="top"}for(var i=0;i<menuItems.length;i++){if(menuItems[i].getAttribute("split")){var td=addChildObj("td",addChildObj("tr",tbody),"","<hr style='border-top:1px dashed #A5A5A5; height:1px'>");td.colSpan=2;td.valign="top"}else{var icon=menuItems[i].getAttribute("icon");var text=unescape(menuItems[i].getAttribute("text"));var tr=addChildObj("tr",tbody,"cursor:pointer;");tr.action=menuItems[i].getAttribute("action");tr.clickedItem=clickedItem;tr.onclick=function(){eval("this.clickedItem."+this.action.replace("[param]",param?"'"+param.join("', '")+"'":""))};addChildObj("td",tr,"width:15px",(text!==null?"<img src='/common/images/trans.gif' width=2 height=17 align='absmiddle'>":"")+(icon===null?"<img src='/common/images/li.gif' width='11' height='10'>":"<img src='/common/images/restrictionGroup/"+icon+"'>"));addChildObj("td",tr,null,(text===null?"<img src='/common/images/trans.gif' height=2>":text),"linkMenu")}}posXY=event.clientX>0?[event.clientX+document.body.scrollLeft,event.clientY+document.body.scrollTop]:[event.screenX,event.screenY];var menuContent=new MasternautWindows(document.body,0,0,width,null,"Z-INDEX:1001; ",table,false,caption,false,false,true,posXY,true,false,false,0);menuContent.updateContentSize();document.contextMenu=menuContent;document.onclick=function(){if(this.contextMenu){this.contextMenu.close()}};menuContent.onClose=function(){document.divToChangeAfterCallback=null;document.contextMenu=null};event.returnValue=false;event.cancelBubble=true}function MasternautTable(container,xml,tagName,headers,columns,actionColumn,action,actionParam){container.innerHTML="";var lnkPrint=addChildObj("span",container,"margin-left:3px","Print","link");lnkPrint.onclick=function(){var newwin=window.open("","print","toolbar=no,location=no,status=no,directories=no,menubar=no,resizable=no,scrollbars=yes,width=680,height=500");newwin.document.write("<html><body leftmargin=5 topmargin=5><table>"+table.innerHTML+"</table></html>");newwin.document.close();newwin.print();newwin.close()};addChildObj("span",container,null," | ");var lnkExport=addChildObj("span",container,null,"Export","link");lnkExport.onclick=function(){var s=[];for(var i=0;i<tbody.childNodes.length;i++){for(var j=0;j<tbody.childNodes[i].childNodes.length;j++){s.push(tbody.childNodes[i].childNodes[j].innerText.replace(","," ").replace("\r\n"," ")+(j==tbody.childNodes[i].childNodes.length-1?"\n":","))}}var frmExport=addChildObj("form",container,"display:none;");frmExport.method="POST";frmExport.action="export.aspx";var csv=addChildObj("textarea",frmExport);csv.name="csv";csv.value=s.join("");frmExport.submit()};var table=addChildObj("table",container);table.cellSpacing=1;table.cellPadding=1;var tbody=addChildObj("tbody",table);var tags=xml.getElementsByTagName(tagName);var trHeader=addChildObj("tr",tbody,"background-image:url(/common/images/windows/barback2.gif); color:white; text-align:center; font-weight:bold");for(var i=0;i<headers.length;i++){addChildObj("td",trHeader,null,headers[i])}var bgColor="white";for(var i=0;i<tags.length;i++){bgColor=(bgColor=="white"?"#D5D5FA":"white");var tr=addChildObj("tr",tbody,"background-color:"+bgColor);for(var j=0;j<columns.length;j++){var text=tags[i].getAttribute(columns[j]);if(columns[j]=="dist"){text=Distance(text)}if(columns[j]=="day"||columns[j]=="dat"){text="<nobr>"+text+"</nobr>"}var td=addChildObj("td",tr,null,text,(actionColumn==j?"link":null));if(actionColumn==j){td.id=i;td.onclick=function(){var param="";for(var i=0;i<actionParam.length;i++){if(actionParam[i].type=="field"){param+="'"+tags[this.id].getAttribute(actionParam[i].attribute)+"', "}else{param+="'"+actionParam[i].value+"', "}}eval("action("+param.substr(0,param.length-2)+")")}}}}}function MasternautWinSlider(B,A,F){var H=false;var C=null;var G=null;function I(){var J=B[0].container.offsetLeft+B[0].container.offsetWidth;C=J+(A[0].container.offsetLeft-J)/2-1.5;G=addChildObj("div",B[0].container.parentNode,"position:absolute; left:"+C+"px; top:"+B[0].container.offsetTop+"px; width:3px; height:60px; background-color:"+F+"; cursor:e-resize;");G.onmousedown=D}function D(){document.onmousemove=function(K){var J=(K?K:window.event);G.style.left=J.clientX+"px";E();return false};document.onmouseup=function(){this.onmousemove=null;this.onmouseup=null};return false}function E(){var J=parseInt(G.style.left,10);var K=J-C;for(win in B){B[win].resizeTo(B[win].container.offsetWidth+K)}for(win in A){A[win].container.style.left=(A[win].container.offsetLeft+K)+"px";A[win].resizeTo(A[win].container.offsetWidth-K)}C=J}I()}function MasternautGantt(E,D,G){var H=[];var B=G;var F=D;var A=E-F;var C=86400;var I=0;this.AddBar=function(L,M,J,P,K,N,O){H.push({Section:[],Caption:L,CaptionColor:M,Height:J,MarginBottom:P,BackColor:K,OnMouseOver:N,OnClick:O});return H.length-1};this.AddSection=function(K,P,O,N,J){var M=TimeToSeconds(O);var L=TimeToSeconds(N);if(M<C){C=M}if(M+L>I){I=M+L}H[K].Section.push({Id:P,Left:M,Width:L,Color:J})};this.Draw=function(J){C=parseInt(C/3600,10)*3600;I=parseInt(I/3600,10)*3600+3600;var K=A/(I-C);var U=900;var V=50;while(K*U<V){U*=2}V=K*U;var R=A/V;for(var N=0;N<R;N++){addChildObj("div",J,"position:absolute; top:0px; left:"+(F+V*N)+"px; width:"+(V)+"px; height:15px; background-color:"+B+"; border-left:1px solid black;","&nbsp;"+SecondsToTime(C+N*U).substr(0,5))}for(var N=0;N<H.length;N++){var P=H[N];var Q=20+N*(P.Height+P.MarginBottom);addChildObj("div",J,"position:absolute; top:"+Q+"px; left:0px; width:"+F+"px; height:"+P.Height+"px; line-height:"+P.Height+"px; white-space:nowrap; font-weight:bold; background-color:"+P.CaptionColor,P.Caption);var O=addChildObj("div",J,"position:absolute; top:"+Q+"px; left:"+F+"px; width:"+A+"px; height:"+P.Height+"px; cursor:pointer; background-color:"+P.BackColor);O.onmousemove=function(X){var W=(X?X:window.event);if(W.srcElement.sectionId){P.OnMouseOver(W.srcElement.sectionId)}};O.onmousedown=function(X){var W=(X?X:window.event);if(W.srcElement.sectionId){P.OnClick(W.srcElement.sectionId)}};var S=P.Section.length;for(var L=0;L<S;L++){var T=P.Section[L];var M=addChildObj("img",O,"position:absolute; left:"+(T.Left-C)*K+"px; width:"+T.Width*K+"px; height:100%;");M.src="/common/images/gantt_"+T.Color+".gif";M.sectionId=T.Id}}}}function MasternautQueue(){var H=[];var B=null;this.Add=function(K){if(K.ShowWaitWindow){showWaitWindow()}if(!K.DontReplaceIdentical){var J=A(K.Action);while(J!=null){H[J].Dispose();H.splice(J,1);J=A(K.Action)}}H.push(K);if(B==null){E()}};function E(){B=G();if(B!=null){if(H[B].ShowWaitWindow){showWaitWindow()}F(H[B].Url,H[B].PostData)}}function G(){var L=0;var K=null;for(var J=0;J<H.length;J++){if(H[J].Priority>L){L=H[J].Priority;K=J}}return K}function A(K){for(var J=0;J<H.length;J++){if(J!=B&&H[J].Action==K){return J}}return null}function I(){if(H[B].ShowWaitWindow){showWaitWindow()}F(H[B].Url,H[B].PostData)}function C(K){hideWaitWindow();var J=(K.childNodes[0].tagName?K.childNodes[0].tagName:K.childNodes[1].tagName);if(J=="message"){ShowNotify(K.getElementsByTagName("message")[0].text)}else{if(J=="sessionLost"){if(getParameter("nolostsession")=="1"){window.location=window.location}else{var L=new MasternautWindows(document.body,0,0,165,70,"z-index:1000;",null,false,"Session lost",false,true,false,false,true,false,true,3,true,false,false);L.divContent.innerHTML="For security reasons your session has expired.\nYou will have to <a href='default.aspx' style='text-decoration:underline'>log back in</a>."}}else{if(J=="error"){if(confirm("The following error has occurred while loading your data:\n\n"+K.getElementsByTagName("error")[0].text+"\n\nPlease click 'ok' if you want to try again.")){I();return }}else{if(H[B].CallBackFunction!=null){H[B].CallBackFunction(K)}}}}H[B].Dispose();H.splice(B,1);E()}function F(K,J){req=false;if(window.XMLHttpRequest){try{req=new XMLHttpRequest()}catch(L){req=false}}else{if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP")}catch(L){try{req=new ActiveXObject("Microsoft.XMLHTTP")}catch(L){req=false}}}}if(req){req.onreadystatechange=D;if(J==undefined||J==null){req.open("GET",K,true);req.send("")}else{req.open("POST",K,true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.send(J)}}}function D(){if(req.readyState==4){if(req.status==200){C(req.responseXML)}else{hideWaitWindow();if(H[B].Priority>1){alert("There was a problem retrieving the data:\n"+req.readyState+"\n"+req.statusText)}else{setTimeout(I,20000)}}}}}function MasternautQueueItem(E,F,D,C,A,B){this.Url=E;this.Action=E.substr(0,(E.indexOf("&")==-1?E.length:E.indexOf("&")));this.Priority=F;this.ShowWaitWindow=D;this.CallBackFunction=C;this.PostData=A;this.DontReplaceIdentical=B;this.Dispose=function(){this.CallBackFunction=null}}function addToQueue(E,F,D,C,A,B){if(document.masternautQueue==null){document.masternautQueue=new MasternautQueue()}document.masternautQueue.Add(new MasternautQueueItem(E,F,D,C,A,B))}function addChildObj(D,C,B,F,A){var E=document.createElement(D);if(B){E.style.cssText=B}if(A){E.className=A}if(F){E.innerHTML=F}if(C){C.appendChild(E)}return E}function addImage(C,F,E,D,B){var A=document.createElement("img");A.src=F;A.alt=E;A.align="absmiddle";if(B){A.style.cssText=B}if(D){A.style.cursor="pointer";A.onclick=D}if(C){C.appendChild(A)}return A}function addRadio(E,C,F,G,A,D){var B;if(window.ActiveXObject){B=document.createElement('<input name="'+C+'">')}else{B=document.createElement("input");B.setAttribute("name",C)}B.type="radio";B.setAttribute("value",F);E.appendChild(B);B.checked=G;addChildObj("span",E,D,A);return B}function addInput(E,D,B,C,F){var A;if(window.ActiveXObject){A=document.createElement('<input name="'+B+'">')}else{A=document.createElement("input");A.setAttribute("name",B)}A.type=D;A.style.cssText=C;if(F){A.value=F}E.appendChild(A);return A}function addCheckbox(D,E,B,C){var A=document.createElement("input");A.type="checkbox";D.appendChild(A);A.checked=E;addChildObj("span",D,C,"&nbsp;"+B);return A}function valueRadio(B){for(var A=0;A<B.length;A++){if(B[A].checked){return B[A].value}}}function getTop(B,A){var D=B;var C=0;while(D!=null&&D.tagName!="BODY"&&D!=A){C+=D.offsetTop;D=D.offsetParent}return C}function getLeft(B,A){var D=B;var C=0;while(D!=null&&D.tagName!="BODY"&&D!=A){C+=D.offsetLeft;D=D.offsetParent}return C}function month(A){switch(A){case 0:return"Jan";case 1:return"Feb";case 2:return"Mar";case 3:return"Apr";case 4:return"May";case 5:return"Jun";case 6:return"Jul";case 7:return"Aug";case 8:return"Sep";case 9:return"Oct";case 10:return"Nov";case 11:return"Dec"}}function week(A){switch(A){case 0:return"Sun";case 1:return"Mon";case 2:return"Tue";case 3:return"Wed";case 4:return"Thu";case 5:return"Fri";case 6:return"Sat"}}function isUkPostCode(I){var J="[abcdefghijklmnoprstuwyz]";var H="[abcdefghklmnopqrstuvwxy]";var F="[abcdefghjkstuw]";var E="[abehmnprvwxy]";var C="[abdefghjlnpqrstuwxyz]";var D=new Array();D.push(new RegExp("^("+J+"{1}"+H+"?[0-9]{1,2})(\\s*)([0-9]{1}"+C+"{2})$","i"));D.push(new RegExp("^("+J+"{1}[0-9]{1}"+F+"{1})(\\s*)([0-9]{1}"+C+"{2})$","i"));D.push(new RegExp("^("+J+"{1}"+H+"?[0-9]{1}"+E+"{1})(\\s*)([0-9]{1}"+C+"{2})$","i"));D.push(/^(GIR)(\s*)(0AA)$/i);D.push(/^(bfpo)(\s*)([0-9]{1,4})$/i);D.push(/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);var G=I;var A=false;for(var B=0;B<D.length;B++){if(D[B].test(G)){D[B].exec(G);G=RegExp.$1.toUpperCase()+" "+RegExp.$3.toUpperCase();G=G.replace(/C\/O\s*/,"c/o ");A=true;break}}if(A){return G}else{return false}}function showWaitWindow(){if(document._waitWindow==null){document._waitWindow=new MasternautWindows(document.body,0,0,110,80,"z-index:10001;",null,false,"Please wait",false,true,false,false,true,false,true,0,true);document._waitWindow.divContent.innerHTML="<br><center><img src='/common/images/waitBar.gif' height=18 width=88></center>"}}function hideWaitWindow(){if(document._waitWindow){document._waitWindow.close();document._waitWindow=null}}function ShowNotify(J,E){var D=100;var B=150;var I;var G;var C;H();document.DivNotify=addChildObj("div",document.body,"z-index:5000; position:absolute; height:"+D+"px; width:"+B+"px; bottom:-"+D+"px; right:4px; border:2px #B3BDCA solid; background-color:#939DAA ; background-image:url(/common/images/background.gif); background-repeat:repeat-x; color:white; font-size:12px; font-weight:bold; text-align:center;","<table height='100%' width='100%'><tr><td>"+J+"</td></tr></table>");F(-1*D,0,false);function A(){F(0,-1*D,true)}function F(M,L,K){if(L!=undefined&&K!=undefined){I=M;G=L;C=K}document.DivNotify.style.bottom=I+"px";I+=(I>G?-10:10);if(I!=G){setTimeout(F,50)}else{if(C){H()}else{setTimeout(A,(4000+J.length*40)*(E?E:1))}}}function H(){if(document.DivNotify!=null){document.body.removeChild(document.DivNotify);document.DivNotify=null}}}function getParameter(D){var B=D.toLowerCase();var C=document.URL;var G=C.toLowerCase();var F=((G.indexOf("?"+B+"=")>-1)||(G.indexOf("&"+B+"=")>-1));if(F){var E,A;var H=(G.indexOf("?"+B+"="));if(H==-1){H=(G.indexOf("&"+B+"="))}H+=B.length+2;E=C.substring(H,C.length);A=E.indexOf("&");if(A==-1){A=E.length}return unescape(E.substring(0,A))}return""}function createCookie(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/"}function readCookie(C,B){var F=C+"=";var E=""+document.cookie;var A=E.split(";");for(var D=0;D<A.length;D++){var G=A[D];while(G.charAt(0)==" "){G=G.substring(1,G.length)}if(G.indexOf(F)==0){return G.substring(F.length,G.length)}}return(B!=undefined?B:null)}function eraseAllCookies(){var D=""+document.cookie;var B=D.split("; ");for(var E=0;E<B.length;++E){var A=B[E].split("=");if(A.length!=2){continue}var C=unescape(A[0]);eraseCookie(C)}}function eraseCookie(A){createCookie(A,"",-1)}function help(A){window.open("help.aspx?id="+A,"help","toolbar=no,location=no,status=no,directories=no,menubar=no,resizable=no,scrollbars=no,width=400,height=320")}function ShowWelcome(){try{if(myDate(new Date)<"2009-5-8"&&top.location.href.indexOf("masternaut.co.uk")>0){var B=new MasternautWindows(document.body,0,0,400,250,"z-index:1501;",null,false,"Map upgrade",false,false,true,false,true,false,true,4,true,false,false);B.divContent.innerHTML="<div style='font-weight:bold; font-size:14px'>Important map upgrade</div><br>We are delighted to announce the latest improvements to the Masternaut system. As part as of our commitment to constantly improving the service, we have made it easier, quicker and simpler to use the system.<br>Some of our fantastic updates include:<br><br>Better route planner, much improved journey history, POI and HGV restriction on the map, traffic delays, custom map, vehicle cluster, drive time zone, driver search and more...<br><br><a href='/common/pdf/webRelease20090407.pdf' style='color: #00308f; text-decoration: underline;'>Please click here to see all our updates</a>.<br><br>If you have any questions, please contact your customer service representative.";createCookie("MapWelcomeShown","1",50)}}catch(A){}}function imageIsLoaded(A){return(A.complete==true&&(A.naturalWidth>=0||A.width>=0))}function enterKeyPressed(B){var A=0;if(B&&B.which){A=B.which}else{if(window.event){A=event.keyCode}}return(A==13)}function myDate(A){return A.getUTCFullYear()+"-"+(A.getMonth()+1)+"-"+A.getDate()}function myDateTime(A){return A.getUTCFullYear()+"-"+(A.getMonth()+1)+"-"+A.getDate()+" "+A.getHours()+":"+A.getMinutes()+":"+A.getSeconds()}function indexOfValueInArray(B,C){for(var A=0;A<C.length;A++){if(C[A]==B){return A}}return -1}function GetBodyHeight(){return(document.body.clientHeight==0?document.documentElement.clientHeight:document.body.clientHeight)}function GetBodyWidth(){return(document.body.clientWidth==0?document.documentElement.clientWidth:document.body.clientWidth)}function AddShim(A){var B=document.createElement("iframe");B.frameBorder="0";B.style.visibility=A.style.visibility;B.style.position="absolute";B.style.zIndex="1000";B.style.top=A.offsetTop+"px";B.style.left=A.offsetLeft+"px";B.style.width=A.offsetWidth+"px";B.style.height=A.offsetHeight+"px";A.shimElement=B;A.parentNode.insertBefore(B,A);A.onmove=function(){if(this.shimElement){this.shimElement.style.left=this.offsetLeft+"px";this.shimElement.style.top=this.offsetTop+"px"}};A.onresize=function(){if(this.shimElement){this.shimElement.style.width=this.offsetWidth+"px";this.shimElement.style.height=this.offsetHeight+"px"}}}function SecondsToTime(B){var A=new Date(2000,1,1,0,0,B);return(A.getDate()>1?A.getDate()-1+" day"+(A.getDate()>2?"s":"")+" ":"")+(A.getHours()>=10?A.getHours():"0"+A.getHours())+":"+(A.getMinutes()>=10?A.getMinutes():"0"+A.getMinutes())+":"+(A.getSeconds()>=10?A.getSeconds():"0"+A.getSeconds())}function TimeToSeconds(A){return parseInt(A.substr(0,2),10)*3600+parseInt(A.substr(3,2),10)*60+parseInt(A.substr(6,2),10)}function TimeAdd(B,A){return SecondsToTime(TimeToSeconds(B)+TimeToSeconds(A))}function TimeSub(B,A){return SecondsToTime(TimeToSeconds(B)-TimeToSeconds(A))}function Cost(A){return Currency()+Math.round(A*100)/100}function Currency(){switch(_defaultCountry){case"IR":return"&euro;";case"AU":return"$";case"NZ":return"$";default:return"£"}}function Speed(A){return Math.round(A*_defaultCoef)+"&nbsp;"+_defaultSpeed}function Distance(A){return Math.round(A*10*_defaultCoef)/10+"&nbsp;"+_defaultDistance}var _defaultCountry=readCookie("defaultCountry");if(_defaultCountry==null){_defaultCountry="UK"}var _defaultDistance=readCookie("defaultUnit");if(_defaultDistance==null){_defaultDistance=(_defaultCountry=="UK"?"miles":"km")}else{_defaultDistance=(_defaultDistance=="0"?"miles":"km")}var _defaultSpeed=(_defaultDistance=="miles"?"mph":"km/h");var _defaultCoef=(_defaultDistance=="miles"?"1":"1.609");