function whichBrowser(){this.agt=navigator.userAgent.toLowerCase();this.major=parseInt(navigator.appVersion);this.dom=(document.getElementById)?1:0;this.ns=(document.layers)?1:0;this.ns4up=(this.ns&&this.major>=4)?1:0;this.ns6=(this.dom&&navigator.appName=="Netscape")?1:0;this.mozilla=this.agt.indexOf("mozilla")!=-1&&parseInt(navigator.appVersion.substring(0,1))>=5;this.op=(window.opera)?1:0;this.ie=(document.all)?1:0;this.ie4=(document.all&&!this.dom)?1:0;this.ie4up=(this.ie&&this.major>=4)?1:0;this.ie5=(document.all&&this.dom)?1:0;this.firefox=(this.agt.indexOf("firefox")!=-1);this.win=((this.agt.indexOf("win")!=-1)||(this.agt.indexOf("16bit")!=-1));this.mac=(this.agt.indexOf("mac")!=-1)}var oBw=new whichBrowser();var showProcessingForm=false;function formatCurrency(a){valueInString=a.toString();if(valueInString.indexOf(".")==-1){if(valueInString=="0"){valueInString="0.00"}else{valueInString=valueInString+".00"}}else{tmp=valueInString.split(".");tmp[1]=tmp[1]+"000";if(parseInt(tmp[1].slice(0,3))>994){valueInString=(parseInt(tmp[0])+1)+".00"}else{if(tmp[1].charAt(2)>4){xtmp=Math.round("1"+tmp[1].slice(0,2)+".9");xtmp=xtmp.toString()+"0";xtmp=xtmp.charAt(1)+xtmp.charAt(2)}else{xtmp=tmp[1].slice(0,2)}valueInString=tmp[0]+"."+xtmp}}return valueInString}function mouseIn(a){mouseInC(a,"#990000")}function mouseOut(a){mouseOutC(a,"#000000")}function mouseInC(b,a){$(b).css("color",a)}function mouseOutC(b,a){$(b).css("color",a)}function mouseInB(a){mouseInBC(a,"#ffb6aa")}function mouseOutB(a){mouseOutBC(a,"white")}function mouseInBC(b,a){$(b).css("backgroundColor",a)}function mouseOutBC(b,a){$(b).css("backgroundColor",a)}var lastRow="0";var originalColor="#000";function M(a){if(originalColor!="#000"){$("#R"+lastRow).css("backgroundColor",originalColor)}lastRow=a;originalColor=$("#R"+lastRow).css("backgroundColor");$("#R"+lastRow).css("backgroundColor","#fafad2")}function HM(a){$("#"+a+"style").css("color","#ff0000");if(a!=orderBy){document.forms[0][a+"arrow"].src="/images/arrow0.gif"}return false}function HO(a){if(a!=orderBy){$("#"+a+"style").css("color","#990000");document.forms[0][a+"arrow"].src="/images/clear.gif"}return false}function openNew(c,b,d,a){return openNewS(c,b,d,a,"no")}var newFormWindow=null;function closeForm(a){if(!a){a=window.event}if(newFormWindow!=null){newFormWindow.close();newFormWindow=null}return false}function openNewS(d,c,e,a,f){var b;var g;if(e==-1){b=0;e=screen.availWidth-6}else{b=(screen.width)?(screen.width-e)/2:0}if(a==-1){g=0;a=screen.availHeight-35}else{g=(screen.height)?(screen.height-a)/2:0}return openNewP(d,c,e,a,f,b,g)}function openNewP(d,c,e,a,f,b,g){if(newFormWindow!=null&&!newFormWindow.closed&&newFormWindow.location){newFormWindow.location.href=d}else{newFormWindow=window.open(d,c,"left="+b+",top="+g+",width="+e+",height="+a+",location=no,navigation=no,resizable=yes,status=no,titlebar=yes,directories=no,toolbar=no,menubar=no,scrollbars="+f);if(!newFormWindow.opener){newFormWindow.opener=self}}if(window.focus){newFormWindow.focus()}return false}var submitFormCount=0;function submitFormAlert(){alert("You could not submit form twice.")}function safeDisableForm(b,c,a){if(submitFormCount==0){displayProcessingForm();if(a==null||a){submitFormCount++;$("a.button").button("option","disabled",true)}}else{if(this.submitFormAlert!=null){submitFormAlert()}}}function safeSubmitForm(b,c,a){if(submitFormCount==0){try{displayProcessingForm();if(a==null||a){submitFormCount++;$("a.button").button("option","disabled",false)}if(c!=null){b.action=c}}finally{b.submit()}}else{if(this.submitFormAlert!=null){submitFormAlert()}}}function isEmpty(a){return((a==null)||(a.length==0))}function isWhitespace(d){if(isEmpty(d)){return true}var b;var a=" \t\n\r";for(b=0;b<d.length;b++){var e=d.charAt(b);if(a.indexOf(e)==-1){return false}}return true}function isNumber(a){return/^-?((\d+\.?\d?)|(\.\d+))$/.test(a)}function validateDate(c,e,b){var d=new Array(31,29,31,30,31,30,31,31,30,31,30,31);var g,a,f;if(isWhitespace(c)){return false}if(isWhitespace(e)){return false}if(isWhitespace(b)){return false}if(isNaN(c)){return false}if(isNaN(e)){return false}if(isNaN(b)){return false}g=parseInt(c,10);a=parseInt(e,10);f=parseInt(b,10);if(a>12||a<1){return false}if(f>d[a-1]){return false}if((g%4!=0)&&(a==2)&&(f>28)){return false}return !((g%4==0)&&(a==2)&&(f>29))}function displayProcessingForm(){progressBar.showBar();window.status="Connecting Xpeedite Server..."}function hiddenProcessingForm(){progressBar.hideBar();window.status="Done"}function getCheckedValue(b){if(!b){return""}var c=b.length;if(c==undefined){if(b.checked){return b.value}else{return""}}for(var a=0;a<c;a++){if(b[a].checked){return b[a].value}}return""}function setCheckedValue(b,d){if(!b){return}var c=b.length;if(c==undefined){b.checked=(b.value==d.toString());return}for(var a=0;a<c;a++){b[a].checked=b[a].value==d.toString()}}var valueN=-1;function createBar(n,f,c,l,g,m,d,a,k,e){var o='<div id="_xpbar'+(++valueN)+'" style="text-align:center;vertical-align:middle;visibility:hidden;z-index:99999;display:none;position:absolute;overflow:hidden;width:'+n+"px; height:"+f+"px;background-color:"+c+";border-color:"+g+";border-width:"+l+'px; border-style:solid;font-size:xx-small;">';o+='<span id="blocks'+valueN+'" style="left:-'+(f*2+1)+'px;position:absolute;font-size:1px">';for(i=0;i<a;i++){o+='<span style="background-color:'+m+";left:-"+((f*i)+i)+"px;font-size:1px;position:absolute;width:"+f+"px;height:"+f+"px;";o+="filter:alpha(opacity="+(100-i*(100/a))+");opacity:"+((100-i*(100/a))/100)+'"></span>'}o+="</span>Getting data from Xpeedite...</div><iframe id=_ixpbar"+valueN+' src="javascript:false;" scrolling=no frameborder=0 style="position:absolute;top:0px;left:0px;display:none;border-width:0;background-color:transparent"></iframe>';document.write(o);var b=(oBw.ie)?document.all["blocks"+valueN]:getElement("blocks"+valueN);b.bar=(oBw.ie)?document.all["_xpbar"+valueN]:getElement("_xpbar"+valueN);b.ibar=(oBw.ie)?document.all["_ixpbar"+valueN]:getElement("_ixpbar"+valueN);b.blocks=a;b.N=valueN;b.w=n;b.h=f;b.speed=d;b.ctr=0;b.count=k;b.action=e;b.togglePause=togglePause;b.showBar=function(){var h,t,q,p,r,s;showProcessingForm=true;if(oBw.ie){q=document.body.offsetWidth;p=document.body.offsetHeight;r=this.offsetWidth;s=this.offsetHeight}else{if(oBw.ns){q=document.width;p=document.height;r=this.style.clip.width;s=this.style.clip.height}else{q=window.innerWidth?window.innerWidth:document.body.clientWidth;p=window.innerHeight?window.innerHeight:document.body.clientHeight;r=this.style.width;s=this.style.height}}if(r<=0){r=300}if(s<=0){s=15}if(q<r-10){r=q-10}h=Math.floor((q-r)/2);t=Math.floor((p-s)/2);if(oBw.ie){h+=document.body.scrollLeft;t+=document.body.scrollTop}else{if(oBw.ns){}else{h+=window.pageXOffset;t+=window.pageYOffset}}this.bar.style.left=h;this.bar.style.top=t;this.bar.style.width=r;this.bar.style.height=s;this.bar.style.visibility="visible";this.bar.style.display="block";this.ibar.style.left=h;this.ibar.style.top=t;this.ibar.style.width=r;this.ibar.style.height=s;this.ibar.style.visibility="visible";this.ibar.style.display="block"};b.hideBar=function(){showProcessingForm=false;this.bar.style.visibility="hidden";this.bar.style.display="none";this.ibar.style.visibility="hidden";this.ibar.style.display="none"};b.tid=setInterval("startBar("+valueN+")",d);return b}function startBar(bn){var t=(oBw.ie)?document.all["blocks"+bn]:getElement("blocks"+bn);if(parseInt(t.style.left)+t.h+1-(t.blocks*t.h+t.blocks)>t.w){t.style.left=-(t.h*2+1)+"px";t.ctr++;if(t.ctr>=t.count){eval(t.action);t.ctr=0}}else{t.style.left=(parseInt(t.style.left)+t.h+1)+"px"}}function togglePause(){if(this.tid==0){this.tid=setInterval("startBar("+this.N+")",this.speed)}else{clearInterval(this.tid);this.tid=0}}var xmlHttp=false;function initXmlHttp(){if(xmlHttp){return}xmlHttp=false;try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){xmlHttp=false}}if(!xmlHttp&&typeof XMLHttpRequest!="undefined"){xmlHttp=new XMLHttpRequest()}if(!xmlHttp){alert("Your browser doesn't support AJAX")}}function getWeather(a){sendWeatherAJAXRequest(a,getWeatherCallback)}function sendWeatherAJAXRequest(b,c){initXmlHttp();if(xmlHttp){window.status="Fetching weather data from Xpeedite...";var a="/getWeather";xmlHttp.open("POST",a,true);xmlHttp.onreadystatechange=c;xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(b)}}function getWeatherCallback(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){try{var a=getPropertyValue("weatherMsg");var b=getPropertyValue("weatherIcon");$("#spnWeather").html(a);$("#spnWeatherIcon").html(b);$("#messageBar").fadeIn("slow")}finally{window.status="Weather data has been updated on "+new Date()}}}}function getPropertyValueFromXML(a,b){var c="";$(a).find("property").each(function(){if($(this).find("name:first").text()==b){$(this).find("list").each(function(){$("select[name="+b+"]").html("");$(this).find("item").each(function(){$("<option value='"+$(this).find("value").text()+"'>"+$(this).find("name").text()+"</option>").appendTo("select[name="+b+"]")});return false});c=$(this).find("value").text();$("select[name="+b+"]").val(c);return false}});return c}function getPropertyValue(l){try{var g=xmlHttp.responseXML.getElementsByTagName("property");for(i=0;i<g.length;i++){var a="";if(g[i].getElementsByTagName("name")[0].firstChild!=null){a=g[i].getElementsByTagName("name")[0].firstChild.nodeValue}if(a!=""&&a==l){var k=g[i].getElementsByTagName("list");var h="";if(g[i].getElementsByTagName("value")[0].firstChild!=null){h=g[i].getElementsByTagName("value")[0].firstChild.nodeValue}if(k.length>0){var b=k[0].childNodes;var m=getElement(l);if(m.type.toLowerCase()=="select-one"){m.options.length=0;for(j=0;j<b.length;j++){var n="";if(b[j].getElementsByTagName("name")[0].firstChild!=null){n=b[j].getElementsByTagName("name")[0].firstChild.nodeValue}var c="";if(b[j].getElementsByTagName("value")[0].firstChild!=null){c=b[j].getElementsByTagName("value")[0].firstChild.nodeValue}var d=(h==c);m.options[j]=new Option(n,c,d,d)}}m.value=h}return h}}}catch(f){}return""}function setFormPropertyValue(a,c){var b=getElement(a);if(b!=null){b.value=c}}function getElement(b){var a=document.getElementById(b);if(a){return a}var c=window.document.forms[0];if(c){a=c[b]}if(a){return a}return document.embeds[b]}function loadApplication(a){switch(a){case 1:window.parent.topper.click("orders");window.parent.topper.menuClick("orders","Place Order");break;case 2:window.parent.topper.click("orders");window.parent.topper.menuClick("orders","Today's Orders");break;case 3:window.parent.topper.click("dispatch");window.parent.topper.menuClick("dispatch","Orders Ready for Dispatch");break;case 4:window.parent.topper.click("dispatch");window.parent.topper.menuClick("dispatch","Enter POD");break;case 5:window.parent.topper.click("invoice");window.parent.topper.menuClick("invoice","Create Invoices");break;case 6:window.parent.topper.click("invoice");window.parent.topper.menuClick("invoice","Today's Invoices");break;case 7:window.parent.topper.click("invoice");window.parent.topper.menuClick("invoice","Apply Payments");break;case 8:window.parent.topper.click("administration");window.parent.topper.menuClick("administration","Customer");break;case 9:window.parent.topper.click("help");window.parent.topper.menuClick("help","Online Help");break;case 10:window.parent.topper.click("orders");window.parent.topper.menuClick("orders","Find Orders");break;case 11:window.parent.topper.click("invoice");window.parent.topper.menuClick("invoice","Find Invoices");break;case 12:window.parent.topper.click("myinfo");break}}function showOnlineHelp(a){openNewS("/showOnlineHelp.do?url="+document.location.href+"&"+a,"onlineHelpWin",-1,-1,"yes")}function getClientWidth(){if(document.all){return screen.width}return window.innerWidth}function getClientHeight(){if(document.all){return screen.height}return window.innerHeight}function replaceAll(c,a,b){if(isEmpty(c)||isEmpty(a)||isEmpty(b)||a==b){return c}while(c.indexOf(a)>=0){c=c.replace(a,b)}return c}function transferValueTo(b,a,c){document.forms[b][a].value=c};