function uw_tracker(e){if(!e){return }var nn=e.nodeName;if(!(nn&&nn.length)){return }if(nn=="A"){uw_mlrUtag(e)}else{if(nn=="INPUT"){if(e.type=="button"||e.type=="submit"){uw_mlrUtag(e)}}}}function uw_mlr(e){if(!e){return }uw_mlrByStr(uw_getHook(e))}function uw_mlrByStr(o){if(o&&o.length){utag.link({listing_link:utag_data.mlr+"|"+o+"_none"})}}function uw_utag(e){if(!e){return }uw_utagByStr(uw_getHook(e))}function uw_utagByStr(o){if(o&&o.length){utag.link({link_name:o,link_attr1:"alt"})}}function uw_mlrUtag(e){if(!e){return }uw_mlrUtagByStr(uw_getHook(e))}function uw_mlrUtagByStr(o){if(o&&o.length){utag.link({link_name:o,link_attr1:"alt",listing_link:utag_data.mlr+"|"+o+"_none"})}}function uw_getHook(e){if(!e){return }var o;o=$(e).attr("name");if(o&&o.length){return o}else{return""}}function uw_firePageView(){try{utag.view(utag_data)}catch(e){}}function uw_detectClickForm(){$('a[name$="_submit"]').each(function(){var n=$(this).attr("name");if(n&&n.length){if("contact_submit"==n){uw_mlrByStr("contact_start")}else{if("appointment_submit"==n){uw_mlrByStr("appointment_start")}}}})}function lead_show_our_websites(url){window.open(url)}function lead_print_page(){window.print()}function lead_bookmark_us(url,title){if(window.sidebar){window.sidebar.addPanel(title,url,"")}else{if(window.opera&&window.print){var elem=document.createElement("a");elem.setAttribute("href",url);elem.setAttribute("title",title);elem.setAttribute("rel","sidebar");elem.click()}else{if(document.all){window.external.AddFavorite(url,title)}}}}function lead_subscribe_newsletter(){var email=document.getElementById("lead_news_subscriber_id").value;if(email==null||email==""){alert("subscriber email is required");return }var url="mailto:merchantemail@merchantshop.com?subject=Subscribe to news letter&body=Email is : "+email;document.location=url}function newPopup(url){popupWindow=window.open(url,"popUpWindow","height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes")}function fbs_click(urlWeb,desc){var u=urlWeb;
var t=desc;window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t),"sharer","toolbar=0,status=0,width=450,height=450");return false}function twitter_click(tweetValue){tweet=tweetValue;window.open("http://twitter.com/home?status="+encodeURIComponent(tweet));return false}function enable(e){$(e).removeAttr("disabled")}function disable(e){$(e).attr("disabled","disabled")}function clear(e){$(e).val("")}function isRequired(e){return $(e).hasClass("required")}function isError(response){return $(response).find("code").text()!="OK"}function gatherText(response){var str="";$(response).find("message").each(function(){if(str.length>0){str+="<br/>"}str+=$(this).text()});return str}function convertFormToXml(e){var xmltmp="<xmlFormInput>";$("#"+e+" input").each(function(){if(this.type!="button"&&this.type!="reset"&&!($(this).hasClass("unsent"))){var value=$(this).val().replace(/\"/g,"&quot;");xmltmp=xmltmp.concat('<field name="'+$(this).attr("name")+'" required="'+isRequired(this)+'" value="'+value+'" />')}});$("#"+e+" textarea").each(function(){var value=$(this).val().replace(/\"/g,"&quot;");xmltmp=xmltmp.concat('<field name="'+$(this).attr("name")+'" required="'+isRequired(this)+'" value="'+value+'" />')});return xmltmp.concat("</xmlFormInput>")}function sendEmailUsForm(){var inputVal=payloadEmailUs();if(!inputVal){errorEmailUs();activateEmailUs()}else{try{$.ajax({async:false,cache:false,url:"/form/ws/sendwebform/contactus",type:"POST",data:inputVal,dataType:"text/xml",success:function(data,status,req){successEmailUs(req.responseXML)},error:function(req,status,error){successEmailUs(req.responseXML)}})}catch(ex){errorEmailUs()}finally{activateEmailUs()}}}function sendSendToFriendForm(){var inputVal=payloadSendToFriend();if(!inputVal){errorSendToFriend();activateSendToFriend()}else{try{$.ajax({async:false,cache:false,url:"/form/ws/sendwebform/contactus",data:inputVal,type:"POST",dataType:"text/xml",success:function(data,status,req){successSendToFriend(req.responseXML)},error:function(req,status,error){successSendToFriend(req.responseXML)
}})}catch(ex){errorSendToFriend()}finally{activateSendToFriend()}}}function payloadEmailUs(){var src=$("#form_email_us input[name='merchant_xml_file']").val();var tmpStr;try{$.ajax({type:"GET",async:false,url:src,dataType:"text",success:function(data){tmpStr=data}})}catch(ex){tmpStr=""}if(!tmpStr){return""}else{return"&merchantAddresses="+encodeURIComponent(tmpStr)+"&xmlFormInput="+encodeURIComponent(convertFormToXml("form_email_us"))}}function payloadSendToFriend(){var src=$("#form_send_to_friend input[name='merchant_xml_file']").val();var tmpStr;try{$.ajax({type:"GET",async:false,url:src,dataType:"text",success:function(data){tmpStr=data}})}catch(ex){tmpStr=""}if(!tmpStr){return""}else{return"&merchantAddresses="+encodeURIComponent(tmpStr)+"&xmlFormInput="+encodeURIComponent(convertFormToXml("form_send_to_friend"))}}function resetEmailUs(){$("#form_email_us").clearForm();activateEmailUs();$("#email_us_id").hide()}function resetSendToFriend(){$("#form_send_to_friend").clearForm();activateSendToFriend();$("#dialog_send_to_friend").hide()}function activateEmailUs(){enable('#form_email_us input[name="name"]');enable('#form_email_us input[name="email"]');enable('#form_email_us textarea[name="comment"]');enable("#submit_email_us");$("#email_us_loaderCircle").hide()}function activateSendToFriend(){enable('#form_send_to_friend input[name="name"]');enable('#form_send_to_friend input[name="email"]');enable('#form_send_to_friend input[name="email_friend"]');enable("#submit_send_to_friend");$("#send_to_friend_loaderCircle").hide()}function deactivateEmailUs(){disable('#form_email_us input[name="name"]');disable('#form_email_us input[name="email"]');disable('#form_email_us textarea[name="comment"]');disable("#submit_email_us");$("#email_us_loaderCircle").show()}function deactivateSendToFriend(){disable('#form_send_to_friend input[name="name"]');disable('#form_send_to_friend input[name="email"]');disable('#form_send_to_friend input[name="email_friend"]');disable("#submit_send_to_friend");$("#send_to_friend_loaderCircle").show()
}function successEmailUs(response){var err=isError(response);var msg=gatherText(response);if(msg==""){if($("html").attr("lang")=="fr"){msg=(err?"Le service n'est pas disponible pour l'instant.":"Le courriel été envoyé.")}else{msg=(err?"Service unavailable. Please try again later.":"Email sent.")}}feedbackEmailUs(msg,err)}function successSendToFriend(response){var err=isError(response);var msg=gatherText(response);if(msg==""){if($("html").attr("lang")=="fr"){msg=(err?"Le service n'est pas disponible pour l'instant.":"Le courriel été envoyé.")}else{msg=(err?"Service unavailable. Please try again later.":"Email sent.")}}feedbackSendToFriend(msg,err)}function errorEmailUs(){if($("html").attr("lang")=="fr"){feedbackEmailUs("Le service n'est pas disponible pour l'instant.",true)}else{feedbackEmailUs("Service unavailable. Please try again later.",true)}}function errorSendToFriend(){if($("html").attr("lang")=="fr"){feedbackSendToFriend("Le service n'est pas disponible pour l'instant.",true)}else{feedbackSendToFriend("Service unavailable. Please try again later.",true)}}function feedbackEmailUs(msg,err){if(err){$("#form_email_us_message").html('<p class="ssoSmallMsgBox msgRed">'+msg+"</p>")}else{$("#form_email_us_message").html('<p class="ssoSmallMsgBox msgGreen">'+msg+"</p>");$("#form_email_us").clearForm()}}function feedbackSendToFriend(msg,err){if(err){$("#dialog_send_to_friend_message").html('<p class="ssoSmallMsgBox msgRed">'+msg+"</p>")}else{$("#dialog_send_to_friend_message").html('<p class="ssoSmallMsgBox msgGreen">'+msg+"</p>");$("#form_send_to_friend").clearForm()}}(function($){$.fn.dropmenu=function(custom){var defaults={openAnimation:"fadeIn",closeAnimation:"slide",openClick:false,openSpeed:300,closeSpeed:300,closeDelay:100,onHide:function(){},onHidden:function(){},onShow:function(){},onShown:function(){}};var settings=$.extend({},defaults,custom);var menu=this;var currentPage=0;var delayTimer="";init();function init(){var items=menu.find(":has(li,div) > a").append('<span class="arrow"></span>');$.each(items,function(i,val){if(items.eq(i).parent().is("li")){items.eq(i).next().addClass("submenu").parent().addClass("haschildren")
}else{items.eq(i).parent().find("ul").show()}});if(settings.openClick){menu.find(".submenu").css("display","none");menu.find(":has(li,div) > a").parent().bind("mouseleave",handleHover).bind("mouseenter",function(){window.clearInterval(delayTimer)});menu.find("a span.arrow").bind("click",handleHover)}else{menu.find(":has(li,div) > a").bind("mouseenter",handleHover).parent().bind("mouseleave",handleHover).bind("mouseenter",function(){window.clearInterval(delayTimer)})}}function handleHover(e){if(e.type=="mouseenter"||e.type=="click"){window.clearInterval(delayTimer);var current_submenu=$(e.target).parent().find(".submenu:not(:animated):not(.open)");if(current_submenu.html()==null){current_submenu=$(e.target).parent().next(".submenu:not(:animated):not(.open)")}if(current_submenu.html()!=null){settings.onShow.call(current_submenu);closeAllMenus();current_submenu.prev().addClass("selected");current_submenu.css("z-index","90");current_submenu.stop().hide();openMenu(current_submenu)}}if(e.type=="mouseleave"||e.type=="mouseout"){current_submenu=$(e.target).parents(".submenu");if(current_submenu.length!=1){var current_submenu=$(e.target).parent().parent().find(".submenu");if(current_submenu.html()==null){var current_submenu=$(e.target).parent().find(".submenu");if(current_submenu.html()==null){var current_submenu=$(e.target).parent().parent().parent().find(".submenu")}}}if(current_submenu.html()!=null){if(settings.closeDelay==0){current_submenu.parent().find("a").removeClass("selected");closeMenu(current_submenu)}else{window.clearInterval(delayTimer);delayTimer=setInterval(function(){window.clearInterval(delayTimer);closeMenu(current_submenu)},settings.closeDelay)}}}}function openMenu(object){switch(settings.openAnimation){case"slide":openSlideAnimation(object);break;case"fade":openFadeAnimation(object);break;default:openSizeAnimation(object);break}}function openSlideAnimation(object){object.addClass("open").slideDown(settings.openSpeed,function(){settings.onShown.call(this)})}function openFadeAnimation(object){object.addClass("open").fadeIn(settings.openSpeed,function(){settings.onShown.call(this)
})}function openSizeAnimation(object){object.addClass("open").show(settings.openSpeed,function(){settings.onShown.call(this)})}function closeMenu(object){settings.onHide.call(object);switch(settings.closeAnimation){case"slide":closeSlideAnimation(object);break;case"fade":closeFadeAnimation(object);break;default:closeSizeAnimation(object);break}}function closeSlideAnimation(object){object.slideUp(settings.closeSpeed,closeCallback)}function closeFadeAnimation(object){object.fadeOut(settings.closeSpeed,function(){$(this).removeClass("open");$(this).prev().removeClass("selected")})}function closeSizeAnimation(object){object.hide(settings.closeSpeed,function(){$(this).removeClass("open");$(this).prev().removeClass("selected")})}function closeAllMenus(){var submenus=menu.find(".submenu.open");$.each(submenus,function(i,val){$(submenus[i]).css("z-index","1");closeMenu($(submenus[i]))})}function closeCallback(object){$(this).removeClass("open");if($(this).prev().attr("class")=="selected"){settings.onHidden.call(this)}$(this).prev().removeClass("selected")}return this}})(jQuery);$.fn.clearForm=function(){return this.each(function(){$(":input",this).each(function(){var type=this.type,tag=this.tagName.toLowerCase();if(type=="text"||type=="password"||tag=="textarea"){this.value=""}else{if(type=="checkbox"||type=="radio"){this.checked=false}else{if(tag=="select"){this.selectedIndex=-1}}}})})};function menu_con(){$("#main-menu>li>ul").parent().mouseenter(function(){$(this).children("a").addClass("over").end().find(">ul").slideDown("fast",function(){MenuClose=false})}).mouseleave(function(){var $currentMenu=$(this);$currentMenu.find(">ul").stop(true,true).slideUp("fast",function(){$currentMenu.children("a").removeClass("over");MenuClose=true})})}(function($){$.fn.easySlider=function(options){var defaults={prevId:"prevBtn",prevText_en:"Previous",prevText_fr:"Pr&eacute;c&eacute;dent",nextId:"nextBtn",nextText_en:"Next",nextText_fr:"Suivant",controlsShow:true,controlsBefore:"",controlsAfter:"",controlsFade:true,firstId:"firstBtn",firstText_en:"First",firstText_fr:"Premier",firstShow:false,lastId:"lastBtn",lastText_en:"Last",lastText_fr:"Dernier",lastShow:false,vertical:false,speed:800,auto:false,pause:2000,continuous:false,numeric:false,numericId:"controls"};
function getLabelValue(value_en,value_fr){language=document.getElementsByTagName("html")[0].lang;value=(new String(language).toLowerCase()=="fr")?value_fr:value_en;return value}var options=$.extend(defaults,options);this.each(function(){var obj=$(this);var s=$("li",obj).length;var w=$("li",obj).width()+3;var h=$("li",obj).height();var clickable=true;obj.width(w);obj.height(h);obj.css("overflow","hidden");var ts=s-1;var t=0;$("ul",obj).css("width",s*w);if(options.continuous){$("ul",obj).prepend($("ul li:last-child",obj).clone().css("margin-left","-"+w+"px"));$("ul",obj).append($("ul li:nth-child(2)",obj).clone());$("ul",obj).css("width",(s+1)*w)}if(!options.vertical){$("li",obj).css("float","left")}if(options.controlsShow){var html=options.controlsBefore;if(options.numeric){html+='<ol id="'+options.numericId+'"></ol>'}else{if(options.firstShow){html+='<span id="'+options.firstId+'"><a href="javascript:void(0);">'+getLabelValue(options.firstText_en,options.firstText_fr)+"</a></span>"}html+=' <span id="'+options.prevId+'"><a onmousedown="uw_mlrUtagByStr(\'photos\');" href="javascript:void(0);">'+getLabelValue(options.prevText_en,options.prevText_fr)+"</a></span>";html+=' <span id="'+options.nextId+'"><a onmousedown="uw_mlrUtagByStr(\'photos\');" href="javascript:void(0);">'+getLabelValue(options.nextText_en,options.nextText_fr)+"</a></span>";if(options.lastShow){html+=' <span id="'+options.lastId+'"><a href="javascript:void(0);">'+getLabelValue(options.lastText_en,options.lastText_fr)+"</a></span>"}}html+=options.controlsAfter;$(obj).after(html)}if(options.numeric){for(var i=0;i<s;i++){$(document.createElement("li")).attr("id",options.numericId+(i+1)).html("<a rel="+i+' href="javascript:void(0);">'+(i+1)+"</a>").appendTo($("#"+options.numericId)).click(function(){animate($("a",$(this)).attr("rel"),true)})}}else{$("a","#"+options.nextId).click(function(){animate("next",true)});$("a","#"+options.prevId).click(function(){animate("prev",true)});$("a","#"+options.firstId).click(function(){animate("first",true)});$("a","#"+options.lastId).click(function(){animate("last",true)
})}function setCurrent(i){i=parseInt(i)+1;$("li","#"+options.numericId).removeClass("current");$("li#"+options.numericId+i).addClass("current")}function adjust(){if(t>ts){t=0}if(t<0){t=ts}if(!options.vertical){$("ul",obj).css("margin-left",(t*w*-1))}else{$("ul",obj).css("margin-left",(t*h*-1))}clickable=true;if(options.numeric){setCurrent(t)}}function animate(dir,clicked){if(clickable){clickable=false;var ot=t;switch(dir){case"next":t=(ot>=ts)?(options.continuous?t+1:ts):t+1;break;case"prev":t=(t<=0)?(options.continuous?t-1:0):t-1;break;case"first":t=0;break;case"last":t=ts;break;default:t=dir;break}var diff=Math.abs(ot-t);var speed=diff*options.speed;if(!options.vertical){p=(t*w*-1);$("ul",obj).animate({marginLeft:p},{queue:false,duration:speed,complete:adjust})}else{p=(t*h*-1);$("ul",obj).animate({marginTop:p},{queue:false,duration:speed,complete:adjust})}if(!options.continuous&&options.controlsFade){if(t==ts){$("a","#"+options.nextId).hide();$("a","#"+options.lastId).hide()}else{$("a","#"+options.nextId).show();$("a","#"+options.lastId).show()}if(t==0){$("a","#"+options.prevId).hide();$("a","#"+options.firstId).hide()}else{$("a","#"+options.prevId).show();$("a","#"+options.firstId).show()}}if(clicked){clearTimeout(timeout)}if(options.auto&&dir=="next"&&!clicked){timeout=setTimeout(function(){animate("next",false)},diff*options.speed+options.pause)}}}var timeout;if(options.auto){timeout=setTimeout(function(){animate("next",false)},options.pause)}if(options.numeric){setCurrent(0)}if(!options.continuous&&options.controlsFade){$("a","#"+options.prevId).hide();$("a","#"+options.firstId).hide()}})}})(jQuery);(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return }var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)
}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.slice(0,q)||"*";var o=s.slice(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).slice(2,10)}var h=function(t,r,s){var q=this,p={},u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.slice(0,v.length-1);var w="onBefore"+v.slice(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var o=this,s={},u=false;
if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var z=q._api().fp_getPlugin(p);if(!z){return }i(o,z);delete o.methods;if(!u){m(z.methods,function(){var B=""+this;o[B]=function(){var C=[].slice.call(arguments);var D=q._api().fp_invoke(p,B,C);return D==="undefined"||D===undefined?o:D}});u=true}}var A=s[w];if(A){var y=A.apply(o,v);if(w.slice(0,1)=="_"){delete s[w]}return y}return o}})};function b(q,G,t){var w=this,v=null,D=false,u,s,F=[],y={},x={},E,r,p,C,o,A;i(w,{id:function(){return E},isLoaded:function(){return(v!==null&&v.fp_play!==undefined&&!D)},getParent:function(){return q},hide:function(H){if(H){q.style.height="0px"}if(w.isLoaded()){v.style.height="0px"}return w},show:function(){q.style.height=A+"px";if(w.isLoaded()){v.style.height=o+"px"}return w},isHidden:function(){return w.isLoaded()&&parseInt(v.style.height,10)===0},load:function(J){if(!w.isLoaded()&&w._fireEvent("onBeforeLoad")!==false){var H=function(){u=q.innerHTML;if(u&&!flashembed.isSupported(G.version)){q.innerHTML=""}if(J){J.cached=true;j(x,"onLoad",J)}flashembed(q,G,{config:t})};var I=0;m(a,function(){this.unload(function(K){if(++I==a.length){H()}})})}return w
},unload:function(J){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(J){J(false)}return w}if(u.replace(/\s/g,"")!==""){if(w._fireEvent("onBeforeUnload")===false){if(J){J(false)}return w}D=true;try{if(v){v.fp_close();w._fireEvent("onUnload")}}catch(H){}var I=function(){v=null;q.innerHTML=u;D=false;if(J){J(true)}};setTimeout(I,50)}else{if(J){J(false)}}return w},getClip:function(H){if(H===undefined){H=C}return F[H]},getCommonClip:function(){return s},getPlaylist:function(){return F},getPlugin:function(H){var J=y[H];if(!J&&w.isLoaded()){var I=w._api().fp_getPlugin(H);if(I){J=new l(H,I,w);y[H]=J}}return J},getScreen:function(){return w.getPlugin("screen")},getControls:function(){return w.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return w.getPlugin("logo")._fireEvent("onUpdate")}catch(H){}},getPlay:function(){return w.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(H){return H?k(t):t},getFlashParams:function(){return G},loadPlugin:function(K,J,M,L){if(typeof M=="function"){L=M;M={}}var I=L?e():"_";w._api().fp_loadPlugin(K,J,M,I);var H={};H[I]=L;var N=new l(K,null,w,H);y[K]=N;return N},getState:function(){return w.isLoaded()?v.fp_getState():-1},play:function(I,H){var J=function(){if(I!==undefined){w._api().fp_play(I,H)}else{w._api().fp_play()}};if(w.isLoaded()){J()}else{if(D){setTimeout(function(){w.play(I,H)},50)}else{w.load(function(){J()})}}return w},getVersion:function(){var I="flowplayer.js 3.2.6";if(w.isLoaded()){var H=v.fp_getVersion();H.push(I);return H}return I},_api:function(){if(!w.isLoaded()){throw"Flowplayer "+w.id()+" not loaded when calling an API method"}return v},setClip:function(H){w.setPlaylist([H]);return w},getIndex:function(){return p},_swfHeight:function(){return v.clientHeight}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var H="on"+this;if(H.indexOf("*")!=-1){H=H.slice(0,H.length-1);var I="onBefore"+H.slice(2);w[I]=function(J){j(x,I,J);
return w}}w[H]=function(J){j(x,H,J);return w}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var H=this;w[H]=function(J,I){if(!w.isLoaded()){return w}var K=null;if(J!==undefined&&I!==undefined){K=v["fp_"+H](J,I)}else{K=(J===undefined)?v["fp_"+H]():v["fp_"+H](J)}return K==="undefined"||K===undefined?w:K}});w._fireEvent=function(Q){if(typeof Q=="string"){Q=[Q]}var R=Q[0],O=Q[1],M=Q[2],L=Q[3],K=0;if(t.debug){g(Q)}if(!w.isLoaded()&&R=="onLoad"&&O=="player"){v=v||c(r);o=w._swfHeight();m(F,function(){this._fireEvent("onLoad")});m(y,function(S,T){T._fireEvent("onUpdate")});s._fireEvent("onLoad")}if(R=="onLoad"&&O!="player"){return }if(R=="onError"){if(typeof O=="string"||(typeof O=="number"&&typeof M=="number")){O=M;M=L}}if(R=="onContextMenu"){m(t.contextMenu[O],function(S,T){T.call(w)});return }if(R=="onPluginEvent"||R=="onBeforePluginEvent"){var H=O.name||O;var I=y[H];if(I){I._fireEvent("onUpdate",O);return I._fireEvent(M,Q.slice(3))}return }if(R=="onPlaylistReplace"){F=[];var N=0;m(O,function(){F.push(new h(this,N++,w))})}if(R=="onClipAdd"){if(O.isInStream){return }O=new h(O,M,w);F.splice(M,0,O);for(K=M+1;K<F.length;K++){F[K].index++}}var P=true;if(typeof O=="number"&&O<F.length){C=O;var J=F[O];if(J){P=J._fireEvent(R,M,L)}if(!J||P!==false){P=s._fireEvent(R,M,L,J)}}m(x[R],function(){P=this.call(w,O,M);if(this.cached){x[R].splice(K,1)}if(P===false){return false}K++});return P};function B(){if($f(q)){$f(q).getParent().innerHTML="";p=$f(q).getIndex();a[p]=w}else{a.push(w);p=a.length-1}A=parseInt(q.style.height,10)||q.clientHeight;E=q.id||"fp"+e();r=G.id||E+"_api";G.id=r;t.playerId=E;if(typeof t=="string"){t={clip:{url:t}}}if(typeof t.clip=="string"){t.clip={url:t.clip}}t.clip=t.clip||{};if(q.getAttribute("href",2)&&!t.clip.url){t.clip.url=q.getAttribute("href",2)}s=new h(t.clip,-1,w);t.playlist=t.playlist||[t.clip];
var I=0;m(t.playlist,function(){var K=this;if(typeof K=="object"&&K.length){K={url:""+K}}m(t.clip,function(L,M){if(M!==undefined&&K[L]===undefined&&typeof M!="function"){K[L]=M}});t.playlist[I]=K;K=new h(K,I,w);F.push(K);I++});m(t,function(K,L){if(typeof L=="function"){if(s[K]){s[K](L)}else{j(x,K,L)}delete t[K]}});m(t.plugins,function(K,L){if(L){y[K]=new l(K,L,w)}});if(!t.plugins||t.plugins.controls===undefined){y.controls=new l("controls",null,w)}y.canvas=new l("canvas",null,w);u=q.innerHTML;function J(L){var K=w.hasiPadSupport&&w.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(F[0].url)&&!K){return true}if(!w.isLoaded()&&w._fireEvent("onBeforeClick")!==false){w.load()}return f(L)}function H(){if(u.replace(/\s/g,"")!==""){if(q.addEventListener){q.addEventListener("click",J,false)}else{if(q.attachEvent){q.attachEvent("onclick",J)}}}else{if(q.addEventListener){q.addEventListener("click",f,false)}w.load()}}setTimeout(H,0)}if(typeof q=="string"){var z=c(q);if(!z){throw"Flowplayer cannot access element: "+q}q=z;B()}else{B()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var t=arguments[1],q=(arguments.length==3)?arguments[2]:{};if(typeof t=="string"){t={src:t}}t=i({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:false},t);if(typeof o=="string"){if(o.indexOf(".")!=-1){var s=[];m(n(o),function(){s.push(new b(this,k(t),k(q)))});return new d(s)}else{var r=c(o);return new b(r!==null?r:o,t,q)}}else{if(o){return new b(o,t,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);
var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var e=typeof jQuery=="function";var i={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(e){jQuery.tools=jQuery.tools||{};jQuery.tools.flashembed={version:"1.0.4",conf:i}}function j(){if(c.done){return false}var l=document;if(l&&l.getElementsByTagName&&l.getElementById&&l.body){clearInterval(c.timer);c.timer=null;for(var k=0;k<c.ready.length;k++){c.ready[k].call()}c.ready=null;c.done=true}}var c=e?jQuery:function(k){if(c.done){return k()}if(c.timer){c.ready.push(k)}else{c.ready=[k];c.timer=setInterval(j,13)}};function f(l,k){if(k){for(key in k){if(k.hasOwnProperty(key)){l[key]=k[key]}}}return l}function g(k){switch(h(k)){case"string":k=k.replace(new RegExp('(["\\])',"g"),"\$1");k=k.replace(/^\s?(\d+)%/,"$1pct");return'"'+k+'"';case"array":return"["+b(k,function(n){return g(n)}).join(",")+"]";case"function":return'"function()"';case"object":var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push('"'+m+'":'+g(k[m]))}}return"{"+l.join(",")+"}"}return String(k).replace(/\s/g," ").replace(/\'/g,'"')}function h(l){if(l===null||l===undefined){return false}var k=typeof l;return(k=="object"&&l.push)?"array":k}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function b(k,n){var m=[];for(var l in k){if(k.hasOwnProperty(l)){m[l]=n(k[l])}}return m}function a(r,t){var q=f({},r);var s=document.all;var n='<object width="'+q.width+'" height="'+q.height+'"';if(s&&!q.id){q.id="_"+(""+Math.random()).substring(9)
}if(q.id){n+=' id="'+q.id+'"'}if(q.cachebusting){q.src+=((q.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(q.w3c||!s){n+=' data="'+q.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(q.w3c||s){n+='<param name="movie" value="'+q.src+'" />'}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+='<param name="'+l+'" value="'+q[l]+'" />'}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?g(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='<param name="flashvars" value=\''+o+"' />"}n+="</object>";return n}function d(m,p,l){var k=flashembed.getVersion();f(this,{getContainer:function(){return m},getConf:function(){return p},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){f(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="<h2>Flash version "+q+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(m.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(m.tagName=="A"){m.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}if(document.all){window[p.id]=document.getElementById(p.id)}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return }}if(!l){return }if(typeof m=="string"){m={src:m}}var o=f({},i);f(o,m);return new d(l,o,k)};f(window.flashembed,{getVersion:function(){var m=[0,0];
if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return m}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:g,getHTML:a});if(e){jQuery.fn.flashembed=function(l,k){var m=null;this.each(function(){m=flashembed(this,l,k)});return l.api===false?this:m}}})();function initSlider(id,speed,autoPlay){var options={nextId:id+"-next",prevId:id+"-prev",orientation:"horizontal",auto:autoPlay,speed:speed,continuous:autoPlay};$("#"+id).easySlider(options)}var Hashtable=(function(){var p="function";var n=(typeof Array.prototype.splice==p)?function(s,r){s.splice(r,1)}:function(u,t){var s,v,r;if(t===u.length-1){u.length=t}else{s=u.slice(t+1);u.length=t;for(v=0,r=s.length;v<r;++v){u[t+v]=s[v]}}};function a(t){var r;if(typeof t=="string"){return t}else{if(typeof t.hashCode==p){r=t.hashCode();return(typeof r=="string")?r:a(r)}else{if(typeof t.toString==p){return t.toString()}else{try{return String(t)}catch(s){return Object.prototype.toString.call(t)}}}}}function g(r,s){return r.equals(s)}function e(r,s){return(typeof s.equals==p)?s.equals(r):(r===s)}function c(r){return function(s){if(s===null){throw new Error("null is not a valid "+r)}else{if(typeof s=="undefined"){throw new Error(r+" must not be undefined")}}}}var q=c("key"),l=c("value");function d(u,s,t,r){this[0]=u;
this.entries=[];this.addEntry(s,t);if(r!==null){this.getEqualityFunction=function(){return r}}}var h=0,j=1,f=2;function o(r){return function(t){var s=this.entries.length,v,u=this.getEqualityFunction(t);while(s--){v=this.entries[s];if(u(t,v[0])){switch(r){case h:return true;case j:return v;case f:return[s,v[1]]}}}return false}}function k(r){return function(u){var v=u.length;for(var t=0,s=this.entries.length;t<s;++t){u[v+t]=this.entries[t][r]}}}d.prototype={getEqualityFunction:function(r){return(typeof r.equals==p)?g:e},getEntryForKey:o(j),getEntryAndIndexForKey:o(f),removeEntryForKey:function(s){var r=this.getEntryAndIndexForKey(s);if(r){n(this.entries,r[0]);return r[1]}return null},addEntry:function(r,s){this.entries[this.entries.length]=[r,s]},keys:k(0),values:k(1),getEntries:function(s){var u=s.length;for(var t=0,r=this.entries.length;t<r;++t){s[u+t]=this.entries[t].slice(0)}},containsKey:o(h),containsValue:function(s){var r=this.entries.length;while(r--){if(s===this.entries[r][1]){return true}}return false}};function m(s,t){var r=s.length,u;while(r--){u=s[r];if(t===u[0]){return r}}return null}function i(r,s){var t=r[s];return(t&&(t instanceof d))?t:null}function b(t,r){var w=this;var v=[];var u={};var x=(typeof t==p)?t:a;var s=(typeof r==p)?r:null;this.put=function(B,C){q(B);l(C);var D=x(B),E,A,z=null;E=i(u,D);if(E){A=E.getEntryForKey(B);if(A){z=A[1];A[1]=C}else{E.addEntry(B,C)}}else{E=new d(D,B,C,s);v[v.length]=E;u[D]=E}return z};this.get=function(A){q(A);var B=x(A);var C=i(u,B);if(C){var z=C.getEntryForKey(A);if(z){return z[1]}}return null};this.containsKey=function(A){q(A);var z=x(A);var B=i(u,z);return B?B.containsKey(A):false};this.containsValue=function(A){l(A);var z=v.length;while(z--){if(v[z].containsValue(A)){return true}}return false};this.clear=function(){v.length=0;u={}};this.isEmpty=function(){return !v.length};var y=function(z){return function(){var A=[],B=v.length;while(B--){v[B][z](A)}return A}};this.keys=y("keys");this.values=y("values");this.entries=y("getEntries");this.remove=function(B){q(B);
var C=x(B),z,A=null;var D=i(u,C);if(D){A=D.removeEntryForKey(B);if(A!==null){if(!D.entries.length){z=m(v,C);n(v,z);delete u[C]}}}return A};this.size=function(){var A=0,z=v.length;while(z--){A+=v[z].entries.length}return A};this.each=function(C){var z=w.entries(),A=z.length,B;while(A--){B=z[A];C(B[0],B[1])}};this.putAll=function(H,C){var B=H.entries();var E,F,D,z,A=B.length;var G=(typeof C==p);while(A--){E=B[A];F=E[0];D=E[1];if(G&&(z=w.get(F))){D=C(F,z,D)}w.put(F,D)}};this.clone=function(){var z=new b(t,r);z.putAll(w);return z}}return b})();new function(settings){var $separator=settings.separator||"&";var $spaces=settings.spaces===false?false:true;var $suffix=settings.suffix===false?"":"[]";var $prefix=settings.prefix===false?false:true;var $hash=$prefix?settings.hash===true?"#":"?":"";var $numbers=settings.numbers===false?false:true;jQuery.query=new function(){var is=function(o,t){return o!=undefined&&o!==null&&(!!t?o.constructor==t:true)};var parse=function(path){var m,rx=/\[([^[]*)\]/g,match=/^([^[]+)(\[.*\])?$/.exec(path),base=match[1],tokens=[];while(m=rx.exec(match[2])){tokens.push(m[1])}return[base,tokens]};var set=function(target,tokens,value){var o,token=tokens.shift();if(typeof target!="object"){target=null}if(token===""){if(!target){target=[]}if(is(target,Array)){target.push(tokens.length==0?value:set(null,tokens.slice(0),value))}else{if(is(target,Object)){var i=0;while(target[i++]!=null){}target[--i]=tokens.length==0?value:set(target[i],tokens.slice(0),value)}else{target=[];target.push(tokens.length==0?value:set(null,tokens.slice(0),value))}}}else{if(token&&token.match(/^\s*[0-9]+\s*$/)){var index=parseInt(token,10);if(!target){target=[]}target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value)}else{if(token){var index=token.replace(/^\s*|\s*$/g,"");if(!target){target={}}if(is(target,Array)){var temp={};for(var i=0;i<target.length;++i){temp[i]=target[i]}target=temp}target[index]=tokens.length==0?value:set(target[index],tokens.slice(0),value)}else{return value}}}return target};var queryObject=function(a){var self=this;
self.keys={};if(a.queryObject){jQuery.each(a.get(),function(key,val){self.SET(key,val)})}else{jQuery.each(arguments,function(){var q=""+this;q=q.replace(/^[?#]/,"");q=q.replace(/[;&]$/,"");if($spaces){q=q.replace(/[+]/g," ")}jQuery.each(q.split(/[&;]/),function(){var key=decodeURIComponent(this.split("=")[0]||"");var val=decodeURIComponent(this.split("=")[1]||"");if(!key){return }if($numbers){if(/^[+-]?[0-9]+\.[0-9]*$/.test(val)){val=parseFloat(val)}else{if(/^[+-]?[0-9]+$/.test(val)){val=parseInt(val,10)}}}val=(!val&&val!==0)?true:val;if(val!==false&&val!==true&&typeof val!="number"){val=val}self.SET(key,val)})})}return self};queryObject.prototype={queryObject:true,has:function(key,type){var value=this.get(key);return is(value,type)},GET:function(key){if(!is(key)){return this.keys}var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];while(target!=null&&tokens.length!=0){target=target[tokens.shift()]}return typeof target=="number"?target:target||""},get:function(key){var target=this.GET(key);if(is(target,Object)){return jQuery.extend(true,{},target)}else{if(is(target,Array)){return target.slice(0)}}return target},SET:function(key,val){var value=!is(val)?null:val;var parsed=parse(key),base=parsed[0],tokens=parsed[1];var target=this.keys[base];this.keys[base]=set(target,tokens.slice(0),value);return this},set:function(key,val){return this.copy().SET(key,val)},REMOVE:function(key){return this.SET(key,null).COMPACT()},remove:function(key){return this.copy().REMOVE(key)},EMPTY:function(){var self=this;jQuery.each(self.keys,function(key,value){delete self.keys[key]});return self},load:function(url){var hash=url.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1");var search=url.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new queryObject(url.length==search.length?"":search,url.length==hash.length?"":hash)},empty:function(){return this.copy().EMPTY()},copy:function(){return new queryObject(this)},COMPACT:function(){function build(orig){var obj=typeof orig=="object"?is(orig,Array)?[]:{}:orig;if(typeof orig=="object"){function add(o,key,value){if(is(o,Array)){o.push(value)
}else{o[key]=value}}jQuery.each(orig,function(key,value){if(!is(value)){return true}add(obj,key,build(value))})}return obj}this.keys=build(this.keys);return this},compact:function(){return this.copy().COMPACT()},toString:function(){var i=0,queryString=[],chunks=[],self=this;var encode=function(str){str=str+"";if($spaces){str=str.replace(/ /g,"+")}return encodeURIComponent(str)};var addFields=function(arr,key,value){if(!is(value)||value===false){return }var o=[encode(key)];if(value!==true){o.push("=");o.push(encode(value))}arr.push(o.join(""))};var build=function(obj,base){var newKey=function(key){return !base||base==""?[key].join(""):[base,"[",key,"]"].join("")};jQuery.each(obj,function(key,value){if(typeof value=="object"){build(value,newKey(key))}else{addFields(chunks,newKey(key),value)}})};build(this.keys);if(chunks.length>0){queryString.push($hash)}queryString.push(chunks.join($separator));return queryString.join("")}};return new queryObject(location.search,location.hash)}}(jQuery.query||{});if(jQuery){(function(){$.extend($.fn,{contextMenu:function(o,callback){if(o.menu==undefined){return false}if(o.inSpeed==undefined){o.inSpeed=150}if(o.outSpeed==undefined){o.outSpeed=75}if(o.inSpeed==0){o.inSpeed=-1}if(o.outSpeed==0){o.outSpeed=-1}$(this).each(function(){var el=$(this);var offset=$(el).offset();$("#"+o.menu).addClass("contextMenu");$(this).mousedown(function(e){var evt=e;evt.stopPropagation();$(this).mouseup(function(e){e.stopPropagation();var srcElement=$(this);$(this).unbind("mouseup");if(evt.button==2){$(".contextMenu").hide();var menu=$("#"+o.menu);if($(el).hasClass("disabled")){return false}var d={},x,y;if(self.innerHeight){d.pageYOffset=self.pageYOffset;d.pageXOffset=self.pageXOffset;d.innerHeight=self.innerHeight;d.innerWidth=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientHeight){d.pageYOffset=document.documentElement.scrollTop;d.pageXOffset=document.documentElement.scrollLeft;d.innerHeight=document.documentElement.clientHeight;d.innerWidth=document.documentElement.clientWidth
}else{if(document.body){d.pageYOffset=document.body.scrollTop;d.pageXOffset=document.body.scrollLeft;d.innerHeight=document.body.clientHeight;d.innerWidth=document.body.clientWidth}}}(e.pageX)?x=e.pageX:x=e.clientX+d.scrollLeft;(e.pageY)?y=e.pageY:y=e.clientY+d.scrollTop;$(document).unbind("click");$(menu).css({top:y,left:x}).fadeIn(o.inSpeed);$(menu).find("A").mouseover(function(){$(menu).find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){$(menu).find("LI.hover").removeClass("hover")});$(document).keypress(function(e){switch(e.keyCode){case 38:if($(menu).find("LI.hover").size()==0){$(menu).find("LI:last").addClass("hover")}else{$(menu).find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");if($(menu).find("LI.hover").size()==0){$(menu).find("LI:last").addClass("hover")}}break;case 40:if($(menu).find("LI.hover").size()==0){$(menu).find("LI:first").addClass("hover")}else{$(menu).find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");if($(menu).find("LI.hover").size()==0){$(menu).find("LI:first").addClass("hover")}}break;case 13:$(menu).find("LI.hover A").trigger("click");break;case 27:$(document).trigger("click");break}});$("#"+o.menu).find("A").unbind("click");$("#"+o.menu).find("LI:not(.disabled) A").click(function(){$(document).unbind("click").unbind("keypress");$(".contextMenu").hide();if(callback){callback($(this).attr("href").substr(1),$(srcElement),{x:x-offset.left,y:y-offset.top,docX:x,docY:y})}return false});setTimeout(function(){$(document).click(function(){$(document).unbind("click").unbind("keypress");$(menu).fadeOut(o.outSpeed);return false})},0)}})});if($.browser.mozilla){$("#"+o.menu).each(function(){$(this).css({MozUserSelect:"none"})})}else{if($.browser.msie){$("#"+o.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})})}else{$("#"+o.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})})}}$(el).add($("UL.contextMenu")).bind("contextmenu",function(){return false
})});return $(this)},disableContextMenuItems:function(o){if(o==undefined){$(this).find("LI").addClass("disabled");return($(this))}$(this).each(function(){if(o!=undefined){var d=o.split(",");for(var i=0;i<d.length;i++){$(this).find('A[href="'+d[i]+'"]').parent().addClass("disabled")}}});return($(this))},enableContextMenuItems:function(o){if(o==undefined){$(this).find("LI.disabled").removeClass("disabled");return($(this))}$(this).each(function(){if(o!=undefined){var d=o.split(",");for(var i=0;i<d.length;i++){$(this).find('A[href="'+d[i]+'"]').parent().removeClass("disabled")}}});return($(this))},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return($(this))},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return($(this))},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return($(this))}})})(jQuery)}if(typeof console=="undefined"){var console={};console.log=function(a){return }}function KMDelegateOption(a,b){this.RunDefaultHandler=a;this.ClientDelegateName=b;this.Clone=function(c,d){this.RunDefaultHandler=c;if(jQuery.isArray(d)){this.ClientDelegateName=d.slice()}else{this.ClientDelegateName=d}}}KMDirectionTurn={};KMDirectionTurn.UTurnPatterns=["U-turn","demi-tour"];KMDirectionTurn.LeftTurnPatterns=["Turn left","Tourner à gauche"];KMDirectionTurn.RightTurnPatterns=["Turn right","Tourner à droite"];KMDirectionTurn.LeftRampPatterns=["Bear left","ramp left","Prendre à gauche","la gauche"];KMDirectionTurn.RightRampPatterns=["Bear right","ramp right","Prendre à droite","la droite"];KMDirectionTurn.StraightPatterns=["Keep straight","Continuer"];KMDirectionTurn.DepartPatterns=["Depart","Départ"];KMDirectionTurn.ArrivePatterns=["Arrive","Arrivée"];KMDirectionTurn.IsTextMatchedToPattern=function(c,f){if(jQuery.isArray(c)&&!String.IsNullOrEmpty(f)){for(var b=0;b<c.length;b++){var e=c[b];var d=new RegExp(e,"gi");var a=f.match(d);if(a!=null&&a.length>0){return true}}}return false};KMDirectionTurn.GetDirectionTurnType=function(a){if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.UTurnPatterns,a)){return KMDirectionTurnType.UTurn
}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.LeftTurnPatterns,a)){return KMDirectionTurnType.LeftTurn}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.RightTurnPatterns,a)){return KMDirectionTurnType.RightTurn}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.LeftRampPatterns,a)){return KMDirectionTurnType.LeftRamp}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.RightRampPatterns,a)){return KMDirectionTurnType.RightRamp}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.StraightPatterns,a)){return KMDirectionTurnType.Straight}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.DepartPatterns,a)){return KMDirectionTurnType.Depart}if(KMDirectionTurn.IsTextMatchedToPattern(KMDirectionTurn.ArrivePatterns,a)){return KMDirectionTurnType.Arrive}return KMDirectionTurnType.None};var KMDirectionTurnType={None:0,UTurn:1,LeftTurn:2,RightTurn:3,LeftRamp:4,RightRamp:5,Straight:6,Depart:7,Arrive:8};String.IsNullOrEmpty=function(a){if(a){if(typeof (a)=="string"){if(a.length>0){return false}}if(a!=null){return false}}return true};String.prototype.Trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")};KMObject={};KMObject.Extend=function(c,a){function b(){}b.prototype=a.prototype;c.prototype=new b();c.prototype.constructor=c;c.baseConstructor=a;c.superClass=a.prototype};function KMRouteSegment(){this.SegmentType=KMRouteSegmentType.Unknown;this.DestinationIndex=-1;this.IndexArray=[];this.LegArray=[]}var KMRouteSegmentType={Unknown:0,Destination:1,Leg:2};GetQueryStringVariable=function(a){var c=window.location.search.substring(1);var d=c.split("&");for(var b=0;b<d.length;b++){var e=d[b].split("=");if(e[0]==a){return e[1]}}return""};DebugPointArray=function(b){if(jQuery.isArray(b)){var a="";for(var c=0;c<b.length;c++){a+=b[c].Debug()}return a}return""};DebugArray=function(a){if(jQuery.isArray(a)){var b="";for(var c=0;c<a.length;c++){b+="["+a[c]+"]"}return b}return""};FloatEquals=function(o,n,k){var d=false;var f=Math.floor(o);var e=Math.floor(n);if(f!=e){return false
}var b=Math.pow(10,k);var c=Math.floor(o*b);var a=Math.floor(n*b);if(c==a){return true}var h=String(o).length;var g=String(n).length;if(h>=g){d=String(o).indexOf(String(n))==0}else{d=String(n).indexOf(String(o))==0}if(d){return true}var q=ChopFloatToPrecision(o,k);var p=ChopFloatToPrecision(n,k);d=q==p;if(d){return true}var m=parseFloat(o).toFixed(k);var l=parseFloat(n).toFixed(k);d=m==l;return d};GetFloatPrecision=function(a){var b=new String(a);if(b.indexOf(".")>-1){return b.length-b.indexOf(".")-1}else{return 0}};ChopFloatToPrecision=function(b,d){var c=GetFloatPrecision(b);if(c==0||c<=d){return b}var e=new String(b);var a=e.length;var h=e.indexOf(".");var f=a-(c-d);var g=e.substr(0,f);return parseFloat(g)};AddressKindOfEquals=function(f,e){if(String.IsNullOrEmpty(f)||String.IsNullOrEmpty(e)){return false}var d=f.replace(/\,/gi,"").replace(/\./gi,"");var h=e.replace(/\,/gi,"").replace(/\./gi,"");if(String.IsNullOrEmpty(d)||String.IsNullOrEmpty(h)){return false}var g=new RegExp(h,"gi");var c=d.match(g);if(c!=null&&c.length>0){return true}g=new RegExp(d,"gi");c=h.match(g);if(c!=null&&c.length>0){return true}return false};AddressIndexInArray=function(c,b){if(jQuery.isArray(b)){for(var d=0;d<b.length;d++){if(AddressKindOfEquals(c,b[d])){return d}}}return -1};VEShapeLayer.prototype.ReferenceID=null;VEShapeLayer.prototype.Group=null;VEShapeLayer.prototype.GeocodeIndex=null;VEShape.prototype.ReferenceID=null;VEShape.prototype.ShapeLayerID=null;VEShape.prototype.IsClustered=false;VEShape.prototype.IsInMapView=false;VEShape.prototype.Payload=null;VEShape.prototype.Group=null;VELatLongRectangle.prototype.Centre=null;VELatLongRectangle.prototype.Zoom=null;VEPixel.prototype.IntX=function(){return this.x.toFixed()};VEPixel.prototype.IntY=function(){return this.y.toFixed()};VEPixel.prototype.Debug=function(){return"("+this.IntX()+","+this.IntY()+")"};VEPixel.prototype.IndexInArray=function(a){if(jQuery.isArray(a)){for(var c=0;c<a.length-1;c++){var e=a[c];var b=a[c+1];var f=false;var d=false;if(e.IntX()<=b.IntX()){if(this.IntX()>=e.IntX()&&this.IntX()<=b.IntX()){f=true
}}else{if(this.IntX()>=b.IntX()&&this.IntX()<=e.IntX()){f=true}}if(e.IntY()<=b.IntY()){if(this.IntY()>=e.IntY()&&this.IntY()<=b.IntY()){d=true}}else{if(this.IntY()>=b.IntY()&&this.IntY()<=e.IntY()){d=true}}if(f&&d){return(c+1)}}}return -1};VELatLong.prototype.Debug=function(){return"("+this.Latitude+","+this.Longitude+")"};VELatLong.prototype.KindOfEquals=function(a,b){if(b===undefined){b=6}if(FloatEquals(this.Latitude,a.Latitude,b)&&FloatEquals(this.Longitude,a.Longitude,b)){return true}if(FloatEquals(this.Latitude,a.Latitude,b-1)&&FloatEquals(this.Longitude,a.Longitude,b-1)){return true}return false};VELatLong.prototype.KindOfInArray=function(a){if(jQuery.isArray(a)){for(var b=0;b<a.length;b++){if(a[b].KindOfEquals(this)){return b}}}return -1};VELatLongRectangle.prototype.Debug=function(){return"TopLeft: "+this.TopLeftLatLong.Debug()+", BottomRight: "+this.BottomRightLatLong.Debug()};VEMap.prototype.GetShapeGuidFromPrimitiveID=function(a){var d=a.replace(/[^_]/g,"").length;if(d==3){var c=a.lastIndexOf("_");var b=a.substring(0,c);return b}return a};VEMap.prototype.LatLongToPixelArray=function(b){var c=[];for(var a=0;a<b.length;a++){c.push(this.LatLongToPixel(b[a],this.GetZoomLevel()))}return c};VEMap.prototype.PixelToLatLongArray=function(b){var c=[];for(var a=0;a<b.length;a++){c.push(this.PixelToLatLong(b[a]))}return c};VERoute.prototype.GetLocations=function(){var a=[];if(this.RouteLegs!=null){for(var b=0;b<=this.RouteLegs.length-1;b++){a.push(this.RouteLegs[b].StartLocation)}a.push(this.RouteLegs[this.RouteLegs.length-1].EndLocation)}return a};VERoute.prototype.GetShapePointsOfAllLegs=function(){if(this.RouteLegs!=null&&this.ShapePoints!=null){var f=new Array(this.RouteLegs.length);for(i=0;i<=this.RouteLegs.length-1;i++){f[i]=[];var d=this.RouteLegs[i];var e=d.StartLocation;var b=d.EndLocation;var a=0;for(var c=0;c<this.ShapePoints.length;c++){if(e.KindOfEquals(this.ShapePoints[c])){a=1}if(a==1){f[i].push(this.ShapePoints[c])}if(b.KindOfEquals(this.ShapePoints[c])){a=2;f[i].push(this.ShapePoints[c])}if(a==2){break
}}}return f}return null};VERoute.prototype.GetShapePointsOfLeg=function(a){if(this.RouteLegs!=null&&this.ShapePoints!=null){var b=this.GetShapePointsOfAllLegs();if(b!=null){if(a>0&&a<b.length){return b[a]}}}return null};VERoute.prototype.GetRouteSegmentArray=function(f){if(this.RouteLegs==null||!jQuery.isArray(this.RouteLegs)){return null}if(!jQuery.isArray(f)){return null}var h=this.GetLocations();var c=[];for(var e=0;e<f.length;e++){var l=f[e];var g=l.KindOfInArray(h);c.push(g)}var m=[];var d=-1;var b=-1;for(var e=0;e<c.length;e++){b=d;d=c[e];if(e==0){var k=new KMRouteSegment();k.SegmentType=KMRouteSegmentType.Destination;k.DestinationIndex=e;k.IndexArray=null;k.LegArray=null;m.push(k)}if(e>0){if(d-b>=1){var a=new KMRouteSegment();a.SegmentType=KMRouteSegmentType.Leg;a.DestinationIndex=-1;a.IndexArray=[];a.LegArray=[];for(j=b;j<=d-1;j++){a.IndexArray.push(j);a.LegArray.push(this.RouteLegs[j])}m.push(a)}var k=new KMRouteSegment();k.SegmentType=KMRouteSegmentType.Destination;k.DestinationIndex=e;k.IndexArray=null;k.LegArray=null;m.push(k)}}return m};function KMCacheManager(){var d;var c="divDataCache";function e(){if(!d&&GetQueryStringVariable("state")!="clear"){try{d=new JSTONE(JSON)}catch(f){}}}function b(f){if(f!=null&&typeof (f)=="string"){f=f.replace(/'/gi,"");f=f.replace(/#/gi,"");f=f.replace(/\$/gi,"");f=f.replace(/%/gi,"");f=f.replace(/\^/gi,"");f=f.replace(/!/gi,"");f=f.replace(/</gi,"");f=f.replace(/>/gi,"");f=f.replace(/~/gi,"");f=f.replace(/"/gi,"");f=f.replace(/\//gi,"");f=f.replace(/\*/gi,"")}return f}function a(f){if(f!=null&&typeof (f)=="string"){f=b(f);f=f.replace(/;/gi,"")}return f}this.Save=function(f,g){e();if(d==undefined||d==null){return""}d.write(f,g)};this.Retrieve=function(f){e();if(d==undefined||d==null){return""}return d.read(f)};this.SetClientCookie=function(h,l,g,n,k,m){var f=new Array();if(h!=null&&l!=null){f.push(a(h)+"="+a(l))}if(g!=null){f.push("expires="+g)}if(n!=null){f.push("path="+n)}if(k!=null){f.push("domain="+k)}if(m!=null&&m){f.push("secure")}document.cookie=f.join("; ")};this.GetClientCookie=function(){return b(document.cookie)
};this.GetClientCookieByName=function(f){var l=document.cookie.split(";");var m=f+"=";var k=null;for(var h=0;h<l.length;h++){var g=l[h];while(g.charAt(0)==" "){g=g.substring(1,g.length)}if(g.indexOf(m)==0){k=g.substring(m.length,g.length)}}return k};this.SaveObjectToClientCache=function(h,k){if(typeof k!="object"){return }if(String.IsNullOrEmpty(h)){return }var g=JSON.stringify(k);if(jQuery("#"+c).length==0){var l=document.createElement("div");l.setAttribute("id",c);jQuery(l).css("display","none");jQuery(l).appendTo("body")}if(jQuery("#"+h).length==0){var f=document.createElement("div");f.setAttribute("id",h);jQuery("#"+c).append(f)}jQuery("#"+h).text(g)};this.GetObjectFromClientCache=function(g){if(String.IsNullOrEmpty(g)){return null}if(jQuery("#"+g).length==0){return null}var f=jQuery("#"+g).text();var k=null;try{k=JSON.parse(f)}catch(h){return null}return k}}function KMClusterManager(mapInstance,shapeLayerManager,shapeManager){var _clusterManager=this;var _mapInstance=mapInstance;var _shapeLayerManager=shapeLayerManager;var _shapeManager=shapeManager;var _clusterShapeLayer=null;var _clusterMapDelegateOption=new KMDelegateOption(true,"");this.Debug=true;this.SetClusterShapeLayer=function(shapeLayer,image){_clusterShapeLayer=shapeLayer;var options=new VEClusteringOptions();options.Callback=this.OnClusterMapHandler;if(!String.IsNullOrEmpty(image)){var customIcon=new VECustomIconSpecification();customIcon.Image=image;options.Icon=customIcon}_clusterShapeLayer.SetClusteringConfiguration(VEClusteringType.Grid,options)};this.SetClusterShapeLayerByID=function(shapeLayerID,image){var shapeLayer=_shapeLayerManager.GetShapeLayer(shapeLayerID);this.SetClusterShapeLayer(shapeLayer,image)};this.GetClusterShapes=function(){if(_clusterShapeLayer!=null){return _clusterShapeLayer.GetClusteredShapes(VEClusteringType.Grid)}return null};this.SetClusterMapDelegateOption=function(option){_clusterMapDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName)};this.OnClusterMapHandler=function(clusters){if(_clusterMapDelegateOption.RunDefaultHandler){if(_clusterManager.Debug){console.log("KMClusterManager.OnClusterMapHandler: Number of clusters: %s",clusters.length)
}}if(jQuery.isArray(_clusterMapDelegateOption.ClientDelegateName)){for(var i=0;i<_clusterMapDelegateOption.ClientDelegateName.length;i++){var delegate=_clusterMapDelegateOption.ClientDelegateName[i];if(!String.IsNullOrEmpty(delegate)){eval(delegate)(_clusterManager,clusters)}}}else{if(!String.IsNullOrEmpty(_clusterMapDelegateOption.ClientDelegateName)){eval(_clusterMapDelegateOption.ClientDelegateName)(_clusterManager,clusters)}}}}function KMListManager(listParentDiv){var _listParentDiv=listParentDiv;var _listItemMouseOverDelegateOption=new KMDelegateOption(true,"");var _listItemMouseOutDelegateOption=new KMDelegateOption(true,"");var _listItemMouseOverCSSClass=null;var _listItemMouseOutCSSClass=null;this.ItemCount=null;this.SetListItemMouseOverDelegate=function(option){_listItemMouseOverDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName)};this.SetListItemMouseOutDelegate=function(option){_listItemMouseOutDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName)};this.ListItemMouseOverCSSClass=function(cssClass){_listItemMouseOverCSSClass=cssClass};this.ListItemMouseOutCSSClass=function(cssClass){_listItemMouseOutCSSClass=cssClass};this.CreateList=function(veShapeLayer,listItemDataBoundDelegate){this.ItemCount=veShapeLayer.GetShapeCount();if(_listParentDiv==null){return }if(this.ItemCount==0){return }if(String.IsNullOrEmpty(listItemDataBoundDelegate)){return }jQuery("#"+_listParentDiv).empty();for(var i=0;i<this.ItemCount;i++){var veShape=veShapeLayer.GetShapeByIndex(i);var itemDiv=jQuery(document.createElement("div"));var id="div_"+veShape.ReferenceID;jQuery(itemDiv).attr("id",id);BindHoverEvents(itemDiv);jQuery("#"+_listParentDiv).append(itemDiv);eval(listItemDataBoundDelegate)(veShape,itemDiv)}};function GetShapeId(divElement){var shapeId=null;if(divElement!=null){shapeId=divElement.id.replace("div_","")}return shapeId}function ListItemMouseOver(e){var target=e.currentTarget;var shapeId=GetShapeId(target);if(_listItemMouseOverCSSClass!=null){jQuery(target).addClass(_listItemMouseOverCSSClass)
}if(!String.IsNullOrEmpty(_listItemMouseOverDelegateOption.ClientDelegateName)){eval(_listItemMouseOverDelegateOption.ClientDelegateName)(e,shapeId)}}function ListItemMouseOut(e){var target=e.currentTarget;var shapeId=GetShapeId(target);if(_listItemMouseOutCSSClass!=null){jQuery(target).addClass(_listItemMouseOutCSSClass)}if(!String.IsNullOrEmpty(_listItemMouseOutDelegateOption.ClientDelegateName)){eval(_listItemMouseOutDelegateOption.ClientDelegateName)(e,shapeId)}}function BindHoverEvents(div){jQuery(div).bind("mouseover",ListItemMouseOver);jQuery(div).bind("mouseout",ListItemMouseOut)}}function KMMapManager(){var _mapManager=this;var _mapInstance;var _shapeLayerManager;var _shapeManager;var _clusterManager;var _resizeDelegateOption=new KMDelegateOption(true,"");var _changeMapStyleDelegateOption=new KMDelegateOption(true,"");var _changeViewDelegateOption=new KMDelegateOption(true,"");var _initModeDelegateOption=new KMDelegateOption(true,"");var _startPanDelegateOption=new KMDelegateOption(true,"");var _endPanDelegateOption=new KMDelegateOption(true,"");var _startZoomDelegateOption=new KMDelegateOption(true,"");var _endZoomDelegateOption=new KMDelegateOption(true,"");var _clickDelegateOption=new KMDelegateOption(true,"");var _doubleClickDelegateOption=new KMDelegateOption(true,"");var _mouseOverDelegateOption=new KMDelegateOption(true,"");var _mouseOutDelegateOption=new KMDelegateOption(true,"");var _obliqueEnterDelegateOption=new KMDelegateOption(true,"");var _obliqueLeaveDelegateOption=new KMDelegateOption(true,"");var _errorDelegateOption=new KMDelegateOption(true,"");this.MapInstance=null;this.MapDivName=null;this.MapElement=null;this.ShapeLayerManager=null;this.ShapeManager=null;this.ClusterManager=null;this.Debug=true;this.GetMap=function(divName,centerLatitude,centerLongitude,zoom,onLoadMap,enhancedRoad){this.MapDivName=divName;this.MapElement=document.getElementById(this.MapDivName);_mapInstance=new VEMap(this.MapDivName);this.MapInstance=_mapInstance;_shapeLayerManager=new KMShapeLayerManager(this.MapInstance);
this.ShapeLayerManager=_shapeLayerManager;_shapeManager=new KMShapeManager(this.MapInstance,this.ShapeLayerManager);this.ShapeManager=_shapeManager;_clusterManager=new KMClusterManager(this.MapInstance,this.ShapeLayerManager,this.ShapeManager);this.ClusterManager=_clusterManager;if(!String.IsNullOrEmpty(onLoadMap)){_mapInstance.onLoadMap=onLoadMap}if(enhancedRoad===undefined){enhancedRoad=true}var mapOptions=new VEMapOptions();mapOptions.DashboardColor="black";mapOptions.UseEnhancedRoadStyle=true;mapOptions.EnableBirdseye=false;_mapInstance.LoadMap(new VELatLong(centerLatitude,centerLongitude),zoom,VEMapStyle.Road,false,VEMapMode.Mode2D,false,0,mapOptions);_mapInstance.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);_mapInstance.AttachEvent("onresize",this.OnResizeHandler);_mapInstance.AttachEvent("onchangemapstyle",this.OnChangeMapStyleHandler);_mapInstance.AttachEvent("onchangeview",this.OnChangeViewHandler);_mapInstance.AttachEvent("oninitmode",this.OnInitModeHandler);_mapInstance.AttachEvent("onstartpan",this.OnStartPanHandler);_mapInstance.AttachEvent("onendpan",this.OnEndPanHandler);_mapInstance.AttachEvent("onstartzoom",this.OnStartZoomHandler);_mapInstance.AttachEvent("onendzoom",this.OnEndZoomHandler);_mapInstance.AttachEvent("onclick",this.OnClickHandler);_mapInstance.AttachEvent("ondoubleclick",this.OnDoubleClickHandler);_mapInstance.AttachEvent("onmouseover",this.OnMouseOverHandler);_mapInstance.AttachEvent("onmouseout",this.OnMouseOutHandler);_mapInstance.AttachEvent("onobliqueenter",this.OnObliqueEnterHandler);_mapInstance.AttachEvent("onobliqueleave",this.OnObliqueLeaveHandler);_shapeManager.UpdateShapesInMapView()};this.AddControl=function(control){if(control==null){return }_mapInstance.AddControl(control)};this.DetachResizeHandler=function(){_mapInstance.DetachEvent("onresize",this.OnResizeHandler)};this.DetachChangeMapStyleHandler=function(){_mapInstance.DetachEvent("onchangemapstyle",this.OnChangeMapStyleHandler)};this.DetachChangeViewHandler=function(){_mapInstance.DetachEvent("onchangeview",this.OnChangeViewHandler)
};this.DetachInitModeHandler=function(){_mapInstance.DetachEvent("oninitmode",this.OnInitModeHandler)};this.DetachStartPanHandler=function(){_mapInstance.DetachEvent("onstartpan",this.OnStartPanHandler)};this.DetachEndPanHandler=function(){_mapInstance.DetachEvent("onendpan",this.OnEndPanHandler)};this.DetachStartZoomHandler=function(){_mapInstance.DetachEvent("onstartzoom",this.OnStartZoomHandler)};this.DetachEndZoomHandler=function(){_mapInstance.DetachEvent("onendzoom",this.OnEndZoomHandler)};this.DetachClickHandler=function(){_mapInstance.DetachEvent("onclick",this.OnClickHandler)};this.DetachDoubleClickHandler=function(){_mapInstance.DetachEvent("ondoubleclick",this.OnDoubleClickHandler)};this.DetachMouseOverHandler=function(){_mapInstance.DetachEvent("onmouseover",this.OnMouseOverHandler)};this.DetachMouseOutHandler=function(){_mapInstance.DetachEvent("onmouseout",this.OnMouseOutHandler)};this.DetachObliqueEnterHandler=function(){_mapInstance.DetachEvent("onobliqueenter",this.OnObliqueEnterHandler)};this.DetachObliqueLeaveHandler=function(){_mapInstance.DetachEvent("onobliqueleave",this.OnObliqueLeaveHandler)};this.SetResizeDelegateOption=function(option){_resizeDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onresize",this.OnResizeHandler)};this.SetChangeMapStyleDelegateOption=function(option){_changeMapStyleDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onchangemapstyle",this.OnChangeMapStyleHandler)};this.SetChangeViewDelegateOption=function(option){_changeViewDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onchangeview",this.OnChangeViewHandler)};this.SetInitModeDelegateOption=function(option){_initModeDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("oninitmode",this.OnInitModeHandler)};this.SetStartPanDelegateOption=function(option){_startPanDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);
_mapInstance.AttachEvent("onstartpan",this.OnStartPanHandler)};this.SetEndPanDelegateOption=function(option){_endPanDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onendpan",this.OnEndPanHandler)};this.SetStartZoomDelegateOption=function(option){_startZoomDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onstartzoom",this.OnStartZoomHandler)};this.SetEndZoomDelegateOption=function(option){_endZoomDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onendzoom",this.OnEndZoomHandler)};this.SetClickDelegateOption=function(option){_clickDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onclick",this.OnClickHandler)};this.SetDoubleClickDelegateOption=function(option){_doubleClickDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("ondoubleclick",this.OnDoubleClickHandler)};this.SetMouseOverDelegateOption=function(option){_mouseOverDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onmouseover",this.OnMouseOverHandler)};this.SetMouseOutDelegateOption=function(option){_mouseOutDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onmouseout",this.OnMouseOutHandler)};this.SetObliqueEnterDelegateOption=function(option){_obliqueEnterDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onobliqueenter",this.OnObliqueEnterHandler)};this.SetObliqueLeaveDelegateOption=function(option){_obliqueLeaveDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onobliqueleave",this.OnObliqueLeaveHandler)};this.SetErrorDelegateOption=function(option){_errorDelegateOption.Clone(option.RunDefaultHandler,option.ClientDelegateName);_mapInstance.AttachEvent("onerror",this.OnErrorHandler)};this.OnResizeHandler=function(e){if(_resizeDelegateOption.RunDefaultHandler){_shapeManager.UpdateShapesInMapView();
if(_mapManager.Debug){console.log("KMMapManager.OnResizeHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_resizeDelegateOption,e)};this.OnChangeMapStyleHandler=function(e){if(_changeMapStyleDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnChangeMapStyleHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_changeMapStyleDelegateOption,e)};this.OnChangeViewHandler=function(e){if(_changeViewDelegateOption.RunDefaultHandler){_shapeManager.UpdateShapesInMapView();if(_mapManager.Debug){console.log("KMMapManager.OnChangeViewHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_changeViewDelegateOption,e)};this.OnInitModeHandler=function(e){if(_initModeDelegateOption.RunDefaultHandler){_shapeManager.UpdateShapesInMapView();if(_mapManager.Debug){console.log("KMMapManager.OnInitModeHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_initModeDelegateOption,e)};this.OnStartPanHandler=function(e){if(_startPanDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnStartPanHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_startPanDelegateOption,e)};this.OnEndPanHandler=function(e){if(_endPanDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnEndPanHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_endPanDelegateOption,e)};this.OnStartZoomHandler=function(e){if(_startZoomDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnStartZoomHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_startZoomDelegateOption,e)};this.OnEndZoomHandler=function(e){if(_endZoomDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnEndZoomHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_endZoomDelegateOption,e)};this.OnClickHandler=function(e){if(_clickDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnClickHandler: %s => %s",e.eventName,e.elementID)
}}HandleClientDelegate(_clickDelegateOption,e)};this.OnDoubleClickHandler=function(e){if(_doubleClickDelegateOption.RunDefaultHandler){var zoom=_mapInstance.GetZoomLevel();if(_mapManager.Debug){console.log("KMMapManager.OnDoubleClickHandler: %s => %s",e.eventName,e.elementID)}}HandleClientDelegate(_doubleClickDelegateOption,e)};this.OnMouseOverHandler=function(e){if(_mouseOverDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnMouseOverHandler: %s => %s",e.eventName,e.elementID)}}HandleClientDelegate(_mouseOverDelegateOption,e)};this.OnMouseOutHandler=function(e){if(_mouseOutDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnMouseOutHandler: %s => %s",e.eventName,e.elementID)}}HandleClientDelegate(_mouseOutDelegateOption,e)};this.OnObliqueEnterHandler=function(e){if(_obliqueEnterDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnObliqueEnterHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_obliqueEnterDelegateOption,e)};this.OnObliqueLeaveHandler=function(e){if(_obliqueLeaveDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnObliqueLeaveHandler: %s",_mapInstance.GetMapView().Debug())}}HandleClientDelegate(_obliqueLeaveDelegateOption,e)};this.OnErrorHandler=function(e){if(_errorDelegateOption.RunDefaultHandler){if(_mapManager.Debug){console.log("KMMapManager.OnErrorHandler: %s",e.error)}}HandleClientDelegate(_errorDelegateOption,e)};HandleClientDelegate=function(delegateOption,e){if(jQuery.isArray(delegateOption.ClientDelegateName)){for(var i=0;i<delegateOption.ClientDelegateName.length;i++){var delegate=delegateOption.ClientDelegateName[i];if(!String.IsNullOrEmpty(delegate)){eval(delegate)(_mapManager,e)}}}else{if(!String.IsNullOrEmpty(delegateOption.ClientDelegateName)){eval(delegateOption.ClientDelegateName)(_mapManager,e)}}}}KMNavigationManager={};KMNavigationManager.GetCurrentViewURL=function(b){if(b==null){return null}var e=window.location.href.replace(window.location.search,"");
var k=b.GetMapView();var h=k.TopLeftLatLong;var a=k.BottomRightLatLong;var d=b.GetCenter();var l=h.Latitude+":"+h.Longitude+":"+a.Latitude+":"+a.Longitude;var g=d.Latitude+":"+d.Longitude;var f=b.GetZoomLevel();jQuery.query.SET("mv",l);jQuery.query.SET("c",g);jQuery.query.SET("z",f);return e+jQuery.query.toString()};KMNavigationManager.GetMapViewFromQueryString=function(){var f=window.location.href;var a=jQuery.query.get("mv");var g=a.split(":");if(g==null||g.length!=4){return null}var b=null;try{var e=new VELatLong(g[0],g[1]);var c=new VELatLong(g[2],g[3]);b=new VELatLongRectangle(e,c);b.Centre=KMNavigationManager.GetMapCenterFromQueryString();b.Zoom=KMNavigationManager.GetMapZoomFromQueryString()}catch(d){console.log("KMNavigationManager.GetMapViewFromQueryString: %s",g.toString());return null}return b};KMNavigationManager.GetMapCenterFromQueryString=function(){var e=jQuery.query.get("c");var a=e.split(":");if(a==null||a.length!=2){return null}var d=null;try{d=new VELatLong(a[0],a[1])}catch(b){console.log("KMNavigationManager.GetMapCenterFromQueryString: %s",a.toString());return null}return d};KMNavigationManager.GetMapZoomFromQueryString=function(){return jQuery.query.get("z")};function KMShapeLayerManager(b){var c=b;var a=new Hashtable();this.DefaultGroupName="{9E2CA069-A266-4ff4-AAD7-C9CEDA52B47B}";this.Debug=true;this.AddShapeLayer=function(h,f,g,e){if(this.GetShapeLayer(h)==null){var d=new VEShapeLayer();d.ReferenceID=h;d.Group=!String.IsNullOrEmpty(f)?f:this.DefaultGroupName;if(!String.IsNullOrEmpty(g)){d.SetTitle(g)}if(!String.IsNullOrEmpty(e)){d.SetDescription(e)}c.AddShapeLayer(d);a.put(h,d)}};this.GetShapeLayerCollection=function(){return a.values()};this.ShowShapeLayer=function(e){var d=this.GetShapeLayer(e);if(d!=null){d.Show()}};this.HideShapeLayer=function(e){var d=this.GetShapeLayer(e);if(d!=null){d.Hide()}};this.IsShapeLayerVisible=function(e){var d=this.GetShapeLayer(e);if(d!=null){return d.IsVisible()}return false};this.GetShapeCount=function(e){var d=this.GetShapeLayer(e);if(d!=null){return d.GetShapeCount()
}return 0};this.GetShapeLayer=function(d){return a.get(d)};this.DeleteShapeLayer=function(e){var d=this.GetShapeLayer(e);if(d!=null){c.DeleteShapeLayer(d);a.remove(e)}};this.ClearShapeLayer=function(e){var d=this.GetShapeLayer(e);if(d!=null){d.DeleteAllShapes()}};this.GetShapeLayersByGroup=function(f){var e=[];for(var g in a.keys()){var d=a.get(g);if(d!=null&&d.Group==f){e.push(d)}}return e};this.DeleteShapeLayersByGroup=function(e){var d=this.GetShapeLayersByGroup(e);if(d!=null&&d.length>0){for(var f in d){this.DeleteShapeLayer(f)}}};this.ShowShapeLayersByGroup=function(e){var d=this.GetShapeLayersByGroup(e);if(d!=null&&d.length>0){for(var f in d){this.ShowShapeLayer(f)}}};this.HideShapeLayersByGroup=function(e){var d=this.GetShapeLayersByGroup(e);if(d!=null&&d.length>0){for(var f in d){this.HideShapeLayer(f)}}}}KMShapeLayerManager.CreateList=function(listParentDiv,veShapeList,listItemDataBoundDelegate){if(listParentDiv==null){return }jQuery("#"+listParentDiv).empty();if(veShapeList==null||veShapeList.length==0){return }if(String.IsNullOrEmpty(listItemDataBoundDelegate)){return }for(var i=0;i<veShapeList.length;i++){var veShape=veShapeList[i];var itemDiv=jQuery(document.createElement("div"));var id=veShape.ReferenceID;jQuery(itemDiv).attr("id",id);jQuery("#"+listParentDiv).append(itemDiv);eval(listItemDataBoundDelegate)(veShape,itemDiv)}};function KMShapeManager(b,e){var d=b;var a=e;var c=new Hashtable();this.DefaultShapeLayerID="{B3A792C8-21D8-4a9b-87FF-1C6D0B6C4D2D}";this.Debug=true;this.AddShapes=function(g,f){var l=a.GetShapeLayer(g);if(l!=null){var k=new Hashtable();if(jQuery.isArray(f)){for(var h=0;h<f.length;h++){if(!String.IsNullOrEmpty(f[h].ReferenceID)){k.put(f[h].ReferenceID,f[h])}}}else{if(!String.IsNullOrEmpty(f.ReferenceID)){k.put(f.ReferenceID,f)}}c.put(g,k);l.AddShape(f)}};this.DeleteShapes=function(f){var g=a.GetShapeLayer(f);if(g!=null){c.remove(f);g.DeleteAllShapes()}};this.DeleteShapesByGroup=function(g,m){var l=a.GetShapeLayer(g);var k=c.get(shapeLaterID);if(l!=null&&k!=null&&!String.IsNUllOrEmpty(m)){var f=this.GetShapesByGroup(g,m);
for(var h=0;h<f.length;h++){k.remove(f[h].ReferenceID);l.DeleteShape(f[h])}}};this.GetShapeByElementID=function(f){var g=null;if(f!=null){g=d.GetShapeByID(f)}return g};this.GetShapeByReferenceID=function(h,k){var f=null;if(h!=null&&k!=null){var g=c.get(h);if(g!=null){f=g.get(k)}}return f};this.GetShapesByShapeLayerID=function(g){var f=c.get(g);if(f!=null){return f.values()}return null};this.GetShapesByGroup=function(l,m){var k=c.get(l);if(k!=null&&!String.IsNUllOrEmpty(m)){var f=[];var g=k.values();for(var h=0;h<g.length;h++){if(g[h].Group==m){f.push(g[h])}}return f}return null};this.IsPointInMapView=function(f){var g=d.GetMapView();var m=g.TopLeftLatLong;var o=g.BottomRightLatLong;var n=Math.min(m.Latitude,o.Latitude);var l=Math.max(m.Latitude,o.Latitude);var h=Math.min(m.Longitude,o.Longitude);var k=Math.max(m.Longitude,o.Longitude);if(f!=null){if(f.Latitude>=n&&f.Latitude<=l&&f.Longitude>=h&&f.Longitude<=k){return true}}return false};this.UpdateShapesInMapView=function(){var k=c.values();for(var l=0;l<k.length;l++){var g=k[l].values();for(var h=0;h<g.length;h++){var f=g[h];var m=f.GetPoints();f.IsInMapView=this.IsPointInMapView(m[0])}}}}function onGeocodeClick(address1){setVal();address=address1;StartGeocoding(address)}function StartGeocoding(address){map.Find(null,address,null,null,null,null,null,null,null,null,GeocodeCallback)}function GeocodeCallback(shapeLayer,findResults,places,moreResults,errorMsg){var resHtml="";if(places==null){alert((errorMsg==null)?"There were no results":errorMsg);return }var place=places[0];var location=place.LatLong;var latitude=location.Latitude;var longitude=location.Longitude;lati=latitude;longi=longitude;var pin=new VEShape(VEShapeType.Pushpin,location);pin.SetCustomIcon("<img src='"+pushpinUrl+"'>");map.AddShape(pin)}function ShowTurnByTurn(route){setVal();var turns="";turns+="<h3>Distance:</strong> "+route.Distance.toFixed(1)+" km";if(g_ShowTravelTime){turns+="<br/><strong>Time:</strong> "+GetTime(route.Time)}turns+="</h3>";turns+="<h4><img src='"+A_ico+"'>"+jQuery("#txtStart_"+global_direction_ctr).val()+"</h4>";
var legs=route.RouteLegs;var leg=null;var turnNum=0;turns+="<ol>";for(var i=0;i<legs.length;i++){leg=legs[i];var legNum=i+1;var turn=null;var legDistance=null;var itineraryLength=leg.Itinerary.Items.length;for(var j=0;j<leg.Itinerary.Items.length;j++){var routeTurnID=g_RouteTurnIDTemplate.replace("{0}",i).replace("{1}",j);turnNum++;turn=leg.Itinerary.Items[j];var turnShape=turn.Shape;var position=turn.LatLong;var shapeIconHtml="";var padding=(turnNum<10)?"&nbsp;":"";shapeIconHtml=g_TurnIconHtmlTemplate.replace("{0}",padding+turnNum+padding);var shape=new VEShape(VEShapeType.Pushpin,turn.LatLong);shape.SetCustomIcon(shapeIconHtml);shape.SetZIndex(2003,2000);shape.Hide();g_RouteShapeLayer.AddShape(shape);turns+="<li id='{0}' routeturntroup='1' shape_id='{1}'>".replace("{0}",routeTurnID).replace("{1}",shape.guid);turns+=turn.Text;legDistance=turn.Distance;if(legDistance>0){turns+=" ("+legDistance.toFixed(1)+" km";if(g_ShowTravelTime){if(turn.Time!=null){turns+="; "+GetTime(turn.Time)}}turns+=")"}turns+="</li>"}}turns+="</ol>";turns+="<h4><img src='"+B_ico+"'>"+jQuery("#txtEnd_"+global_direction_ctr).val()+"</h4>";jQuery("[routeturntroup=1]").live("mouseover",RouteTurn_OnMouseOver);jQuery("[routeturntroup=1]").live("mouseout",RouteTurn_OnMouseOut);jQuery("[routeturntroup=1]").live("click",RouteTurn_OnClick);SetDirections(turns);$("#directionsBox_"+global_direction_ctr).show();showDirections(global_direction_ctr)}function GetDirections(){setVal();g_RouteShapeLayer.DeleteAllShapes();g_DragPointShapeLayer.DeleteAllShapes();g_DestinationShapeLayer.DeleteAllShapes();g_PointArray=[];g_NumberOfGotRoute=1;var locations=[];locations.push(jQuery("#txtStart_"+global_direction_ctr).val());if(jQuery("#useLatLongForDirections_"+global_direction_ctr).val()=="true"){var latitude=jQuery("#latitude_"+global_direction_ctr).val();var longitude=jQuery("#longitude_"+global_direction_ctr).val();var latLong=new VELatLong(latitude,longitude);locations.push(latLong)}else{locations.push(jQuery("#txtEnd_"+global_direction_ctr).val())}var options=GetRouteOptions();
map.GetDirections(locations,options)}function OnGotRoute(route){setVal();if(route.RouteLegs==null||route.RouteLegs.length==0){return }if(g_ShowTurnByTurn){ShowTurnByTurn(route)}if(g_PointArray.length==0){g_PointArray.push(route.RouteLegs[0].StartLocation);g_PointArray.push(route.RouteLegs[0].EndLocation)}if(g_NumberOfGotRoute==1){map.SetMapView(route.ShapePoints)}g_NumberOfGotRoute++;var shape=new VEShape(VEShapeType.Polyline,route.ShapePoints);shape.ReferenceID="Route";shape.SetLineColor(new VEColor(24,93,198,0.6));shape.SetLineWidth(5);shape.HideIcon();shape.SetTitle(g_RouteTitle);shape.SetZIndex(1000,2000);g_RouteShapeLayer.AddShape(shape);var startPoint=new VEShape(VEShapeType.Pushpin,route.RouteLegs[0].StartLocation);startPoint.ReferenceID="0";startPoint.SetCustomIcon(A_ico);startPoint.SetZIndex(2001,2000);g_RouteShapeLayer.AddShape(startPoint);var numLegs=route.RouteLegs.length;if(numLegs>1){for(i=1;i<=numLegs-1;i++){var wayPoint=new VEShape(VEShapeType.Pushpin,route.RouteLegs[i].StartLocation);wayPoint.ReferenceID=i;wayPoint.SetCustomIcon("<img src='"+poi_via+"'>");wayPoint.SetZIndex(2001,2000);g_RouteShapeLayer.AddShape(wayPoint);var primitiveID=wayPoint.Primitives[0].iid;jQuery("#"+primitiveID).contextMenu({menu:"myRouteContextMenu"},function(action,el,pos){RouteContextMenuAction(action,el,pos)})}}var endPoint=new VEShape(VEShapeType.Pushpin,route.RouteLegs[numLegs-1].EndLocation);endPoint.ReferenceID=numLegs;endPoint.SetCustomIcon(B_ico);endPoint.SetZIndex(2002,2000);g_RouteShapeLayer.AddShape(endPoint);map.AttachEvent("onmouseover",HandleMouseOverRoute)}function HandleMouseOverRoute(e){setValByMapElemId(e);if(e.elementID!=null){if(map.GetShapeByID(e.elementID).GetTitle().match(g_RouteTitle)){map.DetachEvent("onmouseover",HandleMouseOverRoute);var x=e.mapX;var y=e.mapY;var LL=map.PixelToLatLong(new VEPixel(x,y));g_DragPoint=new VEShape(VEShapeType.Pushpin,LL);g_DragPoint.SetCustomIcon("<img src='"+poi_via+"'>");g_DragPoint.SetZIndex(1000,2000);g_DragPointShapeLayer.AddShape(g_DragPoint);map.AttachEvent("onmousemove",HandleMouseOverRouteMove)
}}}function HandleMouseOverRouteMove(e){setValByMapElemId(e);if(e.elementID!=null){if(map.GetShapeByID(e.elementID).GetTitle().match(g_RouteTitle)){var x=e.mapX;var y=e.mapY;var LL=map.PixelToLatLong(new VEPixel(x,y));g_DragPoint.SetPoints(LL);map.AttachEvent("onmousedown",HandleMouseDown)}}else{map.DetachEvent("onmousedown",HandleMouseDown);map.DetachEvent("onmousemove",HandleMouseOverRouteMove);g_DragPointShapeLayer.DeleteAllShapes();map.AttachEvent("onmouseover",HandleMouseOverRoute)}}function HandleMouseDown(e){setValByMapElemId(e);if(e.elementID!=null&&e.leftMouseButton){map.DetachEvent("onmousemove",HandleMouseOverRouteMove);map.AttachEvent("onmousemove",HandleDragPointMove);map.AttachEvent("onmouseup",HandleMouseUp)}}function HandleDragPointMove(e){setValByMapElemId(e);var x=e.mapX;var y=e.mapY;var LL=map.PixelToLatLong(new VEPixel(x,y));g_DragPoint.SetPoints(LL);return true}function HandleMouseUp(e){setValByMapElemId(e);map.DetachEvent("onmousemove",HandleDragPointMove);map.DetachEvent("onmouseup",HandleMouseUp);if(e.leftMouseButton){var x=e.mapX;var y=e.mapY;var LL=map.PixelToLatLong(new VEPixel(x,y));g_PointArray.splice(g_PointArray.length-1,0,LL);g_DragPoint=null;g_DragPointShapeLayer.DeleteAllShapes();Reroute()}}function Reroute(){setVal();g_RouteShapeLayer.DeleteAllShapes();var options=GetRouteOptions();map.GetDirections(g_PointArray,options)}function GetRouteOptions(){var options=new VERouteOptions();options.DrawRoute=false;options.DistanceUnit=VERouteDistanceUnit.Kilometer;options.SetBestMapView=false;options.RouteCallback=OnGotRoute;return options}function SetDirections(s){var d=document.getElementById("directions_"+global_direction_ctr);d.innerHTML=s}function GetTime(time){if(time==null){return("")}if(time>60){var seconds=time%60;var minutes=time-seconds;minutes=minutes/60;if(minutes>60){var minLeft=minutes%60;var hours=minutes-minLeft;hours=hours/60;return(hours+" hour(s), "+minLeft+" minute(s), "+seconds+" second(s)")}else{return(minutes+" minutes, "+seconds+" seconds")}}else{return(time+" seconds")
}}function RouteTurn_OnMouseOver(e){setValByMapElemId(e);var id=e.srcElement.id;if(!String.IsNullOrEmpty(id)){jQuery("#"+id).removeClass().addClass("RouteTurnHoverStyle");var shape_id=jQuery("#"+id).attr("shape_id");var shape=g_RouteShapeLayer.GetShapeByID(shape_id);if(shape!=null){shape.Show()}}}function RouteTurn_OnMouseOut(e){setValByMapElemId(e);var id=e.srcElement.id;if(!String.IsNullOrEmpty(id)){jQuery("#"+id).removeClass().addClass("RouteTurnStyle");var shape_id=jQuery("#"+id).attr("shape_id");var shape=g_RouteShapeLayer.GetShapeByID(shape_id);if(shape!=null){shape.Hide()}}}function RouteTurn_OnClick(e){setValByMapElemId(e);var id=e.srcElement.id;if(!String.IsNullOrEmpty(id)){var shape_id=jQuery("#"+id).attr("shape_id");var shape=g_RouteShapeLayer.GetShapeByID(shape_id);if(shape!=null){g_mapManager.MapInstance.SetCenter(shape.GetPoints()[0])}}}function MapContextMenuAction(action,el,pos){if(action=="add_destination"){if(g_PointArray!=null&&g_PointArray.length>0){setVal();var shapeIconHtml="<img src='/images/blue_dot.gif'>";var pixel=new VEPixel(pos.x+5,pos.y+5);var shape=new VEShape(VEShapeType.Pushpin,map.PixelToLatLong(pixel));shape.SetCustomIcon(shapeIconHtml);shape.SetZIndex(2004,2000);shape.Hide();var LL=map.PixelToLatLong(pixel);g_PointArray.splice(g_PointArray.length-1,0,LL);g_DragPoint=null;g_DragPointShapeLayer.DeleteAllShapes();Reroute()}}}function RouteContextMenuAction(action,el,pos){if(action=="delete_destination"){setVal();var primitiveID=jQuery(el).attr("id");var shape=map.GetShapeByID(primitiveID);if(shape!=null){if(g_PointArray!=null&&g_PointArray.length>0){if(shape.ReferenceID>0&&shape.ReferenceID<g_PointArray.length-1){g_PointArray.splice(shape.ReferenceID,1);g_RouteShapeLayer.DeleteShape(shape);g_DragPoint=null;g_DragPointShapeLayer.DeleteAllShapes();Reroute()}}}}}function callGetDirections(ctr){$("#directionsBox_"+global_direction_ctr).hide();global_direction_ctr=ctr;setVal();GetDirections()}function hideDirections(ctr){global_direction_ctr=ctr;$("#directions_"+global_direction_ctr).slideUp(300)
}function showDirections(ctr){global_direction_ctr=ctr;$("#directions_"+global_direction_ctr).slideDown(300)}function setVal(){map=mapList[global_direction_ctr];g_RouteShapeLayer=routeShapeLayerList[global_direction_ctr];g_DragPointShapeLayer=dragPointShapeLayerList[global_direction_ctr];g_DestinationShapeLayer=destinationShapeLayerList[global_direction_ctr];g_RouteTitle=routeTitleList[global_direction_ctr]}function setValByMapElemId(e){var i;for(i=0;i<mapList.length;i++){var k=mapList[i].GetShapeByID(e.elementID);if(mapList[i].GetShapeByID(e.elementID)!=null){global_direction_ctr=i;setVal();break}}}var g_debugMode=false;var g_mapManager=null;var g_mapManager=new KMMapManager();var g_RouteShapeLayer=null;var routeShapeLayerList=new Array();var g_DragPointShapeLayer=null;var dragPointShapeLayerList=new Array();var g_DestinationShapeLayer=null;var destinationShapeLayerList=new Array();var g_PointArray=null;var g_RouteTitle="My_Route";var routeTitleList=new Array();var g_DragPoint;var g_ShowTurnByTurn=true;var g_ShowTravelTime=false;var g_RouteTurnIDTemplate="Route_Turn_{0}_{1}";var g_TurnIconHtmlTemplate="<div style=\"background-image: url('/images/turnpointPushpin.png');\" class='drivingDirectionsTurnIcon drivingDirectionsTurnListIcon'><div class='drivingDirectionsTurnIconText'>{0}</div></div>";var g_NumberOfGotRoute=0;var map=null;var mapList=new Array();var mapOptions=null;var pin=null;var global_direction_ctr=0;function InitMaps(){$('div[id^="directionsBox"]').each(function(index){$("#directionsBox_"+index).hide()});$('div[id^="mapDiv"]').each(function(index){lati=$("#mer_address_"+index+"_lati").attr("value");longi=$("#mer_address_"+index+"_longi").attr("value");InitMap($(this).attr("id"),index,lati,longi)})}function InitMap(mapDivId,indx,lati,longi){g_mapManager.Debug=false;g_mapManager.GetMap(mapDivId,lati,longi,15,null);mapList[indx]=g_mapManager.MapInstance;pin=new VEShape(VEShapeType.Pushpin,new VELatLong(lati,longi));pin.SetCustomIcon("<img src='"+pushpinUrl+"'>");mapList[indx].AddShape(pin);routeShapeLayerList[indx]=new VEShapeLayer();
mapList[indx].AddShapeLayer(routeShapeLayerList[indx]);dragPointShapeLayerList[indx]=new VEShapeLayer();mapList[indx].AddShapeLayer(dragPointShapeLayerList[indx]);destinationShapeLayerList[indx]=new VEShapeLayer();mapList[indx].AddShapeLayer(destinationShapeLayerList[indx]);routeTitleList[indx]="My_Route_"+mapDivId;jQuery("#"+mapDivId).contextMenu({menu:mapDivId+"ContextMenu"},function(action,el,pos){MapContextMenuAction(action,el,pos)})}var tw_max_word_ctr=20;var tw_curr_word_ctr=0;var tw_word_ctr_flag=false;function InitTestimonialWidget(newsHost){tw_loadTestimonial(newsHost)}function tw_loadTestimonial(newsHost){var wssid=$("#testimonial").find('input[name="wssid"]').val();var lang=$("#testimonial").find('input[name="lang"]').val();if(!wssid||!lang){tw_unavailable();return }var url=newsHost+"news/api/testimonials/latest/"+lang+"/"+wssid;try{$.ajax({type:"GET",async:true,dataType:"jsonp",timeout:5000,url:url,success:function(data,status,req){tw_render(data,newsHost)},error:function(data,status,req){tw_unavailable()}})}catch(ex){tw_unavailable()}}function tw_render(data,newsHost){var item;if(data.items&&data.items[0]){item=data.items[0];try{if(item.content){$.each(item.content.blocks,function(idx,val){tw_renderBlock(val,item.id,newsHost);if(!tw_word_ctr_flag){tw_renderName(item.name);tw_renderCompany(item.company)}if(val.image){var div=$("<div/>");$(div).addClass("clear");$("#testimonial").append(div)}})}else{tw_unavailable()}}catch(ex){tw_unavailable()}}else{tw_unavailable(1)}}function tw_renderBlock(e,tid,newsHost){if(!e){tw_unavailable()}if(e.image){tw_renderImage(e.image,newsHost)}var type=e.body.type;if(type&&type.length){if("list"==type){tw_render_list(e.body.items)}else{if("text"==type){$.each(e.body.paragraphs,function(idx,val){tw_renderParagraph(val,tid)})}}}}function tw_renderName(e){if(!e){return }var d=$("<p/>");$(d).addClass("tw-name");$(d).text("- "+e);$("#testimonial").append(d)}function tw_renderCompany(e){if(!e){return }var d=$("<p/>");$(d).addClass("tw-company");$(d).text(e);$("#testimonial").append(d)
}function tw_renderImage(e,newsHost){if(!e){tw_unavailable()}var pth=newsHost+"news/api/images/";var align=e.align;if(!(align&&align.length)){align="left"}var d=$("<div/>");$(d).attr("style","float:"+align+";");$(d).addClass(align);var img=$("<img/>");if(e.width<=100){$(img).attr("width",e.width);$(img).attr("height",e.height)}else{var ratio=e.width/100;$(img).attr("width",100);$(img).attr("height",e.height/ratio)}$(img).attr("src",pth+e.filename);$(d).append(img);$("#testimonial").append(d)}function tw_render_list_item(e){if(!e){tw_unavailable();return }var li=$("<li/>");$(li).append(e);$(s).append(li)}function tw_renderParagraph(e,tid){if(!e||!tid){tw_unavailable()}var align=e.align;if(!(align&&align.length)){align="left"}var a=$("<p/>");$(a).attr("style","text-align:"+align+";");$.each(e.parts,function(index,val){if(!tw_word_ctr_flag){tw_renderPart(a,val,tid)}else{return false}});$("#testimonial").append(a)}function tw_renderPart(parent,e,tid){if(!parent||!e||!tid){tw_unavailable();return }var tag=null;var text=e.text;if(text&&text.length){text=tw_afterCounted(text);if(e.link){if(e.linkUrl&&e.linkUrl.length){tag=tw_append_tag(tag,$("<a/>"));$(tag).attr("href",e.linkUrl);if(e.linkTarget&&e.linkTarget.length){$(tag).attr("target",e.linkTarget)}}}if(e.bold){tag=tw_append_tag(tag,$("<strong/>"))}if(e.underline){tag=tw_append_tag(tag,$("<u/>"))}if(tag){if($(tag).children().length){$(tag).find(":only-child:last").html("&#34;&nbsp;"+text+"&nbsp;&#34;")}else{$(tag).html("&#34;&nbsp;"+text+"&nbsp;&#34;")}parent.append(tag)}else{parent.append("&#34;&nbsp;"+text+"&nbsp;&#34;")}if(tw_word_ctr_flag){tw_read_more(parent,tid)}}}function tw_append_tag(parent,e){if(parent==null){return e}if($(parent).children().length>0){$(parent).find(":only-child:last").append(e)}else{$(parent).append(e)}return parent}function tw_unavailable(id){var con=$("#testimonial").parent().get(0);var p=$("<p/>");$(p).attr("id","testimonial_message");if(id&&id==1){if(tw_getLang()=="fr"){$(p).html('<p class="ssoSmallMsgBox msgRed">Aucune témoignage trouvée.</p>')
}else{$(p).html('<p class="ssoSmallMsgBox msgRed">No testminonial found.</p>')}}else{if(tw_getLang()=="fr"){$(p).html('<p class="ssoSmallMsgBox msgRed">Service n\'est pas disponible. Veuillez réessayer plus tard.</p>')}else{$(p).html('<p class="ssoSmallMsgBox msgRed">Service is not available. Please try again later.</p>')}}$(con).html("");$("#tw_button").remove();$(con).append(p)}function tw_msg_in_preview(){var con=$("#testimonial").parent().get(0);var p=$("<p/>");$(p).attr("id","testimonial_message");$(p).html('<p class="ssoSmallMsgBox msgRed">Testimonial will not be displayed in preview mode. They will be displayed when PR moves up to Customer Preview or Publish.</p>');$(con).html("");$("#tw_button").remove();$(con).append(p)}function tw_getLang(){var lang=$('#testimonial input[name="lang"]').val();if(!lang||!lang.length>0){lang="en"}return lang}function tw_read_more(parent,tid){var turl=$('#testimonial input[name="testimonialPageUrl"]').val();if(turl&&turl.length){if(isPreviewMode(turl)){var a=$("<a/>");$(a).attr("href",turl+"&tid="+tid);$(a).text("continue");parent.append(a)}else{var a=$("<a/>");$(a).attr("href",turl+"?tid="+tid);$(a).text("continue");parent.append(a)}}}function isPreviewMode(url){var re=/preview/g;if(re.test(url)){return true}else{return false}}function tw_afterCounted(str){if(str&&str.length){var i=$.trim(str).split(" ").length;if(tw_curr_word_ctr+i>tw_max_word_ctr){tw_word_ctr_flag=true;return tw_getWords(tw_curr_word_ctr+i-tw_max_word_ctr,str)+"..."}else{tw_curr_word_ctr=tw_curr_word_ctr+i;return str}}}function tw_getWords(ctr,str){var tmp="";$.each($.trim(str).split(" "),function(index,val){tmp=tmp.concat(" ",val);if(index+1>=ctr){return false}});return tmp};
