try{var testCommons=new MQObject;testCommons=null}catch(error){throw"You must include mqcommon.js or toolkit api script prior to mqutils.js.";}var mqutils=1;if(!Array.prototype.push)Array.prototype.push=function(){for(var a=Array.push.arguments.length,b=0;b<a;b++)this[this.length]=Array.push.arguments[b];return this.length};function mq_ParamExists(a){var b;return a!==b}function mqGetElementById(a){if(document.getElementById(a))return document.getElementById(a);return null}
function mqBuildUrl(a){var b=_mqServerPort.replace(/mapquest.com:?\d*/,"mapquest.com");return _reqPrefix+b+"/oapi/transaction?"+a+"&key="+_mqKey}function mqUrlLimit(){var a=2048;if(MQA.BrowserInfo.isNS)a=7168;return a}function mqLimitDisplay(){var a=2;if(MQA.BrowserInfo.isNS)a=7;return a}
function mqDoRemote(a,b,c,d){c=document.getElementsByTagName(c).item(0);(d=mqGetElementById(b))&&c.removeChild(d);d=document.createElement("script");var e=mqBuildUrl(a);if(a.substring(0,4)=="http")e=a;if(e.length>mqUrlLimit())alert("The request query exceeds the limit ("+mqLimitDisplay()+" Kb) allowed for your browser type. Please reduce the amount of data in the request query!");else{d.src=e;d.type="text/javascript";d.id=b;c.appendChild(d)}}
function mqCreateXMLDocImportNode(a){var b;if(document.implementation.createDocument){b=document.implementation.createDocument("","",null);try{b.appendChild(b.importNode(a,true))}catch(c){alert(c);alert(a.nodeName)}}else if(window.ActiveXObject){b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(a.xml)}return b}
function mqXmlToStr(a){var b=new String,c=null;if(a==null)return"";if(MQA.BrowserInfo.isNS){c=new window.XMLSerializer;b=c.serializeToString(a)}else if(MQA.BrowserInfo.isIE)b=a.xml;if(MQA.BrowserInfo.isSafari){c=new window.XMLSerializer;b=(b=c.serializeToString(a))||"";b=b.replace(/#38;/g,"&")}return b}
function mqCreateNSManager(a){var b={normalResolver:xmlDoc.createNSResolver(xmlDoc.documentElement),lookupNamespaceURI:function(c){switch(c){case "_mq":return a;default:return this.normalResolver.lookupNamespaceURI(c)}}};return b}
function mqGetNode(a,b){if(MQA.BrowserInfo.isSafari)if(a.evaluate){a=a.evaluate(b,a,null,9,null);return a.singleNodeValue}else{var c=[];c=b.split("/");c[c.length-1].indexOf("@")!=-1&&c.splice(c.length-1,1);var d=a.documentElement,e=false;if(c.length==2&&d.tagName==c[1])e=true;else{b=c.length-1;for(var f=1;f<b;f++){e=false;if(d.tagName==c[f]&&d.hasChildNodes())for(var h=d.hasChildNodes()?d.childNodes.length:0,g=0;g<h;g++)if(d.childNodes[g].tagName==c[f+1]){d=d.childNodes[g];e=true;break}if(c[f+1]&&
c[f+1].indexOf("text()")!=-1)e=true;if(c[f+1].indexOf("[")!=-1){d=parseInt(c[f+1].substr(c[f+1].indexOf("[")+1,c[f+1].indexOf("]")-1));c[f+1]=c[f+1].substr(0,c[f+1].indexOf("["));d=a.getElementsByTagName(c[f+1]).item(d-1);e=true}}}return a=e==true?d:null}else if(MQA.BrowserInfo.isIE)return a=a.selectSingleNode(b);else if(MQA.BrowserInfo.isNS){a=a.evaluate(b,a,null,9,null);return a.singleNodeValue}return null}
function mqGetNodeText(a){var b="";if(MQA.BrowserInfo.isIE)b=a.text;else if(MQA.BrowserInfo.isNS&&a.firstChild)b=a.firstChild.nodeValue;if(MQA.BrowserInfo.isSafari&&a.firstChild){b=(b=a.firstChild.nodeValue)?b:"";b=b.replace(/#38;/g,"&")}return b}
function mqGetXPathNodeText(a,b){var c;if(MQA.BrowserInfo.isSafari){c=mqGetNode(a,b);var d=a="";if(b.indexOf("@")!=-1){d=b.substr(b.indexOf("@")+1,b.length);a=c.attributes.getNamedItem(d).nodeValue}else if(c)a=mqGetNodeText(c);return a}if(MQA.BrowserInfo.isIE){c=a.selectSingleNode(b);return c==null?"":c.text}else if(MQA.BrowserInfo.isNS){try{c=a.evaluate(b,a,null,2,null)}catch(e){alert(b);alert(e)}return c.stringValue}return""}
function mqReplaceNode(a,b,c){a=a.createTextNode(c);return b.firstChild?b.replaceChild(a,b.firstChild):b.appendChild(a)}function mqReplaceElementNode(a,b,c){var d=a.documentElement;b=b.documentElement;c=a.getElementsByTagName(c).item(0);node=MQA.BrowserInfo.isIE?b:a.importNode(b,true);c?d.replaceChild(node,c):d.appendChild(node);return a}function mqSetNodeText(a,b,c){b=mqGetNode(a,b);if(b==null)return null;return mqReplaceNode(a,b,c)}
function mqTransformXMLFromString(a,b,c){a=MQA.createXMLDoc(a);b=MQA.createXMLDoc(b);var d;if(MQA.BrowserInfo.isNS){d=new XSLTProcessor;d.importStylesheet(b);d=d.transformToFragment(a,document);c.appendChild(d)}else if(MQA.BrowserInfo.isIE){d=new ActiveXObject("Msxml2.DOMDocument.5.0");d=a.transformNode(b);c.innerHTML+=d}}
function mqTransformXMLFromNode(a,b,c){b=MQA.createXMLDoc(b);var d;if(MQA.BrowserInfo.isNS){d=new XSLTProcessor;d.importStylesheet(b);d=d.transformToFragment(a,document);c.appendChild(d)}else if(MQA.BrowserInfo.isIE){d=new ActiveXObject("Msxml2.DOMDocument.5.0");d=a.transformNode(b);c.innerHTML+=d}}mqAddEvent(window,"load",alphaBackgrounds);
function alphaBackgrounds(){if(navigator.platform=="Win32"&&navigator.appName=="Microsoft Internet Explorer"&&window.attachEvent){var a=navigator.appVersion.match(/MSIE (\d+\.\d+)/,"");a=a!=null&&Number(a[1])>=5.5;for(i=0;i<document.all.length;i++){var b=document.all[i].currentStyle.backgroundImage;if(a&&b)if(b.match(/\.png/i)!=null){b=b.substring(5,b.length-2);document.all[i].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"', sizingMethod='scale')";document.all[i].style.backgroundImage=
"url(/images/background-form-button.gif)"}}}}function mqFormatNumber(a,b){return Math.floor(a*Math.pow(10,b))/Math.pow(10,b)}function mq_display_time(a){var b;if(a>3600){b=a/3600;var c=" "+Math.floor(b)+" hours,";b=a/60%60;c+=" "+mqFormatNumber(b,2)+" minutes";return c}if(a>60){b=a/60;return" "+mqFormatNumber(b,2)+" minutes"}}function mq_display_distance(a){return" "+mqFormatNumber(a.value,2)+(a.units=="mi"?" miles":" kilometers")}
var isIE5Mac=navigator.userAgent.indexOf("MSIE 5")!=-1&&navigator.userAgent.indexOf("Mac")!=-1;
function mqCreateFormInput(a,b,c,d,e,f,h,g,j){a=a.appendChild(document.createElement("div"));a.className="row";var k=a.appendChild(document.createElement("label"));k.htmlFor=b;k.appendChild(document.createTextNode(d));a.appendChild(document.createElement("br"));d=document.createElement("input");d.id=b;d.type=e;d.name=f;if(g!="")d.size=g;if(!isNaN(parseInt(j)))d.maxLength=parseInt(j);if(h!="")d.value=h;if(c!=""){b=a.appendChild(document.createElement("span"));b.className=c;b.appendChild(d)}else a.appendChild(d)}
function mqCreateInput(a,b,c,d,e,f,h){var g=document.createElement("input");g.id=b;g.type=c;g.name=d;if(f!="")g.size=f;if(!isNaN(parseInt(h)))g.maxLength=parseInt(h);if(e!="")g.value=e;a.appendChild(g)}function mqCreateHiddenInput(a,b,c,d){var e;if(isIE5Mac)e=document.createElement("input type=hidden");else{e=document.createElement("input");e.type="hidden"}e.name=c;if(b!="")e.id=b;if(d!="")e.value=d;a.appendChild(e)}
function mqCreateFormSelect(a,b,c,d,e,f,h){a=a.appendChild(document.createElement("div"));a.className="row";var g=a.appendChild(document.createElement("label"));g.htmlFor=b;g.appendChild(document.createTextNode(d));a.appendChild(document.createElement("br"));if(c!=""){d=a.appendChild(document.createElement("span"));d.className=c;c=d.appendChild(document.createElement("select"))}else c=a.appendChild(document.createElement("select"));c.id=b;c.name=e;length=f.length;for(x=0;x<length;x++){b=c.appendChild(document.createElement("option"));
eval("option.value = elements[x]."+h);eval("option.appendChild (document.createTextNode (elements[x]."+h+"))")}return c}function mqCreateDiv(a,b,c){a=a.appendChild(document.createElement("div"));if(b!="")a.className=b;if(c!="")a.id=c;return a}function mqCreateA(a,b,c){a=a.appendChild(document.createElement("a"));a.href=b;if(c!="")a.title=c;return a}function mqCreateSpan(a,b,c){a=a.appendChild(document.createElement("span"));if(b!="")a.className=b;if(c!="")a.id=c;return a}
function mqCreateImg(a,b,c,d,e,f,h){a=a.appendChild(document.createElement("img"));if(b!="")a.src=b;if(!isNaN(parseInt(c)))a.width=parseInt(c);if(!isNaN(parseInt(d)))a.height=parseInt(d);if(e!="")a.id=e;if(f!="")a.name=f;if(h!="")a.alt=h;return a}
function mqCreateImgDiv(a,b,c,d,e,f,h){a=a.appendChild(document.createElement("div"));if(e!="")a.id=e;if(!isNaN(parseInt(c)))a.style.width=parseInt(c)+"px";if(!isNaN(parseInt(d)))a.style.height=parseInt(d)+"px";if(f!="")a.name=f;if(h!="")a.alt=h;return a}
function mqXMLHttpRequest(){var a=null;if(window.XMLHttpRequest)try{a=new XMLHttpRequest}catch(b){a=null}else if(window.ActiveXObject)try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){a=null}}return a}
function mqAddEvent(a,b,c){if(window.opera&&MQA.BrowserInfo.version<8)return a=a.attachEvent("on"+b,c);else if(a.addEventListener){window.opera&&MQA.BrowserInfo.version>=8?a.addEventListener(b,c,false):a.addEventListener(b,c,true);return true}else if(a.attachEvent)return a=a.attachEvent("on"+b,c);else a["on"+b]=c}
function mqRemoveEvent(a,b,c){window.opera&&eval("fObj.on"+b+" = null");if(a.removeEventListener)window.opera&&MQA.BrowserInfo.version>=8?a.removeEventListener(b,c,false):a.removeEventListener(b,c,true);else if(a.detachEvent)a.detachEvent("on"+b,c);else a["on"+b]=null}
function mqGetEventData(a){fEventData={};if(document.addEventListener){fEventData.id=a.target.id;fEventData.type=a.type;fEventData.element=a.target}else if(window.event){fEventData.id=window.event.srcElement.id;fEventData.type=window.event.type;fEventData.element=window.event.srcElement}else return null;return fEventData}
function mqGetXY(a){xyData={};if(document.createElement&&document.getElementsByTagName){if(!document.createElementNS)document.createElementNS=function(d,e){return document.createElement(e)};if(document.addEventListener&&typeof a.pageX=="number"){for(var b=a.target,c=CalculatedTotalOffsetTop=0;b.offsetParent;){c+=b.offsetLeft;CalculatedTotalOffsetTop+=b.offsetTop;b=b.offsetParent}b=a.pageX-c;c=a.pageY-CalculatedTotalOffsetTop;xyData.elementId=a.target.id;xyData.elementX=b;xyData.elementY=c;xyData.pageX=
a.pageX;xyData.pageY=a.pageY}else if(window.event&&typeof window.event.offsetX=="number"){xyData.elementId=window.event.srcElement.id;xyData.elementX=event.offsetX;xyData.elementY=event.offsetY;xyData.pageX=0;xyData.pageY=0;for(a=mqGetElementById(xyData.elementId);a;){xyData.pageX+=a.offsetLeft;xyData.pageY+=a.offsetTop;a=a.offsetParent}xyData.pageX+=xyData.elementX;xyData.pageY+=xyData.elementY}return xyData}}
function mqGetPDivSize(a){size=new MQSize;if(a.parent.style.width.length==0)a.parent.style.width="800px";if(a.parent.style.height.length==0)a.parent.style.height="600px";size.setWidth(parseInt(a.parent.style.width)-4);size.setHeight(parseInt(a.parent.style.height)-4);return size}function mqSetPDivSize(a,b){a.parent.style.width=b.getWidth()+"px";a.parent.style.height=b.getHeight()+"px"}
function mqurlencode(a){a=a.replace(/%/g,"%25");a=a.replace(/&/g,"%26");a=a.replace(/#/g,"%23");a=a.replace(/\//g,"%2F");a=a.replace(/:/g,"%3A");a=a.replace(/;/g,"%3B");a=a.replace(/=/g,"%3D");a=a.replace(/\?/g,"%3F");a=a.replace(/@/g,"%40");a=a.replace(/\$/g,"%24");a=a.replace(/,/g,"%2C");return a=a.replace(/\+/g,"%2B")}function mqGetGuid(){var a=new Date(2006,0,1),b=new Date;do var c=new Date;while(c-b<1);a=c.getTime()-a.getTime();return Math.ceil(a)}
function mqPause(a){var b=new Date;for(a=b.getTime()+a;1;){b=new Date;if(b.getTime()>a)return}}var _mqLogStartTime=null,_mqLogCurTime=null,_mqLogprevTime=null;
function mqLogTime(a){if(mqGetElementById("mqTimeLogs")){var b=mqGetElementById("mqTimeLogs"),c=new Date;if(_mqLogStartTime==null){b.value="Time(ms) Difference\t Message\n";_mqLogprevTime=_mqLogStartTime=c.getTime()}_mqLogCurTime=c.getTime();c=_mqLogCurTime-_mqLogStartTime;var d=_mqLogCurTime-_mqLogprevTime;b.value=b.value+c+"\t "+d+"\t\t "+a+"\n";_mqLogprevTime=_mqLogCurTime}}
function mqResetTimeLogs(){if(mqGetElementById("mqTimeLogs")){var a=mqGetElementById("mqTimeLogs"),b=new Date;a.value="Time(ms) Difference\t Message\n";_mqLogprevTime=_mqLogStartTime=b.getTime()}}function mqGetAdvantageResultPath(a){var b;if(a=="poiMap")b="poiResults";else if(a=="locMap")b="locations";else if(a=="search")b="searchResults";return b}function mqGetAdvantageMapPath(a){return a=a=="locMap"?"/advantage/"+a+"/locations/location/map":"/advantage/"+a+"/map"}
function mqPrepareMapUrl(a){var b="";b=a.replace(/https?:\/\//,_reqPrefix);b=b.replace(/mapquest.com:?\d*/,"mapquest.com");return b=b.replace(/iwebsys.aol.com:?\d*/,"iwebsys.aol.com")}
function display(a,b,c,d,e){if(mqGetElementById(a)){a=mqGetElementById(a);var f=a.appendChild(document.createElement("label"));f=f.appendChild(document.createElement("b"));f.appendChild(document.createTextNode(b));a.appendChild(document.createElement("br"));b=a.appendChild(document.createElement("textarea"));b.className=e;b.style.overflow="auto";if(d!=null)b.id=d;b.appendChild(document.createTextNode(c));a.appendChild(document.createElement("br"));a.appendChild(document.createElement("br"))}};