(function(){var D=window.MQA,E=D.EventUtil,B=E.falseFunction,C=E.hitch;function A(G,F){this.map=G;this.printview=F}A.prototype={generatePFUrl:function(L,W,h){var g;var K=0;switch(D.browser.name){case"msie":g=D.IE_URL_LEN;break;default:g=D.APACHE_URL_LEN;break}try{var k=D.STATICRESOURCES+"?";var v=(typeof (L)!="undefined")?L.toString():this.getSize().toString();k+=(v!="")?"size="+v+"&":"";var V;if(this.bestFitRect!=null){var q=this.map.getZoom(this.map.bestFitRect,this.map.keepCenter,null,null,L);V=this.map.getScaleFromZoom(q)}else{V=this.map.getScale()}k+=(V!="")?"scale="+V+"&":"";k+=(this.map.getMapType()!="")?"type="+this.map.getMapType()+"&":"";k+=(this.map.getCenter()!="")?"center="+this.map.getCenter().getLatitude()+","+this.map.getCenter().getLongitude()+"&":"";k+=(Key!="")?"key="+Key+"&":"";if(h){k+="session="+h+"&"}var R="rand="+(Math.round((Math.random()*10000)));var U="";var m="";var f="";var a="";var P="";var X="";if(IsDotCom){var M="";if(this.map.traffic){M+="&traffic=";var Q=this.map.traffic.incidentTypeFilter;iIncidents=false;iConstruction=false;for(var Y=0;Y<Q.length;Y++){var F=Q[Y];switch(F){case D.TRAFFIC_INCIDENTS:iIncidents=true;break;case D.TRAFFIC_CONSTRUCTION:iConstruction=true;break}}D.TRAFFIC_ALL=100;D.TRAFFIC_NONE=0;if(iIncidents&&iConstruction){iType=D.TRAFFIC_ALL}else{if(iIncidents&&!iConstruction){iType=D.TRAFFIC_INCIDENTS}else{if(!iIncidents&&iConstruction){iType=D.TRAFFIC_CONSTRUCTION}else{if(!iIncidents&&!iConstruction){iType=D.TRAFFIC_NONE}else{iType=D.TRAFFIC_NONE}}}}if(this.map.traffic.flowActive){switch(iType){case D.TRAFFIC_NONE:M+=4;break;case D.TRAFFIC_CONSTRUCTION:M+=3;break;case D.TRAFFIC_INCIDENTS:M+=2;break;case D.TRAFFIC_ALL:M+=1;break}}}g-=(k.length+R.length+((M!=null)?M.length:0));var w=false;var c=false;var u=false;var l=false;var p=["","route-0"];var S=(W!=null)?W:"purple";var G;var H=this.map.getShapeCollections(true);for(var s=0;s<H.length;s++){for(var d=0,r=H[s].getSize();d<r;d++){if(H[s].getAt(d) instanceof D.Poi||H[s].getAt(d) instanceof D.BasePoi){var o=H[s].getAt(d);var N=0;var b=0;if(o.getBias()){var O=o.getBias();var e=o.getIconOffset();N=O.x-e.x;b=O.y-e.y}if(H[s].collectionName==""||H[s].collectionName.indexOf("route")!=-1||H[s].collectionName.indexOf("search")!=-1){var Z=o.getKey();switch(Z){case"mcenter":case"scenter":case"ecenter":case"pcenter":G=Z+"="+o.getLatLng().lat+","+o.getLatLng().lng+","+N+","+b+"&";U+=G;g-=G.length;break;default:var n="";if(typeof (o.getKey())!="string"){}else{n=o.getKey().split("-")}switch(n[0]){case"stops":if(!c){f="stops=";g-=f.length;g-=1;c=true}if(isNaN(n[1])){G=n[1]+","+o.getLatLng().lat+","+o.getLatLng().lng+","+N+","+b+"|"}else{G=unescape("%"+(parseInt((n[1]-K))+65).toString(16))+","+o.getLatLng().lat+","+o.getLatLng().lng+","+N+","+b+"|"}f+=G;g-=G.length;break;case"pois":if(!w){m="pois=";g-=m.length;g-=1;w=true}G=S+"-"+n[1]+","+o.getLatLng().lat+","+o.getLatLng().lng+","+N+","+b+"|";m+=G;g-=G.length;break;case"vias":K++;if(!u){a="vias=";g-=a.length;g-=1;u=true}G="red-circle,"+o.getLatLng().lat+","+o.getLatLng().lng+","+N+","+b+"|";a+=G;g-=G.length;break}break}}else{if((H[s].getName().indexOf("category:")!=-1)||(H[s].getName().indexOf("sourcevendor:")!=-1)){if(!l){P="biz=";g-=P.length;g-=1;l=true}var I=this.getBizIconInfo(o.getIcon().imageURL);G=I.imgName+",";G+=o.getLatLng().lat+",";G+=o.getLatLng().lng+",";G+=N+",";G+=b+",";G+=I.tweakX+",";G+=I.tweakY;G+="|";P+=G;g-=G.length}else{if(H[s].collectionName.indexOf("corridorBizLocPOIS")!=-1){var N=0;var b=0;if(o.getBias()){var O=o.getBias();var e=o.getIconOffset();N=O.x-e.x;b=O.y-e.y}G=S+((o.isSuperPoi())?"-s":"")+","+o.getLatLng().lat+","+o.getLatLng().lng+","+N+","+b+"|";if(!w){X="pois=";g-=X.length;g-=1;w=true}X+=G;g-=G.length}}}}}}}k+=U;k+=f+"&";k+=m+"&";k+=a+"&";k+=P+"&";k+=X+"&";k+=R+M;if(g<0){var J="/LongUrlServlet?action=getGuid";var T={verb:"POST",setup:function(i){i.setRequestHeader("Content-Type","application/x-www-form-urlencoded");i.setRequestHeader("Content-length",1000)},postData:"longurl="+escape(k.substring(k.indexOf(".php?")+5))};D.IO.doGetJSON(J,T,C(this,"longUrlResponse",this.printview));return""}}catch(t){}return k},getBizIconInfo:function(G){var F=(G.lastIndexOf("_super")!=-1)?"-s":"";var H=G.substring(G.lastIndexOf("/")+1,G.lastIndexOf(".png")).toLowerCase();if(H.indexOf("_tail-")!=-1){H=H.substring(H.indexOf("_tail-")+6)}H=H.replace("_super","")+F;if(G.indexOf("_poi")!=-1){return{imgName:H,tweakX:-11,tweakY:0}}else{return{imgName:H,tweakX:-4,tweakY:0}}},longUrlResponse:function(H,G,F){H.setPrintMap("http://"+STATICSERVER+"/tileprint.php?guid="+G.guid+"&guidcmd=getimgguid&rand="+Math.random()*1000000)}};D.PrintFriendly=A})();MQA.Loader._moduleLoaded("printfriendly");
