// (c)2009 CoachR

var YSAJAX={};YSAJAX.SESSION_NAME="";YSAJAX.bShowURL=isDefined("DEBUG_MODE",true)?DEBUG_MODE:true;YSAJAX.fnDefaultCallback=null;YSAJAX.objDefaultCallback=null;YSAJAX.MAX_GETLENGTH=2048;YSAJAX.cancelRequest=function(_1){if(_1!=null){_1.stopped=true;if(_1.xmlhttp!=null){_1.xmlhttp.abort();}
_1.xmlhttp=null;}};YSAJAX.createXMLHttpRequest=function(){var _2=null;if(window.XMLHttpRequest){try{_2=new XMLHttpRequest();}
catch(e){}}else{if(window.ActiveXObject){for(var i=6;i>0&&_2==null;i--){try{if(i==2){_2=new ActiveXObject("Microsoft.XMLHTTP");}else{_2=new ActiveXObject("Msxml2.XMLHTTP."+i+".0");}}
catch(e){_2=null;}}}}
if(!_2){alert("Your browser doesn't support AJAX communications...");}
return _2;};YSAJAX.getXML=function(_4){if(_4.responseXML&&_4.responseXML.documentElement){return _4.responseXML.documentElement;}else{return null;}};YSAJAX.onFormSubmit=function(_5,_6,_7,_8,_9){_5=YSDOM.getObj(_5);if(!isDefined(_8)){_8=window;}
YSAJAX.sendRequest(_6,YSAJAX.getFormParams(_5,""),true,_7,_8,_9);};YSAJAX.sendRequest=function(_a,_b,_c,_d,_e,_f){if(!isDefined(_b)){_b=null;}
if(!isDefined(_c)){_c=false;}
if(!isDefined(_d)){_d=null;}
if(!isDefined(_e)){_e=window;}
if(!isDefined(_f)){_f=null;}
if(_a==null){if(location.pathname==""){_a="/";}else{_a=location.pathname.substr(location.pathname.lastIndexOf("/")+1);}}
if(YSAJAX.SESSION_NAME!=""){var _10=YSCookie.read(YSAJAX.SESSION_NAME);if(_10){_a+=(_a.indexOf("?")==-1?"?":"&");_a+=YSAJAX.SESSION_NAME+"="+_10;}}
var _11={xmlhttp:YSAJAX.createXMLHttpRequest(),stopped:false};if(_b==null||_b==""||typeof _b!="string"){_b="";}else{if(_b[_b.length-1]!="&"){_b+="&";}}
_b+="fw_nocache="+YSDateTime.getCurTime()+"&ajax=";if(!_c){if(_a.length+_b.length+1>YSAJAX.MAX_GETLENGTH){_c=true;YSLog.write("GET IS TOO LONG: "+(_a.length+_b.length+1)+"; send via POST");}else{if(_a.indexOf("?")==-1){_a+="?"+_b;}else{_a+="&"+_b;}}}
if(YSAJAX.bShowURL){YSLog.writeText(_a+(_c?(_a.indexOf("?")==-1?"?":"&")+_b:"")+"\n"+"url length: "+_a.length);}
try{_11.xmlhttp.open((_c?"POST":"GET"),_a,true);_11.xmlhttp.onreadystatechange=function(){if(_11.xmlhttp.readyState==4){if(!_11.stopped){if(YSAJAX.fnDefaultCallback==null){if(_11.xmlhttp.status==403){YSDOM.refreshPage();}else{if(_d){_d.call(_e,_11.xmlhttp,_f);}}}else{YSAJAX.fnDefaultCallback.call(YSAJAX.objDefaultCallback,_d,_e,_11.xmlhttp,_f);}}else{YSLog.write("Request Cancelled");}
try{_11.xmlhttp.onreadystatechange=null;}
catch(e){}
_11.xmlhttp=null;_11=null;}};if(_c){_11.xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");if(!bSafari&&!bChrome){_11.xmlhttp.setRequestHeader("Content-length",_b.length);}}
if(!bSafari&&!bChrome){_11.xmlhttp.setRequestHeader("Connection","close");}
_11.xmlhttp.send((_c?_b:null));}
catch(e){YSLog.write("sendRequest error: "+YSDebug.print_r(e,true));}
return _11;};YSAJAX.setDefaultCallback=function(_12,_13){if(!isDefined(_13)){_13=window;}
YSAJAX.fnDefaultCallback=_12;YSAJAX.objDefaultCallback=_13;};YSAJAX.showRequestURLs=function(_14){YSAJAX.bShowURL=_14==true;};YSConfirm.YES_NO=1;YSConfirm.OK=2;YSConfirm.iZIndex=1000;function YSConfirm(sID,_16,_17,sNo,_19,_1a,_1b,_1c,_1d){this.sID=sID;this.sQuestion=YSString.trim(_16);this.sYes=_17;this.sNo=sNo;this.fnCallback=isDefined(_19)?_19:null;this.objCallback=isDefined(_1a)?_1a:window;this.eCenterElement=isDefined(_1b)?_1b:null;this.iType=isDefined(_1c)?_1c:YSConfirm.YES_NO;this.oCallbackParam=isDefined(_1d)?_1d:null;this.divPopup=null;this.divOverlay=null;this.divTopBar=null;this.btnNo=null;this.btnYes=null;YSConfirm.iZIndex++;this.createConfirm();};YSConfirm.CreateAlert=function(_1e,sOK,_20){if(!isDefined(sOK)){sOK="OK";}
new YSConfirm("alert",_1e,sOK,"",null,null,_20,YSConfirm.OK);};YSConfirm.CreateLinkConfirm=function(_21,_22,_23,sNo,_25,_26){if(!isDefined(_26)){_26=null;}
new YSConfirm("linkconfirm",_21,_23,sNo,YSConfirm.OnLinkConfirm,window,_25,YSConfirm.YES_NO,{sLink:_22,objCaller:_26});};YSConfirm.OnLinkConfirm=function(sID,_28,_29,e){if(_28){document.location.href=_29.sLink;}
if(_29.objCaller&&_29.objCaller.onconfirmresult){_29.objCaller.onconfirmresult(_28,e);}};YSConfirm.prototype.destruct=function(){YSMoveElement.unsetDraggable(this.divTopBar);YSEventHandler.Instance().removeHandler(this.btnYes,"onclick",YSConfirm.prototype.onClickYes,this);if(this.iType==YSConfirm.YES_NO){YSEventHandler.Instance().removeHandler(this.btnNo,"onclick",YSConfirm.prototype.onClickNo,this);}
this.divOverlay=this.divPopup=this.divTopBar=this.fnCallback=this.objCallback=this.eCenterElement=this.oCallbackParam=this.btnYes=this.btnNo=null;};YSConfirm.prototype.close=function(_2b,e){YSDOM.removeElement(this.divPopup);YSDOM.removeElement(this.divOverlay);if(this.fnCallback){this.fnCallback.call(this.objCallback,this.sID,_2b,this.oCallbackParam,e);}
this.destruct();};YSConfirm.prototype.createConfirm=function(){var _2d=YSDOM.getBodySize();this.divOverlay=document.createElement("div");YSCSS.setTransparency(this.divOverlay,60);YSCSS.setMultiStyle(this.divOverlay,["width","height","position","top","left","backgroundColor","zIndex","display"],[_2d.width+"px",_2d.height+"px","absolute","0px","0px","white",YSConfirm.iZIndex,"none"]);document.body.appendChild(this.divOverlay);YSCSS.setStyle(this.divOverlay,"display","block");this.divPopup=document.createElement("div");this.divPopup.className="fw_confirmpopup";YSCSS.setMultiStyle(this.divPopup,["visibility","position","zIndex"],["hidden","absolute",YSConfirm.iZIndex+1]);this.divTopBar=document.createElement("div");this.divTopBar.className="fw_confirmtopbar";this.divPopup.appendChild(this.divTopBar);var _2e=document.createElement("div");_2e.className="fw_confirmquestion";this.divPopup.appendChild(_2e);var _2f=document.createElement("p");_2f.innerHTML=this.sQuestion;_2e.appendChild(_2f);var _30=document.createElement("div");YSCSS.setStyle(_30,"textAlign","center");_2e.appendChild(_30);this.btnYes=document.createElement("button");this.btnYes.className="fw_confirmyes";this.btnYes.innerHTML=this.sYes;_30.appendChild(this.btnYes);if(this.iType==YSConfirm.YES_NO){this.btnNo=document.createElement("button");this.btnNo.className="fw_confirmno";this.btnNo.innerHTML=this.sNo;_30.appendChild(this.btnNo);}
document.body.appendChild(this.divPopup);YSEventHandler.Instance().addHandler(this.btnYes,"onclick",YSConfirm.prototype.onClickYes,this);if(this.iType==YSConfirm.YES_NO){YSEventHandler.Instance().addHandler(this.btnNo,"onclick",YSConfirm.prototype.onClickNo,this);}
YSMoveElement.setDraggable(this.divPopup,this.divTopBar);var _31=YSDOM.setToCenter(this.divPopup,null,this.eCenterElement);if(!YSDOM.isInSight(this.divPopup,-1,_31)){YSDOM.setToCenter(this.divPopup,null,null);}
YSCSS.setStyle(this.divPopup,"visibility","visible");YSDOM.setFocus(this.btnYes);};YSConfirm.prototype.onClickNo=function(e){this.close(false,e);};YSConfirm.prototype.onClickYes=function(e){this.close(true,e);};var YSCookie={};YSCookie.create=function(_34,_35,_36,_37){if(!isDefined(_36)){_36=0;}
if(!isDefined(_37)){_37=false;}
var _38="";if(!_36){_36=2147483647;_37=true;}
var _39=new Date();if(_37){_39.setTime(_36*1000);}else{_39.setTime(_39.getTime()+(_36*24*60*60*1000));}
_38="; expires="+_39.toGMTString();document.cookie=escape(_34)+"="+escape(_35)+_38+"; path=/";};YSCookie.read=function(_3a){var _3b=_3a+"=";var _3c=YSCookie.getAll();if(isDefined(_3c[_3a])){return _3c[_3a];}else{return null;}};YSCookie.getAll=function(){var _3d=document.cookie.split(";");var _3e={};for(var i=0;i<_3d.length;i++){var _40=_3d[i].split("=");_3e[String(unescape(_40[0])).trim()]=unescape(_40[1]);}
return _3e;};YSCookie.erase=function(_41){YSCookie.create(_41,"",-1);};var YSCSS={};YSCSS.addClassName=function(obj,_43){obj=YSDOM.getObj(obj);if(obj==null||_43==null){return;}
if(!YSCSS.hasClassName(obj,_43)){if(obj.className){obj.className=obj.className+" "+_43;}else{obj.className=_43;}}};YSCSS.getBorderBottom=function(_44){return YSCSS.getStyle(_44,"borderBottomWidth",true);};YSCSS.getBorderLeft=function(_45){return YSCSS.getStyle(_45,"borderLeftWidth",true);};YSCSS.getBorderRight=function(_46){return YSCSS.getStyle(_46,"borderRightWidth",true);};YSCSS.getBorderTop=function(_47){return YSCSS.getStyle(_47,"borderTopWidth",true);};YSCSS.getCustomCursor=function(_48,_49,_4a){if(!isDefined(_49)){_49=new Pixel(0,0);}
if(!isDefined(_4a)){_4a="default";}
var _4b="url(\""+_48+"\")";if(bSafari||bChrome){_4b+=" "+_49.left+" "+_49.top;}
_4b+=", "+_4a;return _4b;};YSCSS.getInnerHeight=function(_4c){return YSCSS.getStyle(_4c,"height",true)-YSCSS.getStyle(_4c,"paddingTop",true)-YSCSS.getStyle(_4c,"paddingBottom",true);};YSCSS.getStyle=function(obj,_4e,_4f){obj=YSDOM.getObj(obj);if(!obj){return null;}
if(!isDefined(_4f)){_4f=false;}
var _50=0;if(_4f){if(_4e=="width"){_50=obj.offsetWidth;}
if(_4e=="height"){_50=obj.offsetHeight;}
if(_50){return _50;}}
_50=obj.style[_4e];if(!_50||_50=="auto"){if(document.defaultView){var css=document.defaultView.getComputedStyle(obj,null);_50=css.getPropertyValue(_4e)||css[_4e];}
if(!_50&&obj.currentStyle){_50=obj.currentStyle[_4e];}
if(!_50&&obj.runtimeStyle){_50=obj.runtimeStyle[_4e];}}
if((typeof _50).toLowerCase()=="string"){_50=_50.toLowerCase();}
if(_4f){var _52=false;if(_50&&_50.substr(_50.length-1,1)=="%"){_52=true;}
_50=parseInt(_50);if(isNaN(_50)){_50=0;if(_4e=="width"){_50=obj.offsetWidth;}
if(_4e=="height"){_50=obj.offsetHeight;}}else{if(_52&&obj.parentNode){_50=_50/100*YSCSS.getStyle(obj.parentNode,_4e,true);}}}
return!isDefined(_50)?null:_50;};YSCSS.hasClassName=function(obj,_54){obj=YSDOM.getObj(obj);if(obj==null){return false;}else{var _55=String(obj.className);return _55.indexOf(_54)!=-1;}};YSCSS.isVisible=function(obj){obj=YSDOM.getObj(obj);if(!obj){return false;}
while(obj.tagName.toLowerCase()!="body"&&YSCSS.getStyle(obj,"display")!="none"&&YSCSS.getStyle(obj,"visibility")!="hidden"){obj=obj.parentNode;}
if(obj.tagName.toLowerCase()=="body"){return true;}else{return false;}};YSCSS.loadCSS=function(_57){var _58=document.getElementsByTagName("head")[0];var _59=document.createElement("link");_59.setAttribute("href",_57);_59.setAttribute("rel","stylesheet");_59.setAttribute("type","text/css");_58.appendChild(_59);};YSCSS.removeClassName=function(obj,_5b){obj=YSDOM.getObj(obj);if(obj==null){return;}
if(YSCSS.hasClassName(obj,_5b+" ")){_5b+=" ";}else{if(YSCSS.hasClassName(obj," "+_5b)){_5b=" "+_5b;}}
YSCSS.replaceClassName(obj,_5b,"");};YSCSS.replaceClassName=function(obj,_5d,_5e){obj=YSDOM.getObj(obj);if(!obj||!obj.className){return;}
var _5f=String(obj.className);_5f=_5f.replace(new RegExp(_5d,"g"),_5e);obj.className=_5f;};YSCSS.replaceClassNameRecursive=function(obj,_61,_62){obj=YSDOM.getObj(obj);YSCSS.replaceClassName(obj,_61,_62);for(var i=0;i<obj.childNodes.length;i++){YSCSS.replaceClassNameRecursive(obj.childNodes[i],_61,_62);}};YSCSS.setClassName=function(obj,_65){var obj=YSDOM.getObj(obj);if(!obj){return;}
obj.className=_65;};YSCSS.setCustomCursor=function(obj,_67,_68,_69){YSCSS.setStyle(obj,"cursor",YSCSS.getCustomCursor(_67,_68,_69));};YSCSS.setMultiStyle=function(obj,_6b,_6c){if(!YSList.isArray(obj)){obj=[obj];}
for(var i=0,_6e=obj.length;i<_6e;i++){var _6f=YSDOM.getObj(obj[i]);for(var j=0,_71=_6b.length;j<_71;j++){if(isDefined(_6b[j])&&isDefined(_6c[j])){YSCSS.setStyle(_6f,_6b[j],_6c[j]);}}}};YSCSS.setStyle=function(obj,_73,_74){obj=YSDOM.getObj(obj);if(obj!=null&&isDefined(obj.style)){if(_73.toLowerCase()=="float"){if(bIE){_73="styleFloat";}else{_73="cssFloat";}}
try{obj.style[_73]=_74;}
catch(e){YSLog.write(obj.id+": "+_73+"="+_74);YSDebug.print_r(e);}}};YSCSS.setStyleRecursive=function(obj,_76,_77){obj=YSDOM.getObj(obj);YSCSS.setStyle(obj,_76,_77);for(var i=0;i<obj.childNodes.length;i++){YSCSS.setStyleRecursive(obj.childNodes[i],_76,_77);}};YSCSS.setTransparency=function(obj,_7a){_7a=100-_7a;if(bIE){if(_7a==100){YSCSS.setStyle(obj,"filter","");}else{YSCSS.setStyle(obj,"filter","alpha(opacity="+_7a+")");}}else{if(_7a==100){YSCSS.setStyle(obj,"MozOpacity","");YSCSS.setStyle(obj,"opacity","");}else{YSCSS.setStyle(obj,"MozOpacity",_7a/100);YSCSS.setStyle(obj,"opacity",_7a/100);}}};YSCSS.swapClassName=function(obj,_7c,_7d){if(obj==null){return;}
if(YSCSS.hasClassName(obj,_7c)){YSCSS.replaceClassName(obj,_7c,_7d);}else{YSCSS.replaceClassName(obj,_7d,_7c);}};var YSDateTime={};YSDateTime.getCurTime=function(){return(new Date()).getTime();};YSDateTime.getTimeString=function(_7e,_7f){if(!isDefined(_7f)||_7f){return YSNumbers.padDigits(Math.floor(_7e/3600),2)+":"+YSNumbers.padDigits(Math.floor(_7e%3600/60),2)+":"+YSNumbers.padDigits(Math.floor(_7e%60),2);}else{return YSNumbers.padDigits(Math.floor(_7e/60),2)+":"+YSNumbers.padDigits(Math.floor(_7e%60),2);}};YSDateTime.getTZOffset=function(){return(new Date()).getTimezoneOffset()*-60;};var YSDebug={};YSDebug.print_r=function(obj,_81){if(_81){return"";}};function Pixel(_82,_83){if(!isDefined(_82)||_82==null){_82=0;}
if(!isDefined(_83)||_83==null){_83=0;}
this.left=_82;this.top=_83;};function Size(_84,_85){if(!isDefined(_84)||_84==null){_84=0;}
if(!isDefined(_85)||_85==null){_85=0;}
this.width=_84;this.height=_85;};Size.prototype.swap=function(){var _86=this.width;this.width=this.height;this.height=_86;};var YSDOM={};YSDOM.iDestructStart=0;YSDOM.addOnFocusBlur=function(_87){if(!isDefined(_87)){_87=document.body;}else{_87=YSDOM.getObj(_87);}
var _88=_87.getElementsByTagName("a");for(var i in _88){_88[i].onfocus=function(e){if(YSDOM.blurLink){return YSDOM.blurLink(e,this);}};}};YSDOM.addRecursiveToID=function(_8b,_8c){if(_8b.id){_8b.id+=_8c;}
for(var i=0;i<_8b.childNodes.length;i++){YSDOM.addRecursiveToID(_8b.childNodes.item(i),_8c);}
return _8b;};YSDOM.blurLink=function(e,obj){obj.blur();};YSDOM.cutOffElementText=function(_90,_91,_92){_90=YSDOM.getObj(_90);if(_90.innerHTML.length>_91){_90.title=_92||_90.innerHTML;_90.innerHTML=_90.innerHTML.substr(0,_91-3)+"...";return true;}else{return false;}};YSDOM.destructChilds=function(_93){_93=YSDOM.getObj(_93);if(!_93){return;}
var _94=_93.childNodes;if(_94){for(var i=0,_96=_94.length;i<_96;i++){YSDOM.destructElement(_94[i]);}}};YSDOM.destructElement=function(_97){_97=YSDOM.getObj(_97);if(!_97){return;}
if(_97==document.body){YSDOM.iDestructStart=(new Date()).getTime();}
var _98=_97.attributes,i,_9a,_9b;if(_98){_9a=_98.length;for(i=0;i<_9a;i++){if(!_98[i]){continue;}
_9b=_98[i].name;if(typeof _97[_9b]==="function"){_97[_9b]=null;}}}
if(YSDOM.iDestructStart==0||(new Date()).getTime()-YSDOM.iDestructStart<2000){YSDOM.destructChilds(_97);}};YSDOM.destructObject=function(obj){if(obj&&typeof obj=="object"){try{for(var _9d in obj){YSDOM.destructObject(obj[_9d]);obj[_9d]=null;}}
catch(e){}}};YSDOM.executeJS=function(_9e){if(YSString.isString(_9e)&&_9e.indexOf("<")!=-1){var oJS={sHTML:_9e,sJS:""};YSDOM.stripJS(oJS);if(oJS.sJS){eval(oJS.sJS);}}else{_9e=YSDOM.getObj(_9e);if(!_9e){return;}
var _a0=_9e.getElementsByTagName("script");for(var i=0;i<_a0.length;i++){eval(_a0[i].innerHTML);}}};YSDOM.hasParent=function(_a2,_a3){if(!_a2){return;}
_a2=YSDOM.getObj(_a2);try{while(_a2.parentNode&&_a2!=document.body){if(_a2.parentNode==_a3){return true;}
_a2=_a2.parentNode;}}
catch(e){}
return false;};YSDOM.findParent=function(_a4,_a5){while(_a4.parentNode&&_a4!=document.body){if(_a4.parentNode.tagName.toLowerCase()==_a5.toLowerCase()){return _a4.parentNode;}
_a4=_a4.parentNode;}
return null;};YSDOM.getBodySize=function(){var _a6=YSDOM.getWindowSize();var _a7=YSDOM.getElementSize(document.body);var _a8=YSDOM.getElementSize(document.body.firstChild);var _a9=YSDOM.getScrollSize();var _aa=Math.max(_a6.width,Math.max(_a7.width,Math.max(_a8.width,_a9.width)));var _ab=Math.max(_a6.height,Math.max(_a7.height,Math.max(_a8.height,_a9.height)));return new Size(_aa,_ab);};YSDOM.getCmbValue=function(_ac){_ac=YSDOM.getObj(_ac);if(_ac){var _ad=_ac.getElementsByTagName("option");for(var i=0;i<_ad.length;i++){if(_ad[i].selected){return YSString.trim(_ad[i].innerHTML);}}}else{return"";}};YSDOM.getDocumentScroll=function(){var _af=new Pixel();_af.left=document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;_af.top=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;return _af;};YSDOM.getElementAttribute=function(_b0,_b1){_b0=YSDOM.getObj(_b0);return YSXML.getAttribute(_b0,_b1);};YSDOM.getElementPosition=function(_b2){_b2=YSDOM.getObj(_b2);if(!_b2){return new Pixel();}
var _b3=_b2.offsetLeft;var _b4=_b2.offsetTop;var _b5=_b2.offsetParent;while(_b5!=null){_b3+=_b5.offsetLeft;_b4+=_b5.offsetTop;if(bSafari&&YSCSS.getStyle(_b5,"position")=="relative"){_b3+=YSCSS.getStyle(_b5,"borderLeftWidth",true);_b4+=YSCSS.getStyle(_b5,"borderTopWidth",true);}
_b5=_b5.offsetParent;}
return new Pixel(_b3,_b4);};YSDOM.getElementSize=function(_b6,_b7){var _b8=new Size(YSCSS.getStyle(_b6,"width",true),YSCSS.getStyle(_b6,"height",true));if(!_b7){_b8.height-=YSCSS.getStyle(_b6,"borderTopWidth",true)+YSCSS.getStyle(_b6,"borderBottomWidth",true);_b8.width-=YSCSS.getStyle(_b6,"borderLeftWidth",true)+YSCSS.getStyle(_b6,"borderRightWidth",true);}
return _b8;};YSDOM.getIFrame=function(_b9){try{var _ba=typeof _b9=="string"?(document.frames?document.frames[_b9]:YSDOM.getObj(_b9)):_b9;if(_ba){return _ba.window||_ba.contentWindow;}else{return null;}}
catch(e){return null;}};YSDOM.getIFrameXML=function(_bb){var _bc=YSDOM.getIFrame(_bb);if(_bc!=null){if(_bc.document){if(_bc.document.XMLDocument&&_bc.document.XMLDocument.documentElement){return _bc.document.XMLDocument.documentElement;}
if(_bc.document.documentElement){return _bc.document.documentElement;}}}
return null;};YSDOM.getMouseEventDiv=function(_bd,_be){_bd=YSDOM.getObj(_bd);if(!_bd){return;}
if(!isDefined(_be)){_be=false;}
if(!_be){var _bf=YSCSS.getStyle(_bd,"position");if(_bf!="relative"&&_bf!="absolute"){YSCSS.setStyle(_bd,"position","relative");}}
var _c0=YSDOM.getElementSize(_bd);var _c1=document.createElement("div");YSCSS.setStyle(_c1,"position","absolute");var _c2=new Pixel();if(_be){_c2=YSDOM.getElementPosition(_bd);}
YSCSS.setMultiStyle(_c1,["left","top","width","height","zIndex","backgroundColor"],[_c2.left+"px",_c2.top+"px",_c0.width+"px",_c0.height+"px","101","white"]);YSCSS.setTransparency(_c1,100);if(_be){document.body.appendChild(_c1);}else{_bd.appendChild(_c1);}
return _c1;};YSDOM.getObj=function(sID){if(YSString.isString(sID)){return document.getElementById(sID);}else{return sID;}};YSDOM.getRadioValue=function(_c4){var _c5=document.getElementsByName(_c4);if(!_c5||_c5.length==0){_c5=[YSDOM.getObj(_c4)];if(_c5[0]==null){return null;}}
for(var i=0,_c7=_c5.length;i<_c7;i++){if(_c5[i].checked){return _c5[i].value;}}
return null;};YSDOM.getRelativePosition=function(_c8,_c9){var _ca=YSDOM.getElementPosition(_c8);var _cb=YSDOM.getElementPosition(_c9);return new Pixel(_ca.left-_cb.left,_ca.top-_cb.top);};YSDOM.getScrollSize=function(){var _cc=new Size();if(document.body.scrollWidth){_cc.width=document.body.scrollWidth;}
if(document.body.scrollHeight){_cc.height=document.body.scrollHeight;}
return _cc;};YSDOM.getValidCopy=function(_cd){var _ce=_cd.cloneNode(true);if(_cd.id){return YSDOM.addRecursiveToID(_ce,"_copy");}else{return _ce;}};YSDOM.getValue=function(_cf,_d0){if(!isDefined(_d0)){_d0=false;}
_cf=YSDOM.getObj(_cf);if(!_cf){return"";}
var _d1="";if(isDefined(_cf.value)){_d1=_cf.value;}else{if(isDefined(_cf.innerHTML)){_d1=_cf.innerHTML;}}
_d1=YSString.trim(_d1);return _d0?YSString.encodeHtml(_d1):_d1;};YSDOM.getWindowSize=function(){if(isDefined(window.innerWidth)&&isDefined(window.innerHeight)){return new Size(window.innerWidth,window.innerHeight);}else{return new Size(document.documentElement.clientWidth||document.body.clientWidth||document.body.scrollWidth,document.documentElement.clientHeight||document.body.clientHeight||document.body.scrollHeight);}};YSDOM.insertAfter=function(_d2,_d3){_d2=YSDOM.getObj(_d2);var _d4=_d2.parentNode;if(_d4){if(_d4.lastchild==_d2){_d4.appendChild(_d3);}else{_d4.insertBefore(_d3,_d2.nextSibling);}}};YSDOM.isInSight=function(_d5,_d6,_d7,_d8){if(!isDefined(_d6)){_d6=-1;}
if(!isDefined(_d7)){_d7=YSDOM.getElementPosition(_d5);}
if(!isDefined(_d8)){_d8=YSDOM.getElementSize(_d5,true);}
var _d9=YSDOM.getWindowSize();var _da=YSDOM.getDocumentScroll();var _db=_da.left;var _dc=_da.top;var _dd=_db+_d9.width;var _de=_dc+_d9.height;if(_d6==-1){return _d7.left>_db&&_d7.top>_dc&&_d7.left+_d8.width<_dd&&_d7.top+_d8.height<_de;}else{return _d7.left+_d8.width>_db+_d6&&_d7.top+_d8.height>_dc+_d6&&_d7.left<_dd-_d6&&_d7.top<_de-_d6;}};YSDOM.posAboveElement=function(_df,_e0,_e1){if(!isDefined(_e1)){_e1=0;}
var _e2=YSDOM.getElementPosition(_e0);var _e3=YSDOM.getElementSize(_e0,true);_e3.width-=_e1;_e3.height-=_e1;_e2.top+=_e1/2;_e2.left+=_e1/2;return YSDOM.posWithinBounds(_df,_e2.left,_e2.top,_e3.width,_e3.height);};YSDOM.posWithinBounds=function(_e4,_e5,_e6,_e7,_e8){return!(_e4.left<_e5||_e4.left>_e5+_e7||_e4.top<_e6||_e4.top>_e6+_e8);};YSDOM.pushElement=function(_e9,_ea){_e9=YSDOM.getObj(_e9);if(!_e9){return;}
if(_e9.childNodes.length>0){_e9.insertBefore(_ea,childNodes[0]);}else{_e9.appendChild(_ea);}};YSDOM.refreshPage=function(){location.href=location.pathname+location.hash;};YSDOM.removeElement=function(_eb,_ec){_eb=YSDOM.getObj(_eb);if(!_eb){return false;}
if(!_eb.parentNode){return false;}
try{if(!isDefined(_ec)||_ec){YSDOM.destructElement(_eb);}
_eb.parentNode.removeChild(_eb);return true;}
catch(e){return false;}};YSDOM.removeElementChilds=function(_ed,_ee){if(!isDefined(_ee)){_ee=true;}
_ed=YSDOM.getObj(_ed);if(!_ed||!_ed.childNodes){if(_ed&&_ed.innerHTML){_ed.innerHTML="";}
return;}
while(_ed.childNodes.length>0){if(_ee){YSDOM.destructElement(_ed.childNodes[0]);}
_ed.removeChild(_ed.childNodes[0]);}
_ed.innerHTML="";};YSDOM.removeHiddenElements=function(_ef){_ef=YSDOM.getObj(_ef);for(var i=0;i<_ef.childNodes.length;i++){if(!isDefined(_ef.childNodes[i].tagName)){continue;}
if(!YSCSS.isVisible(_ef.childNodes[i])&&!YSCSS.hasClassName(_ef.childNodes[i],"tinyMCETextarea")&&_ef.childNodes[i].getAttribute("type")!="hidden"){if(YSDOM.removeElement(_ef.childNodes[i])){i--;}else{YSDOM.removeHiddenElements(_ef.childNodes[i]);}}}};YSDOM.removeLastChild=function(_f1,_f2){_f1=YSDOM.getObj(_f1);if(!_f1){return;}
var _f3=_f1.childNodes.length;if(_f3==0){return;}
var _f4=_f1.childNodes[_f3-1];if(!isDefined(_f2)||_f2){YSDOM.destructElement(_f4);}
_f1.removeChild(_f4);};YSDOM.replaceElement=function(_f5,_f6){_f5.parentNode.insertBefore(_f6,_f5);YSDOM.removeElement(_f5);};YSDOM.setElementAttribute=function(_f7,_f8,_f9){_f7=YSDOM.getObj(_f7);YSXML.setAttribute(_f7,_f8,_f9);};YSDOM.setFocus=function(_fa){_fa=YSDOM.getObj(_fa);if(!_fa){return;}
try{_fa.focus();}
catch(e){YSDebug.print_r(e);}
if(_fa.createTextRange){try{var _fb=_fa.createTextRange();_fb.moveStart("character",_fa.value.length);_fb.collapse();_fb.select();}
catch(e){}}};YSDOM.setInnerHTML=function(obj,_fd){obj=YSDOM.getObj(obj);if(!obj){return;}
var oJS={sHTML:_fd,sJS:""};YSDOM.stripJS(oJS);obj.innerHTML=oJS.sHTML;if(oJS.sJS){eval(oJS.sJS);}};YSDOM.setPosition=function(obj,oPos){YSCSS.setMultiStyle(obj,["left","top"],[Math.round(oPos.left)+"px",Math.round(oPos.top)+"px"]);};YSDOM.setRadioValue=function(_101,_102){var _103=document.getElementsByName(_101);if(!_103||_103.length==0){_103=[YSDOM.getObj(_101)];if(_103[0]==null){return;}}
for(var i=0,_105=_103.length;i<_105;i++){_103[i].checked=(_103[i].value==_102);}};YSDOM.setSize=function(obj,_107){if(_107.width!=null){var _108=_107.width-YSCSS.getStyle(obj,"paddingLeft",true)-YSCSS.getStyle(obj,"paddingRight",true)-YSCSS.getStyle(obj,"borderLeftWidth",true)-YSCSS.getStyle(obj,"borderRightWidth",true);YSCSS.setStyle(obj,"width",Math.round(_108)+"px");}
if(_107.height!=null){var _109=_107.height-YSCSS.getStyle(obj,"paddingTop",true)-YSCSS.getStyle(obj,"paddingBottom",true)-YSCSS.getStyle(obj,"borderTopWidth",true)-YSCSS.getStyle(obj,"borderBottomWidth",true);YSCSS.setStyle(obj,"height",Math.round(_109)+"px");}};YSDOM.setToCenter=function(_10a,_10b,_10c){var _10d;if(_10c&&_10c!=window){var _10e=YSDOM.getElementSize(_10c);var _10f=YSDOM.getElementPosition(_10c);_10d=new Pixel(_10e.width*0.5+_10f.left,_10e.height*0.5+_10f.top);}else{var _110=YSDOM.getWindowSize();_10d=new Pixel(_110.width*0.5,_110.height*0.5+YSDOM.getDocumentScroll().top);}
var _111=_10b||YSDOM.getElementSize(_10a);var oPos=new Pixel(_10d.left-_111.width*0.5,_10d.top-_111.height*0.5);YSDOM.setPosition(_10a,oPos);return oPos;};YSDOM.setValue=function(_113,_114){_113=YSDOM.getObj(_113);if(_113){if(isDefined(_113.value)){_113.value=_114;}else{if(isDefined(_113.innerHTML)){_113.innerHTML=_114;}}}};YSDOM.stripJS=function(_115){_115.sJS="";var _116=_115.sHTML;var _117;var _118="<script type=\"text/javascript\">";var iPos=-1,_11a=-1;while((iPos=_116.indexOf(_118,iPos))!=-1){iPos+=_118.length;_11a=_116.indexOf("</script>",iPos);if(_11a!=-1){_115.sJS+=_116.substring(iPos,_11a);iPos-=_118.length;_116=_116.substr(0,iPos)+_116.substr(_11a+9);}}
_115.sHTML=_116;};YSDOM.truncate=function(_11b,_11c){_11b=YSDOM.getObj(_11b);if(_11b){var _11d=YSXML.getFirstTextNode(_11b);if(_11d&&_11d.nodeValue.length>_11c){_11b.title=_11d.nodeValue;_11d.nodeValue=_11d.nodeValue.substr(0,_11c-3)+"...";}}};function DTC(){this.aElements=new Array();};DTC.prototype.getDTC=function(sID){var obj=YSDOM.getObj(sID);if(obj&&isDefined(this.aElements[obj.id])){return this.aElements[sID].sDTC;}else{return"";}};DTC.prototype.onResetField=function(sID){var obj=YSDOM.getObj(sID);if(obj&&isDefined(this.aElements[obj.id])){YSCSS.addClassName(obj,this.aElements[obj.id].sSCN);obj.value=this.aElements[obj.id].sDTC;}};DTC.prototype.onBlur=function(e,obj){if(obj.value==""&&isDefined(this.aElements[obj.id])){YSCSS.addClassName(obj,this.aElements[obj.id].sSCN);obj.value=this.aElements[obj.id].sDTC;}};DTC.prototype.onFormSubmit=function(frm){for(var sID in this.aElements){var obj=YSDOM.getObj(sID);if(obj&&YSDOM.hasParent(obj,frm)&&this.aElements[sID].sDTC==obj.value){obj.value="";}}};DTC.prototype.onFocus=function(e,obj){if(this.aElements[obj.id].sDTC==obj.value){obj.value="";}
if(this.aElements[obj.id].sSCN){YSCSS.removeClassName(obj,this.aElements[obj.id].sSCN);}};DTC.prototype.setDTC=function(sID,_12a,_12b){if(!isDefined(_12b)){_12b=null;}
this.aElements[sID]={sDTC:_12a,sSCN:_12b};var _12c=YSDOM.getObj(sID);YSEventHandler.Instance().addHandler(_12c,"onfocus",DTC.onFocus,this);YSEventHandler.Instance().addHandler(_12c,"onblur",DTC.onBlur,this);};var DTC=new DTC();var YSEvent={};YSEvent.cancelEvent=function(e,_12e){if(!isDefined(_12e)){_12e=false;}
e=YSEvent.getEvent(e);if(!e){return;}
e.returnValue=false;e.cancelBubble=_12e;if(e.preventDefault){e.preventDefault();}
if(e.stopPropagation){e.stopPropagation();}};YSEvent.disableSelect=function(_12f){if(bIE){if(_12f!=document){_12f.unselectable="on";}else{_12f.onselectstart=function(e){return false;};}}else{if(_12f.style){YSCSS.setStyle(_12f,"MozUserSelect","none");YSCSS.setStyle(_12f,"KhtmlUserSelect ","none");YSCSS.setStyle(_12f,"WebkitUserSelect","none");}else{YSEventHandler.Instance().addHandler(_12f,"onmousedown",__empty,window,false);}}};YSEvent.enableSelect=function(_131){if(bIE){if(_131!=document){_131.unselectable="off";}else{_131.onselectstart=function(e){return true;};}}else{if(_131.style){YSCSS.setStyle(_131,"MozUserSelect","");YSCSS.setStyle(_131,"KhtmlUserSelect ","");YSCSS.setStyle(_131,"WebkitUserSelect","");}else{YSEventHandler.Instance().removeHandler(_131,"onmousedown",__empty,window,true);}}};YSEvent.getEvent=function(e){if(!e){e=window.event;}
if(!e){e=null;}
return e;};YSEvent.getEventTarget=function(e){e=YSEvent.getEvent(e);if(!e){return null;}
var _135=null;if(e.target){_135=e.target;}else{if(e.srcElement){_135=e.srcElement;}}
if(_135&&_135.nodeType==3){_135=_135.parentNode;}
return _135;};YSEvent.getEventFrom=function(e){e=YSEvent.getEvent(e);if(!e){return null;}
var _137=e.fromElement||e.relatedTarget;return _137?_137:null;};YSEvent.getEventTo=function(e){e=YSEvent.getEvent(e);if(!e){return null;}
var _139=e.toElement||e.relatedTarget;return _139?_139:null;};YSEvent.getGlobalMousePosition=function(e){var iX=0;var iY=0;var e=YSEvent.getEvent(e);if(!e){return new Pixel();}
if(e.pageX||e.pageY){iX=e.pageX;iY=e.pageY;}else{if(e.clientX||e.clientY){var _13d=YSDOM.getDocumentScroll();iX=e.clientX+_13d.left;iY=e.clientY+_13d.top;}}
return new Pixel(iX,iY);};YSEvent.getKeyCode=function(e){e=YSEvent.getEvent(e);if(!e){return null;}
return e.keyCode;};YSEvent.getMouseButton=function(e){e=YSEvent.getEvent(e);if(!e){return null;}
var _140=1;if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){_140=e.which;}else{_140=e.button;}}
return _140;};YSEvent.getObjMousePosition=function(e,_142,_143){if(!isDefined(_143)){_143=0;}
if(bIE){_143=_143*2+1;}
var _144=null;if(isDefined(e)&&e!=null&&isDefined(e.top)&&isDefined(e.left)){_144=e;}else{_144=YSEvent.getGlobalMousePosition(e);}
var _145=YSDOM.getElementPosition(_142);_145.top+=_143;_145.left+=_143;return new Pixel(_144.left-_145.left,_144.top-_145.top);};YSEvent.getScrollWheelDirection=function(e){e=YSEvent.getEvent(e);var _147=0;if(e.wheelDelta){_147=e.wheelDelta/120;if(window.opera){_147=-_147;}}else{if(e.detail){_147=-e.detail/3;}}
return _147;};YSEvent.isMouseAboveElement=function(e,_149,_14a){if(!isDefined(_14a)){_14a=0;}
var oPos=YSEvent.getGlobalMousePosition(e);return YSDOM.posAboveElement(oPos,_149,_14a);};YSEvent.isBubbling=function(e,obj){e=YSEvent.getEvent(e);if(!e){return false;}
return e.relatedTarget==obj||YSDOM.hasParent(e.relatedTarget,obj);};YSEvent.performClick=function(sID){if(isPageLoaded(YSEvent.performClick,null,sID)){var _14f=YSDOM.getObj(sID);if(_14f&&_14f.onclick){_14f.onclick();}}};function YSEventHandler(){this.aoCallbacks={};this.iLastGivenID=0;};YSEventHandler.Me=null;YSEventHandler.Instance=function(){if(YSEventHandler.Me==null){YSEventHandler.Me=new YSEventHandler();}
return YSEventHandler.Me;};YSEventHandler.OnScroll=function(e){if(this.onmousewheel){this.onmousewheel(e);}};YSEventHandler.prototype.destruct=function(){for(var sID in this.aoCallbacks){this.aoCallbacks[sID].obj=null;this.aoCallbacks[sID].returnvalue=null;YSList.clear(this.aoCallbacks[sID].callbackfunctions);this.aoCallbacks[sID].callbackfunctions=null;delete this.aoCallbacks[sID];}
this.aoCallbacks=null;YSEventHandler.Me=null;};YSEventHandler.prototype.addHandler=function(obj,_153,_154,_155,_156){obj=YSDOM.getObj(obj);if(!obj){return;}
if(!isDefined(_154)||_154==null){return;}
if(!isDefined(_155)){_155=window;}
if(!isDefined(_156)){_156=null;}
_153=this.getTranslatedEvent(_153);var _157=_153+"_EventHandlerID";var iID=YSNumbers.checkInt(YSXML.getAttribute(obj,_157));if(iID==0){iID=++this.iLastGivenID;this.aoCallbacks[iID]={};this.aoCallbacks[iID].obj=obj;this.aoCallbacks[iID].jseval=YSString.getFunctionString(obj,_153);this.aoCallbacks[iID].returnvalue=null;this.aoCallbacks[iID].callbackfunctions=[];obj[_153]=this.getEventFunction(_153);YSDOM.setElementAttribute(obj,_157,iID);if(!bIE&&_153=="onmousewheel"){obj.addEventListener("DOMMouseScroll",YSEventHandler.OnScroll,false);}}
if(_156!=null||this.aoCallbacks[iID].returnvalue==null){this.aoCallbacks[iID].returnvalue=_156;}
var _159={};_159.fnCallback=_154;_159.objScope=_155;if(this.callbackExists(_159,iID)==-1){this.aoCallbacks[iID].callbackfunctions.push(_159);}};YSEventHandler.prototype.callbackExists=function(_15a,_15b){var _15c=this.aoCallbacks[_15b].callbackfunctions;for(var i=0;i<_15c.length;i++){if(_15c[i].fnCallback==_15a.fnCallback&&_15c[i].objScope==_15a.objScope){return i;}}
return-1;};YSEventHandler.prototype.getCallbackInfo=function(_15e){return this.aoCallbacks[_15e]||null;};YSEventHandler.prototype.getEventFunction=function(_15f){return function(e){return YSEventHandler.prototype.onEvent.call(this,e,_15f);};};YSEventHandler.prototype.getTranslatedEvent=function(_161){if(bIE){if(_161=="onmouseover"){_161="onmouseenter";}else{if(_161=="onmouseout"){_161="onmouseleave";}}}
return _161;};YSEventHandler.prototype.onEvent=function(e,_163){if(!bIE&&(_163=="onmouseover"||_163=="onmouseout")&&YSEvent.isBubbling(e,this)){return false;}
if(this==document&&_163.substr(0,5)=="onkey"){var _164=document.activeElement?document.activeElement.tagName.toLowerCase():"";if(_164=="input"||_164=="textarea"||_164=="button"||_164=="select"){return true;}}
var iID=YSNumbers.checkInt(YSXML.getAttribute(this,_163+"_EventHandlerID"));var _166=YSEventHandler.Instance().getCallbackInfo(iID);if(_166!=null){if(_166.jseval){eval("var event = e;");eval(_166.jseval);}
var _167=_166.returnvalue;var _168=_166.callbackfunctions;for(var i=0;i<_168.length;i++){var _16a=_168[i].fnCallback.call(_168[i].objScope,YSEvent.getEvent(e),this);if(_16a!=undefined){if(_167==null){_167=_16a;}else{if(_166.returnvalue==null){_167=_167&&_16a;}}}}
if(_167!=null){return _167;}}};YSEventHandler.prototype.removeHandler=function(obj,_16c,_16d,_16e,_16f){obj=YSDOM.getObj(obj);if(!obj){return;}
_16c=this.getTranslatedEvent(_16c);var iID=YSNumbers.checkInt(YSXML.getAttribute(obj,_16c+"_EventHandlerID"));var _171=this.getCallbackInfo(iID);if(_171!=null){if(!isDefined(_16e)){_16e=window;}
for(var i=0;i<_171.callbackfunctions.length;i++){if(_171.callbackfunctions[i].objScope==_16e&&_171.callbackfunctions[i].fnCallback==_16d){_171.callbackfunctions.splice(i,1);}}
if(_171.callbackfunctions.length==0&&_171.jseval==""){this.removeEvent(obj,_16c);}else{if(isDefined(_16f)){_171.returnvalue=_16f;}}}};YSEventHandler.prototype.removeEvent=function(obj,_174){obj=YSDOM.getObj(obj);if(!obj){return;}
_174=this.getTranslatedEvent(_174);var iID=YSXML.getAttribute(obj,_174+"_EventHandlerID");if(this.getCallbackInfo(iID)!=null){delete this.aoCallbacks[iID];}
obj[_174]=null;YSXML.setAttribute(obj,_174+"_EventHandlerID","");};var YSFlash={};YSFlash.getHTML=function(sID,sSrc,_178,_179){if(bIE){return"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" "+"width=\""+_178.width+"\" height=\""+_178.height+"\" id=\""+sID+"\" "+"name=\""+sID+"\" align=\"middle\">"+"<param name=\"allowScriptAccess\" value=\"always\" />"+"<param name=\"allowFullScreen\" value=\"false\" />"+"<param name=\"movie\" value=\""+sSrc+"\" />"+"<param name=\"loop\" value=\"false\" />"+"<param name=\"menu\" value=\"false\" />"+"<param name=\"quality\" value=\"best\" />"+"<param name=\"bgcolor\" value=\"#ffffff\" />"+"<param name=\"FlashVars\" value=\""+_179+"\" />"+"<param name=\"wmode\" value=\"transparent\" />"+"</object>";}else{return"<embed id=\""+sID+"\" src=\""+sSrc+"\" "+"quality=\"high\" bgcolor=\"#000000\" width=\""+_178.width+"\" "+"height=\""+_178.height+"\" name=\""+sID+"\" "+"allowScriptAccess=\"always\" allowFullScreen=\"false\" "+"type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" "+"flashvars=\""+_179+"\" wmode=\"transparent\" />";}};YSFlash.call=function(_17a,_17b,args){var _17a=YSDOM.getObj(_17a);if(!_17a){return;}
var _17d=[];for(var i=2,_17f=arguments.length;i<_17f;i++){_17d.push(arguments[i]);}
if(bIE){var _180=window.self.__flash__argumentsToXML(_17d,0);var sXML="<invoke name=\"";sXML=sXML+_17b;sXML=sXML+"\" returntype=\"javascript\">";sXML=sXML+_180;sXML=sXML+"</invoke>";var _182=_17a.callFunction(sXML);if(_182!=null&&typeof _182=="string"){eval(_182);}}else{_17a[_17b].apply(_17a,_17d);}};var YSForm={};YSForm.aRequests={};YSForm.aUploads={};YSForm.oOnSubmitDone=null;YSForm.getFormParams=function(_183,_184){for(var i=0,_186=_183.childNodes.length;i<_186;i++){var _187=_183.childNodes[i];if(!isDefined(_187.tagName)){continue;}
if(_187.tagName.toLowerCase()=="input"){if(_187.type.toLowerCase()=="checkbox"){_184+=_187.id+"="+(_187.checked?"1":"")+"&";}else{if(_187.type.toLowerCase()=="radio"){if(_187.checked){_184+=_187.name+"="+YSDOM.getValue(_187,true)+"&";}}else{_184+=_187.id+"="+YSDOM.getValue(_187,true)+"&";}}}else{if(_187.tagName.toLowerCase()=="select"||_187.tagName.toLowerCase()=="textarea"){_184+=_187.id+"="+YSDOM.getValue(_187,true)+"&";}else{_184=YSForm.getFormParams(_187,_184);}}}
return _184;};YSForm.onProcessFormResult=function(_188,xml){if(YSForm.oOnSubmitDone!=null){YSForm.oOnSubmitDone.fn.call(YSForm.oOnSubmitDone.obj,_188,xml);}
if(xml!=null){var _18a=YSXML.getChildren(xml,"forminput");for(var i=0,_18c=_18a.length;i<_18c;i++){var _18d=YSDOM.getObj(YSXML.getAttribute(_18a[i],"id"));var _18e=YSXML.getAttribute(_18a[i],"errorid");if(!_18e){_18e="fw_inputerror_"+_18d.id;}
var _18f=YSDOM.getObj(_18e);if(!_18f){_18f=document.createElement("div");_18f.id=_18e;_18d.parentNode.insertBefore(_18f,_18d);}
var _190=YSXML.getData(_18a[i]);_18f.innerHTML=_190;if(_190){YSCSS.addClassName(_18d,"fw_badinput");YSCSS.setStyle(_18f,"display","");YSCSS.addClassName(_18f,"fw_errormsg");}else{YSCSS.removeClassName(_18d,"fw_badinput");YSCSS.removeClassName(_18f,"fw_errormsg");YSCSS.setStyle(_18f,"display","none");}
DTC.onBlur(null,_18d);}
var _191=YSXML.getChildAttribute(xml,"result","action");if(_191){if(_191.substr(0,11)=="javascript:"){eval(_191.substr(11));}else{location.href=_191;}}}};YSForm.onSubmit=function(e,_193){_193=YSDOM.getObj(_193);if(isDefined(YSForm.aRequests[_193.id])){YSAJAX.cancelRequest(YSForm.aRequests[_193.id]);}
YSForm.onTinyMCECheck(_193);YSForm.aRequests[_193.id]=YSAJAX.sendRequest(_193.action,YSForm.getFormParams(_193,""),true,YSForm.onSubmitResult,window,_193.id);YSEvent.cancelEvent(e,true);return false;};YSForm.onSubmitResult=function(_194,_195){delete YSForm.aRequests[_195];YSForm.onProcessFormResult(_195,YSAJAX.getXML(_194));};YSForm.onTinyMCECheck=function(_196){if(!isDefined("tinyMCE",true)){return;}
var _197=_196.getElementsByTagName("textarea");for(var i=0,_199=_197.length;i<_199;i++){var ed=tinyMCE.get(_197[i].id);if(ed){_197[i].value=ed.getContent();}}};YSForm.onUpload=function(e,_19c,_19d,_19e,_19f){_19c=YSDOM.getObj(_19c);if(isDefined(YSForm.aUploads[_19c.id])){YSEvent.cancelEvent(e,true);return false;}
var _1a0=isDefined(_19d)&&_19d!=null;if(_1a0){if(!isDefined(_19e)){_19e=window;}
if(!isDefined(_19f)){_19f=2000;}}
var _1a1=_19c.id+"_uploadframe";YSXML.setAttribute(_19c,"target",_1a1);var _1a2=document.createElement("input");_1a2.type="hidden";_1a2.value=1;_1a2.id="ajax";_1a2.name="ajax";_19c.appendChild(_1a2);YSForm.onTinyMCECheck(_19c);var _1a3=document.createElement("div");YSCSS.setStyle(_1a3,"display","none");_1a3.innerHTML="<iframe name=\""+_1a1+"\" id=\""+_1a1+"\" "+"onload=\"YSForm.onUploadCompleted(this);\" "+"style=\"display: none;\"></iframe>";document.body.appendChild(_1a3);YSXML.setAttribute(_1a3.firstChild,"formid",_19c.id);YSForm.aUploads[_19c.id]={toStatus:_1a0?new YSTimeout(_19f,YSForm.onUploadStatus,window,{fn:_19d,obj:_19e,frm:_19c},true):null};return true;};YSForm.onUploadCompleted=function(_1a4){var wnd=YSDOM.getIFrame(_1a4);if(wnd==null||wnd.document.location.href=="about:blank"){return;}
YSLog.write("form "+_1a4.formid+" uploaded");var _1a6=YSForm.aUploads[_1a4.formid];if(_1a6){if(_1a6.toStatus!=null){_1a6.toStatus.cancelTimeout();}
delete YSForm.aUploads[_1a4.formid];}
var xml=YSDOM.getIFrameXML(_1a4);YSForm.onProcessFormResult(_1a4.formid,xml);YSDOM.removeElement(_1a4.parentNode);YSLog.write("upload completed");};YSForm.onUploadStatus=function(_1a8){};YSForm.onUploadStatusResult=function(_1a9,_1aa){var xml=YSAJAX.getXML(_1a9);if(xml!=null){var _1ac=0.25;_1aa.fn.call(_1aa.obj,_1aa.frm,_1ac);}};YSForm.setOnSubmitDoneListener=function(_1ad,_1ae){if(_1ad==null){YSForm.oOnSubmitDone=null;}else{YSForm.oOnSubmitDone={fn:_1ad,obj:isDefined(_1ae)?_1ae:window};}};var bIE=document.all?true:false;var bIE8=navigator.userAgent.indexOf("MSIE 8.0")!=-1;var bIE7=bIE&&!bIE8;var bChrome=navigator.userAgent.indexOf("Chrome")!=-1;var bSafari=navigator.userAgent.indexOf("Safari")!=-1;var bPageLoaded=false;var bSubmitting=false;var DEBUG_MODE=false;var BASE_PATH="";var IMAGE_PATH="";var STYLE_PATH="";var SCRIPT_PATH="";var LANGUAGE="en";var JS_VERSION="1.0";function __empty(){};window.onerror=function(sMsg,sURL,_1b1){YSLog.writeText("JS Error: "+sMsg+" in "+sURL+" on line "+_1b1);return!DEBUG_MODE;};function isDefined(_1b2,_1b3){if(_1b3&&typeof _1b2=="string"){_1b2=window[_1b2];}
return(String(typeof _1b2)!="undefined");};function isPageLoaded(_1b4,_1b5,_1b6){if(!bPageLoaded){new YSTimeout(250,_1b4,isDefined(_1b5)&&_1b5!=null?_1b5:window,isDefined(_1b6)?_1b6:null);return false;}else{return true;}};function __onUnLoad(){if(isDefined("YSLog",true)){YSLog.destruct();}
if(isDefined("YSEventHandler",true)){YSEventHandler.Instance().destruct();}
if(isDefined("YSMouseMoveEvent",true)){YSMouseMoveEvent.Instance().destruct();}
if(isDefined("YSMoveElement",true)){YSMoveElement.destruct();}
if(isDefined("YSHash",true)){YSHash.destruct();}
if(isDefined("DP",true)){DP.destruct();}
if(isDefined("YSCombobox",true)){YSCombobox.Destruct();}
if(isDefined("YSTable",true)){YSTable.Destruct();}
if(isDefined("YSText",true)){YSText.destruct();}
if(isDefined("YSDOM",true)){YSDOM.destructElement(document.body);}};function YSHash(){this.sLastHash="";this.bInit=false;this.fnCallback=this.objCallback=null;this.frFrame=null;};YSHash.prototype.destruct=function(){YSDOM.removeElement(this.frFrame);this.fnCallback=this.objCallback=null;};YSHash.prototype.go=function(_1b7){this.init();if(bIE){this.writeToFrame(_1b7);}
document.location.hash=_1b7;};YSHash.prototype.init=function(){if(this.bInit){return;}
if(!document.body){setTimeout("YSHash.init();",200);return;}
this.bInit=true;if(bIE){this.frFrame=document.createElement("iframe");this.frFrame.id="hash-state-frame";this.frFrame.style.display="none";document.body.appendChild(this.frFrame);if(document.location.hash){this.writeToFrame(document.location.hash.substr(1));}else{this.writeToFrame("");}}
setInterval("YSHash.onCheck();",150);};YSHash.prototype.onChange=function(_1b8){if(this.fnCallback!=null&&_1b8.length>0){this.fnCallback.call(this.objCallback,_1b8.substr(1));}};YSHash.prototype.onCheck=function(){if(document.location.hash!=this.sLastHash){this.sLastHash=document.location.hash;this.onChange(this.sLastHash);}};YSHash.prototype.onRemoveHashFromTitle=function(){var iPos=document.title.lastIndexOf(document.location.hash);if(iPos!=-1){if(iPos+document.location.hash.length==document.title.length){document.title=document.title.substr(0,iPos);}}};YSHash.prototype.setOnChange=function(_1ba,_1bb){this.init();if(!isDefined(_1bb)){_1bb=window;}
this.fnCallback=_1ba;this.objCallback=_1bb;};YSHash.prototype.syncHash=function(){if(this._hash!=document.location.hash){document.location.hash=this._hash;}};YSHash.prototype.writeToFrame=function(_1bc){var doc=this.frFrame.contentDocument||this.frFrame.contentWindow.document;doc.open();doc.write("<script>window._hash = '"+_1bc+"'; window.onload = parent.YSHash.syncHash;</script>");doc.close();};var YSHash=new YSHash();function YSJS(){this.aLoaded={};};YSJS.prototype.isLoaded=function(sID){return this.aLoaded[sID]==1;};YSJS.prototype.load=function(sID,_1c0,_1c1,_1c2,_1c3){if(!isDefined(_1c1)){_1c1=null;}
if(!isDefined(_1c2)){_1c2=null;}
if(!isDefined(_1c3)){_1c3=null;}
this.aLoaded[sID]=0;if(_1c0.indexOf("?")!=-1){_1c0+="&";}else{_1c0+="?";}
_1c0+="fw_jsv="+JS_VERSION;YSLog.write("loadJS: "+_1c0);var oJS=document.createElement("script");oJS.setAttribute("type","text/javascript");oJS.setAttribute("src",_1c0);oJS.onreadystatechange=function(){if(this.readyState.toLowerCase()=="loaded"||this.readyState.toLowerCase()=="complete"){YSJS.aLoaded[sID]=1;if(_1c1!=null){_1c1.call(_1c2,sID,_1c3);}}};oJS.onload=function(){YSJS.aLoaded[sID]=1;if(_1c1!=null){_1c1.call(_1c2,sID,_1c3);}};document.body.appendChild(oJS);};var YSJS=new YSJS();var YSList={};YSList.clear=function(_1c5){for(var _1c6 in _1c5){_1c5[_1c6]=null;}};YSList.compare=function(a,b){if(typeof a=="string"){if(typeof b=="string"){return a<b?-1:a==b?0:1;}else{return 1;}}else{if(typeof b=="string"){return-1;}else{if(typeof a=="object"&&isDefined(a.compare)){return a.compare(b);}else{return a-b;}}}};YSList.count=function(_1c9){var _1ca=_1c9.length;var _1cb=false;for(var _1cc in _1c9){if(_1ca==0){_1cb=true;}
break;}
if(_1cb){for(var _1cc in _1c9){_1ca++;}}
return _1ca;};YSList.exists=function(_1cd,_1ce){for(var _1cf in _1cd){if(_1cd[_1cf]==_1ce){return true;}}
return false;};YSList.getFirst=function(_1d0){if(YSList.isArray(_1d0)){if(_1d0.length>0){return _1d0[0];}}
return null;};YSList.getLast=function(_1d1){if(YSList.isArray(_1d1)){if(_1d1.length>0){return _1d1[_1d1.length-1];}}
return null;};YSList.isArray=function(obj){if(!obj){return false;}
if(typeof obj=="string"){return false;}
if(String(obj.constructor).toLowerCase().indexOf("array")!=-1||(typeof obj).toLowerCase()=="array"||(typeof obj["length"])!="undefined"){return true;}
return false;};YSList.toParamString=function(_1d3,_1d4){if(!isDefined(_1d4)){_1d4="";}
var _1d5="";for(var _1d6 in _1d3){_1d5+="&"+_1d4+_1d6+"="+YSString.encodeHtml(_1d3[_1d6]);}
return _1d5.substring(1);};YSList.toSource=function(_1d7){var _1d8="";var _1d9=true;if(isDefined(_1d7[0])){_1d9=false;}
for(var _1da in _1d7){if(_1d9){_1d8+=","+_1da+":"+YSString.valueToString(_1d7[_1da]);}else{_1d8+=","+YSString.valueToString(_1d7[_1da]);}}
if(_1d8.length==0){return"[]";}else{if(_1d9){_1d8="{"+_1d8.substring(1)+"}";}else{_1d8="["+_1d8.substring(1)+"]";}
return _1d8;}};YSList.toString=function(_1db){if(!((typeof _1db).toLowerCase()=="array"||(typeof _1db).toLowerCase()=="object")){return _1db;}
var _1dc="";for(var _1dd in _1db){_1dc+=",<br /> "+_1dd+" => "+YSList.toString(_1db[_1dd]);}
_1dc="["+_1dc.substring(8)+"]";return _1dc;};var YSLog={destruct:function(){},write:function(){},writeText:function(){},onUnLoad:function(){}};function YSMouseMoveEvent(){this.aElementRegister={};this.iLastKeyGiven=1;};YSMouseMoveEvent.Me=null;YSMouseMoveEvent.Instance=function(){if(YSMouseMoveEvent.Me==null){YSMouseMoveEvent.Me=new YSMouseMoveEvent();}
return YSMouseMoveEvent.Me;};YSMouseMoveEvent.prototype.destruct=function(){for(var sID in this.aElementRegister){delete this.aElementRegister[sID];}
this.aElementRegister=null;YSMouseMoveEvent.Me=null;};YSMouseMoveEvent.prototype.isInTimeout=function(_1df){var sID=YSDOM.getElementAttribute(_1df,"MouseMoveID");if(sID&&isDefined(this.aElementRegister[sID])){return this.aElementRegister[sID].timeout!=null;}
return false;};YSMouseMoveEvent.prototype.mouseMoved=function(e,obj,oPos,sID){if(!isDefined(sID)){sID=YSDOM.getElementAttribute(obj,"MouseMoveID");}
var oReg=this.aElementRegister[sID];if(isDefined(oReg)){if(!isDefined(oPos)){if(oReg.timeout!=null){clearTimeout(oReg.timeout);}
oPos=YSEvent.getGlobalMousePosition(e);if(YSDateTime.getCurTime()-oReg.lastmovetime<oReg.maxfreq){oReg.timeout=setTimeout("YSMouseMoveEvent.Instance().mouseMoved(null,null,"+"{left:"+oPos.left+",top:"+oPos.top+"},\""+sID+"\");",oReg.maxfreq);return true;}}
oReg.timeout=null;oReg.lastmovetime=YSDateTime.getCurTime();for(var i=0,_1e7=oReg.aFn.length;i<_1e7;i++){oReg.aFn[i].call(oReg.aObj[i],oReg.element,oPos);}}};YSMouseMoveEvent.prototype.registerElement=function(_1e8,_1e9,_1ea,_1eb){if(_1e8==null||_1ea==null){return;}
if(!isDefined(_1eb)||_1eb==null){_1eb=window;}
var sID=YSDOM.getElementAttribute(_1e8,"MouseMoveID");if(!sID||!isDefined(this.aElementRegister[sID])){sID="genMoveID_"+this.iLastKeyGiven++;YSDOM.setElementAttribute(_1e8,"MouseMoveID",sID);this.aElementRegister[sID]={aObj:[_1eb],aFn:[_1ea],maxfreq:_1e9,lastmovetime:0,timeout:null,element:_1e8};YSEventHandler.Instance().addHandler(_1e8,"onmousemove",YSMouseMoveEvent.prototype.mouseMoved,this);}else{var oReg=this.aElementRegister[sID];oReg.maxfreq=Math.min(_1e9,oReg.maxfreq);oReg.aObj.push(_1eb);oReg.aFn.push(_1ea);}};YSMouseMoveEvent.prototype.removeElement=function(_1ee){var sID=YSDOM.getElementAttribute(_1ee,"MouseMoveID");if(sID){var oReg=this.aElementRegister[sID];if(oReg){if(oReg.timeout!=null){clearTimeout(oReg.timeout);}
YSEventHandler.Instance().removeHandler(oReg.element,"onmousemove",YSMouseMoveEvent.prototype.mouseMoved,this);oReg=null;delete this.aElementRegister[sID];}}};function YSMoveElement(){this.iLastID=1;this.aCheckCodes=new Array();this.aCouples=new Array();this.bMoving=false;this.sMovingID=null;this.oMoveStartPos={top:0,left:0};this.bDocEventsSet=false;};YSMoveElement.prototype.destruct=function(){this.aCheckCodes=this.aCouples=this.oMoveStartPos=null;};YSMoveElement.prototype.onDocMouseMove=function(_1f1,oPos){if(this.bMoving){YSCSS.setMultiStyle(this.aCouples[this.sMovingID],["top","left"],[(oPos.top-this.oMoveStartPos.top)+"px",(oPos.left-this.oMoveStartPos.left)+"px"]);}};YSMoveElement.prototype.onDocMouseUp=function(e,_1f4){this.bMoving=false;this.sMovingID=null;if(bIE){document.onselectstart=new Function("return true");}else{return true;}};YSMoveElement.prototype.onElementMouseDown=function(e,_1f6){if(this.aCheckCodes[_1f6.id]&&!eval(this.aCheckCodes[_1f6.id])){return true;}
var _1f7=YSEvent.getGlobalMousePosition(e);var _1f8=YSDOM.getElementPosition(this.aCouples[_1f6.id]);if(_1f8.top!=0&&_1f8.left!=0){this.oMoveStartPos.top=_1f7.top-_1f8.top;this.oMoveStartPos.left=_1f7.left-_1f8.left;}else{this.oMoveStartPos={top:0,left:0};}
this.bMoving=true;this.sMovingID=_1f6.id;if(bIE){document.onselectstart=new Function("return false");}else{return false;}};YSMoveElement.prototype.setDraggable=function(_1f9,_1fa,_1fb){_1f9=YSDOM.getObj(_1f9);_1fa=YSDOM.getObj(_1fa);if(!_1f9||!_1fa){return;}
if(YSCSS.getStyle(_1f9,"position")!="absolute"){var _1fc=YSDOM.getElementPosition(_1f9);var _1fd=YSCSS.getStyle(_1f9,"width",true);var _1fe=YSCSS.getStyle(_1f9,"height",true);var _1ff=document.createElement("div");YSCSS.setMultiStyle(_1ff,["width","height"],[_1fd+"px",_1fe+"px"]);YSCSS.setMultiStyle(_1f9,["position","top","left","width","height"],["absolute",_1fc.top+"px",_1fc.left+"px",_1fd+"px",_1fe+"px"]);YSDOM.replaceElement(_1f9,_1ff);document.body.appendChild(_1f9);}
if(!_1fa.id){_1fa.id="MovingElement_"+this.iLastID++;}
this.aCheckCodes[_1fa.id]=isDefined(_1fb)?_1fb:null;this.aCouples[_1fa.id]=_1f9;if(_1fa.tagName.toLowerCase()=="form"){var _200=_1fa.getElementsByTagName("fieldset");for(var i=0;i<_200.length;i++){YSCSS.setStyle(_200[i],"cursor","move");}}
YSCSS.setStyle(_1fa,"cursor","move");YSEventHandler.Instance().addHandler(_1fa,"onmousedown",YSMoveElement.onElementMouseDown,this);if(!this.bDocEventsSet){YSMouseMoveEvent.Instance().registerElement(document.documentElement,20,YSMoveElement.onDocMouseMove,this);YSEventHandler.Instance().addHandler(document.documentElement,"onmouseup",YSMoveElement.onDocMouseUp,this);this.bDocEventsSet=true;}};YSMoveElement.prototype.unsetDraggable=function(_202){_202=YSDOM.getObj(_202);if(!_202||!_202.id){return;}
delete this.aCheckCodes[_202.id];delete this.aCouples[_202.id];YSEventHandler.Instance().removeHandler(_202,"onmousedown",YSMoveElement.onElementMouseDown,this);};var YSMoveElement=new YSMoveElement();var YSNumbers={};YSNumbers.MAX_INT=2147483647;YSNumbers.checkInt=function(i){var _204=parseInt(i);if(isNaN(_204)){_204=0;}
return _204;};YSNumbers.checkFloat=function(f){var _206=parseFloat(f);if(isNaN(_206)){_206=0;}
return _206;};YSNumbers.dec2hex=function(_207){return YSNumbers.checkInt(_207).toString(16);};YSNumbers.degToRad=function(fDeg){return fDeg*Math.PI/180;};YSNumbers.hex2dec=function(_209){var _20a=parseInt(_209,16);if(isNaN(_20a)){return 0;}else{return _20a;}};YSNumbers.isInteger=function(_20b){return YSNumbers.checkInt(_20b)==_20b&&_20b!="";};YSNumbers.isNumeric=function(_20c){return YSNumbers.checkFloat(_20c)==_20c&&_20c!="";};YSNumbers.padDigits=function(_20d,_20e){var _20f=_20d.toString();while(_20f.length<_20e){_20f="0"+_20f;}
return _20f;};YSNumbers.radToDeg=function(fRad){return fRad*180/Math.PI;};YSNumbers.roundNumber=function(_211,_212,_213){if(!isDefined(_212)){_212=-1;}
if(!isDefined(_213)){_213=true;}
if(_212>=0){var _214=YSNumbers.checkFloat(_211).toFixed(_212);return _213?YSNumbers.checkFloat(_214):_214;}else{return _213?YSNumbers.checkFloat(_211):String(_211);}};function Sha1(s){var _216=function(n,s){var t4=(n<<s)|(n>>>(32-s));return t4;};var _21a=function(val){var s="";var i;var v;for(i=7;i>=0;i--){v=(val>>>(i*4))&15;s+=v.toString(16);}
return s;};var _21f;var i,j;var W=new Array(80);var H0=1732584193;var H1=4023233417;var H2=2562383102;var H3=271733878;var H4=3285377520;var A,B,C,D,E;var temp;s=YSUTF8.encode(s);var _22e=s.length;var _22f=[];for(i=0;i<_22e-3;i+=4){j=s.charCodeAt(i)<<24|s.charCodeAt(i+1)<<16|s.charCodeAt(i+2)<<8|s.charCodeAt(i+3);_22f.push(j);}
switch(_22e%4){case 0:i=2147483648;break;case 1:i=s.charCodeAt(_22e-1)<<24|8388608;break;case 2:i=s.charCodeAt(_22e-2)<<24|s.charCodeAt(_22e-1)<<16|32768;break;case 3:i=s.charCodeAt(_22e-3)<<24|s.charCodeAt(_22e-2)<<16|s.charCodeAt(_22e-1)<<8|128;break;}
_22f.push(i);while((_22f.length%16)!=14){_22f.push(0);}
_22f.push(_22e>>>29);_22f.push((_22e<<3)&4294967295);for(_21f=0;_21f<_22f.length;_21f+=16){for(i=0;i<16;i++){W[i]=_22f[_21f+i];}
for(i=16;i<=79;i++){W[i]=_216(W[i-3]^W[i-8]^W[i-14]^W[i-16],1);}
A=H0;B=H1;C=H2;D=H3;E=H4;for(i=0;i<=19;i++){temp=(_216(A,5)+((B&C)|(~B&D))+E+W[i]+1518500249)&4294967295;E=D;D=C;C=_216(B,30);B=A;A=temp;}
for(i=20;i<=39;i++){temp=(_216(A,5)+(B^C^D)+E+W[i]+1859775393)&4294967295;E=D;D=C;C=_216(B,30);B=A;A=temp;}
for(i=40;i<=59;i++){temp=(_216(A,5)+((B&C)|(B&D)|(C&D))+E+W[i]+2400959708)&4294967295;E=D;D=C;C=_216(B,30);B=A;A=temp;}
for(i=60;i<=79;i++){temp=(_216(A,5)+(B^C^D)+E+W[i]+3395469782)&4294967295;E=D;D=C;C=_216(B,30);B=A;A=temp;}
H0=(H0+A)&4294967295;H1=(H1+B)&4294967295;H2=(H2+C)&4294967295;H3=(H3+D)&4294967295;H4=(H4+E)&4294967295;}
temp=_21a(H0)+_21a(H1)+_21a(H2)+_21a(H3)+_21a(H4);return temp.toLowerCase();};var YSString={};YSString.addSlashes=function(_230,_231){for(var _232 in _231){sReplace="/\\"+_231[_232]+"/g";sReplacement="\\\\"+_231[_232];_230=eval("sString.replace(/"+sReplace+"/g, '"+sReplacement+"');");}
return _230;};YSString.encodeHtml=function(_233){if(YSUTF8.bUseUTF8){return encodeURIComponent(_233);}else{_233=escape(_233);_233=sYSDOM.replace(/%u20AC/g,"%80");_233=sYSDOM.replace(/\//g,"%2F");_233=sYSDOM.replace(/\+/g,"%2B");_233=sYSDOM.replace(/@/g,"%40");return _233;}};YSString.getFunctionString=function(obj,_235){if((typeof obj).toLowerCase()=="function"){fnFunction=obj;}else{if(!obj){fnFunction=window[_235];}else{fnFunction=obj[_235];}}
if(!isDefined(fnFunction)){return"";}
var _235=String(fnFunction);if(isDefined(_235)){_235=_235.substring(_235.indexOf("{")+1,_235.lastIndexOf("}")-1);}else{_235="";}
return _235.trim();};YSString.getJSCall=function(_236,_237){var _238=_236+"(";for(var i=0;i<_237.length;i++){_238+=YSString.valueToString(_237[i]);if(i!=_237.length-1){_238+=",";}}
_238+=");";return _238;};YSString.htmlEntities=function(_23a){var _23b=new Array(38,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,248,249,250,251,252,253,254,255,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,216,217,218,219,220,221,222,8364,34,223,60,62,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190);var _23c=new Array("amp","agrave","aacute","acirc","atilde","auml","aring","aelig","ccedil","egrave","eacute","ecirc","euml","igrave","iacute","icirc","iuml","eth","ntilde","ograve","oacute","ocirc","otilde","ouml","oslash","ugrave","uacute","ucirc","uuml","yacute","thorn","yuml","Agrave","Aacute","Acirc","Atilde","Auml","Aring","AElig","Ccedil","Egrave","Eacute","Ecirc","Euml","Igrave","Iacute","Icirc","Iuml","ETH","Ntilde","Ograve","Oacute","Ocirc","Otilde","Ouml","Oslash","Ugrave","Uacute","Ucirc","Uuml","Yacute","THORN","euro","quot","szlig","lt","gt","cent","pound","curren","yen","brvbar","sect","uml","copy","ordf","laquo","not","shy","reg","macr","deg","plusmn","sup2","sup3","acute","micro","para","middot","cedil","sup1","ordm","raquo","frac14","frac12","frac34");for(var i=0;i<_23b.length;i++){var _23e=0;var iPos=-1;while((iPos=_23a.indexOf(String.fromCharCode(_23b[i]),_23e))!=-1){_23a=_23a.substr(0,iPos)+"&"+_23c[i]+";"+_23a.substr(iPos+1);_23e=iPos+_23c[i].length+2;}}
return _23a;};YSString.isString=function(s){return(typeof s).toLowerCase()=="string";};YSString.stripHTMLTags=function(s){if(!s){return s;}
return s.replace(/<\/?[^>]+(>|$)/g,"");};YSString.trim=function(s){if(!s){return s;}
var _243=s.replace(/^\s+/g,"");return _243.replace(/\s+$/g,"");};String.prototype.trim=function(){return YSString.trim(this);};YSString.ucfirst=function(_244){if(!s){return s;}
var _245=_244.substr(0,1);return _245.toUpperCase()+_244.substring(1);};YSString.valueToString=function(_246){var _247="";if(!isDefined(_246)){_247="undefined";}else{if(_246==null){_247="null";}else{if(YSList.isArray(_246)||(typeof _246).toLowerCase()=="object"){_247=YSList.toSource(_246);}else{if(YSNumbers.isNumeric(_246)||_246=="this"||_246=="event"){_247=_246;}else{if(_246==true||_246==false){_247=String(_246);}else{_247="'"+_246.replace(/'/g,"\\'")+"'";}}}}}
return String(_247);};function YSTable(sID){if(isDefined(YSTable.aTables[sID])){YSTable.aTables[sID].destruct();}
this.tblTable=YSDOM.getObj(sID);this.sID=sID;this.sRowHoverClass=null;this.aHoverEvents=[];YSTable.aTables[sID]=this;};YSTable.aTables={};YSTable.Destruct=function(){for(var sID in YSTable.aTables){YSTable.aTables[sID].destruct();}
YSTable.aTables=null;};YSTable.GetTable=function(sID){if(isDefined(YSTable.aTables[sID])){return YSTable.aTables[sID];}else{return null;}};YSTable.prototype.destruct=function(_24b){for(var i=0,_24d=this.aHoverEvents.length;i<_24d;i++){YSEventHandler.Instance().removeEvent(this.aHoverEvents[i],"onmouseover");YSEventHandler.Instance().removeEvent(this.aHoverEvents[i],"onmouseout");this.aHoverEvents[i]=null;}
this.aHoverEvents=null;if(isDefined(_24b)&&_24b){YSDOM.removeElement(this.tblTable);}else{YSDOM.destructElement(this.tblTable);}
this.tblTable=null;if(isDefined(YSTable.aTables[this.sID])){delete YSTable.aTables[this.sID];}};YSTable.prototype.onRowHover=function(e,obj){YSCSS.addClassName(obj,this.sRowHoverClass);};YSTable.prototype.onRowHoverEnd=function(e,obj){YSCSS.removeClassName(obj,this.sRowHoverClass);};YSTable.prototype.setRowHoverClass=function(_252){YSLog.write("tablehover "+_252);this.sRowHoverClass=_252;var aTRs=YSXML.getChildren(this.tblTable,"tr");for(var i=0,_255=aTRs.length;i<_255;i++){if(!YSXML.exists(aTRs[i],"th")){this.aHoverEvents.push(aTRs[i]);YSEventHandler.Instance().addHandler(aTRs[i],"onmouseover",YSTable.prototype.onRowHover,this);YSEventHandler.Instance().addHandler(aTRs[i],"onmouseout",YSTable.prototype.onRowHoverEnd,this);}}};function YSText(){this.aTexts={};};YSText.prototype.destruct=function(){this.aTexts=null;};YSText.prototype.get=function(_256,_257){if(this.aTexts[_256]){var _258=this.aTexts[_256];if(isDefined(_257)&&_257.length>0){var _259=0;for(var i=0,_25b=_257.length;i<_25b;i++){_259=_258.indexOf("[",_259);if(_259!=-1){iEndPos=_258.indexOf("]",_259+1);if(iEndPos!=-1){_258=_258.substring(0,_259)+_257[i]+_258.substring(iEndPos+1);_259+=_257[i].length;}else{break;}}else{break;}}}
return _258;}else{return _256.substring(2,_256.length-2);}};YSText.prototype.set=function(_25c,_25d){this.aTexts[_25c]=_25d;};var YSText=new YSText();YSTimeout.iLastID=1;YSTimeout.aTimeouts={};function YSTimeout(iMS,_25f,_260,_261,_262,_263){if(!isDefined(_260)){_260=window;}
if(!isDefined(_261)){_261=null;}
if(!isDefined(_262)){_262=false;}
if(!isDefined(_263)){_263=0;}
this.iID=YSTimeout.iLastID++;this.iMS=iMS;YSTimeout.aTimeouts["TO_"+this.iID]={objCaller:_260,fnCaller:_25f,oParam:_261,bInterval:_262,bIgnoreInterval:false,iStartTime:YSDateTime.getCurTime()-_263};var _264="YSTimeout.prototype.onTimeoutPassed.call(window, "+this.iID+");";if(_262){YSTimeout.aTimeouts["TO_"+this.iID].iTimeoutID=setInterval(_264,iMS);}else{YSTimeout.aTimeouts["TO_"+this.iID].iTimeoutID=setTimeout(_264,iMS);}};YSTimeout.prototype.cancelTimeout=function(){var _265=YSTimeout.aTimeouts["TO_"+this.iID];if(!_265){return;}
if(_265.bInterval){clearInterval(_265.iTimeoutID);}else{clearTimeout(_265.iTimeoutID);}
delete YSTimeout.aTimeouts["TO_"+this.iID];};YSTimeout.prototype.getTimePassed=function(){var _266=YSTimeout.aTimeouts["TO_"+this.iID];if(_266){return YSDateTime.getCurTime()-_266.iStartTime;}else{return 0;}};YSTimeout.prototype.onInterrupt=function(){var _267=YSTimeout.aTimeouts["TO_"+this.iID];if(!_267){return;}
if(_267.bInterval){this.onTimeoutPassed(this.iID);clearInterval(_267.iTimeoutID);_267.iTimeoutID=setInterval("YSTimeout.prototype.onTimeoutPassed"+".call(window, "+this.iID+");",this.iMS);}else{clearTimeout(_267.iTimeoutID);this.onTimeoutPassed(this.iID);}};YSTimeout.prototype.onTimeoutPassed=function(iID,_269){var _26a=YSTimeout.aTimeouts["TO_"+iID];if(!_26a){return;}
if(_26a.bInterval&&_26a.bIgnoreInterval){_26a.bIgnoreInterval=false;return;}
var _26b=_26a.fnCaller.call(_26a.objCaller,_26a.oParam,YSDateTime.getCurTime()-_26a.iStartTime);if(_26b===false||!_26a.bInterval){if(_26a.bInterval){clearInterval(_26a.iTimeoutID);}
delete YSTimeout.aTimeouts["TO_"+iID];}};var YSTinyMCE={};YSTinyMCE.bInitialized=false;YSTinyMCE.bLoading=false;YSTinyMCE.TINYMCE_PATH="TinyMCE/";YSTinyMCE.addControl=function(sID){YSTinyMCE.removeControl(sID);tinyMCE.execCommand("mceAddControl",true,sID);};YSTinyMCE.getContent=function(sID,_26e){if(!isDefined(_26e)){_26e=false;}
var _26f=tinyMCE.get(sID).getContent();if(_26e){return YSString.encodeHtml(_26f);}else{return _26f;}};YSTinyMCE.initTinyMCE=function(_270){if(!YSTinyMCE.bInitialized){YSTinyMCE.bInitialized=true;if(!isDefined(_270)){_270={};}
var _271={mode:"none",theme:"advanced",theme_advanced_buttons1:"bold,italic,underline,"+"separator,bullist,numlist,"+"separator,undo,redo,"+"separator,link,unlink,"+"separator,paste",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",language:LANGUAGE,content_css:STYLE_PATH+"layout.css",body_class:"mceContentBody",paste_auto_cleanup_on_paste:true,extended_valid_elements:"hr[class|width|size|noshade],"+"font[face|size|color|style],"+"span[class|align|style],"+"li[class|style],ul[class|style],"+"script[charset|defer|language|src|type],"+"object[width|height],"+"param[name|value],"+"embed[src|type|wmode|width|height|allowscriptaccess|allowfullscreen],"+"iframe[width|height|frameborder|scrolling|"+"marginheight|marginwidth|src]",paste_use_dialog:false,paste_strip_class_attributes:"all",force_p_newlines:true,entity_encoding:"raw",custom_undo_redo_levels:10};for(sIndex in _270){_271[sIndex]=_270[sIndex];}
tinyMCE.init(_271);}};YSTinyMCE.isIMLoaded=function(){return YSJS.isLoaded("tinymceIM");};YSTinyMCE.isLoaded=function(){return YSJS.isLoaded("tinymce");};YSTinyMCE.load=function(fn,obj,_274){if(!YSTinyMCE.isLoaded()&&!YSTinyMCE.bLoading){YSTinyMCE.bLoading=true;YSJS.load("tinymce",BASE_PATH+"scripts/"+YSTinyMCE.TINYMCE_PATH+"tiny_mce_src.js",fn,obj,_274);}else{fn.call(obj,"tinymce",_274);}};YSTinyMCE.loadIM=function(fn,obj,_277){if(!YSTinyMCE.isIMLoaded()){YSJS.load("tinymceIM",BASE_PATH+"scripts/"+YSTinyMCE.TINYMCE_PATH+"plugins/imagemanager/js/mcimagemanager.js",fn,obj,_277);}else{fn.call(obj,"tinymceIM",_277);}};YSTinyMCE.removeControl=function(sID){try{tinyMCE.execCommand("mceRemoveControl",false,sID);}
catch(e){}};YSTinyMCE.setContent=function(sID,_27a){tinyMCE.get(sID).setContent(_27a);};var YSUTF8={};YSUTF8.bUseUTF8=true;YSUTF8.encode=function(_27b){_27b=_27b.toString();_27b=_27b.replace(/\r\n/g,"\n");var _27c="";for(var i=0;i<_27b.length;i++){var c=_27b.charCodeAt(i);if(c<128){_27c+=String.fromCharCode(c);}else{if((c>127)&&(c<2048)){_27c+=String.fromCharCode((c>>6)|192);_27c+=String.fromCharCode((c&63)|128);}else{_27c+=String.fromCharCode((c>>12)|224);_27c+=String.fromCharCode(((c>>6)&63)|128);_27c+=String.fromCharCode((c&63)|128);}}}
return _27c;};YSUTF8.decode=function(_27f){var _280="";var i=0;var c=c1=c2=0;while(i<sYSUTF8.length){c=sYSUTF8.charCodeAt(i);if(c<128){_280+=String.fromCharCode(c);i++;}else{if((c>191)&&(c<224)){c2=sYSUTF8.charCodeAt(i+1);_280+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=sYSUTF8.charCodeAt(i+1);c3=sYSUTF8.charCodeAt(i+2);_280+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}}
return _280;};var YSXML={};YSXML.exists=function(_283,_284){return _283.getElementsByTagName(_284).length>0;};YSXML.getAttribute=function(_285,_286){if(!_285){return null;}
if(!(typeof _285.getAttribute=="undefined")){return _285.getAttribute(_286);}else{return _285[_286];}};YSXML.getChild=function(_287,_288){var _289=_287.getElementsByTagName(_288);if(_289.length>0){return _289[0];}else{return null;}};YSXML.getChildren=function(_28a,_28b){return _28a.getElementsByTagName(_28b);};YSXML.getChildAttribute=function(_28c,_28d,_28e){var _28f="";var _290=_28c.getElementsByTagName(_28d);if(_290&&_290.length>0){_28f=YSXML.getAttribute(_290[0],_28e);}
return YSString.trim(_28f);};YSXML.getChildData=function(_291,_292){var _293="";var _294=_291.getElementsByTagName(_292);if(_294&&_294.length>0){_293=YSXML.getData(_294[0]);}
return YSString.trim(_293);};YSXML.getChildText=function(_295,_296){var _297="";var _298=_295.getElementsByTagName(_296);if(_298&&_298.length>0){_297=YSXML.getText(_298[0]);}
return YSString.trim(_297);};YSXML.getData=function(_299){var _29a="";try{if(_299.text){_29a=_299.text;}else{if(_299.textContent){_29a=_299.textContent;}else{if(_299.childNodes&&_299.childNodes.length>0&&_299.childNodes[0].nodeValue){_29a=_299.childNodes[0].nodeValue;}}}}
catch(e){}
return YSString.trim(_29a);};YSXML.getFirstTextNode=function(_29b){if(_29b){for(var i=0;i<_29b.childNodes.length;i++){if(_29b.childNodes[i].nodeType==3){return _29b.childNodes[i];}}}
return null;};YSXML.getText=function(_29d){if(_29d){if(_29d.innerText&&_29d.innerText.length>0){return YSString.trim(_29d.innerText);}else{if(_29d.firstChild){return YSString.trim(_29d.firstChild.data);}}}
return"";};YSXML.setAttribute=function(_29e,_29f,_2a0){if(!_29e){return;}
if(!(typeof _29e.setAttribute=="undefined")){_29e.setAttribute(_29f,_2a0);}else{_29e[_29f]=_2a0;}};function AutoComplete(_2a1,_2a2,_2a3,_2a4){YSScrollable.call(this,true);this.objRef=_2a1;this.fnCallback=_2a3;this.objCallback=isDefined(_2a4)?_2a4:window;this.aOptions=[];this.iSelectedIndex=-1;this.iLineHeight=16;this.iMinWidth=YSCSS.getStyle(this.objRef,"width",true)-25;this.divPosition=this.divFold=this.divOptionHolder=this.ulOptions=null;this.divScroll=null;this.bPreventClose=false;this.onInit();YSEventHandler.Instance().addHandler(_2a2,"onmousedown",AutoComplete.prototype.onTextboxClick,this);YSEventHandler.Instance().addHandler(_2a2,"onkeydown",AutoComplete.prototype.onTextboxKeyDown,this);if(!AutoComplete.bDocEventsSet){AutoComplete.bDocEventsSet=true;YSEventHandler.Instance().addHandler(document,"onmousedown",AutoComplete.CloseCurrent);}};AutoComplete.prototype=new YSScrollable();AutoComplete.MAX_ITEMS=6;AutoComplete.acCur=null;AutoComplete.bDocEventsSet=false;AutoComplete.CloseCurrent=function(e){if(AutoComplete.acCur!=null){AutoComplete.acCur.onClose();}};AutoComplete.prototype.destruct=function(){this.objRef=null;this.aOptions=null;this.divPosition=this.divFold=this.divOptionHolder=this.ulOptions=null;this.divScroll=null;};AutoComplete.prototype.onClick=function(e,obj){this.iSelectedIndex=YSNumbers.checkInt(YSXML.getAttribute(obj,"optionIndex"));this.fnCallback.call(this.objCallback,this.aOptions[this.iSelectedIndex]);};AutoComplete.prototype.onClose=function(){if(this.bPreventClose){this.bPreventClose=false;return;}
YSCSS.setStyle(this.divPosition,"display","none");if(AutoComplete.acCur==this){AutoComplete.acCur=null;}};AutoComplete.prototype.onInit=function(){this.divPosition=document.createElement("div");this.divPosition.className="autoc_pos";YSCSS.setMultiStyle(this.divPosition,["position","display","overflow"],["absolute","none","hidden"]);this.divFold=document.createElement("div");this.divFold.className="fw_jslst_holder";YSCSS.setMultiStyle(this.divFold,["overflow","position","padding"],["hidden","relative","3px"]);this.divOptionHolder=document.createElement("div");YSCSS.setMultiStyle(this.divOptionHolder,["float","width","overflow","position"],["left",150+"px","hidden","relative"]);this.ulOptions=document.createElement("ul");this.ulOptions.className="fw_jslst_values";YSMouseMoveEvent.Instance().registerElement(this.ulOptions,100,AutoComplete.prototype.onListMouseMove,this);this.divOptionHolder.appendChild(this.ulOptions);this.divFold.appendChild(this.divOptionHolder);this.divPosition.appendChild(this.divFold);document.body.appendChild(this.divPosition);};AutoComplete.prototype.onListMouseMove=function(){if(this.iSelectedIndex!=-1){YSCSS.removeClassName(this.ulOptions.childNodes[this.iSelectedIndex],"selected");this.iSelectedIndex=-1;}};AutoComplete.prototype.onOpen=function(){var _2a8=YSDOM.getElementPosition(this.objRef);var _2a9=YSDOM.getElementSize(this.objRef);YSCSS.setMultiStyle(this.divPosition,["left","top","display"],[_2a8.left+"px",(_2a8.top+_2a9.height)+"px","block"]);AutoComplete.acCur=this;};AutoComplete.prototype.onTextboxClick=function(){var _2aa=YSCSS.getStyle(this.divPosition,"display");if(this.aOptions.length>0&&_2aa=="none"){this.onOpen();this.bPreventClose=true;}else{if(_2aa!="none"){this.onClose();}}};AutoComplete.prototype.onTextboxKeyDown=function(e,obj){var _2ad=YSEvent.getKeyCode(e);if(_2ad>40){return;}
if(_2ad==13&&this.iSelectedIndex>=0){this.fnCallback.call(this.objCallback,this.aOptions[this.iSelectedIndex]);this.iSelectedIndex=-1;this.onClose();obj.blur();return;}
var _2ae=-2;if(_2ad==40){if(this.iSelectedIndex<this.aOptions.length-1){_2ae=this.iSelectedIndex+1;}}
if(_2ad==38){if(this.iSelectedIndex>=0){_2ae=this.iSelectedIndex-1;}}
if(_2ae!=-2){var _2af=this.getTopLineNr();if(this.iSelectedIndex>=0){YSCSS.removeClassName(this.ulOptions.childNodes[this.iSelectedIndex],"selected");}else{_2ae+=_2af;}
if(_2ae>=0){YSCSS.addClassName(this.ulOptions.childNodes[_2ae],"selected");}
if(_2ae>=_2af+AutoComplete.MAX_ITEMS){this.doScroll(-1);}else{if(_2ae<_2af){this.doScroll(1);}}
this.iSelectedIndex=_2ae;}};AutoComplete.prototype.setOptions=function(_2b0){this.aOptions=_2b0;if(_2b0.length==0){this.onClose();return;}
this.iSelectedIndex=-1;if(YSCSS.getStyle(this.divPosition,"display")=="none"){this.onOpen();}
this.iNrOfLines=this.aOptions.length;this.iTotalHeight=this.iNrOfLines*this.iLineHeight;this.iShowHeight=Math.min(this.iTotalHeight,AutoComplete.MAX_ITEMS*this.iLineHeight);YSCSS.setStyle(this.divFold,"height",this.iShowHeight+"px");var _2b1=this.ulOptions.childNodes;while(_2b1.length>0){YSEventHandler.Instance().removeEvent(_2b1[0],"onclick");YSDOM.removeElement(_2b1[0]);}
YSDOM.removeElementChilds(this.ulOptions);for(var i=0,_2b3=_2b0.length;i<_2b3;i++){var _2b4=document.createElement("li");_2b4.innerHTML=_2b0[i].sValue;_2b4.className="fw_jslst_option";YSCSS.setStyle(_2b4,"cursor","pointer");this.ulOptions.appendChild(_2b4);YSXML.setAttribute(_2b4,"optionIndex",i);YSEventHandler.Instance().addHandler(_2b4,"onmousedown",AutoComplete.prototype.onClick,this);}
YSCSS.setMultiStyle(this.ulOptions,["float","visibility","width"],["left","visible","auto"]);document.body.appendChild(this.ulOptions);var _2b5=YSCSS.getStyle(this.ulOptions,"width",true)+3;var _2b6=Math.max(this.iMinWidth+(_2b0.length>1?0:16),_2b5);this.divOptionHolder.appendChild(this.ulOptions);YSCSS.setMultiStyle(this.ulOptions,["float","visibility","width"],["none","visible",(_2b6-(_2b0.length>1?3:0))+"px"]);YSCSS.setStyle(this.divOptionHolder,"width",_2b6+"px");var _2b7=_2b6+(_2b0.length>1?25:9);YSCSS.setStyle(this.divPosition,"width",_2b7+"px");YSDOM.removeElement(this.divScroll);this.onResetScroll();if(_2b0.length>1){this.divScroll=this.onCreateScrollBar(this.ulOptions,this.divFold,"fw_jslst");}else{this.divScroll=null;}};function CoachrEvent(){YSScrollable.call(this,true);};CoachrEvent.prototype=new YSScrollable();CoachrEvent.prototype.destruct=function(){YSScrollable.prototype.destruct.call(this);};CoachrEvent.prototype.onLoad=function(){this.iLineHeight=2;this.iShowHeight=YSCSS.getStyle("eventusers","height",true);this.onNewUserContent();};CoachrEvent.prototype.onNewUserContent=function(){var _2b8=YSDOM.getObj("eventusersinner");this.iTotalHeight=Math.max(YSCSS.getStyle(_2b8,"height",true),this.iShowHeight);var _2b9=this.getTopLineNr();this.iNrOfLines=undefined;this.onCreateScrollBar(_2b8,YSDOM.getObj("eventusers"),"fw_jslst");this.doScroll(-_2b9);};CoachrEvent.prototype.onTrackChange=function(_2ba,_2bb,_2bc,_2bd){YSDOM.setInnerHTML("eventusers",_2bd);this.onNewUserContent();IFramePage.setUserID(YSNumbers.checkInt(YSDOM.getRadioValue("users")));if(_2ba==""||_2bb==null){return;}
TrackPage.onTrackChange(_2ba,_2bc,_2bb,_2bd);};CoachrEvent.prototype.onViewTrack=function(_2be,_2bf){var sURL=SettingsBar.getURL("shared-workouts/map/"+_2be+".html");window.open(_2bf?sURL+"?c="+_2bf:sURL,"blank");};CoachrEvent.prototype.onUserChange=function(_2c1){IFramePage.setUserID(YSNumbers.checkInt(_2c1.value));};var CoachrEvent=new CoachrEvent();function CoachRMCE(){};CoachRMCE.prototype.onFirstLoad=function(_2c2,sID){YSTinyMCE.initTinyMCE({skin:"coachr"});this.onShowMCE(sID);};CoachRMCE.prototype.onRemoveMCE=function(sID){YSTinyMCE.removeControl(sID);};CoachRMCE.prototype.onShow=function(sID){if(!bPageLoaded){setTimeout("CoachRMCE.onShow('"+sID+"');",250);return;}
if(YSTinyMCE.isLoaded()){this.onShowMCE(sID);}else{YSTinyMCE.load(CoachRMCE.onFirstLoad,this,sID);}};CoachRMCE.prototype.onShowMCE=function(sID){YSTinyMCE.addControl(sID);};var CoachRMCE=new CoachRMCE();function IFrameCode(){this.sType="";this.sSize="";this.sFlashID="copySWF";this.lblCode=null;this.txtCopy=null;this.btnSWF=null;this.toHideCopy=null;this.toCheckTitle=null;};IFrameCode.prototype.destruct=function(){if(this.toHideCopy!=null){this.toHideCopy.onInterrupt();this.toHideCopy=null;}
if(this.toCheckTitle!=null){this.toCheckTitle.cancelTimeout();this.toCheckTitle=null;}
this.lblCode=null;this.txtCopy=null;this.btnSWF=null;YSListbox.DestructLst("embedtype");YSListbox.DestructLst("embedsize");};IFrameCode.prototype.onAddSWF=function(_2c7){YSDOM.removeElement("copySWFHolder");var _2c8=YSDOM.getElementSize("CopyCode",false);var sSrc=SCRIPT_PATH+"MyClipboard.swf";var _2ca="id="+this.sFlashID+"&width="+_2c8.width+"&height="+_2c8.height+"&onload=IFrameCode.onSWFLoad&onclick=IFrameCode.onSWFClick"+"&copytext="+YSString.encodeHtml(_2c7);var _2cb=YSFlash.getHTML(this.sFlashID,sSrc,_2c8,_2ca);var _2cc=document.createElement("div");YSCSS.setMultiStyle(_2cc,["top","right","position"],["0px","0px","absolute"]);_2cc.id="copySWFHolder";_2cc.innerHTML=_2cb;YSDOM.getObj("copybuttonholder").appendChild(_2cc);};IFrameCode.prototype.onChangeCode=function(){var _2cd,sKey;if(this.sType==""){this.sType="track";}
if(this.sType=="track"){_2cd=TrackPage.getTrackURL();sKey=TrackPage.getPermCode();}else{_2cd=TrackPage.getUserID();sKey=TrackPage.getUserKey();}
var sSrc="http://www.coachr.com/ext/"+this.sType+"/"+_2cd+"/"+this.sSize+".js?key="+sKey;var _2d0="<script type=\"text/javascript\" src=\""+sSrc+"\"></script>";YSXML.setAttribute(YSDOM.getObj("embedcode"),"maxlength",_2d0.length);YSDOM.setValue("embedcode",_2d0);this.onAddSWF(_2d0);if(this.toHideCopy!=null){this.toHideCopy.onInterrupt();this.toHideCopy=null;}};IFrameCode.prototype.onCopyCode=function(){if(this.toHideCopy!=null){this.toHideCopy.cancelTimeout();}else{this.txtCopy=document.createTextNode(" "+YSText.get("[?CodeCopied?]"));this.lblCode.appendChild(this.txtCopy);}
this.toHideCopy=new YSTimeout(10000,IFrameCode.onHideCopy,this);if(this.toCheckTitle!=null){this.toCheckTitle.onInterrupt();}};IFrameCode.prototype.onHideCopy=function(){YSDOM.removeElement(this.txtCopy);this.txtCopy=null;this.toHideCopy=null;};IFrameCode.prototype.onKeyDown=function(e,obj){var iKey=YSEvent.getKeyCode(e);return iKey<32;};IFrameCode.prototype.onLoad=function(){if(YSListbox.GetLst("embedsize")==null||TrackPage.getPermCode().length==0){setTimeout("IFrameCode.onLoad();",250);return;}
this.lblCode=YSDOM.getObj("trackurlholder").firstChild;this.sType=YSListbox.GetKey("embedtype");this.sSize=YSListbox.GetKey("embedsize");this.onChangeCode();};IFrameCode.prototype.onSizeChange=function(_2d4,sKey){_2d4.getSelector().firstChild.firstChild.innerHTML=_2d4.getValue();this.sSize=sKey;this.onChangeCode();};IFrameCode.prototype.onSWFClick=function(){this.onCopyCode();};IFrameCode.prototype.onSWFLoad=function(sID,_2d7){};IFrameCode.prototype.onTypeChange=function(_2d8,sKey){_2d8.getSelector().firstChild.firstChild.innerHTML=_2d8.getValue();this.sType=sKey;this.onChangeCode();};var IFrameCode=new IFrameCode();function YSListbox(sID,_2db,_2dc,_2dd){if(YSListbox.aIDs[sID]||YSDOM.getObj(sID)==null){return;}
YSScrollable.call(this,true);YSListbox.aIDs[sID]=this;this.sID=sID;this.iMaxNrOfItems=isDefined(_2dc)?_2dc:10;this.aValues={};this.sDefaultKey=_2db;this.sKey=_2db;this.sValue="";this.divClick=YSDOM.getObj(sID);this.divPosition=null;this.divFold=null;this.ulOptions=null;this.iPadding=3;this.bUseCopy=isDefined(_2dd)?_2dd:false;this.bFoldDown=true;this.bPreventClose=false;this.oStartPos=new Pixel();this.oOnChange=null;this.oFoldInterval=null;this.bFolding=true;this.createFoldDiv();YSCSS.setStyle(this.divClick,"cursor","pointer");YSEventHandler.Instance().addHandler(this.divClick,"onmouseout",YSListbox.prototype.onLstMouseOut,this);YSEventHandler.Instance().addHandler(this.divClick,"onmousedown",YSListbox.prototype.onLstClick,this,true);YSEvent.disableSelect(this.divClick);if(!YSListbox.bDocEventsSet){YSListbox.bDocEventsSet=true;YSEventHandler.Instance().addHandler(document,"onmousedown",YSListbox.CloseCurrent);}};YSListbox.DURATION=200;YSListbox.lstUnfolded=null;YSListbox.bDocEventsSet=false;YSListbox.aIDs={};YSListbox.prototype=new YSScrollable();YSListbox.Destruct=function(){YSListbox.lstUnfolded=null;for(var sID in YSListbox.aIDs){YSListbox.aIDs[sID].destruct();delete YSListbox.aIDs[sID];}
YSListbox.aIDs=null;};YSListbox.DestructLst=function(sID){if(isDefined(YSListbox.aIDs[sID])){YSListbox.aIDs[sID].destruct();delete YSListbox.aIDs[sID];}};YSListbox.CloseCurrent=function(){if(YSListbox.lstUnfolded!=null){YSListbox.lstUnfolded.close();}};YSListbox.GetLst=function(sID){return isDefined(YSListbox.aIDs[sID])?YSListbox.aIDs[sID]:null;};YSListbox.GetKey=function(sID){var _2e2=YSListbox.GetLst(sID);if(_2e2==null){return"";}else{return _2e2.getKey();}};YSListbox.GetValue=function(sID){var _2e4=YSListbox.GetLst(sID);if(_2e4==null){return"";}else{return _2e4.getValue();}};YSListbox.IsAboveOptions=function(e,oPos){if(YSListbox.lstUnfolded!=null){if(!isDefined(oPos)){return YSEvent.isMouseAboveElement(e,YSListbox.lstUnfolded.divFold);}else{return YSDOM.posAboveElement(oPos,YSListbox.lstUnfolded.divFold);}}
return false;};YSListbox.prototype.destruct=function(){YSScrollable.prototype.destruct.call(this);this.ulOptions=null;if(this.oFoldInterval!=null){this.oFoldInterval.cancelTimeout();this.oFoldInterval=null;}
YSDOM.removeElement(this.divPosition);this.divClick=this.divFold=this.divPosition=this.oOnChange=this.oSliding=this.oStartPos=null;};YSListbox.prototype.close=function(){if(this.bPreventClose){this.bPreventClose=false;return;}
if(!this.bFolding){this.onLstClick();}};YSListbox.prototype.createFoldDiv=function(){this.ulOptions=YSDOM.getObj(this.sID+"_values");if(this.ulOptions==null||this.ulOptions.childNodes.length==0){return;}
if(this.bUseCopy){this.ulOptions=YSDOM.getValidCopy(this.ulOptions);}
this.iNrOfLines=this.ulOptions.childNodes.length;for(var i=0;i<this.iNrOfLines;i++){var eCur=this.ulOptions.childNodes[i];if(eCur.childNodes.length<2){continue;}
var sKey=YSXML.getText(eCur.childNodes[0]);var _2ea=eCur.childNodes[1].innerHTML;this.aValues[sKey]={value:_2ea,position:i};if(this.sKey==sKey){this.sValue=_2ea;}
YSCSS.addClassName(eCur.childNodes[0],"hide");YSCSS.addClassName(eCur,"fw_jslst_option");YSCSS.setStyle(eCur,"cursor","pointer");YSXML.setAttribute(eCur,"YSLst_key",sKey);YSEventHandler.Instance().addHandler(eCur,"onmousedown",YSListbox.prototype.onItemClick,this,false);}
document.body.appendChild(this.ulOptions);YSCSS.addClassName(this.ulOptions,"fw_jslst_values");YSCSS.setStyle(this.ulOptions,"float","left");var _2eb=YSCSS.getStyle(this.ulOptions,"width",true);var _2ec=Math.max(YSCSS.getStyle(this.divClick,"width",true),_2eb+this.iPadding*3+this.iScrollWidth);var _2ed=_2ec-(this.iPadding*3+this.iScrollWidth);YSCSS.setStyle(this.ulOptions,"float","none");var _2ee=document.createElement("div");YSCSS.setMultiStyle(_2ee,["float","width","overflow","position"],["left",_2ed+"px","hidden","relative"]);this.divPosition=document.createElement("div");YSCSS.setMultiStyle(this.divPosition,["position","display","width","overflow","zIndex"],["absolute","none",_2ec+"px","hidden",100]);this.divFold=document.createElement("div");this.divFold.className="fw_jslst_holder";this.divFold.id=this.sID+"_holder";YSCSS.setMultiStyle(this.divFold,["overflow","height","padding","position"],["hidden","1px",this.iPadding+"px","relative"]);this.divPosition.appendChild(this.divFold);this.iLineHeight=YSCSS.getStyle(this.ulOptions.firstChild,"height",true);this.iTotalHeight=YSCSS.getStyle(this.ulOptions,"height",true);this.iShowHeight=Math.min(this.iNrOfLines,this.iMaxNrOfItems)*this.iLineHeight;YSCSS.setStyle(_2ee,"height",this.iShowHeight+"px");_2ee.appendChild(this.ulOptions);this.divFold.appendChild(_2ee);this.onCreateScrollBar(this.ulOptions,this.divFold,"fw_jslst");document.body.appendChild(this.divPosition);var _2ef=YSCSS.getStyle(this.divFold,"borderLeftWidth",true)+YSCSS.getStyle(this.divFold,"borderRightWidth",true);_2ed-=_2ef;if(_2ed>=_2eb){YSCSS.setStyle(_2ee,"width",_2ed+"px");}else{YSCSS.setStyle(_2ee,"width",_2eb+"px");YSCSS.setStyle(this.divPosition,"width",(_2ec+(_2eb-_2ed))+"px");}
YSCSS.removeClassName(this.ulOptions,"invisible");};YSListbox.prototype.getDefaultKey=function(){return this.sDefaultKey;};YSListbox.prototype.getID=function(){return this.sID;};YSListbox.prototype.getKey=function(){return this.sKey;};YSListbox.prototype.getOption=function(sKey){return isDefined(this.aValues[sKey])?this.ulOptions.childNodes[this.aValues[sKey].position].childNodes[1]:null;};YSListbox.prototype.getSelector=function(){return this.divClick;};YSListbox.prototype.getValue=function(){return this.sValue;};YSListbox.prototype.onCheckFoldDirection=function(){var _2f1=Math.min(YSCSS.getStyle(document.body,"height",true),YSDOM.getWindowSize().height+YSDOM.getDocumentScroll().top);this.bFoldDown=YSDOM.getElementPosition(this.divClick).top+YSCSS.getStyle(this.divClick,"height",true)+this.iShowHeight+2*this.iPadding<=_2f1;};YSListbox.prototype.onLstClick=function(e){if(YSListbox.lstUnfolded!=null&&YSListbox.lstUnfolded!=this){YSListbox.lstUnfolded.close();}
YSListbox.lstUnfolded=this;var _2f3=YSListbox.DURATION;if(this.oFoldInterval!=null){_2f3=this.oFoldInterval.getTimePassed();this.oFoldInterval.cancelTimeout();}else{if(this.bFolding&&this.aValues[this.sKey]){var _2f4=YSCSS.getStyle(this.ulOptions,"marginTop",true)*-1/this.iLineHeight;this.doScroll(_2f4-this.aValues[this.sKey].position);}}
var _2f5=YSCSS.getStyle(this.divFold,"height",true);var _2f6=null;if(this.bFolding){this.onCheckFoldDirection();this.bFolding=false;var oPos=YSDOM.getElementPosition(this.divClick);if(this.bFoldDown){oPos.top+=YSCSS.getStyle(this.divClick,"height",true);YSCSS.setStyle(this.divFold.firstChild,"marginTop","0px");YSCSS.setStyle(this.divFold.childNodes[1],"marginTop","0px");}else{oPos.top-=5;}
this.oStartPos=oPos;YSDOM.setPosition(this.divPosition,oPos);YSCSS.setStyle(this.divPosition,"display","block");_2f6=YSListbox.prototype.onUnFold;}else{this.bFolding=true;_2f6=YSListbox.prototype.onFold;}
this.oFoldInterval=new YSTimeout(15,_2f6,this,{start:_2f5,duration:_2f3},true);this.bPreventClose=true;return false;};YSListbox.prototype.onLstMouseOut=function(){if(YSListbox.lstUnfolded!=this){YSCSS.removeClassName(this.divClick,"selected");}else{YSCSS.addClassName(this.divClick,"selected");}};YSListbox.prototype.onItemClick=function(e,obj){this.setKey(YSXML.getAttribute(obj,"YSLst_key"),true);};YSListbox.prototype.onFold=function(_2fa,_2fb){var _2fc=Math.min(_2fb/_2fa.duration,1);var _2fd=Math.round(_2fa.start-(_2fa.start-1)*_2fc);this.onFoldAction(_2fd);if(_2fd==1){YSCSS.setStyle(this.divPosition,"display","none");this.oFoldInterval.cancelTimeout();this.oFoldInterval=null;if(YSListbox.lstUnfolded==this){YSListbox.lstUnfolded=null;}
YSCSS.removeClassName(this.divClick,"selected");}};YSListbox.prototype.onUnFold=function(_2fe,_2ff){var _300=Math.min(_2ff/_2fe.duration,1);var _301=Math.round(_2fe.start+(this.iShowHeight-_2fe.start)*_300);this.onFoldAction(_301);if(_301==this.iShowHeight){this.oFoldInterval.cancelTimeout();this.oFoldInterval=null;}};YSListbox.prototype.onFoldAction=function(_302){YSCSS.setStyle(this.divFold,"height",_302+"px");if(!this.bFoldDown){YSCSS.setStyle(this.divPosition,"top",(this.oStartPos.top-_302-2*this.iPadding)+"px");YSCSS.setStyle(this.divFold.firstChild,"marginTop",(_302-this.iShowHeight)+"px");YSCSS.setStyle(this.divFold.childNodes[1],"marginTop",(_302-this.iShowHeight)+"px");}};YSListbox.prototype.setKey=function(sKey,_304){if(!isDefined(this.aValues[sKey])){return;}
if(!isDefined(_304)){_304=true;}
var _305=this.sKey;var _306=this.sValue;this.sKey=sKey;this.sValue=this.aValues[sKey].value;if(_304&&this.oOnChange!=null){var _307=typeof this.oOnChange.obj=="string"?eval(this.oOnChange.obj):this.oOnChange.obj;var _308=this.oOnChange.fn.call(_307,this,this.sKey);if(isDefined(_308)&&_308===false){this.sKey=_305;this.sValue=_306;}}};YSListbox.prototype.setOnChange=function(_309,_30a){if(!isDefined(_30a)){_30a=window;}
this.oOnChange={fn:_309,obj:_30a};};function YSScrollable(_30b){if(isDefined(_30b)&&_30b){this.iShowHeight=1;this.iTotalHeight=1;this.iScrollWidth=16;this.iLineHeight=12;this.iLinesPerScroll=1;this.iNrOfLines=undefined;this.iScrollSpace=0;this.iSliderHeight=0;this.oSliding={startmouse:0,starttop:0};this.fSliderExtra=0;this.fScrollPixPerLine=0;this.iScrollMaxTop=0;this.bMovingSlider=false;this.divSliderHolder=null;this.divScrollable=null;this.oScrollInterval=null;if(!YSScrollable.bDocEventsSet){YSScrollable.bDocEventsSet=true;YSMouseMoveEvent.Instance().registerElement(document,30,YSScrollable.onDocMouseMove);YSEventHandler.Instance().addHandler(document,"onmouseup",YSScrollable.onDocMouseUp);}}};YSScrollable.bDocEventsSet=false;YSScrollable.scCur=null;YSScrollable.onDocMouseUp=function(e){if(YSScrollable.scCur!=null&&YSScrollable.scCur.bMovingSlider){YSScrollable.scCur.onPositionSlider();YSScrollable.scCur.bMovingSlider=false;YSScrollable.scCur=null;YSEvent.enableSelect(document);}};YSScrollable.onDocMouseMove=function(e,oPos){if(YSScrollable.scCur!=null&&YSScrollable.scCur.bMovingSlider){YSScrollable.scCur.onSliderMove(oPos.top-YSScrollable.scCur.oSliding.startmouse);}};YSScrollable.prototype.destruct=function(){this.divSliderHolder=null;this.divScrollable=null;this.oScrollInterval=null;};YSScrollable.prototype.doScroll=function(_30f,_310){var _311=this.getCurScroll();if(_311==0&&_30f>0){return;}
var _312=-1*(this.iTotalHeight-this.iShowHeight);if(_311==_312&&_30f<0){return;}
_311+=_30f*this.iLineHeight*this.iLinesPerScroll;_311=Math.min(Math.max(_311,_312),0);YSCSS.setStyle(this.divScrollable,"marginTop",_311+"px");this.onPositionSlider(_311);};YSScrollable.prototype.getCurScroll=function(){return YSCSS.getStyle(this.divScrollable,"marginTop",true);};YSScrollable.prototype.getTopLineNr=function(){return Math.abs(this.getCurScroll())/this.iLineHeight;};YSScrollable.prototype.onCreateScrollBar=function(_313,_314,_315){this.divScrollable=_313;this.onResetScroll();var _316=document.createElement("div");_316.className=_315+"_scrollbar";YSCSS.setMultiStyle(_316,["float","width","height"],["right",this.iScrollWidth+"px",this.iShowHeight+"px"]);var _317=document.createElement("div");_317.className=_315+"_scrollup";YSCSS.setMultiStyle(_317,["width","height"],[this.iScrollWidth+"px",this.iScrollWidth+"px"]);this.iScrollSpace=Math.max(this.iShowHeight-2*this.iScrollWidth,0);this.iSliderHeight=0;if(this.iShowHeight<this.iTotalHeight){var _318=this.iScrollSpace*(this.iShowHeight/this.iTotalHeight);this.iSliderHeight=Math.max(20,Math.floor(_318));this.fSliderExtra=Math.max(this.iSliderHeight-_318,0);}
if(!isDefined(this.iNrOfLines)){this.iNrOfLines=this.iTotalHeight/this.iLineHeight;}
this.fScrollPixPerLine=this.iScrollSpace/this.iNrOfLines;this.iScrollMaxTop=this.iScrollSpace-this.iSliderHeight;this.divSliderHolder=document.createElement("div");YSCSS.setMultiStyle(this.divSliderHolder,["width","height"],[this.iScrollWidth+"px",this.iScrollSpace+"px"]);if(this.iShowHeight<this.iTotalHeight){var _319=document.createElement("div");_319.className=_315+"_scrollslider";YSCSS.setStyle(_319,"height",(this.iSliderHeight-2)+"px");this.divSliderHolder.appendChild(_319);YSEventHandler.Instance().addHandler(_319,"onmousedown",YSScrollable.prototype.onSliderDown,this);}
var _31a=document.createElement("div");_31a.className=_315+"_scrolldown";YSCSS.setMultiStyle(_31a,["width","height"],[this.iScrollWidth+"px",this.iScrollWidth+"px"]);_316.appendChild(_317);_316.appendChild(this.divSliderHolder);_316.appendChild(_31a);_314.appendChild(_316);YSEventHandler.Instance().addHandler(_317,"onmousedown",YSScrollable.prototype.onScrollUpStart,this);YSEventHandler.Instance().addHandler(_317,"onmouseup",YSScrollable.prototype.onScrollStop,this);YSEventHandler.Instance().addHandler(_31a,"onmousedown",YSScrollable.prototype.onScrollDownStart,this);YSEventHandler.Instance().addHandler(_31a,"onmouseup",YSScrollable.prototype.onScrollStop,this);YSEventHandler.Instance().addHandler(_314,"onmousewheel",YSScrollable.prototype.onScroll,this);return _316;};YSScrollable.prototype.onPositionSlider=function(_31b){if(this.iShowHeight==this.iTotalHeight){return;}
if(!isDefined(_31b)){_31b=this.getCurScroll();}
var _31c;if(_31b<=this.iShowHeight-this.iTotalHeight){_31c=this.iScrollMaxTop;}else{var _31d=(-1*_31b)/this.iLineHeight*this.fScrollPixPerLine;var _31e=_31d/this.iScrollSpace;_31d-=_31e*this.fSliderExtra;_31c=Math.ceil(Math.min(_31d,this.iScrollMaxTop));}
YSCSS.setStyle(this.divSliderHolder,"height",(this.iScrollSpace-_31c)+"px");YSCSS.setStyle(this.divSliderHolder,"paddingTop",_31c+"px");};YSScrollable.prototype.onResetScroll=function(){YSCSS.setStyle(this.divScrollable,"marginTop","0px");this.onPositionSlider(0);};YSScrollable.prototype.onScroll=function(e){this.onScrollStop(e);this.doScroll(YSEvent.getScrollWheelDirection(e),0);};YSScrollable.prototype.onScrollDownStart=function(e){this.onScrollStop(e);this.oScrollInterval=new YSTimeout(70,YSScrollable.prototype.doScroll,this,-1,true);};YSScrollable.prototype.onScrollStop=function(e){if(YSScrollable.onDocMouseUp(e)){return;}
if(this.oScrollInterval!=null){this.oScrollInterval.cancelTimeout();this.oScrollInterval=null;}
YSEvent.cancelEvent(e,true);};YSScrollable.prototype.onScrollUpStart=function(e){this.onScrollStop(e);this.oScrollInterval=new YSTimeout(70,YSScrollable.prototype.doScroll,this,1,true);};YSScrollable.prototype.onSliderDown=function(e){YSScrollable.scCur=this;this.bMovingSlider=true;this.oSliding.startmouse=YSEvent.getGlobalMousePosition(e).top;this.oSliding.starttop=YSCSS.getStyle(this.divSliderHolder,"paddingTop",true);YSEvent.cancelEvent(e,true);YSEvent.disableSelect(document);};YSScrollable.prototype.onSliderMove=function(_324){var _325=Math.ceil(Math.min(Math.max(0,this.oSliding.starttop+_324),this.iScrollMaxTop));YSCSS.setStyle(this.divSliderHolder,"height",(this.iScrollSpace-_325)+"px");YSCSS.setStyle(this.divSliderHolder,"paddingTop",_325+"px");var _326=_325/this.iScrollMaxTop;_325+=_326*this.fSliderExtra;var _327=_325/this.iScrollSpace*this.iTotalHeight*-1;YSCSS.setStyle(this.divScrollable,"marginTop",(Math.round(_327/this.iLineHeight)*this.iLineHeight)+"px");};function SettingsBar(){this.sPageID=null;this.oOnCountryChange=null;this.oOnMetricChange=null;this.bKM=null;this.DOMAIN_LANGUAGE="en";this.KMPERMILE=1.609344;this.MPERFT=0.3048;};SettingsBar.prototype.destruct=function(){this.oOnCountryChange=null;this.oOnMetricChange=null;};SettingsBar.prototype.getBasePath=function(){if(this.DOMAIN_LANGUAGE!=LANGUAGE){return BASE_PATH+LANGUAGE+"/";}else{return BASE_PATH;}};SettingsBar.prototype.getCurrentTabURL=function(){var _328=Tabs.getCurTab();if(_328!=null&&!YSCSS.hasClassName(_328,"first")){return this.sPageID.substr(0,this.sPageID.length-5)+"/"+_328.id+".html";}else{return this.sPageID;}};SettingsBar.prototype.getCurrentURL=function(){return this.getURL(this.getCurrentTabURL());};SettingsBar.prototype.getPageID=function(){return this.sPageID;};SettingsBar.prototype.getURL=function(sURL){var _32a="";if(location.port&&location.port!=80){_32a=":"+location.port;}
return location.protocol+"//"+location.hostname+_32a+this.getBasePath()+sURL;};SettingsBar.prototype.isKM=function(){if(this.bKM===null){this.bKM=YSCookie.read("km");}
return this.bKM!=0;};SettingsBar.prototype.onAjaxResult=function(_32b,_32c,_32d,_32e){if(_32d.status==403){location.href=this.getCurrentURL();}else{if(_32b){_32b.call(_32c,_32d,_32e);}}};SettingsBar.prototype.onCountryChange=function(_32f,sKey){_32f.getSelector().firstChild.childNodes[1].innerHTML=_32f.getValue();if(SearchPage.isLoaded()){YSAJAX.sendRequest(null,"setsetting&getbox&cc="+sKey,false,SettingsBar.onCountryResult,SettingsBar,{notify:true,cc:sKey});}else{YSAJAX.sendRequest(null,"setsetting&cc="+sKey,false,SettingsBar.onCountryResult,SettingsBar,{notify:false,cc:sKey});}
YSCookie.create("countrycode",sKey,0);};SettingsBar.prototype.onCountryResult=function(_331,_332){if(_332.notify){SearchPage.onCountrySelect(_331);}
if(this.oOnCountryChange!=null){this.oOnCountryChange.fn.call(this.oOnCountryChange.obj,_332.cc);}};SettingsBar.prototype.onLanguageChange=function(_333,sKey){if(sKey!=LANGUAGE){var _335=BASE_PATH.substr(0,BASE_PATH.length-1);var _336=location.protocol+"//"+location.hostname;var _337=location.pathname+location.search;if(_337.indexOf(_335)==0){_337=_337.substr(_335.length);}
if(_337.substr(0,LANGUAGE.length+1)=="/"+LANGUAGE){_337=_337.substr(LANGUAGE.length+1);}
var _338=Tabs.getCurTab();if(_338!=null){var _339=_337.indexOf("/",1);if(_339==-1){_339+=2;}else{_339++;}
var _33a=_337.substr(_339);var _33b=YSCSS.hasClassName(_338,"first")?this.sPageID:_338.id+".html";if(_33a!=_33b){if(_33a==this.sPageID){_337=_337.substr(0,_337.length-5)+"/"+_33b;}else{if(_33b==this.sPageID){_337=_337.substr(0,_339-1)+".html";}else{_337=_337.substr(0,_339)+_33b;}}}}
if(sKey==this.DOMAIN_LANGUAGE){location.href=_336+_335+_337;}else{location.href=_336+_335+"/"+sKey+_337;}}};SettingsBar.prototype.onLoad=function(_33c){if(bChrome){if(YSDOM.getObj("frmLogin")){YSDOM.setFocus("email");YSDOM.setFocus("password");YSDOM.getObj("password").blur();}}
this.sPageID=_33c;};SettingsBar.prototype.onMetricChange=function(_33d,sKey){_33d.getSelector().firstChild.childNodes[1].innerHTML=_33d.getValue();var bKM=sKey=="km"?1:0;YSAJAX.sendRequest(null,"setsetting&km="+bKM,false,SettingsBar.onMetricResult,this);YSCookie.create("km",bKM,0);this.bKM=bKM;};SettingsBar.prototype.onMetricResult=function(_340){if(this.oOnMetricChange!=null){this.oOnMetricChange.fn.call(this.oOnMetricChange.obj,this.bKM);}};SettingsBar.prototype.onProfileChange=function(xml){var _342=YSXML.getChildData(xml,"newlogin");var _343=document.createElement("div");YSDOM.replaceElement(YSDOM.getObj("loginholder"),_343);YSDOM.setInnerHTML(_343,_342);if(SearchPage.isLoaded()){Searcher.onRefreshSearch();}
var _344=YSXML.getChildText(xml,"newname");var _345=YSDOM.getObj("frontuser");if(_345!=null){_345.innerHTML="&nbsp;|&nbsp;"+_344;}};SettingsBar.prototype.setOnCountryChange=function(_346,_347){if(_346==null){this.oOnCountryChange=null;}else{this.oOnCountryChange={fn:_346,obj:isDefined(_347)?_347:window};}};SettingsBar.prototype.setOnMetricChange=function(_348,_349){if(_348==null){this.oOnMetricChange=null;}else{this.oOnMetricChange={fn:_348,obj:isDefined(_349)?_349:window};}};var SettingsBar=new SettingsBar();YSAJAX.setDefaultCallback(SettingsBar.onAjaxResult,SettingsBar);function Sharer(){var _34a=Math.floor((screen.width-800)/2);var iTop=Math.floor((screen.height-525-40)/2);this.sOptions="width=800,height=525,resizable=yes,left="+_34a+",top="+iTop;};Sharer.prototype.getURL=function(_34c){if(_34c){return"http://coachr.com/"+TrackPage.getPermCode();}else{var sURL=SettingsBar.getCurrentURL();var _34e=sURL.indexOf("?");if(_34e!=-1){sURL=sURL.substr(0,_34e);}
sURL+="?c="+TrackPage.getPermCode();return sURL;}};Sharer.prototype.onDelicousShare=function(){var _34f=document.title;var _350=_34f.indexOf("-");if(_350==-1){_34f="";}else{_34f=_34f.substr(_350);}
_34f=YSText.get("[?shared-workouts.html:SharedWorkoutsTitle?]")+" "+_34f;open("http://delicious.com/save?v=5&noui&jump=close&url="+YSString.encodeHtml(this.getURL())+"&title="+YSString.encodeHtml(_34f),"delicious",this.sOptions);};Sharer.prototype.onFacebookShare=function(){var sURL=this.getURL();open("http://www.facebook.com/sharer.php?u="+YSString.encodeHtml(sURL),"facebook",this.sOptions);};Sharer.prototype.onHyvesLoaded=function(){if(!isDefined("Hyves",true)){setTimeout("Sharer.onHyvesLoaded();",250);return;}
var _352=document.createElement("div");document.body.appendChild(_352);var sMsg=YSText.get("[?HyvesMsg?]",[this.getURL()]);Hyves.connect.tip({title:YSText.get("[?HyvesTitle?]"),body:sMsg,category:12},null,_352);Hyves.connect.submit(0);YSDOM.removeElement(_352);};Sharer.prototype.onHyvesShare=function(){if(YSJS.isLoaded("hyves")){this.onHyvesLoaded();}else{YSJS.load("hyves","http://www.hyves.nl/precompiled/hyvesconnect_async.js",Sharer.onHyvesLoaded,this);}};Sharer.prototype.onMailShare=function(){View.Create("mailshare","url="+YSString.encodeHtml(this.getURL()));};Sharer.prototype.onTwitterShare=function(){var _354=TrackPage.getTrackDuration();var sMsg=YSText.get("[?TwitterMsg?]",[Math.floor(_354/3600),Math.floor(_354%3600/60),this.getURL(true)]);open("http://twitter.com/home?status="+YSString.encodeHtml(sMsg),"twitter",this.sOptions);};var Sharer=new Sharer();function Tabs(){this.sCallbackURL=null;this.ulTabs=null;this.liCurTab=null;this.oCurRequest=null;this.oOnRemove=null;this.oOnChange=null;this.imgCurLoading=null;this.aTabContent={};this.aPreloading={};this.bLoaded=false;this.bCacheExisting=true;};Tabs.prototype.destruct=function(){YSDOM.destructElement(this.ulTabs);this.ulTabs=this.liCurTab=this.oCurRequest=this.imgCurLoading=null;this.aTabContent=this.oOnRemove=this.oOnChange=null;SettingsBar.destruct();};Tabs.prototype.add=function(sID,_357,_358,_359,_35a){if(!isDefined(_35a)){_35a=null;}
if(!isDefined(_358)){_358=true;}
if(!isDefined(_359)||_358){_359=true;}
if(this.ulTabs==null){setTimeout(YSString.getJSCall("Tabs.add",[sID,_357,_358,_359,_35a]),250);return;}
var _35b=document.createElement("li");_35b.id=sID;if(_35a!=null){YSXML.setAttribute(_35b,"coupledTab",_35a);}
var aTab=document.createElement("a");aTab.href="#tab_"+sID;aTab.innerHTML=_357;_35b.appendChild(aTab);var _35d=document.createElement("div");_35d.className="tabclose";_35b.appendChild(_35d);this.ulTabs.appendChild(_35b);aTab.onclick=function(){return false;};aTab.onfocus=function(){this.blur();};_35b.onclick=function(_35e){Tabs.onClick(this,true,_35e);YSHash.go("tab_"+this.id);return false;};_35d.onclick=function(e){Tabs.remove(this.parentNode.id);YSEvent.cancelEvent(e,true);return false;};if(_358){_35b.onclick();}else{if(_359){this.onClick(_35b,false);}}};Tabs.prototype.getCurTab=function(){return this.liCurTab;};Tabs.prototype.getCurTabID=function(){return this.liCurTab!=null?this.liCurTab.id:"";};Tabs.prototype.getTabCouple=function(_360){_360=YSDOM.getObj(_360);var _361=YSXML.getAttribute(_360,"coupledTab");if(_361&&this.hasTab(_361)){return YSDOM.getObj(_361);}else{return null;}};Tabs.prototype.hasTab=function(sID){return YSDOM.getObj(sID)!=null;};Tabs.prototype.isLoaded=function(){return this.bLoaded;};Tabs.prototype.onCacheTab=function(_363){if(this.bCacheExisting&&!isDefined(this.aTabContent[_363])&&YSDOM.getObj("tabcontent")!=null){this.bCacheExisting=false;var _364=document.createElement("div");var _365=YSDOM.getObj("tabcontent").childNodes;while(_365.length){_364.appendChild(_365[0]);}
YSDOM.getObj("tabcontent").appendChild(_364);this.aTabContent[_363]=_364;}};Tabs.prototype.onClick=function(_366,_367,_368){if(YSCSS.hasClassName(_366,"active")){return;}
if(!isDefined(_367)){_367=true;}
if(!isDefined(_368)){_368="";}
if(_367){for(var sID in this.aPreloading){this.aPreloading[sID]=1;}}
if(isDefined(this.aPreloading[_366.id])){this.aPreloading[_366.id]=_367?2:1;return;}
if(_367){if(this.oOnChange!=null){this.oOnChange.fn.call(this.oOnChange.obj,_366.id,this.liCurTab==null?"":this.liCurTab.id);}
var aLI=_366.parentNode.getElementsByTagName("li");var _36b=1;for(var i=0,_36d=aLI.length;i<_36d;i++){if(YSCSS.hasClassName(aLI[i],"hide")){_36b++;continue;}
YSCSS.removeClassName(aLI[i],"before");if(aLI[i]==_366){YSCSS.addClassName(aLI[i],"active");if(i-_36b>=0){YSCSS.addClassName(aLI[i-_36b],"before");}}else{YSCSS.removeClassName(aLI[i],"active");}}}
if(this.liCurTab){this.onCacheTab(this.liCurTab.id);}
if(isDefined(this.aTabContent[_366.id])){if(_367){if(this.liCurTab){YSCSS.addClassName(this.aTabContent[this.liCurTab.id],"hidden");setTimeout("YSCSS.setStyle(Tabs.aTabContent['"+this.liCurTab.id+"'], "+"'visibility', 'hidden');",0);}
YSCSS.setStyle(this.aTabContent[_366.id],"visibility","hidden");YSCSS.removeClassName(this.aTabContent[_366.id],"hidden");setTimeout("YSCSS.setStyle(Tabs.aTabContent['"+_366.id+"'], 'visibility', 'visible');",0);this.liCurTab=_366;}}else{var _36e={sRequested:_366.id,sPrevious:this.liCurTab?this.liCurTab.id:null,bOpen:_367};if(_367){this.liCurTab=_366;if(this.imgCurLoading){YSDOM.removeElement(this.imgCurLoading);}}
var oPos=YSDOM.getElementPosition(_366);var _370=YSDOM.getElementSize(_366);oPos.left+=_370.width-20;oPos.top+=_367?4:24;var _371=null;if(IMAGE_PATH!=""){_371=document.createElement("img");_371.src=IMAGE_PATH+"loadingsmall.gif";YSCSS.setMultiStyle(_371,["position","top","left"],["absolute",oPos.top+"px",oPos.left+"px"]);document.body.appendChild(_371);}
if(_367){this.imgCurLoading=_371;}
_36e.imgLoading=_371;if(this.oCurRequest&&_367){YSAJAX.cancelRequest(this.oCurRequest);}
if(_368!=""&&_368[0]!="&"){_368="&"+_368;}
var _372=YSAJAX.sendRequest(this.sCallbackURL,"tab="+_366.id+"&getxhtml="+_368,false,Tabs.onUpdate,this,_36e);if(_367){this.oCurRequest=_372;}else{this.aPreloading[_366.id]=1;}}};Tabs.prototype.onHashChange=function(_373){if(_373==""){this.onClick(this.ulTabs.firstChild);}else{if(_373.substr(0,4)=="tab_"){_373=_373.substr(4);}
var _374=YSDOM.getObj(_373);if(_374){this.onClick(_374);}}};Tabs.prototype.onLoad=function(_375){this.sCallbackURL=_375;this.bLoaded=true;this.ulTabs=YSDOM.getObj("tablist");var _376=this.ulTabs.getElementsByTagName("a");for(var i=0,_378=_376.length;i<_378;i++){var _379=_376[i].parentNode;_376[i].href="#tab_"+_379.id;if(YSCSS.hasClassName(_379,"active")){this.liCurTab=_379;}
_376[i].onclick=function(){return false;};_379.onclick=function(_37a){Tabs.onClick(this,true,_37a);YSHash.go("tab_"+this.id);return false;};}
if(this.liCurTab!=null){this.onCacheTab(this.liCurTab.id);if(this.oOnChange!=null){this.oOnChange.fn.call(this.oOnChange.obj,this.liCurTab.id,null);}}
YSHash.setOnChange(Tabs.onHashChange,this);};Tabs.prototype.onRefresh=function(xml,_37c){if(!isDefined(_37c)){_37c=YSXML.getChildText(xml,"tabid");}
if(isDefined(this.aTabContent[_37c])){var _37d=YSXML.getChildData(xml,"tabxhtml");YSDOM.destructChilds(this.aTabContent[_37c]);YSDOM.setInnerHTML(this.aTabContent[_37c],_37d);}};Tabs.prototype.onReload=function(_37e,_37f){if(this.hasTab(_37e)&&isDefined(this.aTabContent[_37e])){if(!isDefined(_37f)){_37f="";}else{if(_37f!=""&&_37f[0]!="&"){_37f="&"+_37f;}}
YSAJAX.sendRequest(this.sCallbackURL,"tab="+_37e+"&getxhtml="+_37f,false,Tabs.onReloadReceived,this,_37e);}};Tabs.prototype.onReloadReceived=function(_380,_381){var xml=YSAJAX.getXML(_380);if(xml!=null){this.onRefresh(xml,_381);}};Tabs.prototype.onUpdate=function(_383,_384){if(_383.status==404){this.remove(_384.sRequested,true);YSDOM.removeElement(_384.imgLoading);}
if(isDefined(this.aTabContent[_384.sRequested])){return;}
if(!this.hasTab(_384.sRequested)){return;}
var xml=YSAJAX.getXML(_383);var _386=xml?YSXML.getChildData(xml,"tabxhtml"):"";var _387=document.createElement("div");this.aTabContent[_384.sRequested]=_387;if(!_384.bOpen){_387.className="hidden";}else{if(_384.sPrevious){YSCSS.addClassName(this.aTabContent[_384.sPrevious],"hidden");}}
YSDOM.getObj("tabcontent").appendChild(_387);YSDOM.setInnerHTML(_387,_386);YSDOM.addOnFocusBlur(_387);YSDOM.removeElement(_384.imgLoading);if(_384.bOpen){this.oCurRequest=null;this.imgCurLoading=null;}
if(isDefined(this.aPreloading[_384.sRequested])){var _388=this.aPreloading[_384.sRequested]>1;delete this.aPreloading[_384.sRequested];if(_388){this.onClick(YSDOM.getObj(_384.sRequested));}}};Tabs.prototype.openTab=function(sID,_38a,_38b){var _38c=isDefined(this.aTabContent[sID]);if(!isDefined(_38a)){_38a=true;}
var _38d=YSDOM.getObj(sID);if(_38d){if(_38a){_38d.onclick(_38b);}else{this.onClick(_38d,false);}}
return _38c;};Tabs.prototype.remove=function(sID,_38f){YSLog.write("remove: "+sID);var aLIs=this.ulTabs.getElementsByTagName("li");var _391=null;var _392=null;var _393=null;for(var i=0,_395=aLIs.length;i<_395;i++){_392=aLIs[i];if(_392.id==sID){var _396=this.liCurTab&&this.liCurTab.id==sID;var _397=null;if(_391!=null){if(_396){_397=_391;}}else{if(++i<aLIs.length){YSCSS.addClassName(aLIs[i],"first");if(_396){_397=aLIs[i];}}}
if(_397!=null){this.openTab(_397);var _398=_392;while(_398!=null){YSCSS.addClassName(_398,"hide");_398=this.getTabCouple(_398);}
if(this.oOnRemove){this.oOnRemove.fn.call(this.oOnRemove.obj,sID,true);}
if(!isDefined(_38f)||!_38f){setTimeout("Tabs.remove(\""+sID+"\", true);",0);return;}}
if(this.oOnRemove){this.oOnRemove.fn.call(this.oOnRemove.obj,sID,false);}
var _399=this.getTabCouple(_392);if(_399!=null){_393=_399.id;}
YSDOM.removeElement(_392);YSDOM.removeElement(this.aTabContent[sID]);delete this.aTabContent[sID];break;}
if(_391==null||isDefined(this.aTabContent[_392.id])){_391=_392;}}
if(_393!=null){this.remove(_393);}};Tabs.prototype.setTabCouple=function(_39a,_39b){YSXML.setAttribute(YSDOM.getObj(_39a),"coupledTab",_39b);};Tabs.prototype.setOnChange=function(_39c,_39d){if(_39c==null){this.oOnChange=null;}else{this.oOnChange={fn:_39c,obj:_39d};if(this.liCurTab!=null){this.oOnChange.fn.call(this.oOnChange.obj,this.liCurTab.id,null);}}};Tabs.prototype.setOnRemove=function(_39e,_39f){if(_39e==null){this.oOnRemove=null;}else{this.oOnRemove={fn:_39e,obj:_39f};}};var Tabs=new Tabs();function onCustomChkClick(e,_3a1){var _3a2=_3a1.getElementsByTagName("span")[0];var _3a3=_3a2.className!="checked";_3a2.className=_3a3?"checked":"";YSDOM.getObj(_3a1.id.substr(0,_3a1.id.lastIndexOf("_"))).value=_3a3?1:"";YSEvent.cancelEvent(e);};function TopMenu(){this.BG_WIDTH=119;this.FADE_DURATION=300;this.FALL_DURATION=350;this.BOUNCE_DURATION=1000;this.objActive=null;this.aFadePercents=[100,80,70,60,50,40,30,20,10,0];this.bCSSFade=bIE||bChrome;this.aAnimations={};};TopMenu.prototype.insertItem=function(_3a4,_3a5,sURL,_3a7){var _3a8=document.createElement("td");_3a8.onclick=function(){location.href=sURL;};_3a8.id=_3a5;var _3a9=document.createElement("div");_3a9.className="menuitem";var _3aa=document.createElement("div");_3aa.className="menubg hide";_3aa.id=_3a5+"_bg";var _3ab=document.createElement("a");_3ab.className="icon "+_3a5;_3ab.href=sURL;var _3ac=document.createElement("strong");_3ac.innerHTML=YSText.get(_3a7);_3a9.appendChild(_3aa);_3a9.appendChild(_3ab);_3a9.appendChild(_3ac);_3a8.appendChild(_3a9);if(_3a4==null){YSDOM.pushElement(YSXML.getChild(YSDOM.getObj("navigation"),"tr"),_3a8);}else{YSDOM.insertAfter(_3a4,_3a8);}
var _3ad=YSDOM.getRelativePosition(_3a9,"header").left;var _3ae=YSCSS.getStyle(_3a9,"width",true);var _3af=YSCSS.getStyle(_3a8,"width",true);YSCSS.setMultiStyle(_3a9,["left","top","position","width"],[_3ad+"px","-120px","absolute",_3ae+"px"]);YSDOM.getObj("header").appendChild(_3a9);var _3b0={sNewID:_3a5,sURL:sURL,sText:YSText.get(_3a7),tdInsert:_3a8,divItem:_3a9,iWidth:_3af};_3b0.toAnimation=new YSTimeout(15,TopMenu.onInsert,this,_3b0,true);YSEventHandler.Instance().addHandler(_3a8,"onmouseover",TopMenu.onShowBG,this);YSEventHandler.Instance().addHandler(_3a8,"onmouseout",TopMenu.onHideBG,this);};TopMenu.prototype.onFadeIn=function(_3b1,_3b2){var _3b3=Math.max(1,Math.min(10,Math.floor((((_3b1.start+_3b2)/this.FADE_DURATION*100)/10))));if(this.bCSSFade){_3b1.objBG.className="menubg fade"+this.aFadePercents[_3b3-1];}else{YSCSS.setTransparency(_3b1.objBG,this.aFadePercents[_3b3-1]);}
if(_3b3==10){_3b1.animation.timeout.cancelTimeout();_3b1.animation.timeout=null;_3b1.animation.fadingIn=false;_3b1.animation.shown=true;}};TopMenu.prototype.onFadeOut=function(_3b4,_3b5){var _3b6=Math.max(1,Math.min(10,Math.floor((((_3b4.start+_3b5)/this.FADE_DURATION*100)/10))));if(this.bCSSFade){_3b4.objBG.className="menubg fade"+this.aFadePercents[10-_3b6];}else{YSCSS.setTransparency(_3b4.objBG,this.aFadePercents[10-_3b6]);}
if(_3b6==10){_3b4.animation.timeout.cancelTimeout();_3b4.animation.timeout=null;}};TopMenu.prototype.onHideBG=function(e,obj){if(obj==this.objActive){return;}
var _3b9=this.aAnimations[obj.id];if(!_3b9){return;}
var _3ba=0;if(_3b9.timeout!=null){_3ba=this.FADE_DURATION-_3b9.timeout.getTimePassed();_3b9.timeout.cancelTimeout();}
_3b9.fadingIn=false;_3b9.shown=false;_3b9.obj=obj;_3b9.timeout=new YSTimeout(30,TopMenu.onFadeOut,this,{start:_3ba,objBG:YSDOM.getObj(obj.id+"_bg"),animation:_3b9},true);};TopMenu.prototype.onInsert=function(_3bb,_3bc){var _3bd=this.FALL_DURATION+this.BOUNCE_DURATION;var _3be=Math.min(_3bc/_3bd,1);YSCSS.setStyle(_3bb.tdInsert,"width",Math.round(_3be*_3bb.iWidth)+"px");var iTop=-120;if(_3bc<=this.FALL_DURATION){iTop=-120+Math.round(_3bc/this.FALL_DURATION*182);}else{iTop=62;_3be=Math.min((_3bc-this.FALL_DURATION)/this.BOUNCE_DURATION,1);var _3c0={"0.22":-38,"0.3":-7,"0.38":7,"0.6":38,"0.8":-15,"1":15};var _3c1=0;for(var _3c2 in _3c0){if(_3be<=_3c2){iTop+=Math.round((_3be-_3c1)/(_3c2-_3c1)*_3c0[_3c2]);break;}else{_3c1=_3c2;iTop+=_3c0[_3c2];}}}
YSCSS.setStyle(_3bb.divItem,"top",iTop+"px");this.onResetBG();if(_3be==1){YSCSS.setMultiStyle(_3bb.divItem,["top","left","position"],["0px","0px","relative"]);_3bb.tdInsert.appendChild(_3bb.divItem);YSCSS.setMultiStyle([_3bb.tdInsert,_3bb.divItem],["width"],["auto"]);_3bb.divItem=null;_3bb.tdInsert=null;_3bb.toAnimation.cancelTimeout();_3bb.toAnimation=null;}};TopMenu.prototype.onLogin=function(){YSAJAX.sendRequest(null,"login&email="+YSDOM.getValue("email",true)+"&"+"password="+Sha1(YSDOM.getValue("password"))+"&"+"rememberme="+YSDOM.getValue("rememberme"),false,TopMenu.onLoginResult,this);};TopMenu.prototype.onLoginResult=function(_3c3){var xml=YSAJAX.getXML(_3c3);if(xml!=null){var _3c5=YSXML.getChildData(xml,"error");if(_3c5){YSConfirm.CreateAlert(_3c5,YSText.get("[?OK?]"),"frmLogin");DTC.onBlur(null,YSDOM.getObj("email"));DTC.onBlur(null,YSDOM.getObj("password"));}else{var _3c6=document.createElement("div");YSDOM.replaceElement(YSDOM.getObj("frmLogin").parentNode,_3c6);YSDOM.setInnerHTML(_3c6,YSXML.getChildData(xml,"newhtml"));YSDOM.setInnerHTML("trlinks",YSXML.getChildData(xml,"editprofile"));TopMenu.insertItem("shared-workouts","my-workouts",SettingsBar.getURL("my-workouts.html"),"[?MenuMyWorkouts?]");}}};TopMenu.prototype.onShowBG=function(e,obj){if(obj==this.objActive){return;}
var _3c9=YSDOM.getObj(obj.id+"_bg");var _3ca=this.aAnimations[obj.id];if(!_3ca){this.aAnimations[obj.id]=_3ca={timeout:null,fadingIn:false,obj:null,shown:false};if(this.bCSSFade){YSCSS.addClassName(_3c9,"fade100");}else{YSCSS.setTransparency(_3c9,100);}
YSCSS.removeClassName(_3c9,"hide");}
if(_3ca.shown||_3ca.fadingIn){return;}
var _3cb=0;if(_3ca.timeout!=null){_3cb=this.FADE_DURATION-_3ca.timeout.getTimePassed();_3ca.timeout.cancelTimeout();}
YSCSS.setStyle(_3c9,"left",(YSCSS.getStyle(obj,"width",true)/2-TopMenu.BG_WIDTH/2)+"px");_3ca.fadingIn=true;_3ca.obj=obj;_3ca.timeout=new YSTimeout(30,TopMenu.onFadeIn,this,{start:_3cb,objBG:_3c9,animation:_3ca},true);};TopMenu.prototype.onResetBG=function(){var _3cc=YSDOM.getObj("navigation").getElementsByTagName("td");for(var i=0,_3ce=_3cc.length;i<_3ce;i++){var _3cf=_3cc[i].id+"_bg";YSCSS.setStyle(_3cf,"left",(YSCSS.getStyle(_3cc[i],"width",true)/2-TopMenu.BG_WIDTH/2)+"px");}};TopMenu.prototype.setActive=function(_3d0){this.objActive=YSDOM.getObj(_3d0);YSEventHandler.Instance().addHandler("frmLogin","onsubmit",TopMenu.onLogin,this,false);};TopMenu.prototype.setEvents=function(aIDs){for(var i=0,_3d3=aIDs.length;i<_3d3;i++){YSEventHandler.Instance().addHandler(YSDOM.getObj(aIDs[i]),"onmouseover",TopMenu.onShowBG,this);YSEventHandler.Instance().addHandler(YSDOM.getObj(aIDs[i]),"onmouseout",TopMenu.onHideBG,this);}};var TopMenu=new TopMenu();function View(_3d4,_3d5,_3d6){YSScrollable.call(this,true);this.vPrevious=isDefined(_3d5)?_3d5:null;this.sExtraParams=isDefined(_3d6)?_3d6:"";this.sViewID=_3d4;this.bIsExtern=_3d4.substr(0,7)=="http://";this.bFolding=false;this.bUnFolded=false;this.iCloseWidth=34;this.iMinHeight=30;this.iMaxHeight=View.HEIGHT-20*2;this.iMaxWidth=View.WIDTH-20*2;this.toFold=null;this.oRequest=null;this.aFormIDs=[];this.aTimeouts={};this.onInit();};View.prototype=new YSScrollable();View.vCur=null;View.FOLD_DURATION=300;View.WIDTH=725;View.HEIGHT=555;View.Close=function(){if(View.vCur!=null){View.vCur.close();}};View.Create=function(_3d7,_3d8){if((View.vCur==null||View.vCur.sViewID!=_3d7)&&(_3d7!=""&&_3d7!=null)){View.vCur=new View(_3d7,View.vCur,_3d8);}};View.Destruct=function(){if(View.vCur!=null){if(View.vCur.sViewID!="forgot"){YSCookie.create("curview",View.vCur.sViewID,1);YSCookie.create("curviewparams",View.vCur.sExtraParams,1);}else{YSCookie.erase("curview");}
View.vCur.destruct();View.vCur=null;}else{YSCookie.erase("curview");}};View.GetCurrent=function(){return View.vCur;};View.OnCloseEnable=function(){if(View.vCur!=null){View.vCur.onCloseEnable(false);}};View.OnIFrameLoad=function(){this.close=View.Close;};View.Reload=function(_3d9){if(View.vCur!=null){View.vCur.onReload(_3d9);}};View.Replace=function(_3da){if(View.vCur==null){View.Create(_3da);}else{View.vCur.onReplace(_3da);}};View.prototype.destruct=function(){YSScrollable.prototype.destruct.call(this);this.divOverlay=this.divOverallHolder=this.divView=this.divHeader=this.divContent=this.aClose=null;for(var i=0,_3dc=this.aFormIDs.length;i<_3dc;i++){YSEventHandler.Instance().removeEvent(this.aFormIDs[i],"onsubmit");}
this.aFormIDs=null;this.aTimeouts=null;this.toFold=null;this.oRequest=null;};View.prototype.destructMCE=function(){if(!isDefined("tinyMCE",true)){return;}
var _3dd=this.divContent.getElementsByTagName("textarea");for(var i=0,_3df=_3dd.length;i<_3df;i++){var ed=tinyMCE.get(_3dd[i].id);if(ed){ed.remove();}}};View.prototype.close=function(_3e1){if(this.oRequest!=null){YSAJAX.cancelRequest(this.oRequest);}
if(this.divOverlay!=null){YSDOM.removeElement(this.divOverlay);this.divOverlay=null;}
if(isDefined(_3e1)&&_3e1){this.destructMCE();YSDOM.removeElement(this.divOverallHolder);this.destruct();}else{if(this.bIsExtern){this.onShowIFrameDiv();}
this.onFold();}
if(View.vCur==this){View.vCur=this.vPrevious;if(View.vCur!=null){if(View.vCur.aFormIDs.length>0){YSForm.setOnSubmitDoneListener(View.prototype.onSubmitDone,View.vCur);}else{YSForm.setOnSubmitDoneListener(null);}}else{YSForm.setOnSubmitDoneListener(null);}}};View.prototype.getHolder=function(){return this.divOverallHolder;};View.prototype.onAnimate=function(_3e2,_3e3){var _3e4=Math.min(_3e3/_3e2,1);var _3e5=YSCSS.getStyle(this.divView,"height",true)-20;var _3e6;if(this.bFolding){_3e6=Math.min(this.iMaxHeight-_3e4*this.iMaxHeight,_3e5);}else{_3e6=Math.max(this.iMinHeight+_3e4*(this.iMaxHeight-this.iMinHeight),_3e5);}
YSCSS.setStyle(this.divView,"height",_3e6+"px");if(_3e4==1){this.toFold.cancelTimeout();this.toFold=null;if(this.bFolding){this.close(true);}else{if(this.bIsExtern){this.onShowIFrame();}
this.bUnFolded=true;}}};View.prototype.onContentReceived=function(_3e7){this.oRequest=null;var xml=YSAJAX.getXML(_3e7);if(xml){this.onReplaceContent(xml);}else{this.close();}};View.prototype.onFold=function(){if(this.bFolding){return;}
var _3e9=View.FOLD_DURATION;if(this.toFold!=null){_3e9=this.toFold.getTimePassed();}
this.bFolding=true;this.toFold=new YSTimeout(20,View.prototype.onAnimate,this,_3e9,true);};View.prototype.onFormSubmit=function(e,obj){this.setBusy(true,obj.id);};View.prototype.onInit=function(){if(this.vPrevious==null){var _3ec=YSDOM.getBodySize();this.divOverlay=document.createElement("div");YSDOM.setSize(this.divOverlay,_3ec);YSDOM.setPosition(this.divOverlay,new Pixel());YSCSS.setTransparency(this.divOverlay,65);YSCSS.setMultiStyle(this.divOverlay,["position","backgroundColor","zIndex","display"],["absolute","black",1001,"none"]);}
var _3ed=YSDOM.getWindowSize();var iTop;if(this.vPrevious){iTop=YSCSS.getStyle(this.vPrevious.divOverallHolder,"top",true);}else{if(_3ed.height>(View.HEIGHT+200)){iTop=Math.round((_3ed.height-View.HEIGHT)*0.5);}else{iTop=100;}
iTop+=YSDOM.getDocumentScroll().top;}
this.divOverallHolder=document.createElement("div");YSDOM.setPosition(this.divOverallHolder,new Pixel(((_3ed.width-View.WIDTH)*0.5),iTop));YSDOM.setSize(this.divOverallHolder,new Size(View.WIDTH,View.HEIGHT));YSCSS.setMultiStyle(this.divOverallHolder,["position","zIndex"],["absolute",1002]);var _3ef=document.createElement("div");_3ef.className="viewtop";this.divOverallHolder.appendChild(_3ef);this.divView=document.createElement("div");this.divView.className="viewcontent";this.divView.id=this.sViewID;this.divHeader=document.createElement("div");this.divView.appendChild(this.divHeader);this.divContent=document.createElement("div");this.divView.appendChild(this.divContent);YSCSS.setMultiStyle(this.divContent,["overflow","position","clear"],["hidden","relative","both"]);YSCSS.setMultiStyle(this.divView,["height","overflow","position"],[this.iMinHeight+"px","hidden","relative"]);this.divOverallHolder.appendChild(this.divView);if(this.bIsExtern){this.onShowIFrameDiv();}
var _3f0=document.createElement("div");_3f0.className="viewbottom";this.divOverallHolder.appendChild(_3f0);this.aClose=document.createElement("a");this.aClose.href="javascript: void(0);";YSCSS.setMultiStyle(this.aClose,["position","right","top"],["absolute","26px","26px"]);this.setBusy(false,null);this.divOverallHolder.appendChild(this.aClose);if(this.divOverlay!=null){document.body.appendChild(this.divOverlay);}
document.body.appendChild(this.divOverallHolder);YSCSS.setStyle(this.divOverlay,"display","block");if(this.bIsExtern){this.onUnFold();}else{this.onRequest();}};View.prototype.onReload=function(_3f1){this.setBusy(true,this.sViewID);this.onRequest(_3f1);};View.prototype.onRequest=function(_3f2){if(!isDefined(_3f2)){_3f2="&";}else{if(_3f2.length==0||_3f2.charAt(0)!="&"){_3f2="&"+_3f2;}}
if(this.sExtraParams!=""){_3f2+="&"+this.sExtraParams;}
this.oRequest=YSAJAX.sendRequest(null,"getxhtml&view="+this.sViewID+_3f2,false,View.prototype.onContentReceived,this);};View.prototype.onReplace=function(_3f3){if(typeof _3f3=="string"){this.sViewID=_3f3;this.onRequest();}else{this.onReplaceContent(_3f3);}};View.prototype.onReplaceContent=function(xml){var _3f5=YSXML.getChildData(xml,"header");var _3f6=YSXML.getChildData(xml,"content");var _3f7=document.createElement("div");var _3f8=document.createElement("div");YSCSS.setMultiStyle([_3f7,_3f8],["width","visibility"],[(View.WIDTH-40)+"px","hidden"]);YSDOM.removeElementChilds(this.divHeader);YSDOM.removeElementChilds(this.divContent);this.divHeader.appendChild(_3f7);this.divContent.appendChild(_3f8);YSDOM.setInnerHTML(_3f7,_3f5);YSDOM.setInnerHTML(_3f8,_3f6);this.aFormIDs=[];var _3f9=_3f8.getElementsByTagName("form");for(var i=0,_3fb=_3f9.length;i<_3fb;i++){this.aFormIDs.push(_3f9[i].id);YSEventHandler.Instance().addHandler(_3f9[i],"onsubmit",View.prototype.onFormSubmit,this);}
if(_3f9.length>0){YSForm.setOnSubmitDoneListener(View.prototype.onSubmitDone,this);}else{YSForm.setOnSubmitDoneListener(null);}
this.setBusy(false,this.sViewID);var _3fc=YSCSS.getStyle(_3f7,"height",true);var _3fd=YSCSS.getStyle(_3f8,"height",true);if(_3fc+_3fd>this.iMaxHeight){YSCSS.setMultiStyle(_3f8,["float","width"],["left",(View.WIDTH-40-this.iCloseWidth)+"px"]);YSCSS.setStyle(_3f8,"visibility","visible");_3fd=YSCSS.getStyle(_3f8,"height",true);this.iTotalHeight=_3fd;var _3fe=this.iMaxHeight-_3fc;this.iShowHeight=Math.min(_3fe,this.iMaxHeight-this.iCloseWidth)-4;this.iLineHeight=1;this.iLinesPerScroll=10;var _3ff=this.onCreateScrollBar(_3f8,this.divContent,"fw_jslst");YSCSS.setMultiStyle(_3ff,["marginTop","marginRight","display"],[(_3fe-this.iShowHeight-2)+"px",Math.floor((this.iCloseWidth-this.iScrollWidth)*0.5)+"px","inline"]);}else{YSCSS.setStyle(_3f8,"visibility","visible");}
YSCSS.setStyle(_3f7,"visibility","visible");if(!this.bUnFolded){this.onUnFold();}};View.prototype.onShowIFrame=function(){var _400=document.createElement("iframe");YSDOM.setSize(_400,new Size(this.iMaxWidth-40,this.iMaxHeight-20));YSCSS.setMultiStyle(_400,["marginLeft","border"],["20px","none"]);_400.scrolling="no";_400.frameBorder=_400.frameborder=_400.border="0";_400.src=this.sViewID;YSDOM.removeElementChilds(this.divContent,false);this.divContent.appendChild(_400);var _401=YSDOM.getIFrame(_400);if(_401!=null){_401.onload=View.OnIFrameLoad;}};View.prototype.onShowIFrameDiv=function(){var _402=document.createElement("div");YSCSS.setMultiStyle(_402,["width","height","marginLeft","backgroundColor"],[(this.iMaxWidth-40)+"px",(this.iMaxHeight-20)+"px","20px","#efefef"]);YSDOM.removeElementChilds(this.divContent,false);this.divContent.appendChild(_402);};View.prototype.onSubmitDone=function(_403,xml){this.setBusy(false,_403);};View.prototype.onUnFold=function(){this.toFold=new YSTimeout(20,View.prototype.onAnimate,this,View.FOLD_DURATION,true);};View.prototype.setBusy=function(_405,_406){if(_405){if(_406!=null){if(isDefined(this.aTimeouts[_406])){delete this.aTimeouts[_406];}else{this.aTimeouts[_406]=new YSTimeout(150,View.prototype.setBusyTimeout,this,{bBusy:_405,sFormID:_406});return;}}
this.aClose.innerHTML="<img src=\""+IMAGE_PATH+"loadingsmall.gif\" />";this.aClose.onclick=null;this.aClose.className="";YSCSS.setMultiStyle(this.aClose,["cursor","paddingRight","paddingTop"],["default","3px","3px"]);}else{if(_406!=null){var _407=this.aTimeouts[_406];if(isDefined(_407)){_407.cancelTimeout();delete this.aTimeouts[_406];}}
this.aClose.innerHTML="";this.aClose.onclick=function(){if(View.vCur!=null){View.vCur.close();}};this.aClose.className="viewclose";YSCSS.setMultiStyle(this.aClose,["cursor","paddingRight","paddingTop"],["auto","0px","0px"]);}};View.prototype.setBusyTimeout=function(_408){this.setBusy(_408.bBusy,_408.sFormID);};var __sLastView=YSCookie.read("curview");if(__sLastView!="edittrack"&&__sLastView!="addtrack"||location.href.indexOf("my-workouts")!=-1){View.Create(__sLastView,YSCookie.read("curviewparams"));}
function EditTrack(){this.EDIT_INFO=1;this.EDIT_ACTIVITY=2;this.iCurStep=this.EDIT_INFO;this.sTrackURL="";this.iOrigActID=0;this.iNewActID=0;this.sOrigTrackName=this.sNewTrackName="";this.bOrigPublic=this.bNewPublic=true;this.sOrigDescription=this.sNewDescription="";};EditTrack.prototype.onActSelect=function(_409){YSCSS.removeClassName("act"+this.iNewActID,"selected");YSCSS.addClassName("act"+_409,"selected");this.iNewActID=_409;};EditTrack.prototype.onOpen=function(_40a){this.sTrackURL=_40a;this.iCurStep=EditTrack.EDIT_INFO;View.Create("edittrack","trackurl="+_40a);};EditTrack.prototype.onPublicChange=function(_40b){this.bNewPublic=_40b;};EditTrack.prototype.onSaveAct=function(_40c){YSAJAX.sendRequest(null,"view=edittrack&s="+this.iCurStep+"&trackurl="+this.sTrackURL+"&act="+this.iNewActID,false,EditTrack.onSaveActResult,this,{next:_40c});};EditTrack.prototype.onSaveActResult=function(_40d,_40e){this.onSaved(_40e.next);};EditTrack.prototype.onSaveConfirm=function(sID,_410,_411){if(sID=="save"){if(_410){if(this.iCurStep==EditTrack.EDIT_INFO){var _412=YSDOM.getObj("frmSetTrack");var _413=YSDOM.getObj("nextstep");if(_413==null){_413=document.createElement("input");_413.type="hidden";_413.id="nextstep";_413.value=_411.next;_412.appendChild(_413);}
_412.onsubmit();}else{if(this.iCurStep==EditTrack.EDIT_ACTIVITY){this.onSaveAct(_411.next);}}}else{if(this.iCurStep==EditTrack.EDIT_ACTIVITY){this.iNewActID=this.iOrigActID;}else{if(this.iCurStep==EditTrack.EDIT_INFO){this.sNewTrackName=this.sOrigTrackName;this.bNewPublic=this.bOrigPublic;this.sNewDescription=this.sOrigDescription;}}
this.onSwitch(_411.next);}}};EditTrack.prototype.onSaved=function(_414){Searcher.onRefreshSearch();WorkoutsPage.onRefresh();if(Tabs.hasTab(TrackPage.getMapTabID(this.sTrackURL))){if(this.iCurStep==EditTrack.EDIT_ACTIVITY){TrackPage.onReload();}else{if(this.iCurStep==EditTrack.EDIT_INFO){TrackPage.onRefreshTrackInfo();}}}
if(this.iCurStep==EditTrack.EDIT_INFO){MarkerManager.onRefreshMarkers(MapManager.getCurMap("search"));MarkerManager.onRefreshMarkers(MapManager.getCurMap(TrackPage.getMapTabID()));}
if(_414==-1){View.Close();}else{if(this.iCurStep==EditTrack.EDIT_ACTIVITY){this.iOrigActID=this.iNewActID;}else{if(this.iCurStep==EditTrack.EDIT_INFO){this.sOrigTrackName=this.sNewTrackName;this.bOrigPublic=this.bNewPublic;this.sOrigDescription=this.sNewDescription;}}
this.onSwitch(_414);}};EditTrack.prototype.onSwitch=function(_415){if(_415==this.iCurStep){return;}
var _416=false;if(this.iCurStep==EditTrack.EDIT_ACTIVITY){if(this.iOrigActID!=this.iNewActID){_416=true;}}else{if(this.iCurStep==EditTrack.EDIT_INFO){if(this.sOrigTrackName!=this.sNewTrackName||this.bOrigPublic!=this.bNewPublic||this.sOrigDescription!=this.sNewDescription){_416=true;}}}
if(_416){new YSConfirm("save",YSText.get("[?SaveChanges?]"),YSText.get("[?Yes?]"),YSText.get("[?No?]"),EditTrack.onSaveConfirm,this,View.GetCurrent().getHolder(),YSConfirm.YES_NO,{next:_415});return;}
this.iCurStep=_415;View.Reload("s="+this.iCurStep);};EditTrack.prototype.onTrackNameChange=function(_417){this.sNewTrackName=_417;};EditTrack.prototype.setActID=function(_418){this.iOrigActID=this.iNewActID=_418;};EditTrack.prototype.setTrackInfo=function(_419,_41a,_41b){this.sOrigTrackName=this.sNewTrackName=_419;this.bOrigPublic=this.bNewPublic=_41a;this.sOrigDescription=this.sNewDescription=_41b;};var EditTrack=new EditTrack();function FAQPage(){this.iLastFAQID=0;};FAQPage.prototype.foldAnswer=function(_41c){if(_41c==this.iLastFAQID){YSCSS.addClassName("faq_"+_41c,"hide");this.iLastFAQID=0;}else{if(this.iLastFAQID!=0){YSCSS.addClassName("faq_"+this.iLastFAQID,"hide");}
YSCSS.removeClassName("faq_"+_41c,"hide");this.iLastFAQID=_41c;}};var FAQPage=new FAQPage();function GraphPage(){this.sTrackURL=null;this.sTabID=null;this.bLive=false;this.gGraph=null;this.gMiniGraph=null;this.aYValueNames=["",""];};GraphPage.prototype.destruct=function(){if(this.gGraph!=null){this.gGraph.destruct();this.gGraph=null;}
if(this.gMiniGraph!=null){this.gMiniGraph.destruct();this.gMiniGraph=null;}};GraphPage.prototype.getColor=function(_41d){switch(_41d){case Graph.LINE_SPEED:return"blue";case Graph.LINE_HEIGHT:return"green";case Graph.LINE_HEART:return"red";case Graph.LINE_PACE:return"yellow";}
return"none";};GraphPage.prototype.getCSSColor=function(_41e){switch(_41e){case Graph.LINE_SPEED:return"#2869A3";case Graph.LINE_HEIGHT:return"#7AA343";case Graph.LINE_HEART:return"#940B0E";case Graph.LINE_PACE:return"#ABA000";}
return"transparent";};GraphPage.prototype.getLegendText=function(_41f){switch(_41f){case Graph.LINE_SPEED:return YSText.get("[?LegendSpeed?]")+" "+(SettingsBar.isKM()?"(km/h)":"(mph)");case Graph.LINE_HEIGHT:return YSText.get("[?LegendHeight?]")+" "+(SettingsBar.isKM()?"(m)":"(ft)");case Graph.LINE_HEART:return YSText.get("[?LegendHeart?]")+" (bpm)";case Graph.LINE_PACE:return YSText.get("[?LegendPace?]")+" "+(SettingsBar.isKM()?"(min/km)":"(min/mi)");}
return"";};GraphPage.prototype.getValueName=function(_420){if(this.aYValueNames[_420-1]!=""){return this.aYValueNames[_420-1];}else{var _421=YSListbox.GetValue("lstGraphLine"+_420);if(_421==""){_421=YSDOM.getObj("lstGraphLine"+_420).firstChild.innerHTML;}
var _422=document.createElement("div");_422.innerHTML=_421;var _423=_422.childNodes[1].innerHTML;this.aYValueNames[_420-1]=_423;return _423;}};GraphPage.prototype.getViewPort=function(){if(this.gGraph){return this.gGraph.getViewPort();}else{return null;}};GraphPage.prototype.hasMiniGraph=function(){return this.gMiniGraph!=null;};GraphPage.prototype.onLineTypeChange=function(_424,sKey){var _426=YSNumbers.checkInt(sKey);var _427=false;if(_424.getID()=="lstGraphLine1"){_427=this.gGraph.setLineType(1,_426);if(_427){this.gMiniGraph.setLineType(1,_426);}}
if(_424.getID()=="lstGraphLine2"){_427=this.gGraph.setLineType(2,_426);if(_427){this.gMiniGraph.setLineType(2,_426);}}
if(_427){var _428=document.createElement("div");_428.innerHTML=_424.getValue();_424.getSelector().firstChild.firstChild.className=_428.firstChild.className;var _429=_428.childNodes[1].innerHTML;_424.getSelector().firstChild.childNodes[1].innerHTML=_429;if(_424.getID()=="lstGraphLine1"){this.aYValueNames[0]=_429;}else{this.aYValueNames[1]=_429;}}
return _427;};GraphPage.prototype.onLiveChange=function(_42a){this.bLive=_42a;if(this.gGraph!=null){this.gGraph.onLiveChange(_42a);}
if(this.gMiniGraph!=null){this.gMiniGraph.onLiveChange(_42a);}};GraphPage.prototype.onLoad=function(_42b,_42c,_42d,_42e){this.sTrackURL=_42b;this.sTabID=TrackPage.getMapTabID(this.sTrackURL);this.bLive=_42e;Tabs.onCacheTab(this.sTabID);var _42f=YSDOM.getObj("minigraphwnd");if(_42f!=null){YSEventHandler.Instance().addHandler(_42f,"onclick",GraphPage.onMiniGraphClick,this);this.gMiniGraph=new Graph("minigraph",this.sTrackURL,false,_42c,_42d,this.bLive);}
this.gGraph=new Graph("maingraph",this.sTrackURL,true,_42c,_42d,this.bLive);Graph.LINE_1=Graph.LINE_2=-1;this.openTrackTab();};GraphPage.prototype.onMetricChange=function(bKM){YSListbox.DestructLst("lstGraphLine1");YSListbox.DestructLst("lstGraphLine2");this.aYValueNames=["",""];if(this.gGraph!=null){Graph.LINE_1=this.gGraph.getLineType(1);Graph.LINE_2=this.gGraph.getLineType(2);this.gGraph.destruct();this.gGraph=null;}
if(this.gMiniGraph!=null){this.gMiniGraph.destruct();this.gMiniGraph=null;}
Tabs.onReload(this.sTabID);};GraphPage.prototype.onMiniGraphClick=function(e,obj){TrackPage.onShowGraph(true);if(this.gGraph!=null&&!this.gGraph.isOnceDrawn()){this.gGraph.onFirstDraw();}};GraphPage.prototype.onPlay=function(_433){if(this.gGraph!=null){this.gGraph.onPlay(_433);}};GraphPage.prototype.onRedraw=function(){if(this.gGraph!=null){this.gGraph.onViewChanged();}
this.onRedrawMiniGraph();};GraphPage.prototype.onRedrawMiniGraph=function(){if(this.gMiniGraph!=null){this.gMiniGraph.onViewChanged();}};GraphPage.prototype.onRemoveMiniGraph=function(){if(this.gMiniGraph!=null){this.gMiniGraph.destruct();this.gMiniGraph=null;var _434=YSDOM.getObj("minigraphwnd");if(_434!=null){YSEventHandler.Instance().removeEvent(_434,"onclick");YSCSS.addClassName(_434,"hide");}}};GraphPage.prototype.onTabRemove=function(_435,_436){if(!_436){YSListbox.DestructLst("lstGraphLine1");YSListbox.DestructLst("lstGraphLine2");if(this.gGraph!=null){this.gGraph.destruct();this.gGraph=null;}}
this.onRemoveMiniGraph();this.bLive=false;this.sTrackURL=null;this.sTabID=null;};GraphPage.prototype.onZoomIn=function(){if(this.gGraph){this.gGraph.onZoomIn();}};GraphPage.prototype.onZoomOut=function(){if(this.gGraph){this.gGraph.onZoomOut();}};GraphPage.prototype.openTrackTab=function(){if(!Tabs.isLoaded()){setTimeout("GraphPage.openTrackTab();",200);return;}
if(document.location.hash.substr(0,8)!="tab_map/"){Tabs.openTab(TrackPage.getMapTabID(this.sTrackURL),false);}};GraphPage.prototype.setMiniShades=function(aVPs){if(this.gMiniGraph!=null){this.gMiniGraph.onNewShading(aVPs);}};var GraphPage=new GraphPage();function HomePage(){MapPage.call(this,null,null);};HomePage.prototype=new MapPage();HomePage.prototype.getMapTabID=function(){return"home";};HomePage.prototype.onCheckQuickcode=function(){var _438=YSDOM.getValue("code");if(!_438){return;}
YSAJAX.sendRequest(null,"code="+_438,false,HomePage.onQuickcodeResult,this);};HomePage.prototype.onLoad=function(_439,_43a,_43b){this.trTrack=new Track(_43a,"home",false);MapPage.prototype.onLoad.call(this);var vp=new ViewPort(new LatLng(_43b.s,_43b.w),new LatLng(_43b.n,_43b.e));MapManager.onLoadMaps("home",_439,"homemap_ge",null,null,vp);};HomePage.prototype.onQuickcodeResult=function(_43d){var xml=YSAJAX.getXML(_43d);var _43f=YSNumbers.checkInt(YSXML.getChildAttribute(xml,"code","result"));var _440=YSXML.getChildData(xml,"code");if(_43f!=302){YSConfirm.CreateAlert(_440,YSText.get("[?OK?]"),"liveview");}else{location.href=SettingsBar.getBasePath()+_440;}};var HomePage=new HomePage();function IFramePage(){this.iEvent=0;this.iUserID=0;this.toUserCheck=null;this.oLastRequest=null;};IFramePage.prototype.destruct=function(){if(this.iEvent!=0){CoachrEvent.destruct();}
if(this.toUserCheck!=null){this.toUserCheck.cancelTimeout();this.toUserCheck=null;}};IFramePage.prototype.onLoad=function(_441,_442){this.iUserID=_441;this.iEvent=_442;this.toUserCheck=new YSTimeout(5000,IFramePage.onUserCheck,this,null,true);if(_442>0){CoachrEvent.onLoad();}};IFramePage.prototype.onUserCheck=function(){if(this.oLastRequest!=null){YSAJAX.cancelRequest(this.oLastRequest);}
var _443="getusertrack="+this.iUserID;if(this.iEvent!=0){_443+="&event="+this.iEvent;}
this.oLastRequest=YSAJAX.sendRequest(null,_443,false,IFramePage.onUserCheckReceived,this);};IFramePage.prototype.onUserCheckReceived=function(_444){var xml=YSAJAX.getXML(_444);if(xml){var _446=YSXML.getChildText(xml,"trackurl");var _447=null;var _448=YSXML.getChild(xml,"vp");if(_448!=null){_447=new ViewPort(new LatLng(YSNumbers.checkFloat(YSXML.getAttribute(_448,"s")),YSNumbers.checkFloat(YSXML.getAttribute(_448,"w"))),new LatLng(YSNumbers.checkFloat(YSXML.getAttribute(_448,"n")),YSNumbers.checkFloat(YSXML.getAttribute(_448,"e"))));}
var _449=YSNumbers.checkInt(YSXML.getChildAttribute(xml,"trackurl","live"))==1;if(this.iEvent!=0){var _44a=YSXML.getChildData(xml,"eventusers");CoachrEvent.onTrackChange(_446,_447,_449,_44a);}else{if(_446!=""&&_447!=null){TrackPage.onTrackChange(_446,_449,_447);}}}};IFramePage.prototype.setUserID=function(_44b){if(_44b!=this.iUserID&&_44b>0){this.iUserID=_44b;this.toUserCheck.onInterrupt();}};var IFramePage=new IFramePage();function MapPage(_44c,_44d){if(isDefined(_44c)){this.sTypeLstID=_44c;this.sStyleLstID=_44d;this.trTrack=null;this.toBETimeout=null;}};MapPage.prototype.destruct=function(){if(this.trTrack!=null){this.trTrack.destruct(false);this.trTrack=null;}};MapPage.prototype.getLiveBuffer=function(){return this.trTrack==null?4:this.trTrack.getLiveBuffer();};MapPage.prototype.isAuto3D=function(){if(this.trTrack!=null){return this.trTrack.isAuto3D();}else{return false;}};MapPage.prototype.isTrackPlaying=function(){return this.trTrack!=null&&this.trTrack.isPlaying();};MapPage.prototype.onAuto3DChange=function(obj,_44f){if(this.trTrack!=null){this.trTrack.onAuto3DChange(obj,_44f);}};MapPage.prototype.onBirdsEyeAvailable=function(_450,_451,_452){if(typeof _450=="object"){_451=_450.iPrevMapStyle;_452=_450.sPrevMapType;_450=_450.bAvailable;}
var _453=YSListbox.GetLst(this.sStyleLstID);if(!_453){if(this.toBETimeout==null){this.toBETimeout=new YSTimeout(250,this.onBirdsEyeAvailable,this,{bAvailable:_450,iPrevMapStyle:_451,sPrevMapType:_452});}
return false;}
this.toBETimeout=null;if(_450){YSCSS.setStyle(_453.getOption("3"),"color","white");}else{YSCSS.setStyle(_453.getOption("3"),"color","#555555");this.onBirdsEyeHide(_451,false);if(_452==GEMap.Type&&this.trTrack!=null){this.trTrack.onMapTypeChanged(MapManager.getMSMap(this.getMapTabID()),MapManager.getGEMap(this.getMapTabID()));}}
return true;};MapPage.prototype.onBirdsEyeHide=function(_454,_455){var _456=YSListbox.GetLst(this.sStyleLstID);_456.setKey(_454,false);_456.getSelector().firstChild.firstChild.innerHTML=_456.getValue();if(_455&&MapManager.hasMap(this.getMapTabID())){this.onViewChanged(MapManager.getCurMap(this.getMapTabID()));}};MapPage.prototype.onLoad=function(){MapManager.setOnBirdsEyeAvailable(this.getMapTabID(),this.onBirdsEyeAvailable,this);MapManager.setOnViewChanged(this.getMapTabID(),this.onViewChanged,this);};MapPage.prototype.onMapStyleChange=function(_457,sKey,_459){var _45a=YSNumbers.checkInt(sKey);var _45b=this.isAuto3D();if(this.isTrackPlaying()&&MapManager.isBirdseyeShown(this.getMapTabID())&&_45a!=3){this.onAuto3DChange(null,false);}
var _45c=MapManager.onMapStyleChange(this.getMapTabID(),_45a);if(_45c.bSucceeded){_457.getSelector().firstChild.firstChild.innerHTML=_457.getValue();if(_45c.mpNewMap!=null&&this.trTrack!=null){this.trTrack.onMapTypeChanged(_45c.mpPrevMap,_45c.mpNewMap);}}else{this.onAuto3DChange(null,_45b);}
if(isDefined(_459)){for(var sKey in _45c){_459[sKey]=_45c[sKey];}}
return _45c.bSucceeded;};MapPage.prototype.onMapTypeChange=function(_45d,sKey){_45d.getSelector().firstChild.firstChild.innerHTML=_45d.getValue();if(this.isTrackPlaying()&&MapManager.isBirdseyeShown(this.getMapTabID())){this.trTrack.onAuto3DChange(null,false);}
var _45f=MapManager.onMapTypeChange(this.getMapTabID(),sKey);if(_45f.mpTo!=null&&this.trTrack!=null){this.trTrack.onMapTypeChanged(_45f.mpFrom,_45f.mpTo);}
if(_45f.iPrevStyle!=-1){this.onBirdsEyeHide(_45f.iPrevStyle,sKey!=MSMap.Type);}
return _45f;};MapPage.prototype.onRedraw=function(){var _460=MapManager.getCurMap(this.getMapTabID());if(_460!=null){_460.onRedraw();}
var _461=MapManager.getMiniMap();if(_461!=null){_461.onRedraw();}};MapPage.prototype.onViewChanged=function(_462){if(this.trTrack!=null){this.trTrack.onViewChanged(_462);}};MapPage.prototype.onZoomIn=function(){var _463=MapManager.getCurMap(this.getMapTabID());if(_463!=null){_463.zoomIn();}};MapPage.prototype.onZoomOut=function(){var _464=MapManager.getCurMap(this.getMapTabID());if(_464!=null){_464.zoomOut();}};function PrivatePage(){};PrivatePage.prototype.onUploadStatus=function(_465,_466){};PrivatePage.prototype.onUploadTrack=function(_467){YSForm.onUpload(_467,PrivatePage.prototype.onUploadStatus,this,1000);};var PrivatePage=new PrivatePage();function Searcher(){this.TIMEOUT=0;this.oTimeout=null;this.iPreviewTOID=0;this.sLastSearch="";this.sCountryCode="";this.sExtraParams="";this.gsrSearchRequest=null;this.iCurPage=1;this.iNrOfPages=1;this.iTotalItems=0;this.aSearchMarkers={};this.acSearch=null;this.sOrigDTC="";this.wvCenter=null;};Searcher.prototype=new IMarkerManager();Searcher.prototype.destruct=function(){IMarkerManager.prototype.destruct.call(this);this.aSearchMarkers=null;if(this.acSearch!=null){this.acSearch.destruct();this.acSearch=null;}
this.wvCenter=null;};Searcher.prototype.doSearch=function(_468,_469){if(YSDOM.getObj("searchresults")==null){return;}
if(!isDefined(_469)){_469="";if(this.sOrigDTC!=""){DTC.setDTC("searchtrack",this.sOrigDTC,"empty");this.sOrigDTC="";}
if(MapManager.hasMap("search")){MSMap.OnWVDeselect();GEMap.OnWVDeselect();}}
if(this.gsrSearchRequest!=null){this.gsrSearchRequest.destruct();}
this.gsrSearchRequest=new GetSearchResult(this,_468,this.iCurPage,_469);this.gsrSearchRequest.sendRequest();};Searcher.prototype.getCountryCode=function(){return this.sCountryCode;};Searcher.prototype.isTileSearch=function(){return this.sExtraParams!=""&&this.sExtraParams.indexOf("t=")!=-1;};Searcher.prototype.onACClick=function(_46a){this.sOrigDTC=DTC.getDTC("searchtrack");this.sLastSearch="";this.sExtraParams=_46a.sParams;var _46b=_46a.bUser?YSText.get("[?TracksOfUser?]",[_46a.sName]):YSText.get("[?TracksFromLocation?]",[_46a.sName]);DTC.setDTC("searchtrack",_46b,"empty");DTC.onResetField("searchtrack");this.onRefreshSearch(1);};Searcher.prototype.onAddMarker=function(_46c,_46d){return _46c.addSearchMarker(_46d);};Searcher.prototype.onCommandResult=function(_46e,_46f){if(_46f){SearchPage.reset();YSDOM.destructChilds("searchresults");YSDOM.setInnerHTML("searchresults",_46e.getNewHTML());this.iNrOfPages=_46e.getNrOfPages();this.iTotalItems=_46e.getTotalItems();this.showNumbers();if(this.acSearch!=null){this.acSearch.setOptions(_46e.getAutoCompleteOptions());}
this.aSearchMarkers=_46e.getMarkers();if(this.iTotalItems==1){var _470=null;for(_470 in this.aSearchMarkers){break;}
this.onShowPreview(_470,"searchresult_1");}else{this.onNewMarkers(MapManager.getCurMap("search"),[]);}}
this.gsrSearchRequest=null;};Searcher.prototype.onLoad=function(){this.acSearch=new AutoComplete(YSDOM.getObj("searchbox"),YSDOM.getObj("searchtrack"),Searcher.onACClick,this);};Searcher.prototype.onMarkerClick=function(_471,_472){TrackPage.openTrack(_471);};Searcher.prototype.onNextPage=function(){this.onPageChange(this.iCurPage+1);};Searcher.prototype.onPageChange=function(_473){if(YSString.isString(_473)){_473=YSNumbers.checkInt(YSString.trim(_473));}
iNewPageNr=Math.max(Math.min(_473,this.iNrOfPages),1);if(iNewPageNr!=this.iCurPage){this.onRefreshSearch(iNewPageNr);}else{if(_473!=this.iCurPage){this.showNumbers();}}};Searcher.prototype.onPrevPage=function(){this.onPageChange(this.iCurPage-1);};Searcher.prototype.onRefreshSearch=function(_474){if(isDefined(_474)){this.iCurPage=_474;}
this.doSearch(this.sLastSearch,this.sExtraParams);};Searcher.prototype.onResetSearch=function(){if(this.sOrigDTC!=""){DTC.setDTC("searchtrack",this.sOrigDTC,"empty");this.sOrigDTC="";}
DTC.onResetField("searchtrack");this.sLastSearch="onResetSearch";this.onSearch(null,"searchtrack","");};Searcher.prototype.onSearch=function(e,obj,_477){if(!isDefined(_477)){_477=obj.value;}
if(YSString.trim(_477)==YSString.trim(this.sLastSearch)){return;}
this.iCurPage=1;this.sExtraParams="";var _478=this.TIMEOUT;if(this.oTimeout!=null){_478-=Math.min(this.TIMEOUT,this.oTimeout.getTimePassed());this.oTimeout.cancelTimeout();}
if(_478){this.oTimeout=new YSTimeout(_478,Searcher.doSearch,this,_477);}else{this.doSearch(_477);}
this.sLastSearch=_477;};Searcher.prototype.onShowPreview=function(_479,_47a){if(this.iPreviewTOID!=0){clearTimeout(this.iPreviewTOID);this.iPreviewTOID=0;}
var _47b=YSDOM.getObj(_47a);var _47c=MapManager.getCurMap("search");if(_47c==null){this.iPreviewTOID=setTimeout("Searcher.onShowPreview('"+_479+"',"+(_47b!=null?"'"+_47b.id+"'":"null")+");",250);return;}
if(isDefined(this.aSearchMarkers[_479])){this.onNewMarkers(_47c,[this.aSearchMarkers[_479]]);}
SearchPage.onShowPreview(_47b,_479);};Searcher.prototype.onWaitForMap=function(_47d){var _47e=MapManager.getCurMap("search");if(_47e!=null){if(_47e.isVisible()){MarkerManager.setLastZoomLevel(_47d.iZoomLevel);_47e.setZoomCenter(_47d.iZoomLevel,_47d.llPoint);return;}}
new YSTimeout(50,Searcher.onWaitForMap,this,_47d);};Searcher.prototype.onWorldViewSearch=function(_47f){if(this.sOrigDTC==""){this.sOrigDTC=DTC.getDTC("searchtrack");}
DTC.setDTC("searchtrack",YSText.get("[?TracksFromArea?]"),"empty");DTC.onResetField("searchtrack");this.sLastSearch="";this.sExtraParams="t="+_47f.iTileID+"&z="+_47f.iZoomLevel;if(_47f.sTabID!="search"){if(Tabs.openTab("search",true,this.sExtraParams)){this.onWaitForMap(_47f);}else{this.wvCenter=_47f;MarkerManager.onPreventSearchReset();}}
this.onRefreshSearch(1);};Searcher.prototype.setCountry=function(_480){this.sCountryCode=_480;};Searcher.prototype.setNrOfItems=function(_481){this.iNrOfPages=Math.floor(Math.max(_481-1,0)/GetSearchResult.RESULTS_PER_PAGE)+1;this.iTotalItems=_481;if(this.wvCenter!=null){this.wvCenter.sTabID="search";this.onWorldViewSearch(this.wvCenter);}else{this.doSearch("");}};Searcher.prototype.setWVMarker=function(_482,_483,_484){this.wvCenter={llPoint:new LatLng(_482.lat,_482.lng),iTileID:_483,iZoomLevel:_484,sTabID:"search",bSelected:true};GroupMarker.gmSelected={setSelected:function(){},wvMarker:this.wvCenter};MarkerManager.setLastZoomLevel(_484);};Searcher.prototype.showNumbers=function(){if(YSDOM.getObj("curpage")){YSDOM.getObj("curpage").value=this.iCurPage;YSDOM.getObj("nrofpages").innerHTML=this.iNrOfPages;}};var Searcher=new Searcher();function SearchPage(){MapPage.call(this,"lstSearchMapType","lstSearchMapStyle");this.bLoaded=false;this.sLastTrackURL=null;this.divCurTrack=null;this.lstCountry=null;};SearchPage.prototype=new MapPage();SearchPage.prototype.destruct=function(){MapPage.prototype.destruct.call(this);Searcher.destruct();this.lstCountry=null;this.divCurTrack=null;};SearchPage.prototype.getMapTabID=function(){return"search";};SearchPage.prototype.isLoaded=function(){return this.bLoaded;};SearchPage.prototype.onCountrySelect=function(_485){var xml=YSAJAX.getXML(_485);if(xml&&YSXML.exists(xml,"box")){var _487=YSNumbers.checkFloat(YSXML.getChildAttribute(xml,"box","n"));var _488=YSXML.getChildAttribute(xml,"box","e");var _489=YSXML.getChildAttribute(xml,"box","s");var _48a=YSXML.getChildAttribute(xml,"box","w");var map=MapManager.getCurMap("search");map.setViewPort(new ViewPort(new LatLng(_489,_48a),new LatLng(_487,_488)));Searcher.onRefreshSearch(1);}};SearchPage.prototype.onInitCountryLst=function(){if(!isDefined(YSListbox.aIDs["lstCountry"])){setTimeout("SearchPage.onInitCountryLst();",250);return;}
SettingsBar.setOnCountryChange(SearchPage.onProfileCountryChange,this);var _48c=YSListbox.aIDs["lstCountry"].getKey();Searcher.setCountry(_48c);YSDOM.getObj("lstCountry_values").id="searchcountry_values";this.lstCountry=new YSListbox("searchcountry",_48c);this.lstCountry.setOnChange(SearchPage.onSearchCountryChange,this);};SearchPage.prototype.onLoad=function(_48d,_48e){this.onInitCountryLst();MapPage.prototype.onLoad.call(this);var vp;if(_48e==null){vp=new ViewPort(new LatLng(-70,-140),new LatLng(70,140));}else{if(isDefined(_48e.zoomlvl)){vp=_48e;}else{vp=new ViewPort(new LatLng(_48e.s,_48e.w),new LatLng(_48e.n,_48e.e));}}
MapManager.onLoadMaps("search",_48d,"searchmap_ge","searchmap_ms",null,vp);TrackPage.onCheckOnLoadHash();Searcher.onLoad();this.bLoaded=true;};SearchPage.prototype.onMapStyleChange=function(_490,sKey){var _492={};if(MapPage.prototype.onMapStyleChange.call(this,_490,sKey,_492)){if(_492.mpNewMap!=null){Searcher.onMapTypeChanged(_492.mpPrevMap,_492.mpNewMap);}
return true;}else{return false;}};SearchPage.prototype.onMapTypeChange=function(_493,sKey){var _495=MapPage.prototype.onMapTypeChange.call(this,_493,sKey);if(_495.mpTo!=null){Searcher.onMapTypeChanged(_495.mpFrom,_495.mpTo);}};SearchPage.prototype.onMetricChange=function(bKM){Searcher.onRefreshSearch();};SearchPage.prototype.onNewCountryBox=function(_497,_498){if(this.lstCountry.getKey()==_498){this.onCountrySelect(_497);}};SearchPage.prototype.onProfileCountryChange=function(_499){this.lstCountry.setKey(_499,false);this.onSearchCountryChange(this.lstCountry,_499,false);};SearchPage.prototype.onSearchCountryChange=function(_49a,sKey,_49c){if(!isDefined(_49c)){_49c=true;}
_49a.getSelector().firstChild.firstChild.innerHTML=_49a.getValue();Searcher.setCountry(sKey);if(_49c){YSAJAX.sendRequest(null,"tab=search&getcountrybox&cc="+sKey,false,SearchPage.onNewCountryBox,this,sKey);}};SearchPage.prototype.reset=function(){this.sLastTrackURL=null;this.divTrack=null;if(this.trTrack!=null){this.trTrack.destruct();this.trTrack=null;}};SearchPage.prototype.onShowPreview=function(_49d,_49e){if(this.sLastTrackURL==_49e){return;}
if(_49d!=null){if(this.divCurTrack!=null){YSCSS.removeClassName(this.divCurTrack,"selected");}
YSCSS.addClassName(_49d,"selected");this.divCurTrack=_49d;}
this.sLastTrackURL=_49e;if(this.trTrack!=null){this.trTrack.destruct();}
this.trTrack=new Track(_49e,"search",false);this.trTrack.onViewChanged(MapManager.getCurMap("search"));};var SearchPage=new SearchPage();function TrackPage(){MapPage.call(this,"lstTrackMapType","lstTrackMapStyle");this.sLastOpenedTrack=null;this.bIFrame=false;this.bGraphShown=false;this.bStartPlayOnFocus=false;this.toTrackInfo=null;this.toLiveChecker=null;this.BUFFER_MARGE=3;this.sQuickCode="";this.sPermCode="";this.iUserID=0;this.sUserKey="";};TrackPage.prototype=new MapPage();TrackPage.prototype.destruct=function(){MapPage.prototype.destruct.call(this);if(this.toTrackInfo!=null){this.toTrackInfo.cancelTimeout();this.toTrackInfo=null;}
if(this.toLiveChecker!=null){this.toLiveChecker.cancelTimeout();this.toLiveChecker=null;}
IFrameCode.destruct();};TrackPage.prototype.getMapTabID=function(_49f){return"map/"+(isDefined(_49f)?_49f:this.sLastOpenedTrack);};TrackPage.prototype.getQuickCode=function(){return this.sQuickCode;};TrackPage.prototype.getTrackDuration=function(){if(this.trTrack==null){return 0;}else{return this.trTrack.getDuration();}};TrackPage.prototype.getTrackURL=function(){return this.sLastOpenedTrack;};TrackPage.prototype.getPermCode=function(){return this.sPermCode;};TrackPage.prototype.getUserID=function(){return this.iUserID;};TrackPage.prototype.getUserKey=function(){return this.sUserKey;};TrackPage.prototype.isGraphShown=function(){return this.bGraphShown;};TrackPage.prototype.isIFrame=function(){return this.bIFrame;};TrackPage.prototype.onBirdsEyeAvailable=function(_4a0,_4a1,_4a2){if((typeof _4a0).toLowerCase()=="object"){var _4a3=_4a0;_4a0=_4a3.bAvailable;_4a1=_4a3.iPrevMapStyle;_4a2=_4a3.sPrevMapType;}
if(MapPage.prototype.onBirdsEyeAvailable.call(this,_4a0,_4a1,_4a2)&&this.trTrack!=null){this.trTrack.onBirdsEyeAvailable(_4a0);}};TrackPage.prototype.onCheckOnLoadHash=function(_4a4){var _4a5=document.location.hash;var bMap=_4a5.substr(0,9)=="#tab_map/";var _4a7=false;if(!bMap){_4a7=_4a5.substr(0,11)=="#tab_graph/";}
if(bMap||_4a7){var _4a8=bMap?_4a5.substr(9):_4a5.substr(11);if(_4a8!=_4a4){this.openTrack(_4a8,_4a4);return false;}}
return true;};TrackPage.prototype.onLiveChange=function(_4a9){this.bStartPlayOnFocus=false;if(this.trTrack!=null){this.trTrack.onLiveChange(_4a9);}
GraphPage.onLiveChange(_4a9);this.onStartLiveChecker(_4a9);};TrackPage.prototype.onLiveCheck=function(){YSAJAX.sendRequest(null,"tab="+this.getMapTabID()+"&islive",false,TrackPage.onLiveCheckResult,this);};TrackPage.prototype.onLiveCheckResult=function(_4aa){var xml=YSAJAX.getXML(_4aa);if(xml!=null){var _4ac=YSXML.getChildAttribute(xml,"status","live")=="true";if(this.trTrack!=null&&_4ac!=this.trTrack.isLive()){this.onLiveChange(_4ac);}}};TrackPage.prototype.onLoad=function(_4ad,_4ae,_4af,_4b0,_4b1,_4b2,_4b3,_4b4,_4b5,_4b6){if(!TrackPage.onCheckOnLoadHash(_4ae)){return;}
this.bIFrame=_4b2;if(this.bIFrame){TrackPage.getMapTabID=function(){return"iframe";};}
if(_4af){this.bStartPlayOnFocus=true;}
this.setInitTrack(_4ae);this.trTrack=new Track(_4ae,this.getMapTabID(_4ae),true,_4af);MapPage.prototype.onLoad.call(this);if(!this.bIFrame){YSEventHandler.Instance().addHandler("minimapwnd","onclick",TrackPage.onMinimapClick,this);}
if(_4b3){this.onStartLiveChecker(_4af);}
MapManager.setActivityID(_4b1);var vp=new ViewPort(new LatLng(_4b0.s,_4b0.w),new LatLng(_4b0.n,_4b0.e));MapManager.onLoadMaps(this.getMapTabID(_4ae),_4ad,"trackmap_ge","trackmap_ms",this.bIFrame?null:"minimap_ge",vp);if(_4b4){this.onLoadGraph({url:_4ae,height:_4b5,heart:_4b6,live:_4af});}
this.setDocTitle();};TrackPage.prototype.onLoadGraph=function(_4b8){if(!isDefined("GraphPage",true)){new YSTimeout(250,TrackPage.onLoadGraph,this,_4b8);return;}
GraphPage.onLoad(_4b8.url,_4b8.height,_4b8.heart,_4b8.live);};TrackPage.prototype.onMapMoveStart=function(){if(this.trTrack!=null){this.trTrack.onMapMoveStart();}};TrackPage.prototype.onMetricChange=function(bKM){if(YSDOM.getObj("trackinfo")!=null){if(this.toTrackInfo!=null){this.toTrackInfo.onInterrupt();}else{this.onRefreshTrackInfo();}}};TrackPage.prototype.onMinimapClick=function(e,obj){this.onShowGraph(false);};TrackPage.prototype.onPlay=function(obj){if(this.trTrack!=null){this.trTrack.onPlay(obj);this.bStartPlayOnFocus=this.trTrack.isPlaying();}};TrackPage.prototype.onPlaySpeedChange=function(_4bd,sKey){if(this.trTrack!=null){if(this.trTrack.setPlaySpeed(YSNumbers.checkInt(sKey))){_4bd.getSelector().firstChild.firstChild.innerHTML=_4bd.getValue();return true;}}
return false;};TrackPage.prototype.onRefreshTrackInfo=function(){YSAJAX.sendRequest(null,"tab="+this.getMapTabID()+"&gettrackinfo=1",false,TrackPage.onTrackInfoReceived,this);};TrackPage.prototype.onReload=function(){Tabs.remove(this.getMapTabID(),true);Tabs.add(this.getMapTabID(),YSText.get("[?MapTab?]"),false,true);};TrackPage.prototype.onResetPlay=function(){if(this.trTrack!=null){this.trTrack.onResetPlay();this.bStartPlayOnFocus=this.trTrack.isPlaying();}};TrackPage.prototype.onShowGraph=function(_4bf){if(_4bf){YSCSS.removeClassName("graphholder","invisible");YSCSS.removeClassName("minimapwnd","selected");YSCSS.addClassName("mapholder","invisible");YSCSS.addClassName("minigraphwnd","selected");if(this.trTrack!=null){GraphPage.onRedraw();this.trTrack.onPlay(null,false,true);if(this.bStartPlayOnFocus){GraphPage.onPlay(true);}}}else{YSCSS.removeClassName("mapholder","invisible");YSCSS.removeClassName("minigraphwnd","selected");YSCSS.addClassName("graphholder","invisible");YSCSS.addClassName("minimapwnd","selected");this.onRedraw();GraphPage.onPlay(false);if(this.trTrack!=null&&this.bStartPlayOnFocus){this.trTrack.onPlay(null,true,true);}}
GraphPage.onRedrawMiniGraph();this.bGraphShown=_4bf;};TrackPage.prototype.onStartLiveChecker=function(_4c0){if(this.toTrackInfo!=null){this.toTrackInfo.cancelTimeout();this.toTrackInfo=null;}
if(this.toLiveChecker!=null){this.toLiveChecker.cancelTimeout();this.toLiveChecker=null;}
this.toLiveChecker=new YSTimeout(7000,TrackPage.onLiveCheck,this,null,true);};TrackPage.prototype.onTabChange=function(_4c1,_4c2){if(!isDefined("GraphPage",true)){setTimeout("TrackPage.onTabChange(\""+_4c1+"\",\""+_4c2+"\");",250);return;}
if(_4c1==this.getMapTabID()){if(this.trTrack!=null&&this.bStartPlayOnFocus){if(this.isGraphShown()){GraphPage.onPlay(true);}else{this.trTrack.onPlay(null,true,true);}}
setTimeout("TrackPage.onRedraw();",25);setTimeout("GraphPage.onRedrawMiniGraph();",25);}else{if(this.trTrack!=null){this.trTrack.onPlay(null,false,true);GraphPage.onPlay(false);}}};TrackPage.prototype.onTabRemove=function(_4c3,_4c4){if(!_4c4){YSListbox.DestructLst("lstTrackMapType");YSListbox.DestructLst("lstTrackMapStyle");IFrameCode.destruct();if(this.trTrack!=null){this.trTrack.destruct(false);this.trTrack=null;}
if(this.toTrackInfo!=null){this.toTrackInfo.cancelTimeout();this.toTrackInfo=null;}
if(this.toLiveChecker!=null){this.toLiveChecker.cancelTimeout();this.toLiveChecker=null;}}
var _4c5=YSDOM.getObj("minimapwnd");if(_4c5!=null){YSEventHandler.Instance().removeEvent(_4c5,"onclick");YSCSS.addClassName(_4c5,"hide");}
GraphPage.onTabRemove(_4c3,_4c4);if(location.href.indexOf("shared-workouts")!=-1){document.title=YSText.get("[?SharedWorkoutsTitle?]")+" - CoachR";}else{document.title=YSText.get("[?MyWorkoutsTitle?]")+" - CoachR";}};TrackPage.prototype.onTimeVPChanged=function(oVP){if(this.trTrack!=null){this.trTrack.onTimeVPChanged(oVP);}};TrackPage.prototype.onTrackChange=function(_4c7,_4c8,vp){if(this.trTrack!=null&&(this.trTrack.getURL()!=_4c7||this.trTrack.isLive()!=_4c8)){this.trTrack.destruct();this.trTrack=new Track(_4c7,this.getMapTabID(_4c7),true,_4c8);if(!_4c8){var _4ca=this.getMapTabID(_4c7);if(MapManager.isBirdseyeShown(_4ca)){MapManager.onBirdsEyeAvailable(MapManager.getMSMap(_4ca),false);}
MapManager.getCurMap(_4ca).setViewPort(vp);}}};TrackPage.prototype.onTrackInfoReceived=function(_4cb){var xml=YSAJAX.getXML(_4cb);if(xml!=null){var _4cd=YSXML.getChildAttribute(xml,"trackinfo","live")=="true";if(this.trTrack!=null&&_4cd!=this.trTrack.isLive()){this.onLiveChange(_4cd);}else{YSDOM.destructChilds("trackinfo");YSDOM.setInnerHTML("trackinfo",YSXML.getChildData(xml,"trackinfo"));}}};TrackPage.prototype.openTrack=function(_4ce,_4cf){if(!isDefined(_4cf)){_4cf="";}
if(!Tabs.isLoaded()){setTimeout("TrackPage.openTrack('"+_4ce+"','"+_4cf+"');",250);return;}
if(_4cf!=""){Tabs.remove(this.getMapTabID(_4cf),true);}
var _4d0=this.getMapTabID(_4ce);var _4d1=Tabs.hasTab(_4d0);if(_4d1){Tabs.openTab(_4d0);}else{if(this.sLastOpenedTrack!=null){Tabs.remove(this.getMapTabID());}
Tabs.add(_4d0,YSText.get("[?MapTab?]"),true,true);}
this.sLastOpenedTrack=_4ce;};TrackPage.prototype.setDocTitle=function(){document.title=YSDOM.getValue("trackusername")+" - "+YSDOM.getValue("trackname")+" - CoachR";};TrackPage.prototype.setInitTrack=function(_4d2){if(this.sLastOpenedTrack==null){this.sLastOpenedTrack=_4d2;}};TrackPage.prototype.setQuickCode=function(_4d3){this.sQuickCode=_4d3;};TrackPage.prototype.setPermCode=function(_4d4){this.sPermCode=_4d4;};TrackPage.prototype.setUser=function(_4d5,_4d6){this.iUserID=_4d5;this.sUserKey=_4d6;};var TrackPage=new TrackPage();function WorkoutsPage(){this.oListTypeRequest=null;this.iCurTime=Math.floor((new Date()).getTime()/1000);this.iCurListType=0;this.iCurPage=1;this.iNrOfPages=1;this.bLoaded=false;};WorkoutsPage.prototype.destruct=function(){if(this.oListTypeRequest!=null){YSAJAX.cancelRequest(this.oListTypeRequest);this.oListTypeRequest=null;}};WorkoutsPage.prototype.onListTypeChange=function(_4d7,sKey){_4d7.getSelector().firstChild.firstChild.innerHTML=_4d7.getValue();this.iCurListType=YSNumbers.checkInt(sKey);this.iCurPage=this.iNrOfPages=1;this.onRefresh();};WorkoutsPage.prototype.onLoad=function(_4d9){this.bLoaded=true;this.iCurTime=_4d9;Tabs.onCacheTab("workouts");TrackPage.onCheckOnLoadHash();};WorkoutsPage.prototype.onMetricChange=function(bKM){this.onRefresh();};WorkoutsPage.prototype.onNextPage=function(){if(this.iCurPage<this.iNrOfPages){this.iCurPage++;this.onRefresh();}};WorkoutsPage.prototype.onPageChange=function(_4db){if(YSString.isString(_4db)){_4db=YSNumbers.checkInt(YSString.trim(_4db));}
iNewPageNr=Math.max(Math.min(_4db,this.iNrOfPages),1);if(iNewPageNr!=this.iCurPage){this.iCurPage=iNewPageNr;this.onRefresh();}else{if(_4db!=this.iCurPage){YSDOM.setValue("curpage",this.iCurPage);}}};WorkoutsPage.prototype.onPrevPage=function(){if(this.iCurPage>1){this.iCurPage--;this.onRefresh();}};WorkoutsPage.prototype.onRefresh=function(_4dc){if(!this.bLoaded){return;}
if(!isDefined(_4dc)){_4dc="";}else{if(_4dc[0]!="&"){_4dc+="&"+_4dc;}}
if(this.oListTypeRequest!=null){YSAJAX.cancelRequest(this.oListTypeRequest);}
this.oListTypeRequest=YSAJAX.sendRequest(null,"tab=workouts&time="+this.iCurTime+"&listtype="+this.iCurListType+"&p="+this.iCurPage+_4dc,false,WorkoutsPage.onWorkoutsReceived,this);};WorkoutsPage.prototype.onRemoveTrack=function(_4dd,_4de){new YSConfirm("removetrack",YSText.get("[?SureToRemTrack?]",[_4de]),YSText.get("[?Yes?]"),YSText.get("[?No?]"),WorkoutsPage.onRemoveTrackConfirmed,this,window,YSConfirm.YES_NO,_4dd);};WorkoutsPage.prototype.onRemoveTrackConfirmed=function(_4df,_4e0,_4e1){if(_4e0){this.onRefresh("remove="+_4e1);}};WorkoutsPage.prototype.onReplaceCalendar=function(){var _4e2=YSDOM.getObj("newcalendar");if(_4e2!=null){var _4e3=YSDOM.getObj("calendar");YSDOM.replaceElement(_4e3,_4e2);_4e2.id="calendar";}};WorkoutsPage.prototype.onTimeChange=function(_4e4){this.iCurTime=_4e4;this.onRefresh();};WorkoutsPage.prototype.onWeekClick=function(_4e5){if(Tabs.openTab("workouts",true,"time="+_4e5+"&listtype=0")){if(this.iCurListType!=0){this.iCurTime=_4e5;YSListbox.GetLst("listtype").setKey(0);}else{this.onTimeChange(_4e5);}}};WorkoutsPage.prototype.onWorkoutsReceived=function(_4e6){var xml=YSAJAX.getXML(_4e6);if(xml!=null){var _4e8=YSXML.getChildData(xml,"workoutlist");var _4e9=YSDOM.getObj("workoutholder");if(_4e9!=null){YSDOM.destructChilds(_4e9);YSDOM.setInnerHTML(_4e9,_4e8);}
var _4ea=YSXML.getChildData(xml,"calendar");var _4eb=YSDOM.getObj("calendar");if(_4eb!=null){YSDOM.destructChilds(_4eb);YSDOM.setInnerHTML(_4eb,_4ea);}}
this.oListTypeRequest=null;};WorkoutsPage.prototype.setNrOfPages=function(_4ec){this.iNrOfPages=_4ec;this.iCurListType=1;};var WorkoutsPage=new WorkoutsPage();function Color(iRed,_4ee,_4ef,_4f0,_4f1){if(!isDefined(_4f0)){_4f0=1;}
if(!isDefined(_4f1)){_4f1="";}
this.Red=YSNumbers.checkInt(iRed);this.Green=YSNumbers.checkInt(_4ee);this.Blue=YSNumbers.checkInt(_4ef);this.Alpha=YSNumbers.checkFloat(_4f0);this.Name=_4f1;if(this.Alpha<0){this.Alpha=0;}
if(this.Alpha>1){this.Alpha=1;}};Color.White=new Color(255,255,255,1,"white");Color.Black=new Color(0,0,0,1,"black");Color.Red=new Color(255,0,0,1,"red");Color.Orange=new Color(255,187,0,1,"orange");Color.Yellow=new Color(255,255,0,1,"yellow");Color.Green=new Color(0,255,0,1,"green");Color.Blue=new Color(0,0,255,1,"blue");Color.Pink=new Color(255,0,255,1,"pink");Color.Purple=new Color(200,0,255,1,"purple");Color.prototype.getCSSColor=function(){return"#"+this.getHexColor();};Color.prototype.getExtendedCSSColor=function(){return"#"+this.getExtendedHexColor();};Color.prototype.getHexColor=function(){return YSNumbers.padDigits(YSNumbers.dec2hex(this.Red),2)+YSNumbers.padDigits(YSNumbers.dec2hex(this.Green),2)+YSNumbers.padDigits(YSNumbers.dec2hex(this.Blue),2);};Color.prototype.getExtendedHexColor=function(){return YSNumbers.padDigits(YSNumbers.dec2hex(Math.floor(this.Alpha*100)),2)+this.getHexColor();};Color.prototype.getIntColor=function(){return YSNumbers.hex2dec(this.getHexColor());};Color.prototype.getExtendedIntColor=function(){return YSNumbers.hex2dec(this.getExtendedHexColor());};Color.prototype.setHexColor=function(_4f2){this.Red=YSNumbers.hex2dec(_4f2.substr(0,2));this.Green=YSNumbers.hex2dec(_4f2.substr(2,2));this.Blue=YSNumbers.hex2dec(_4f2.substr(4,2));};Color.prototype.setExtendedHexColor=function(_4f3){this.Alpha=YSNumbers.hex2dec(_4f3.substr(0,2));this.setHexColor(_4f3.substr(2,6));};function GetGraphCommand(_4f4,_4f5,_4f6,_4f7,_4f8){JSCommand.call(this,_4f4,_4f5,true);this.aStretch={};this.aMinY={};this.aMaxY={};this.iMinX=0;this.iMaxX=YSNumbers.MAX_INT;this.bRequestRange=false;this.bLive=false;this.aLines=[];this.iGraphWidth=_4f6;this.fPixPerX=_4f7;this.aLineTypes=_4f8;this.bProcessed=false;};GetGraphCommand.prototype=new JSCommand();GetGraphCommand.prototype.destruct=function(){JSCommand.prototype.destruct.call(this);this.aMinY=this.aMaxY=this.aLines=this.aStretch=null;};GetGraphCommand.prototype.getLines=function(){return this.aLines;};GetGraphCommand.prototype.getLineTypes=function(){return this.aLineTypes;};GetGraphCommand.prototype.getMinX=function(){return this.iMinX;};GetGraphCommand.prototype.getMaxX=function(){return this.iMaxX;};GetGraphCommand.prototype.getMinY=function(_4f9){return isDefined(this.aMinY[_4f9])?this.aMinY[_4f9]:0;};GetGraphCommand.prototype.getMinYs=function(){return this.aMinY;};GetGraphCommand.prototype.getMaxY=function(_4fa){return isDefined(this.aMaxY[_4fa])?this.aMaxY[_4fa]:10;};GetGraphCommand.prototype.getMaxYs=function(){return this.aMaxY;};GetGraphCommand.prototype.getParams=function(){var _4fb={};if(this.iMaxX!=YSNumbers.MAX_INT){_4fb.time=this.iMinX;if(!this.bLive){_4fb.time+="-"+this.iMaxX;}}else{this.bRequestRange=true;}
if(this.bLive){this.bRequestRange=true;if(this.iGraphWidth>200){_4fb.islive=1;}}
if(this.bRequestRange){_4fb.range=1;}
_4fb.w=this.iGraphWidth;if(this.fPixPerX>0){_4fb.pixperx=this.fPixPerX;}
for(var i=0,_4fd=this.aLineTypes.length;i<_4fd;i++){switch(this.aLineTypes[i]){case Graph.LINE_SPEED:_4fb.speed=1;break;case Graph.LINE_HEIGHT:_4fb.height=1;break;case Graph.LINE_HEART:_4fb.heartrate=1;break;case Graph.LINE_PACE:_4fb.pace=1;break;}}
return _4fb;};GetGraphCommand.prototype.getStretchInfo=function(){return this.aStretch;};GetGraphCommand.prototype.onDataReceived=function(_4fe){if(this.getStatus()==404){return;}
if(_4fe){if(YSXML.exists(this.xml,"error")){_4fe=false;}else{this.onProcessResult();}}
this.icCaller.onCommandResult(this,_4fe);};GetGraphCommand.prototype.onMetricConvert=function(_4ff,iY){if(!SettingsBar.isKM()){switch(_4ff){case Graph.LINE_SPEED:return iY/SettingsBar.KMPERMILE;case Graph.LINE_HEIGHT:return iY/SettingsBar.MPERFT;case Graph.LINE_PACE:return iY*SettingsBar.KMPERMILE;}}
return iY;};GetGraphCommand.prototype.onProcessResult=function(){if(!this.bProcessed){var _501=this.aLineTypes.length;var _502=YSXML.getChildren(this.xml,"line");if(_502.length==0){if(this.iMaxX==YSNumbers.MAX_INT){this.iMaxX=60;}
for(var i=0;i<_501;i++){this.aLines[this.aLineTypes[i]]=[];}
this.bProcessed=true;return;}
var _504=true;var _505=4;var _506,_507,_508;for(var i=0;i<_501;i++){_506=this.aLineTypes[i];this.aLines[_506]=[];}
for(var i=0,_509=_502.length;i<_509;i++){var _50a=0;var _50b=[0,0,0,0];var iY=0;var _50d=null;var _50e=YSXML.getText(_502[i]).split("|");if(_504&&_50e.length>0){this.iMinX=YSNumbers.checkInt(_50e[0]);_504=false;}
var _50f;if(this.bRequestRange){_50f=YSXML.getAttribute(_502[i],"range").split("|");}
var _510=0,_511,_512,_513,_514,_515,_516,_517,_518,_519;for(_506=1;_506<=4;_506++){if(isDefined(this.aLines[_506])){this.aLines[_506][i]=[];}
if(this.bRequestRange){_510=(_506-1)*2;_511=YSNumbers.checkInt(_50f[_510]);_512=YSNumbers.checkInt(_50f[_510+1]);_511=this.onMetricConvert(_506,_511);_512=this.onMetricConvert(_506,_512);if(_506==Graph.LINE_HEIGHT||_506==Graph.LINE_HEART){this.aMinY[_506]=_511;}else{this.aMinY[_506]=0;}
this.aMaxY[_506]=_512;}}
for(var k=0,_51b=_50e.length;k+_501*(_505+1)<_51b;k+=(k==0?_501:_501*(_505+1))+1){_50a+=YSNumbers.checkInt(_50e[k]==""?1:_50e[k]);_507=k>0&&_505==4;for(var m=0;m<_501;m++){_506=this.aLineTypes[m];_508=_507?k+m*5+1:k+m+1;_50b[m]+=YSNumbers.checkInt(_50e[_508])/100;iY=this.onMetricConvert(_506,_50b[m]);var _51d=new GraphPoint(_50a,iY);this.aLines[_506][i].push(_51d);if(_507){_51d.setC1(YSNumbers.checkInt(_50e[_508+1])+_50a,YSNumbers.checkInt(_50e[_508+2])/100+iY);_51d.setC2(YSNumbers.checkInt(_50e[_508+3])+_50a,YSNumbers.checkInt(_50e[_508+4])/100+iY);}}}
this.iMaxX=_50a;}
if(YSXML.exists(this.xml,"location")){GetTrackCommand.prototype.onExtractTrackInfo.call(this,true);}
this.bProcessed=true;}};GetGraphCommand.prototype.onStretch=function(iY,_51f){return iY;};GetGraphCommand.prototype.sendRequest=function(){this.startConnection(this.getParams());};GetGraphCommand.prototype.setCachedInfo=function(_520,_521,_522){if(_520){this.aStretch=_520;}
if(_521){this.aMinY=_521;}
if(_522){this.aMaxY=_522;}};GetGraphCommand.prototype.setLive=function(_523){this.bLive=isDefined(_523)?_523:true;};GetGraphCommand.prototype.setTimeBounds=function(_524,_525,_526){this.iMinX=_524;this.iMaxX=_525;if(isDefined(_526)&&_526>0){this.iGraphWidth=_526;}};function SearchMarker(_527,_528,_529,_52a){this.llPoint=_527;this.sTrackURL=_528;this.iActivityID=_529;this.bUseAnalysis=_52a;};function GetSearchResult(_52b,_52c,_52d,_52e){JSCommand.call(this,_52b,null);this.setRequestToCurPage(true);this.sSearch=_52c;this.iCurPage=_52d;if(isDefined(_52e)){if(_52e.length>0&&_52e[0]!="&"){this.sExtraParams="&"+_52e;}else{this.sExtraParams=_52e;}}else{this.sExtraParams="";}
this.iTotalItems=0;this.iNrOfPages=1;this.bHasResult=false;this.sNewHTML="";this.aMarkers=[];this.aOptions=[];this.bProcessed=false;};GetSearchResult.RESULTS_PER_PAGE=4;GetSearchResult.prototype=new JSCommand();GetSearchResult.prototype.destruct=function(){JSCommand.prototype.destruct.call(this);this.sNewHTML=null;this.aMarkers=null;this.aOptions=null;};GetSearchResult.prototype.getAutoCompleteOptions=function(){return this.aOptions;};GetSearchResult.prototype.getMarkers=function(){return this.aMarkers;};GetSearchResult.prototype.getNewHTML=function(){return this.sNewHTML;};GetSearchResult.prototype.getNrOfPages=function(){return this.iNrOfPages;};GetSearchResult.prototype.getTotalItems=function(){return this.iTotalItems;};GetSearchResult.prototype.getParams=function(){var _52f={};_52f.s=this.sSearch;_52f.p=this.iCurPage;_52f.tab="search";_52f.cc=Searcher.getCountryCode();var _530=MapManager.getCurMap("search");_52f.vp=_530!=null?_530.getViewPort().toParam():"";return _52f;};GetSearchResult.prototype.hasSearchResult=function(){return this.bHasResult;};GetSearchResult.prototype.onDataReceived=function(_531){if(_531){this.onProcessResult();}
this.icCaller.onCommandResult(this,_531);};GetSearchResult.prototype.onProcessResult=function(){if(!this.bProcessed){if(YSXML.exists(this.xml,"autocomplete")){var _532=YSXML.getChild(this.xml,"autocomplete").childNodes;var _533,_534,_535,_536;for(var i=0,_538=_532.length;i<_538;i++){_533=_532[i].tagName=="user";_536=YSXML.getData(_532[i]);if(_533){_534=YSText.get("[?ACUser?]",[_536]);}else{_535=YSNumbers.checkInt(YSXML.getAttribute(_532[i],"type"));switch(_535){case 1:_534=YSText.get("[?ACCity?]",[_536]);break;case 2:_534=YSText.get("[?ACMunicipal?]",[_536]);break;case 3:_534=YSText.get("[?ACState?]",[_536]);break;}}
this.aOptions.push({sValue:_534,sName:_536,bUser:_533,sParams:YSXML.getAttribute(_532[i],"params")});}}
if(YSXML.exists(this.xml,"noresults")){this.bHasResult=false;this.iTotalItems=0;this.iNrOfPages=1;this.sNewHTML=YSText.get("[?NoSearchResults?]");}else{this.bHasResult=true;var _539;var _53a=YSXML.getChildren(YSXML.getChild(this.xml,"results"),"result");for(var i=0,_538=_53a.length;i<_538;i++){this.sNewHTML+=YSXML.getData(_53a[i]);_539=YSXML.getAttribute(_53a[i],"trackurl");this.aMarkers[_539]=new SearchMarker(new LatLng(YSNumbers.checkFloat(YSXML.getAttribute(_53a[i],"startlat")),YSNumbers.checkFloat(YSXML.getAttribute(_53a[i],"startlng"))),_539,YSNumbers.checkInt(YSXML.getAttribute(_53a[i],"activityid")),YSXML.getAttribute(_53a[i],"useanalysis")=="true");}
this.iTotalItems=YSNumbers.checkInt(YSXML.getChildAttribute(this.xml,"results","total"));this.iNrOfPages=Math.floor(Math.max(this.iTotalItems-1,0)/GetSearchResult.RESULTS_PER_PAGE)+1;}
this.bProcessed=true;}};GetSearchResult.prototype.sendRequest=function(){this.startConnection(this.getParams(),this.sExtraParams);};GetTrackCommand.iNextRequestNr=0;function GetTrackCommand(_53b,_53c){JSCommand.call(this,_53b,_53c);this.vpViewPort=null;this.aRequests={};this.bGetViewPort=false;this.bProcessed=false;this.iLiveBuffer=4;};GetTrackCommand.prototype=new JSCommand();GetTrackCommand.prototype.destruct=function(){JSCommand.prototype.destruct.call(this);this.aLinePoints=null;this.vpViewPort=null;for(var i in this.aRequests){this.aRequests[i].destruct();this.aRequests[i]=null;}
this.aRequests=null;};GetTrackCommand.prototype.addRequest=function(_53e){this.aRequests[_53e.getRequestNr()]=_53e;};GetTrackCommand.prototype.applyViewPort=function(_53f){if(isDefined(this.aRequests[_53f])){this.aRequests[_53f].applyViewPort(this.vpViewPort);}};GetTrackCommand.prototype.drawRequests=function(_540){if(!isDefined(_540)){for(var i in this.aRequests){this.aRequests[i].drawLines();}}else{for(var i=0,_542=_540.length;i<_542;i++){if(isDefined(this.aRequests[_540[i]])){this.aRequests[_540[i]].drawLines();}}}};GetTrackCommand.prototype.getAllLinePoints=function(_543){if(!isDefined(this.aRequests[_543])){return{};}
return this.aRequests[_543].getAllLinePoints();};GetTrackCommand.prototype.getAllRequestPoints=function(){var _544={};for(var i in this.aRequests){_544[i]=this.getAllLinePoints(i);}
return _544;};GetTrackCommand.prototype.getLinePoints=function(_546,_547){if(!isDefined(this.aRequests[_546])){return[];}
return this.aRequests[_546].getLinePoints(_547);};GetTrackCommand.prototype.getLiveBuffer=function(){return this.iLiveBuffer;};GetTrackCommand.prototype.getRequest=function(_548){if(isDefined(this.aRequests[_548])){return this.aRequests[_548];}else{return null;}};GetTrackCommand.prototype.getRequests=function(){return this.aRequests;};GetTrackCommand.prototype.getViewPort=function(){return this.vpViewPort;};GetTrackCommand.prototype.includeViewPort=function(_549){if(!isDefined(_549)){_549=true;}
this.bGetViewPort=_549;};GetTrackCommand.prototype.onDataReceived=function(_54a){if(this.getStatus()==404){if(Tabs.isLoaded()){Tabs.remove(TrackPage.getMapTabID(this.getTrackURL()));}
return;}
if(_54a){if(YSXML.exists(this.xml,"error")){_54a=false;}else{this.onProcessResult();}}
this.icCaller.onCommandResult(this,_54a);};GetTrackCommand.prototype.onExtractTrackInfo=function(_54b){var bKM=SettingsBar.isKM();var sLoc=YSXML.getChildData(this.xml,"location");var _54e=YSXML.getChildText(this.xml,"time");var _54f=YSXML.getChildAttribute(this.xml,"track","distance");if(_54f.length==0){_54f=YSXML.getChildAttribute(this.xml,"graph","distance");}
YSDOM.setValue("detaillocation",sLoc);YSDOM.truncate("detaillocation",22);YSDOM.setValue("detailtime",_54e);YSDOM.setValue("detaildistance",_54f);if(_54b){YSDOM.setValue("statdistance",YSNumbers.checkFloat(_54f));}
var _550=YSXML.getChild(this.xml,"speed");if(_550!=null){var fMin=YSNumbers.checkFloat(YSXML.getAttribute(_550,"min"));var fMax=YSNumbers.checkFloat(YSXML.getAttribute(_550,"max"));var fAvg=YSNumbers.checkFloat(YSXML.getAttribute(_550,"avg"));var fCur=YSNumbers.checkFloat(YSXML.getAttribute(_550,"cur"));if(!bKM){fMin/=SettingsBar.KMPERMILE;fMax/=SettingsBar.KMPERMILE;fAvg/=SettingsBar.KMPERMILE;fCur/=SettingsBar.KMPERMILE;}
YSDOM.setValue("minspeed",YSNumbers.roundNumber(fMin,1,false));YSDOM.setValue("maxspeed",YSNumbers.roundNumber(fMax,1,false));YSDOM.setValue("avgspeed",YSNumbers.roundNumber(fAvg,1,false));if(_54b){YSDOM.setValue("statspeed",YSNumbers.roundNumber(fCur,1,false));}}
var _555=YSXML.getChild(this.xml,"heart");if(_555!=null){YSDOM.setValue("minheart",YSXML.getAttribute(_555,"min"));YSDOM.setValue("maxheart",YSXML.getAttribute(_555,"max"));YSDOM.setValue("avgheart",YSXML.getAttribute(_555,"avg"));if(_54b){YSDOM.setValue("statheart",YSXML.getAttribute(_555,"cur"));}}
var _556=YSXML.getChild(this.xml,"altitude");if(_556!=null){var fMin=YSNumbers.checkFloat(YSXML.getAttribute(_556,"min"));var fMax=YSNumbers.checkFloat(YSXML.getAttribute(_556,"max"));var fCur=YSNumbers.checkFloat(YSXML.getAttribute(_556,"cur"));if(!bKM){fMin/=SettingsBar.MPERFT;fMax/=SettingsBar.MPERFT;fCur/=SettingsBar.MPERFT;}
YSDOM.setValue("minaltitude",YSNumbers.roundNumber(fMin,1,false));YSDOM.setValue("maxaltitude",YSNumbers.roundNumber(fMax,1,false));if(_54b){YSDOM.setValue("stataltitude",YSNumbers.roundNumber(fCur,1,false));}}};GetTrackCommand.prototype.onProcessResult=function(){if(!this.bProcessed){if(this.bGetViewPort){this.vpViewPort=new ViewPort(new LatLng(YSXML.getChildAttribute(this.xml,"viewport","s"),YSXML.getChildAttribute(this.xml,"viewport","w")),new LatLng(YSXML.getChildAttribute(this.xml,"viewport","n"),YSXML.getChildAttribute(this.xml,"viewport","e")));}
this.iLiveBuffer=YSNumbers.checkInt(YSXML.getChildText(this.xml,"livebuffer"));if(this.iLiveBuffer==0){this.iLiveBuffer=4;}
if(YSXML.exists(this.xml,"location")){this.onExtractTrackInfo();}
var _557=YSXML.getChildren(this.xml,"request");for(var i=0,_559=_557.length;i<_559;i++){var _55a=_557[i].getAttribute("id");if(isDefined(this.aRequests[_55a])){this.aRequests[_55a].storeRequestResult(_557[i],this.sTrackURL);}else{YSLog.write("Request "+_55a+" not found!!!");}}
this.bProcessed=true;}};GetTrackCommand.prototype.sendRequest=function(){var _55b={};var _55c=0;for(var i in this.aRequests){var _55e=this.aRequests[i].getParams();for(var sKey in _55e){_55b[sKey]=_55e[sKey];}
_55c++;}
_55b.num=_55c;if(this.bGetViewPort){_55b.vp=1;}
if(this.oID.live){_55b.islive=1;}
this.startConnection(_55b);};function GetTrackRequest(_560,_561,_562){if(!isDefined(_561)){_561=MapManager.getCurMap();}
if(!isDefined(_562)){_562=false;}
this.iRequestNr=_560;this.mpMap=_561;this.bStaticLines=_562;this.bUseInnerViewPort=false;this.bUseOuterViewPort=false;this.oForcedMapSize=null;this.oTimeBounds=null;this.bIncludePixels=false;this.bAllowDestruct=true;this.bAllowDrawing=true;this.aLinePoints={};this.vpViewPort=null;this.bHasResult=false;};GetTrackRequest.prototype.destruct=function(){if(!this.bAllowDestruct){this.bAllowDestruct=true;return;}
this.mpMap=this.oForcedMapSize=this.oTimeBounds=this.aLinePoints=this.vpViewPort=null;};GetTrackRequest.prototype.applyViewPort=function(vp){if(vp!=null&&this.mpMap!=null&&!this.mpMap.bDestructed&&!this.mpMap.getViewPort().contains(vp)){this.mpMap.setViewPort(vp);}};GetTrackRequest.prototype.copyMe=function(_564,_565,_566){if(!isDefined(_564)||_564==null){_564=this.iRequestNr+1;}
if(!isDefined(_565)||_565==null){_565=this.mpMap;}
if(!isDefined(_566)||_566==null){_566=this.bStaticLines;}
var _567=new GetTrackRequest(_564,_565,_566);_567.useInnerViewPort(this.bUseInnerViewPort);_567.useOuterViewPort(this.bUseOuterViewPort);_567.setViewPortToUse(this.vpViewPort);if(this.oTimeBounds!=null){_567.setTimeBounds(this.oTimeBounds.starttime,this.oTimeBounds.endtime);}
return _567;};GetTrackRequest.prototype.drawLines=function(){if(this.mpMap==null||this.mpMap.bDestructed||!this.bAllowDrawing){return;}
if(this.bStaticLines){this.mpMap.replaceStaticLines(this.aLinePoints,6);}else{if(this.mpMap.isMiniMap()){this.mpMap.replaceLines(this.aLinePoints,6,false);}else{this.mpMap.replaceLines(this.aLinePoints,7,true);}}};GetTrackRequest.prototype.getAllLinePoints=function(){return this.aLinePoints;};GetTrackRequest.prototype.getFirstPoint=function(_568){return YSList.getFirst(YSList.getFirst(this.getLinePoints(_568)));};GetTrackRequest.prototype.getLastPoint=function(_569){return YSList.getLast(YSList.getLast(this.getLinePoints(_569)));};GetTrackRequest.prototype.getLinePoints=function(_56a){if(!isDefined(this.aLinePoints[_56a])){return[];}
return this.aLinePoints[_56a];};GetTrackRequest.prototype.getMap=function(){return this.mpMap;};GetTrackRequest.prototype.getParams=function(){if(this.mpMap==null){return{};}
var _56b={};var _56c=this.oForcedMapSize;if(_56c==null){_56c=this.mpMap.getPixelSize();}
var _56d=false;if(this.bUseInnerViewPort||this.bUseOuterViewPort){_56d=true;var _56e=this.vpViewPort;if(_56e==null){_56e=this.mpMap.getViewPort();_56e=_56e.stretchToSize(this.mpMap,_56c);}
if(this.bUseInnerViewPort){_56b[this.iRequestNr+"_ibox"]=_56e.toParam();}
if(this.bUseOuterViewPort){_56b[this.iRequestNr+"_obox"]=_56e.getOuterViewPort().toParam();}}else{_56b[this.iRequestNr+"_w"]=_56c.width;_56b[this.iRequestNr+"_h"]=_56c.height;}
if(this.oTimeBounds!=null){_56d=true;_56b[this.iRequestNr+"_time"]=this.oTimeBounds.starttime+(this.oTimeBounds.endtime!=-1?"*"+this.oTimeBounds.endtime:"");}
if(_56d){var _56f=this.mpMap.getDegPerPix();_56b[this.iRequestNr+"_latpp"]=_56f.latperpix;_56b[this.iRequestNr+"_lngpp"]=_56f.lngperpix;}
_56b[this.iRequestNr+"_pix"]=this.bIncludePixels?1:0;_56b[this.iRequestNr+"_max"]=this.mpMap.getMaxPoints();return _56b;};GetTrackRequest.prototype.getRequestNr=function(){return this.iRequestNr;};GetTrackRequest.prototype.getTimes=function(_570){var _571=[];var _572=this.getLinePoints(_570);for(var i=0,_574=_572.length;i<_574;i++){_571.push({iMinX:_572[i][0].getTime(),iMaxX:YSList.getLast(_572[i]).getTime()});}
return _571;};GetTrackRequest.prototype.hasResult=function(){return this.bHasResult;};GetTrackRequest.prototype.includePixels=function(){this.bIncludePixels=true;};GetTrackRequest.prototype.removeLines=function(){if(this.mpMap==null){return;}
var _575=[];if(this.mpMap.isMiniMap()){_575.push(this.mpMap);}else{_575.push(MapManager.getGEMap(this.mpMap.getTabID()));_575.push(MapManager.getMSMap(this.mpMap.getTabID()));}
for(var i=0,_577=_575.length;i<_577;i++){if(_575[i]==null){continue;}
if(this.bStaticLines){_575[i].clearStaticLines();}else{_575[i].clearLines();}}};GetTrackRequest.prototype.setAllowDestruct=function(_578){this.bAllowDestruct=_578;};GetTrackRequest.prototype.setAllowDrawing=function(_579){this.bAllowDrawing=_579;};GetTrackRequest.prototype.setForcedMapSize=function(_57a){this.oForcedMapSize=_57a;};GetTrackRequest.prototype.setMap=function(_57b){this.mpMap=_57b;};GetTrackRequest.prototype.setTimeBounds=function(_57c,_57d){if(!isDefined(_57c)){_57c=0;}
if(!isDefined(_57d)){_57d=-1;}
this.oTimeBounds={starttime:_57c,endtime:_57d};};GetTrackRequest.prototype.setViewPortToUse=function(_57e){this.vpViewPort=_57e;this.bUseInnerViewPort=true;};GetTrackRequest.prototype.storeLine=function(_57f,_580,_581,_582,_583,_584,_585,_586){var _587=_580.split("|");var _588=_581.split("|");var _589=_582.split("|");var _58a=_583.split("|");var _58b=_584.split("|");var _58c=_585.split("|");var _58d=_586.split("|");var _58e=null,_58f=null,_590=null,_591=null;if(_589[0]===""){_58e=-1;}
if(_58a[0]===""){fStaticHeart=0;}
if(_58b[0]===""){_590=0;}
if(_58c[0]===""){_591=0;}
if(_588.length>1){var _592=0;if(!isDefined(this.aLinePoints[_57f])){this.aLinePoints[_57f]=[];}else{_592=this.aLinePoints[_57f].length;}
if(!isDefined(this.aLinePoints[_57f][_592])){this.aLinePoints[_57f][_592]=[];}
var _593=0;var _594=0;var _595,_596,fAlt,_598;var _599=0;var _59a=0;var _59b=_587.length;for(var i=0,_59d=_588.length;i<_59d;i++){if(i*2+1<_59b){_599+=YSNumbers.checkInt(_588[i]!=""?_588[i]:10)*0.1;_593+=YSNumbers.checkInt(_587[i*2]!=""?_587[i*2]:0)*0.000001;_594+=YSNumbers.checkInt(_587[i*2+1]!=""?_587[i*2+1]:0)*0.000001;if(_58e!==null){_595=_58e;}else{_595=YSNumbers.checkInt(_589[i]!=""?_589[i]:0)*0.1;}
if(_58f!==null){_596=_58f;}else{_596=YSNumbers.checkInt(_58a[i]!=""?_58a[i]:0);}
if(_590!==null){fAlt=_590;}else{fAlt=YSNumbers.checkInt(_58b[i]!=""?_58b[i]:0)*0.1;}
if(_591!==null){_598=_591;}else{_598=YSNumbers.checkInt(_58c[i]!=""?_58c[i]:0)*0.001;}
_59a=YSNumbers.checkInt(_58d[i]!=""?_58d[i]:10);var _59e=new GPSPoint(_599,_593,_594,_595,_596,fAlt,_598,_59a);this.aLinePoints[_57f][_592].push(_59e);}else{break;}}}};GetTrackRequest.prototype.storeRequestResult=function(_59f,_5a0){this.bHasResult=true;var _5a1=YSXML.getChildren(_59f,"line");for(var i=0,_5a3=_5a1.length;i<_5a3;i++){var _5a4=YSXML.getChildText(_5a1[i],"points");var _5a5=YSXML.getChildText(_5a1[i],"times");var _5a6=YSXML.getChildText(_5a1[i],"speeds");var _5a7=YSXML.getChildText(_5a1[i],"bpm");var _5a8=YSXML.getChildText(_5a1[i],"alt");var _5a9=YSXML.getChildText(_5a1[i],"dist");var _5aa=YSXML.getChildText(_5a1[i],"pixels");this.storeLine(_5a0,_5a4,_5a5,_5a6,_5a7,_5a8,_5a9,_5aa);}};GetTrackRequest.prototype.useInnerViewPort=function(bUse){if(!isDefined(bUse)){bUse=true;}
this.bUseInnerViewPort=bUse;};GetTrackRequest.prototype.useOuterViewPort=function(bUse){if(!isDefined(bUse)){bUse=true;}
this.bUseOuterViewPort=bUse;if(bUse){this.bUseInnerViewPort=true;}};function WorldViewMarker(_5ad,_5ae,_5af,_5b0,_5b1,_5b2,_5b3){this.llPoint=_5ad;this.iWeight=_5ae;this.bLive=_5af;this.iZoomLevel=_5b0;this.iTileID=_5b1;this.bSelected=_5b2;this.sTabID=_5b3;};function GetWorldViewMarkers(_5b4,_5b5){JSCommand.call(this,_5b4,null);this.aMarkers=[];this.iZoomLevel=1;this.bProcessed=false;this.mpMap=isDefined(_5b5)?_5b5:MapManager.getCurMap();this.sTabID=_5b5?_5b5.getTabID():null;};GetWorldViewMarkers.prototype=new JSCommand();GetWorldViewMarkers.prototype.destruct=function(){JSCommand.prototype.destruct.call(this);this.aMarkers=null;};GetWorldViewMarkers.prototype.getMap=function(){return this.mpMap;};GetWorldViewMarkers.prototype.getParams=function(){var _5b6={};if(this.mpMap==null){return _5b6;}
_5b6.zoomlevel=this.iZoomLevel=this.mpMap.getZoomLevel();if(MapManager.isBirdseyeShown()){_5b6.zoomlevel+=17;this.iZoomLevel+=17;}
if(_5b6.zoomlevel>1){var _5b7=this.mpMap.getViewPort().stretchToSize(this.mpMap);_5b6.viewport=(_5b7.getSW().getLat()-_5b7.getLatDiff()*0.25)+","+(_5b7.getSW().getLng()-_5b7.getLngDiff()*0.25)+";"+(_5b7.getNE().getLat()+_5b7.getLatDiff()*0.25)+","+(_5b7.getNE().getLng()+_5b7.getLngDiff()*0.25);}
return _5b6;};GetWorldViewMarkers.prototype.getWorldViewMarkers=function(){return this.aMarkers;};GetWorldViewMarkers.prototype.onDataReceived=function(_5b8){if(this.mpMap.bDestructed){return;}
if(_5b8){this.onProcessResult();}
this.icCaller.onCommandResult(this,_5b8);};GetWorldViewMarkers.prototype.onProcessResult=function(){if(!this.bProcessed){this.aMarkers=[];var _5b9=YSXML.getChild(this.xml,"worldview");if(_5b9){var _5ba=YSNumbers.checkInt(_5b9.getAttribute("maxweight"));var _5bb=YSXML.getChildren(_5b9,"zone");for(var i=0,_5bd=_5bb.length;i<_5bd;i++){var _5be=YSNumbers.checkInt(YSXML.getAttribute(_5bb[i],"id"));this.aMarkers[i]=new WorldViewMarker(new LatLng(YSNumbers.checkFloat(YSXML.getAttribute(_5bb[i],"lat")),YSNumbers.checkFloat(YSXML.getAttribute(_5bb[i],"lng"))),YSNumbers.checkInt(YSXML.getAttribute(_5bb[i],"weight")),YSNumbers.checkInt(YSXML.getAttribute(_5bb[i],"live"))==1,this.iZoomLevel,_5be,MSMap.IsWVMarkerSelected(_5be)||GEMap.IsWVMarkerSelected(_5be),this.sTabID);}}
this.bProcessed=true;}};GetWorldViewMarkers.prototype.sendRequest=function(){this.startConnection(this.getParams());};function JSCommand(_5bf,_5c0,_5c1){this.icCaller=_5bf;this.sTrackURL=_5c0;this.bGraphRequest=isDefined(_5c1)?_5c1:false;this.bProcessed=false;this.oID={};this.bAlive=true;this.bDownloaded=false;this.bRequestToCurPage=false;this.iStatus=0;this.sData=null;this.xml=null;this.oRequest=null;};JSCommand.prototype.destruct=function(){this.bAlive=false;this.stopConnection();this.icCaller=null;this.xml=null;this.oID=null;this.oRequest=null;};JSCommand.prototype.getCommandID=function(){return this.oID;};JSCommand.prototype.getData=function(){return this.sData;};JSCommand.prototype.getParamString=function(_5c2){var _5c3="";for(var _5c4 in _5c2){_5c3+=(_5c3==""?"":"&")+_5c4+"="+_5c2[_5c4];}
return _5c3;};JSCommand.prototype.getStatus=function(){return this.iStatus;};JSCommand.prototype.getTrackURL=function(){return this.sTrackURL;};JSCommand.prototype.getXML=function(){return this.xml;};JSCommand.prototype.onDataReceived=null;JSCommand.prototype.onXMLHttpReturn=function(_5c5,_5c6){if(!this.bAlive){return;}
this.bDownloaded=true;this.iStatus=_5c5.status;this.sData=_5c5.responseText;this.xml=YSAJAX.getXML(_5c5);this.onDataReceived(this.xml!=null);this.destruct();};JSCommand.prototype.setCommandID=function(oID){for(var _5c8 in oID){this.oID[_5c8]=oID[_5c8];}};JSCommand.prototype.setRequestToCurPage=function(_5c9){this.bRequestToCurPage=_5c9;};JSCommand.prototype.startConnection=function(_5ca,_5cb){this.bDownloaded=false;this.bProcessed=false;this.xml=null;this.sData=null;var _5cc=null;if(!this.bRequestToCurPage){if(!isPageLoaded(JSCommand.prototype.startConnectionTimeout,this,_5ca)){return;}
var _5cc=SettingsBar.getBasePath()+"core/shared-workouts/";if(this.sTrackURL==null){_5cc+="worldview.xml";}else{_5cc+=this.sTrackURL+"/"+(this.bGraphRequest?"graph":"map")+".xml";}}
if(!isDefined(_5cb)){_5cb="";}
this.oRequest=YSAJAX.sendRequest(_5cc,this.getParamString(_5ca)+_5cb,false,JSCommand.prototype.onXMLHttpReturn,this);};JSCommand.prototype.startConnectionTimeout=function(_5cd){this.startConnection(_5cd);};JSCommand.prototype.stopConnection=function(){if(this.oRequest!=null&&!this.bDownloaded){YSAJAX.cancelRequest(this.oRequest);this.oRequest=null;return true;}
return false;};function GPSPoint(_5ce,fLat,fLng,_5d1,_5d2,_5d3,_5d4,_5d5){LatLng.call(this,fLat,fLng);this.iTime=Math.round(YSNumbers.checkFloat(_5ce)*1000);this.fSpeed=YSNumbers.checkFloat(_5d1);this.iHeart=YSNumbers.checkInt(_5d2);this.fAltitude=YSNumbers.checkFloat(_5d3);this.fDistFromStart=YSNumbers.checkFloat(_5d4);this.iPixels=Math.abs(YSNumbers.checkInt(_5d5));if(this.iPixels>50000){this.iPixels=10;}};GPSPoint.prototype=new LatLng();GPSPoint.prototype.getAltitude=function(){return this.fAltitude;};GPSPoint.prototype.getAltitudeDiff=function(_5d6){return this.fAltitude-_5d6.fAltitude;};GPSPoint.prototype.getCopy=function(){var _5d7=new GPSPoint(this.iTime/1000,this.fLat,this.fLng,this.fSpeed,this.iHeart,this.fAltitude,this.fDistFromStart,this.iPixels);return _5d7;};GPSPoint.prototype.getDistance=function(){return this.fDistFromStart;};GPSPoint.prototype.getDistanceDiff=function(_5d8){return this.fDistFromStart-_5d8.fDistFromStart;};GPSPoint.prototype.getHeart=function(){return this.iHeart;};GPSPoint.prototype.getHeartDiff=function(_5d9){return this.iHeart-_5d9.iHeart;};GPSPoint.prototype.getPixDist=function(){return this.iPixels;};GPSPoint.prototype.getSpeed=function(){return this.fSpeed;};GPSPoint.prototype.getSpeedDiff=function(_5da){return this.fSpeed-_5da.getSpeed();};GPSPoint.prototype.getTime=function(){return Math.round(this.iTime/1000);};GPSPoint.prototype.getTimeMS=function(){return this.iTime;};GPSPoint.prototype.getTimeDiff=function(_5db){return this.getTimeDiffMS(_5db)/1000;};GPSPoint.prototype.getTimeDiffMS=function(_5dc){return this.getTimeMS()-_5dc.getTimeMS();};GPSPoint.prototype.setTimeMS=function(_5dd){this.iTime=_5dd;};GPSPoint.prototype.toString=function(){return this.iTime/1000+"; "+LatLng.prototype.toString.call(this)+"; "+this.fSpeed;};function LatLng(fLat,fLng){if(isDefined(fLat)){this.setLat(fLat);this.setLng(fLng);}else{this.fLat=this.fLng=0;}};LatLng.prototype.copyMe=function(){return new LatLng(this.getLat(),this.getLng());};LatLng.prototype.equals=function(_5e0){if(_5e0 instanceof LatLng){return _5e0.getLat()==this.getLat()&&_5e0.getLng()==this.getLng();}else{return false;}};LatLng.prototype.getLat=function(){return this.fLat;};LatLng.prototype.getLatDiff=function(_5e1,_5e2){if(!isDefined(_5e2)||_5e2){return Math.abs(_5e1.getLat()-this.getLat());}else{return this.getLat()-_5e1.getLat();}};LatLng.prototype.getLng=function(){return this.fLng;};LatLng.prototype.getLngDiff=function(_5e3,_5e4){if(!isDefined(_5e4)||_5e4){var _5e5=Math.abs(_5e3.getLng()-this.getLng());if(_5e5>180){_5e5=360-_5e5;}
return _5e5;}else{var _5e5=this.getLng()-_5e3.getLng();if(_5e5>180){_5e5-=360;}else{if(_5e5<-180){_5e5+=360;}}
return _5e5;}};LatLng.prototype.isValid=function(){return this.getLat()!=0||this.getLng()!=0;};LatLng.prototype.setLat=function(fLat){var _5e7=YSNumbers.roundNumber(YSNumbers.checkFloat(fLat),6);if(_5e7>90){_5e7=90;}
if(_5e7<-90){_5e7=-90;}
this.fLat=_5e7;};LatLng.prototype.setLng=function(fLng){var _5e9=YSNumbers.roundNumber(YSNumbers.checkFloat(fLng),6);if(_5e9>180){_5e9=-180+(_5e9-180);}
if(_5e9<-180){_5e9=180+(_5e9+180);}
this.fLng=_5e9;};LatLng.prototype.toGELatLng=function(){return new G.LatLng(this.getLat(),this.getLng());};LatLng.prototype.toMSLatLng=function(){return new VELatLong(this.getLat(),this.getLng(),0,VEAltitudeMode.RelativeToGround);};LatLng.prototype.toString=function(){return"("+this.fLat+", "+this.fLng+")";};function ViewPort(llSW,llNE){if(llSW instanceof LatLng&&llNE instanceof LatLng){this.llSW=llSW;this.llNE=llNE;this.llNW=new LatLng(this.llNE.getLat(),this.llSW.getLng());this.llSE=new LatLng(this.llSW.getLat(),this.llNE.getLng());}else{this.llNE=new LatLng(0,0);this.llSW=new LatLng(0,0);this.llNW=new LatLng(0,0);this.llSE=new LatLng(0,0);}
this.fLatDiff=this.fLngDiff=-1;};ViewPort.prototype.destruct=function(){this.llNW=this.llNE=this.llSE=this.llSW=null;};ViewPort.prototype.contains=function(_5ec){if(_5ec instanceof LatLng){return!(_5ec.getLat()<this.llSW.getLat()||_5ec.getLng()<this.llSW.getLng()||_5ec.getLat()>this.llNE.getLat()||_5ec.getLng()>this.llNE.getLng());}else{if(_5ec instanceof ViewPort){return!(_5ec.llSW.getLat()<this.llSW.getLat()||_5ec.llSW.getLng()<this.llSW.getLng()||_5ec.llNE.getLat()>this.llNE.getLat()||_5ec.llNE.getLng()>this.llNE.getLng());}else{return false;}}};ViewPort.prototype.equals=function(_5ed){if(_5ed instanceof ViewPort){return this.llSW.equals(_5ed.llSW)&&this.llNE.equals(_5ed.llNE);}else{return false;}};ViewPort.prototype.extend=function(_5ee){if(_5ee instanceof LatLng){if(!this.llNE.isValid()&&!this.llSW.isValid()){this.llSW.setLng(_5ee.getLng());this.llSW.setLat(_5ee.getLat());this.llNE.setLng(_5ee.getLng());this.llNE.setLat(_5ee.getLat());}else{this.llSW.setLng(Math.min(this.llSW.getLng(),_5ee.getLng()));this.llSW.setLat(Math.min(this.llSW.getLat(),_5ee.getLat()));this.llNE.setLng(Math.max(this.llNE.getLng(),_5ee.getLng()));this.llNE.setLat(Math.max(this.llNE.getLat(),_5ee.getLat()));}
this.storeDiffs();}};ViewPort.prototype.getCenter=function(){var fLat=this.llSW.getLat()+(this.getLatDiff()*0.5);var fLng=this.llSW.getLng()+(this.getLngDiff()*0.5);return new LatLng(fLat,fLng);};ViewPort.prototype.getCopy=function(){return new ViewPort(new LatLng(this.llSW.getLat(),this.llSW.getLng()),new LatLng(this.llNE.getLat(),this.llNE.getLng()));};ViewPort.prototype.getLatDiff=function(){if(this.fLatDiff==-1){this.storeDiffs();}
return this.fLatDiff;};ViewPort.prototype.getLngDiff=function(){if(this.fLngDiff==-1){this.storeDiffs();}
return this.fLngDiff;};ViewPort.prototype.getNE=function(){return this.llNE;};ViewPort.prototype.getNW=function(){return this.llNW;};ViewPort.prototype.getSE=function(){return this.llSE;};ViewPort.prototype.getSW=function(){return this.llSW;};ViewPort.prototype.getOuterViewPort=function(){return new ViewPort(new LatLng(this.llSW.getLat()-this.getLatDiff(),this.llSW.getLng()-this.getLngDiff()),new LatLng(this.llNE.getLat()+this.getLatDiff(),this.llNE.getLng()+this.getLngDiff()));};ViewPort.prototype.intersects=function(_5f1){if(_5f1 instanceof ViewPort){return _5f1.llNE.getLat()>this.llSE.getLat()&&_5f1.llSE.getLat()<this.llNE.getLat()&&_5f1.llSW.getLng()<this.llSE.getLng()&&_5f1.llSE.getLng()>this.llSW.getLng();}else{return false;}};ViewPort.prototype.isValid=function(){return this.llSW.isValid()||this.llNE.isValid();};ViewPort.prototype.setNE=function(llNE){if(llNE instanceof LatLng){this.llNE=llNE;this.llNW.setLat(this.llNE.getLat());this.llSE.setLng(this.llNE.getLng());this.storeDiffs();}};ViewPort.prototype.setNW=function(llNW){if(llNW instanceof LatLng){this.llNW=llNW;this.llNE.setLat(this.llNW.getLat());this.llSW.setLng(this.llNW.getLng());this.storeDiffs();}};ViewPort.prototype.setSE=function(llSE){if(llSE instanceof LatLng){this.llSE=llSE;this.llNE.setLng(this.llSE.getLng());this.llSW.setLat(this.llSE.getLat());this.storeDiffs();}};ViewPort.prototype.setSW=function(llSW){if(llSW instanceof LatLng){this.llSW=llSW;this.llNW.setLng(this.llSW.getLng());this.llSE.setLat(this.llSW.getLat());this.storeDiffs();}};ViewPort.prototype.storeDiffs=function(){this.fLatDiff=this.llNE.getLatDiff(this.llSW);this.fLngDiff=this.llSW.getLngDiff(this.llNE);};ViewPort.prototype.stretchToSize=function(_5f6,_5f7){if(!isDefined(_5f7)){_5f7=_5f6.getPixelSize();}
var _5f8=null;var _5f9=_5f6.getPixDiff(this.llSW,this.llNW);if(_5f9!=_5f7.height){var _5fa=this.getLatDiff();var _5fb=(1+((_5f7.height-_5f9)/_5f9))*_5fa;var _5fc=(_5fb-_5fa)/2;_5f8=new ViewPort(new LatLng(this.llSW.getLat()-_5fc,this.llSW.getLng()),new LatLng(this.llNE.getLat()+_5fc,this.llNE.getLng()));}
var _5fd=_5f6.getPixDiff(this.llSW,this.llSE);if(_5fd!=_5f7.width){var _5fe=this.getLngDiff();var _5ff=(1+((_5f7.width-_5fd)/_5fd))*_5fe;var _5fc=(_5ff-_5fe)/2;_5f8=new ViewPort(new LatLng(this.llSW.getLat(),this.llSW.getLng()-_5fc),new LatLng(this.llNE.getLat(),this.llNE.getLng()+_5fc));}
if(_5f8==null){return this.getCopy();}else{return _5f8;}};ViewPort.prototype.toGEViewPort=function(){return new G.LatLngBounds(this.llSW.toGELatLng(),this.llNE.toGELatLng());};ViewPort.prototype.toMSViewPort=function(){return new VELatLongRectangle(this.llNW.toMSLatLng(),this.llSE.toMSLatLng(),null,null);};ViewPort.prototype.toParam=function(){return this.llSW.getLat()+","+this.llSW.getLng()+";"+this.llNE.getLat()+","+this.llNE.getLng();};ViewPort.prototype.toString=function(){return"SW: "+this.llSW.toString()+"; NE: "+this.llNE.toString();};function Drawer(_600){if(isDefined(_600)){this.gGraph=_600;this.bMainGraph=_600.isMainGraph();if(this.bMainGraph){Drawer.dwCurDrawer=this;}
this.oYAxHolder=null;this.oXAxLines=null;this.oXAxTexts=null;this.divGraphHolder=null;this.oGraphLineHolder=null;this.oEventCatcher=null;this.oXLegend=null;this.oYLegend=null;this.iGraphHeight=this.bMainGraph?290:100;this.iGraphWidth=this.bMainGraph?400:120;this.iFontSize=this.bMainGraph?11:9;this.iHalfFontSize=this.bMainGraph?6:4;this.iYExtTextDist=this.bMainGraph?4:2;this.iYAxisLineWidth=this.bMainGraph?2:1;this.iLineWidth=this.bMainGraph?5:2;this.iLineOffset=-1*Math.round(this.iLineWidth*0.25);this.iPaddingTop=this.bMainGraph?7:25;this.iPaddingLeft=this.bMainGraph?58:32;this.iMaxYScales=this.bMainGraph?5:3;this.iMaxXScales=this.iMaxYScales+1;this.iScaleExtWidth=this.bMainGraph?10:5;this.iExtraWidth=this.bMainGraph?55:40;this.iTimeWidth=0;this.iLastTimeWidth=0;this.iInitXLinesLeft=-1*this.iGraphWidth;this.iInitXTextLeft=this.iInitXLinesLeft;this.aTimeScales=[1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,10800,21600,43200,86400,172800,259200,345600];this.aValueScales=[1,2,2.5,5];this.iTimeScale=0;this.aYScales={};this.bForceDrawYScale=true;this.aLines={};this.iLastZoomTime=0;this.plPlayer=null;}};Drawer.ZOOM_INTERVAL=250;Drawer.MIN_TIMEWIDTH=300;Drawer.MIN_NORMALTIMEWIDTH=300;Drawer.MIN_LIVETIMEWIDTH=60;Drawer.bDocEventsSet=false;Drawer.dwCurDrawer=null;Drawer.prototype.destruct=function(){YSEventHandler.Instance().removeEvent(this.oEventCatcher,"onmousedown");if(this.plPlayer!=null){this.plPlayer.destruct();}
this.oYAxHolder=null;this.oXAxLines=null;this.oXAxTexts=null;this.divGraphHolder=null;this.oGraphLineHolder=null;this.gGraph=null;this.oEventCatcher=null;this.oXLegend=null;this.oYLegend=null;this.aLines=null;if(Drawer.dwCurDrawer==this){Drawer.dwCurDrawer=null;}};Drawer.prototype.getExtraX=function(){return this.iExtraWidth*this.getXPerPix();};Drawer.prototype.getGraph=function(){return this.gGraph;};Drawer.prototype.getGraphSize=function(){return new Size(this.iGraphWidth,this.iGraphHeight);};Drawer.prototype.getGraphWidth=function(){return this.iGraphWidth;};Drawer.prototype.getNextScale=function(iX){return Math.ceil(iX/this.iTimeScale)*this.iTimeScale;};Drawer.prototype.getPixPerX=function(){return this.iGraphWidth/this.iTimeWidth;};Drawer.prototype.getPixForX=function(iX){return Math.round((iX-this.gGraph.getViewPort().iMinX)*this.getPixPerX());};Drawer.prototype.getStringTime=function(_603){return YSDateTime.getTimeString(_603);};Drawer.prototype.getTimeWidth=function(){return this.iTimeWidth;};Drawer.prototype.getUpperBound=function(_604,_605){if(_605<_604[0].getX()){return 0;}
var _606=_604.length;if(_605>=_604[_606-1].getX()){return _606-1;}
var _607=0;var _608=_606;var iCur=_606>>1;var _60a=false;var _60b=null;while(!_60a){_60b=_604[iCur];if(iCur==0||iCur==_606-1||_605==_60b.getX()){_60a=true;}else{if(_605>_60b.getX()){if(_605<=_604[iCur+1].getX()){iCur++;_60a=true;}else{_607=iCur;iCur+=(_608-_607)>>1;}}else{if(_605<_60b.getX()){if(_605>_604[iCur-1].getX()){_60a=true;}else{_608=iCur;iCur-=(_608-_607+1)>>1;}}}}}
return iCur;};Drawer.prototype.getXPerPix=function(){return this.iTimeWidth/this.iGraphWidth;};Drawer.prototype.isYScaleRecalc=function(){return this.gGraph.isLive()||this.bForceDrawYScale||this.gGraph.isLive();};Drawer.prototype.onAddLineLegend=function(_60c,_60d){var _60e=document.createElement("span");_60e.className="legend "+GraphPage.getColor(_60c);this.oYLegend.appendChild(_60e);var _60f=document.createElement("div");var bKM=SettingsBar.isKM();if(_60c==Graph.LINE_SPEED){_60f.innerHTML=YSText.get("[?LegendSpeed?]",[bKM?"km/h":"mph"]);}else{if(_60c==Graph.LINE_HEIGHT){_60f.innerHTML=YSText.get("[?LegendHeight?]",[bKM?"m":"ft"]);}else{if(_60c==Graph.LINE_HEART){_60f.innerHTML=YSText.get("[?LegendHeart?]",["bpm"]);}else{if(_60c==Graph.LINE_PACE){_60f.innerHTML=YSText.get("[?LegendPace?]",[bKM?"min/km":"min/mi"]);}}}}
this.oYLegend.appendChild(_60f);var _611=YSCSS.getStyle(_60e,"width",true);var _612,_613;if(_60d){_612=new Pixel(0,4);_613=new Pixel(_611+2,3);}else{var _614=YSCSS.getStyle(_60f,"width",true);_612=new Pixel(this.iPaddingLeft*2+this.iGraphWidth-_611,4);_613=new Pixel(_612.left-2-_614,3);}
YSDOM.setPosition(_60e,_612);YSDOM.setPosition(_60f,_613);};Drawer.prototype.onDetermineYScale=function(cmd,_616){var _617=cmd.getMinY(_616);var _618=cmd.getMaxY(_616);var _619=_618-_617;var _61a;var _61b;var _61c=_617;if(_616==Graph.LINE_PACE){var _61d=_619/this.iMaxYScales;var i=0;for(var _61f=this.aTimeScales.length;i<_61f;i++){if(_61d<=this.aTimeScales[i]){break;}}
_61a=this.aTimeScales[i];_61b=Math.ceil(_618/_61a);}else{var _620=Math.pow(10,String(Math.floor(_619/4)).length-1);for(var i=0,_61f=this.aValueScales.length;i<_61f;i++){_61a=this.aValueScales[i]*_620;if(_617!=0){if(_617>0){_61c=Math.floor(_617/_61a)*_61a;}else{_61c=Math.ceil(_617/_61a)*_61a;}
_61b=Math.ceil((_618-_61c)/_61a);}else{_61b=Math.ceil(_619/_61a);}
if(_61b<=this.iMaxYScales){break;}
if(i==_61f-1){_620*=10;i=-1;}}}
this.aYScales[_616]={scale:_61a,num:Math.max(2,_61b),start:_61c};};Drawer.onDocMouseMove=function(obj,oPos){if(Drawer.dwCurDrawer!=null){Drawer.dwCurDrawer.gGraph.onMouseMove(oPos);}};Drawer.onDocMouseUp=function(e,obj){if(Drawer.dwCurDrawer!=null){YSCSS.setStyle(document.body,"cursor","auto");YSCSS.setStyle(Drawer.dwCurDrawer.oEventCatcher,"cursor","url(\"http://www.google.com/intl/en_ALL/mapfiles/openhand.cur\"), default");Drawer.dwCurDrawer.gGraph.onMouseUp();}};Drawer.prototype.onDrawGap=function(_625){var _626=document.createElement("div");YSDOM.setSize(_626,new Size(this.iExtraWidth,this.iGraphHeight-2));YSDOM.setPosition(_626,new Pixel(_625,0));_626.className="graphgap";this.oXAxLines.appendChild(_626);};Drawer.prototype.onDrawGraph=function(_627,_628){if(this.plPlayer!=null&&this.plPlayer.isMoving()){if(isDefined(_628)){this.aLines=_628;}
return;}
YSDOM.removeElementChilds(this.oGraphLineHolder,false);YSCSS.setStyle(this.oGraphLineHolder,"left",this.iInitXLinesLeft+"px");var _629=this.gGraph.getAllViewPort();var _62a=_629.iMaxX-_629.iMinX;var _62b=_627.iMinX-_629.iMinX-this.iTimeWidth;var _62c=_62a+this.getExtraX();if(_62b<0){_62b+=_62c;}
var _62d=this.getPixPerX();var _628=isDefined(_628)?_628:this.aLines;var _62e=false;for(var i=2;i>=1;i--){var _630=this.gGraph.getLineType(i);if(_630==Graph.LINE_NONE||!isDefined(_628[_630])){continue;}
if(i==2&&bIE8){_62e=true;}
var _631=GraphPage.getCSSColor(_630);var _632=this.aYScales[_630];var _633=_632.num*_632.scale;var _634=_632.start+_633;var _635=this.iGraphHeight/_633;var _636=_628[_630];var _637=_636.length;if(_637==0){continue;}
if(this.gGraph.isLive()||!this.bMainGraph||_637>1||_636[0][0].getX()!=_629.iMinX||_636[0][_636[0].length-1].getX()!=this.gGraph.getRealMaxX()){var _638=_629.iMinX+_62b;var _639,_63a;for(var k=0;k<_637;k++){if(_636[k].length<2){continue;}
_63a=_636[k][0].getX()-_638;if(_63a>=-5){_639=_63a*_62d;}else{_639=this.gGraph.getXDiff(_638,_636[k][0].getX())*_62d;}
this.onDrawGraphLine(_636[k],Math.round(_639+this.iLineOffset),null,_635,_634,_633,_631);}}else{var _63c=_62b;if(_62e){_62b+=this.iTimeWidth*0.5;if(_62b>_62c){_62b-=_62c;}}
var _63d=_636[0];var _63e=_63d.length;var _63f=_62a*_62d;var _640=this.getUpperBound(_63d,_629.iMinX+_62b);if(_640==_63e-1){_640=0;}
_62b=_63c;var _641=this.iGraphWidth*(_62e?2.5:3);var _642=_641*this.getXPerPix();var _643=this.gGraph.getXDiff(_629.iMinX+_62b,_63d[_640].getX())*_62d;var _644,_645,_646;while(_643<_641){if(_640>0){_644=(_629.iMaxX-_63d[_640].getX())*_62d;}else{_644=_63f;}
if(_643+_644>_641){var _647=(_62b+_642)%_62c;_645=this.getUpperBound(_63d,_629.iMinX+_647);}else{_645=_63e-1;}
this.onDrawGraphLine(_63d,Math.round(_643+this.iLineOffset),Math.ceil(_644),_635,_634,_633,_631,_640,_645);_643+=_644+this.iExtraWidth;_640=0;}}}
this.aLines=_628;};Drawer.prototype.onDrawXScale=function(_648,_649,_64a){if(_64a){var _64b=document.createElement("div");YSCSS.setMultiStyle(_64b,["width","left","whiteSpace","textAlign"],["100px",_648+"px","nowrap","center"]);_64b.innerHTML=this.getStringTime(_649);this.oXAxTexts.appendChild(_64b);}
var _64c=document.createElement("div");YSDOM.setSize(_64c,new Size(1,this.iGraphHeight-2));YSCSS.setMultiStyle(_64c,["backgroundColor","left"],["#868686",_648+"px"]);var _64d=document.createElement("div");YSDOM.setSize(_64d,new Size(1,this.iScaleExtWidth));YSDOM.setPosition(_64d,new Pixel(_648,this.iGraphHeight-1));YSCSS.setStyle(_64d,"backgroundColor","#474747");this.oXAxLines.appendChild(_64c);this.oXAxLines.appendChild(_64d);};Drawer.prototype.onDrawYScale=function(iTop,iY,_650,_651){var _652=_650==1&&iTop>0&&iTop<this.iGraphHeight;if(iTop>0){iTop--;}
iTop+=this.iPaddingTop;if(_652){var _653=document.createElement("div");YSDOM.setPosition(_653,new Pixel(this.iPaddingLeft+1,iTop));YSDOM.setSize(_653,new Size(this.iGraphWidth-2,1));YSCSS.setStyle(_653,"backgroundColor","#868686");this.oYAxHolder.appendChild(_653);}
var _654,_655=50;if(_650==1){_654=this.iPaddingLeft-this.iScaleExtWidth;_655=_654-this.iYExtTextDist;}else{_654=this.iPaddingLeft+this.iGraphWidth;}
var _656=document.createElement("div");YSDOM.setPosition(_656,new Pixel(_654,iTop));YSDOM.setSize(_656,new Size(this.iScaleExtWidth,1));YSCSS.setStyle(_656,"backgroundColor",_651);this.oYAxHolder.appendChild(_656);var _657=document.createElement("div");YSCSS.setMultiStyle(_657,["top","width"],[(iTop-this.iHalfFontSize)+"px",_655+"px"]);if(_650==1){YSCSS.setStyle(_657,"textAlign","right");}else{YSCSS.setStyle(_657,"left",(_654+this.iScaleExtWidth+this.iYExtTextDist)+"px");}
_657.innerHTML=iY;this.oYAxHolder.appendChild(_657);};Drawer.prototype.onGenerateXHolders=function(_658){if(!this.bMainGraph){this.oYLegend=document.createElement("div");YSDOM.setSize(this.oYLegend,new Size(this.iGraphWidth+this.iPaddingLeft*2,this.iFontSize));_658.appendChild(this.oYLegend);}
this.oYAxHolder=document.createElement("div");_658.appendChild(this.oYAxHolder);var _659=document.createElement("div");YSCSS.setStyle(_659,"overflow","hidden");YSDOM.setPosition(_659,new Pixel(this.iPaddingLeft+1,this.iPaddingTop+1));YSDOM.setSize(_659,new Size(this.iGraphWidth-2,this.iGraphHeight-1+this.iScaleExtWidth));var _65a=document.createElement("div");YSCSS.setStyle(_65a,"overflow","hidden");var _65b=this.iPaddingLeft-this.iFontSize*2;YSDOM.setPosition(_65a,new Pixel(_65b,this.iPaddingTop+this.iGraphHeight+this.iScaleExtWidth));YSDOM.setSize(_65a,new Size(this.iGraphWidth+this.iFontSize*4,this.iFontSize*2.5));this.iInitXLinesLeft=-1-this.iGraphWidth;this.iInitXTextLeft=-1*_65b-(50-this.iPaddingLeft)-this.iGraphWidth;this.oXAxLines=document.createElement("div");YSDOM.setSize(this.oXAxLines,new Size(this.iGraphWidth*3,this.iGraphHeight-1+this.iScaleExtWidth));YSCSS.setStyle(this.oXAxLines,"left",this.iInitXLinesLeft+"px");_659.appendChild(this.oXAxLines);this.oXAxTexts=document.createElement("div");YSDOM.setSize(this.oXAxTexts,new Size(this.iGraphWidth*3+100,this.iFontSize*2.5));YSCSS.setStyle(this.oXAxTexts,"left",this.iInitXTextLeft+"px");_65a.appendChild(this.oXAxTexts);_658.appendChild(_659);_658.appendChild(_65a);};Drawer.prototype.onInit=function(_65c){var _65d=this.getGraphSize();_65d.width-=2;_65d.height-=2;var _65e=document.createElement("div");YSDOM.setSize(_65e,_65d);YSDOM.setPosition(_65e,new Pixel(this.iPaddingLeft,this.iPaddingTop));_65e.className="graphrect";_65c.appendChild(_65e);this.onGenerateXHolders(_65c);this.divGraphHolder=document.createElement("div");YSCSS.setStyle(this.divGraphHolder,"overflow","hidden");YSDOM.setPosition(this.divGraphHolder,new Pixel(this.iPaddingLeft+1,this.iPaddingTop+1-0.5*this.iLineWidth));YSDOM.setSize(this.divGraphHolder,new Size(this.iGraphWidth-2,this.iGraphHeight+this.iLineWidth));this.onGenerateGraphHolder(this.divGraphHolder);_65c.appendChild(this.divGraphHolder);this.oXLegend=document.createElement("div");YSDOM.setSize(this.oXLegend,new Size(this.iGraphWidth,this.iFontSize));var _65f=new Pixel(this.iPaddingLeft,this.iPaddingTop+this.iGraphHeight+this.iScaleExtWidth+this.iFontSize*1.5);if(!this.bMainGraph){_65f.top+=this.iHalfFontSize;}
YSDOM.setPosition(this.oXLegend,_65f);YSCSS.setMultiStyle(this.oXLegend,["textAlign","fontWeight"],["center","bold"]);_65c.appendChild(this.oXLegend);var _660=document.createElement("div");YSDOM.setPosition(_660,new Pixel(this.iPaddingLeft+1,this.iPaddingTop+1));YSDOM.setSize(_660,_65d);YSCSS.setStyle(_660,"backgroundColor","black");YSCSS.setTransparency(_660,100);_65c.appendChild(_660);Drawer.MIN_TIMEWIDTH=this.gGraph.isLive()?Drawer.MIN_LIVETIMEWIDTH:Drawer.MIN_NORMALTIMEWIDTH;if(this.bMainGraph){this.onInitEvents(_660);if(this.gGraph.isLive()){this.plPlayer=new GraphPlayer(this,this.divGraphHolder);}}};Drawer.prototype.onInitEvents=function(_661){this.oEventCatcher=_661;if(this.gGraph.isLive()){YSEventHandler.Instance().removeEvent(_661,"onmousedown");YSCSS.setStyle(_661,"cursor","default");}else{YSCSS.setStyle(_661,"cursor","url(\"http://www.google.com/intl/en_ALL/mapfiles/openhand.cur\"), default");YSEventHandler.Instance().addHandler(_661,"onmousedown",Drawer.prototype.onMouseDown,this);}
YSEventHandler.Instance().addHandler(_661,"onmousewheel",Drawer.prototype.onMouseWheel,this);if(!Drawer.bDocEventsSet&&!this.gGraph.isLive()){Drawer.bDocEventsSet=true;YSMouseMoveEvent.Instance().registerElement(document,30,Drawer.onDocMouseMove);YSEventHandler.Instance().addHandler(document,"onmouseup",Drawer.onDocMouseUp);}};Drawer.prototype.onLineTypeChange=function(){this.bForceDrawYScale=true;};Drawer.prototype.onLiveChange=function(_662){if(!this.bMainGraph){return;}
this.onReset();this.onInitEvents(this.oEventCatcher);if(!_662&&this.plPlayer!=null){this.plPlayer.destruct();this.plPlayer=null;}else{if(_662&&this.plPlayer==null){this.plPlayer=new GraphPlayer(this,this.divGraphHolder);}}
Drawer.MIN_TIMEWIDTH=_662?Drawer.MIN_LIVETIMEWIDTH:Drawer.MIN_NORMALTIMEWIDTH;};Drawer.prototype.onMouseDown=function(e,obj){YSCSS.setStyle(document.body,"cursor","url(\"http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur\"), default");YSCSS.setStyle(obj,"cursor","url(\"http://www.google.com/intl/en_ALL/mapfiles/closedhand.cur\"), default");this.gGraph.onMouseDown(YSEvent.getGlobalMousePosition(e));};Drawer.prototype.onMouseWheel=function(e,obj,_667){var _668=this.gGraph.isLive();var _669=!isDefined(_667);var _66a=YSDateTime.getCurTime();if(_66a-this.iLastZoomTime>Drawer.ZOOM_INTERVAL){this.iLastZoomTime=_66a;var _66b=_669?YSEvent.getScrollWheelDirection(e)>0:_667;var _66c=this.gGraph.getTrackLength();if(_668){_66c+=this.gGraph.getVP().iMinX+this.iTimeWidth-this.gGraph.getRealMaxX();}
if((this.iTimeWidth<_66c||_66b)&&(this.iTimeWidth>Drawer.MIN_TIMEWIDTH||!_66b)){var _66d;if(this.iTimeWidth==Drawer.MIN_TIMEWIDTH&&this.iLastTimeWidth>this.iTimeWidth){_66d=this.iLastTimeWidth;}else{_66d=Math.min(Math.max(Math.round(this.iTimeWidth*(_66b?0.75:1.33)),Drawer.MIN_TIMEWIDTH),_66c);}
var _66e;if(_668){_66e=(this.gGraph.getRealMaxX()-this.gGraph.getVP().iMinX)/this.iTimeWidth;}else{_66e=_669?YSEvent.getObjMousePosition(e,obj).left/this.iGraphWidth:0.5;}
this.gGraph.onZoom(_66d,_66e);this.iLastTimeWidth=this.iTimeWidth;this.iTimeWidth=_66d;this.iTimeScale=0;this.gGraph.onViewChanged();this.gGraph.onTimeWidthChanged(this.iTimeWidth);}}
if(_669){YSEvent.cancelEvent(e,true);}
return false;};Drawer.prototype.onMove=function(_66f){YSCSS.setStyle(this.oGraphLineHolder,"left",(this.iInitXLinesLeft+_66f)+"px");YSCSS.setStyle(this.oXAxLines,"left",(this.iInitXLinesLeft+_66f)+"px");YSCSS.setStyle(this.oXAxTexts,"left",(this.iInitXTextLeft+_66f)+"px");};Drawer.prototype.onNewShading=function(aVPs){};Drawer.prototype.onPlay=function(_671){if(this.plPlayer!=null){this.plPlayer.onPlay(_671);}};Drawer.prototype.onRedraw=function(_672){this.onXScaleRedraw(_672);this.onDrawGraph(_672);};Drawer.prototype.onReset=function(){this.iTimeScale=this.iTimeWidth=this.iLastTimeWidth=0;this.bForceDrawYScale=true;};Drawer.prototype.onUpdate=function(cmd,_674,_675){var _676=this.isYScaleRecalc();if(this.iTimeScale==0){var _677=this.iTimeWidth/this.iMaxXScales;var i=0;for(var _679=this.aTimeScales.length;i<_679;i++){if(_677<=this.aTimeScales[i]){break;}}
this.iTimeScale=this.aTimeScales[i];this.oXLegend.innerHTML=YSText.get("[?LegendTime?]");}
if(this.plPlayer==null||!this.plPlayer.isMoving()){this.onXScaleRedraw(_674);}
if(_676){this.bForceDrawYScale=false;this.aYScales={};YSDOM.removeElementChilds(this.oYAxHolder,false);YSDOM.removeElementChilds(this.oYLegend,false);for(var i=1;i<=2;i++){var _67a=this.gGraph.getLineType(i);if(_67a==Graph.LINE_NONE){continue;}
this.onDetermineYScale(cmd,_67a);this.onYScaleRedraw(i,_67a);if(!this.bMainGraph){this.onAddLineLegend(_67a,i==1);}}}
if(this.plPlayer!=null){this.plPlayer.onUpdate(cmd.getMaxX());if(_675&&TrackPage.isGraphShown()){this.plPlayer.onPlay(true);}}
this.onDrawGraph(_674,cmd.getLines());};Drawer.prototype.onXScaleRedraw=function(_67b){YSDOM.removeElementChilds(this.oXAxLines,false);YSDOM.removeElementChilds(this.oXAxTexts,false);YSCSS.setStyle(this.oXAxLines,"left",this.iInitXLinesLeft+"px");YSCSS.setStyle(this.oXAxTexts,"left",this.iInitXTextLeft+"px");var _67c=this.gGraph.getAllViewPort();var _67d=this.getPixPerX();var _67e,_67f,_680;if(this.bMainGraph){_67e=this.iGraphWidth*3;var _681=_67c.iMaxX-_67c.iMinX;var _682=_67b.iMinX-_67c.iMinX-this.iTimeWidth;if(_682<0){_682+=_681+this.getExtraX();}
_67f=this.getNextScale(_682);if(_67f>_681){_67f=0;}
_680=this.gGraph.getXDiff(_67c.iMinX+_682,_67c.iMinX+_67f)*_67d;}else{_67f=0;_680=this.iGraphWidth;_67e=this.iGraphWidth*2;}
var _683=-100;var _684,_685,_686;while(_680<=_67e){_684=Math.round(_680);_686=_680-_683>=this.iExtraWidth;if(_686){_683=_680;}
this.onDrawXScale(_684,_67f,_686);if(_67f+this.iTimeScale>_681){_680+=_67d*(_681-_67f);if(this.bMainGraph){this.onDrawGap(_680);}
_680+=this.iExtraWidth;_67f=0;}else{_67f+=this.iTimeScale;_680+=_67d*this.iTimeScale;}}};Drawer.prototype.onYScaleRedraw=function(_687,_688){var _689=this.aYScales[_688];var _68a=_689.num*_689.scale;var _68b=_689.start+_68a;var _68c=this.iGraphHeight/_68a;var _68d=GraphPage.getCSSColor(_688);var _68e,iTop;for(var i=0;i<=_689.num;i++){_68e=_689.start+i*_689.scale;iTop=Math.round((_68b-_68e)*_68c);if(_688==Graph.LINE_PACE){_68e=YSDateTime.getTimeString(_68e,false);}
this.onDrawYScale(iTop,_68e,_687,_68d);}
var _691=document.createElement("div");YSDOM.setSize(_691,new Size(this.iYAxisLineWidth,this.iGraphHeight));var _692=_687==1?this.iPaddingLeft-(this.iYAxisLineWidth-1):this.iPaddingLeft+this.iGraphWidth-1;YSDOM.setPosition(_691,new Pixel(_692,this.iPaddingTop));YSCSS.setStyle(_691,"backgroundColor",GraphPage.getCSSColor(_688));this.oYAxHolder.appendChild(_691);if(this.bMainGraph){this.onShowUnitText(_687,GraphPage.getValueName(_687));}};Drawer.prototype.onZoomIn=function(){this.onMouseWheel(null,null,true);};Drawer.prototype.onZoomOut=function(){this.onMouseWheel(null,null,false);};Drawer.prototype.setLiveVP=function(_693,_694){};Drawer.prototype.setTimeWidth=function(_695){this.iTimeWidth=Math.max(_695,Drawer.MIN_TIMEWIDTH);};function Graph(_696,_697,_698,_699,_69a,_69b){this.sDivID=_696;this.sTrackURL=_697;this.bAllowUserAction=_698;this.bLive=isDefined(_69b)?_69b:_69b;this.bHasHeight=_699;this.bHasHeart=_69a;this.bIsOnceDrawn=false;this.iLine1=Graph.LINE_1>=0?Graph.LINE_1:Graph.LINE_SPEED;this.iLine2=Graph.LINE_2>=0?Graph.LINE_2:_69a?Graph.LINE_HEART:_699?Graph.LINE_HEIGHT:Graph.LINE_NONE;this.oAllViewPort={iMinX:0,iMaxX:0};this.oViewPort={iMinX:0,iMaxX:YSNumbers.MAX_INT};this.iMaxXScale=0;this.iRealMaxX=0;this.oMoveStart=null;this.oMoveEnd=null;this.cmdLast=null;this.oCached={oVP:{iMinX:0,iMaxX:0},iLine1:0,iLine2:0,iTimeWidth:0};this.oCachedGraphInfo={};this.oGraphHolder=YSDOM.getObj(this.sDivID);YSDOM.removeElementChilds(this.oGraphHolder);this.dwDrawer=Graph.VML?new VML(this):new SVG(this);var _69c=TrackPage.isGraphShown()||!this.bAllowUserAction;if(_69c){this.onFirstDraw();}
this.toLive=null;if(this.bLive&&_69c){this.onStartLiveRequests(true);}};Graph.LINE_NONE=0;Graph.LINE_SPEED=1;Graph.LINE_HEIGHT=2;Graph.LINE_HEART=3;Graph.LINE_PACE=4;Graph.LINE_1=-1;Graph.LINE_2=-1;Graph.VML=document.all?true:false;Graph.prototype.destruct=function(){if(this.toLive!=null){this.toLive.cancelTimeout();this.toLive=null;}
this.dwDrawer.destruct();this.dwDrawer=null;if(this.cmdLast!=null){this.cmdLast.destruct();this.cmdLast=null;}
this.oMoveStart=this.oMoveEnd=this.oViewPort=this.oAllViewPort=null;YSDOM.removeElementChilds(this.oGraphHolder);};Graph.prototype.getAllViewPort=function(){return this.oAllViewPort;};Graph.prototype.getID=function(){return this.sDivID;};Graph.prototype.getLineType=function(_69d){if(_69d==2){return this.iLine2;}else{return this.iLine1;}};Graph.prototype.getMaxXScale=function(){if(this.iMaxXScale==0){this.iMaxXScale=this.oAllViewPort.iMaxX+this.dwDrawer.getExtraX();}
return this.iMaxXScale;};Graph.prototype.getNormalizedX=function(iX){var _69f=this.getMaxXScale();if(iX>_69f){return this.oAllViewPort.iMinX+(iX-_69f);}
if(iX<this.oAllViewPort.iMinX){return _69f-(this.oAllViewPort.iMinX-iX);}
return iX;};Graph.prototype.getOuterViewPort=function(){if(!this.hasData()){return{iMinX:0,iMaxX:YSNumbers.MAX_INT};}
if(this.bLive){var _6a0=this.dwDrawer.getXPerPix()*50;var _6a1=Math.max(this.oAllViewPort.iMinX,this.oViewPort.iMinX-_6a0);var _6a2=this.iRealMaxX+_6a0;return{iMinX:Math.round(_6a1),iMaxX:Math.round(_6a2)};}else{var _6a3=this.getTrackLength();if(_6a3<=this.dwDrawer.getTimeWidth()){return{iMinX:this.oAllViewPort.iMinX,iMaxX:this.oAllViewPort.iMaxX};}
var _6a4=this.getXDiff(this.oViewPort.iMinX,this.oViewPort.iMaxX);if(_6a4*3>=_6a3){return{iMinX:this.oAllViewPort.iMinX,iMaxX:this.oAllViewPort.iMaxX};}else{var _6a1=this.getNormalizedX(this.oViewPort.iMinX-_6a4);var _6a2=this.getNormalizedX(this.oViewPort.iMaxX+_6a4);return{iMinX:_6a1,iMaxX:_6a2};}}};Graph.prototype.getRealMaxX=function(){return this.iRealMaxX;};Graph.prototype.getTrackLength=function(){return this.iRealMaxX-this.oAllViewPort.iMinX;};Graph.prototype.getTrackURL=function(){return this.sTrackURL;};Graph.prototype.getViewPort=function(){return this.oViewPort;};Graph.prototype.getVP=function(){return this.oViewPort;};Graph.prototype.getXDiff=function(_6a5,_6a6){if(_6a6>=_6a5){return _6a6-_6a5;}else{return(this.getMaxXScale()-_6a5)+(_6a6-this.oAllViewPort.iMinX);}};Graph.prototype.hasData=function(){return!(this.oViewPort.iMaxX==YSNumbers.MAX_INT||this.oAllViewPort.iMaxX==0);};Graph.prototype.isCached=function(oVP){if(this.oCached.oVP.iMinX!=oVP.iMinX||this.oCached.oVP.iMaxX!=oVP.iMaxX||this.oCached.iLine1!=this.iLine1||this.oCached.iLine2!=this.iLine2||this.oCached.iTimeWidth!=this.dwDrawer.getTimeWidth()){this.oCached.oVP.iMinX=oVP.iMinX;this.oCached.oVP.iMaxX=oVP.iMaxX;this.oCached.iLine1=this.iLine1;this.oCached.iLine2=this.iLine2;this.oCached.iTimeWidth=this.dwDrawer.getTimeWidth();return false;}else{return true;}};Graph.prototype.isLive=function(){return this.bLive;};Graph.prototype.isMainGraph=function(){return this.bAllowUserAction;};Graph.prototype.isOnceDrawn=function(){return this.bIsOnceDrawn;};Graph.prototype.onAllVPChanged=function(){this.iMaxXScale=0;};Graph.prototype.onCommandResult=function(cmd,_6a9){if(_6a9&&this.bIsOnceDrawn){if(cmd.getCommandID().live&&!this.isMainGraph()){this.dwDrawer.onReset();}
var _6aa=!this.hasData();if(_6aa){this.iMaxXScale=0;this.oViewPort.iMinX=cmd.getMinX();this.oViewPort.iMaxX=Math.max(this.oViewPort.iMinX+Drawer.MIN_TIMEWIDTH,cmd.getMaxX());this.iRealMaxX=cmd.getMaxX();this.oAllViewPort={iMinX:this.oViewPort.iMinX,iMaxX:this.oViewPort.iMaxX};if(this.bLive&&this.isMainGraph()){this.oViewPort.iMinX=Math.max(this.oAllViewPort.iMinX,this.iRealMaxX-Drawer.MIN_TIMEWIDTH/4*3);this.oViewPort.iMaxX=this.oViewPort.iMinX+Drawer.MIN_TIMEWIDTH;this.oAllViewPort.iMaxX=this.oViewPort.iMaxX+Drawer.MIN_TIMEWIDTH/2;this.dwDrawer.setTimeWidth(Drawer.MIN_TIMEWIDTH);}else{this.dwDrawer.setTimeWidth(this.oViewPort.iMaxX-this.oViewPort.iMinX);}
this.isCached(this.oViewPort);}else{if(this.bLive&&this.isMainGraph()){this.iRealMaxX=cmd.getMaxX();}}
this.oCachedGraphInfo.aStretch=cmd.getStretchInfo();this.oCachedGraphInfo.aMinY=cmd.getMinYs();this.oCachedGraphInfo.aMaxY=cmd.getMaxYs();if(!_6aa||!this.bLive||!this.isMainGraph()){this.dwDrawer.onUpdate(cmd,this.oViewPort,cmd.getCommandID().startplay?true:false);}else{this.onViewChanged(false,{startplay:true});}}
this.cmdLast=null;};Graph.prototype.onFirstDraw=function(){this.dwDrawer.onInit(this.oGraphHolder);this.onViewChanged(true);this.bIsOnceDrawn=true;};Graph.prototype.onLiveChange=function(_6ab){var _6ac=this.bLive;this.bLive=_6ab;this.oAllViewPort.iMaxX=0;this.iMaxXScale=0;if(_6ac&&!_6ab){if(this.toLive!=null){this.toLive.cancelTimeout();this.toLive=null;}
this.onViewChanged(true);}else{if(!_6ac&&_6ab){this.onViewChanged(true);if(!this.bAllowUserAction||TrackPage.isGraphShown()){this.onStartLiveRequests(true);}}}
this.dwDrawer.onLiveChange(_6ab);};Graph.prototype.onLiveUpdate=function(){if(this.isMainGraph()){this.oCached.oVP.iMaxX=0;}else{this.oAllViewPort={iMinX:0,iMaxX:0};this.oViewPort={iMinX:0,iMaxX:YSNumbers.MAX_INT};this.oCached={oVP:{iMinX:0,iMaxX:0},iLine1:0,iLine2:0,iTimeWidth:0};this.oCachedGraphInfo={};}
this.onViewChanged(false,{live:true});};Graph.prototype.onMouseDown=function(oPos){if(!this.hasData()){return;}
this.oMoveStart=oPos;YSEvent.disableSelect(document);};Graph.prototype.onMouseMove=function(oPos){if(this.oMoveStart!=null){this.dwDrawer.onMove(oPos.left-this.oMoveStart.left);this.oMoveEnd=oPos;}};Graph.prototype.onMouseUp=function(){if(this.oMoveStart!=null){YSEvent.enableSelect(document);if(this.oMoveEnd!=null){var _6af=(this.oMoveEnd.left-this.oMoveStart.left)*this.dwDrawer.getXPerPix();this.oMoveStart=null;this.oMoveEnd=null;this.setViewPortWidth(this.dwDrawer.getTimeWidth(),this.oViewPort.iMinX-_6af);}else{this.oMoveStart=null;}}};Graph.prototype.onPlay=function(_6b0){if(this.bLive){if(!_6b0&&this.toLive!=null){this.toLive.cancelTimeout();this.toLive=null;}else{if(_6b0&&this.toLive==null){this.onStartLiveRequests();}}
this.dwDrawer.onPlay(_6b0);}};Graph.prototype.onStartLiveRequests=function(_6b1){if(!_6b1){this.onLiveUpdate();}
this.toLive=new YSTimeout(this.bAllowUserAction?2000:5000,Graph.prototype.onLiveUpdate,this,null,true);};Graph.prototype.onTimeWidthChanged=function(_6b2){this.iMaxXScale=0;this.onUpdateMap(_6b2);};Graph.prototype.onUpdateMap=function(_6b3){if(!this.bLive){if(_6b3==(this.oAllViewPort.iMaxX-this.oAllViewPort.iMinX)){TrackPage.onTimeVPChanged(this.oAllViewPort);}else{TrackPage.onTimeVPChanged(this.oViewPort);}}};Graph.prototype.onViewChanged=function(_6b4,oID){var oVP=this.getOuterViewPort();if(!this.isCached(oVP)){if(this.cmdLast!=null){this.cmdLast.destruct();}
var _6b7=[this.iLine1];if(this.iLine2!=Graph.LINE_NONE){if(this.iLine2<this.iLine1){_6b7.unshift(this.iLine2);}else{_6b7.push(this.iLine2);}}
this.cmdLast=new GetGraphCommand(this,this.sTrackURL,this.dwDrawer.getGraphWidth(),_6b4?0:this.dwDrawer.getPixPerX(),_6b7);if(!_6b4){this.cmdLast.setTimeBounds(oVP.iMinX,oVP.iMaxX);this.cmdLast.setCachedInfo(this.oCachedGraphInfo.aStretch,this.oCachedGraphInfo.aMinY,this.oCachedGraphInfo.aMaxY);}
this.cmdLast.setLive(this.bLive);if(isDefined(oID)&&oID!=null){this.cmdLast.setCommandID(oID);}
this.cmdLast.sendRequest();}else{this.dwDrawer.onRedraw(this.oViewPort);}};Graph.prototype.onZoom=function(_6b8,_6b9){var _6ba=this.oViewPort.iMinX+_6b9*this.dwDrawer.getTimeWidth();var _6bb=_6b9*_6b8;this.setViewPortWidth(_6b8,Math.round(_6ba-_6bb),false);};Graph.prototype.onZoomIn=function(){this.dwDrawer.onZoomIn();};Graph.prototype.onZoomOut=function(){this.dwDrawer.onZoomOut();};Graph.prototype.setLineType=function(_6bc,_6bd){if(_6bc>2||_6bc<1){return false;}
if(_6bd>4||_6bd<(_6bc==1?1:0)){return false;}
if(_6bd==Graph.LINE_HEIGHT&&!this.bHasHeight){return false;}
if(_6bd==Graph.LINE_HEART&&!this.bHasHeart){return false;}
var _6be=_6bd==(_6bc==1?this.iLine2:this.iLine1);if(_6be&&_6bc==2&&this.iLine2==Graph.LINE_NONE){return false;}
var _6bf=this.iLine1;var _6c0=this.iLine2;if(_6bc==1){this.iLine1=_6bd;}else{if(_6bc==2){this.iLine2=_6bd;}}
if(_6be){if(_6bc==2){this.iLine1=0;YSListbox.GetLst("lstGraphLine1").setKey(_6c0);}else{this.iLine2=0;YSListbox.GetLst("lstGraphLine2").setKey(_6bf);}
return true;}
this.dwDrawer.onLineTypeChange();this.onViewChanged();return true;};Graph.prototype.setViewPortWidth=function(_6c1,_6c2,_6c3){if(isDefined(_6c2)&&_6c2!==null){this.oViewPort.iMinX=this.getNormalizedX(_6c2);}
if(this.getTrackLength()<=_6c1){this.oViewPort.iMaxX=this.getNormalizedX(this.oViewPort.iMinX-this.dwDrawer.getExtraX());}else{this.oViewPort.iMaxX=this.getNormalizedX(this.oViewPort.iMinX+_6c1);}
if(!isDefined(_6c3)||_6c3){this.onViewChanged();this.onUpdateMap(_6c1);}};Graph.prototype.onNewShading=function(aVPs){this.dwDrawer.onNewShading(aVPs);};function GraphPlayer(_6c5,_6c6){this.dwDrawer=_6c5;this.divGraphHolder=_6c6;this.iMaxX=0;this.fCurX=0;this.iMaxWidth=this.dwDrawer.getGraphWidth()-2;this.iVPMaxX=0;this.iLastPlayTime=0;this.iTimePlayAllowed=0;this.iMinBuffer=TrackPage.getLiveBuffer()+GraphPlayer.EXTRA_BUFFER;this.toPlayer=null;this.bWaitingForData=false;};GraphPlayer.EXTRA_BUFFER=2;GraphPlayer.MOVE_DURATION=500;GraphPlayer.prototype.destruct=function(){YSCSS.setStyle(this.divGraphHolder,"width",this.iMaxWidth+"px");this.divGraphHolder=null;if(this.toPlayer!=null){this.toPlayer.cancelTimeout();this.toPlayer=null;}};GraphPlayer.prototype.isMoving=function(){return this.toMove!=null;};GraphPlayer.prototype.onLiveChange=function(_6c7){};GraphPlayer.prototype.onMove=function(_6c8,_6c9){var _6ca=Math.min(_6c9/GraphPlayer.MOVE_DURATION,1);_6c8=Math.round(_6c8*_6ca);var _6cb=this.dwDrawer.getGraph();var _6cc=_6cb.getAllViewPort();var oVP=_6cb.getViewPort();var _6ce=this.iVPMaxX+_6c8*this.dwDrawer.getXPerPix();oVP.iMaxX=_6ce;oVP.iMinX=_6ce-this.dwDrawer.getTimeWidth();_6cc.iMaxX=_6ce+this.dwDrawer.getTimeWidth()*0.5;_6cb.onAllVPChanged();this.dwDrawer.onMove(_6c8*-1);YSCSS.setStyle(this.divGraphHolder,"width",Math.min(this.dwDrawer.getPixForX(this.fCurX),this.iMaxWidth)+"px");if(_6ca==1){this.toMove.cancelTimeout();this.toMove=null;this.dwDrawer.onRedraw(oVP);}};GraphPlayer.prototype.onPlay=function(_6cf){this.iLastPlayTime=YSDateTime.getCurTime();if(_6cf&&this.toPlayer==null){this.toPlayer=new YSTimeout(60,GraphPlayer.prototype.run,this,null,true);}else{if(!_6cf&&this.toPlayer!=null){this.toPlayer.cancelTimeout();this.toPlayer=null;}}};GraphPlayer.prototype.onUpdate=function(_6d0){this.iMaxX=_6d0;this.iMinBuffer=TrackPage.getLiveBuffer()+GraphPlayer.EXTRA_BUFFER;if(this.fCurX==0){this.fCurX=this.iMaxX-this.iMinBuffer;this.iLastPlayTime=YSDateTime.getCurTime();this.run();}};GraphPlayer.prototype.run=function(){var _6d1=YSDateTime.getCurTime();if(_6d1<this.iTimePlayAllowed){return;}
var _6d2=_6d1-this.iLastPlayTime;this.iLastPlayTime=_6d1;if(this.bWaitingForData){if(this.iMaxX-this.fCurX<this.iMinBuffer){this.iTimePlayAllowed=_6d1+500;this.iLastPlayTime+=500;return;}else{YSLog.write("Graph Enough: "+(this.iMaxX-this.fCurX)+" s");this.bWaitingForData=false;}}
if(this.fCurX>=this.iMaxX){YSLog.write("Graph WAIT for "+this.iMinBuffer+" seconds of data");this.iTimePlayAllowed=_6d1+500;this.iLastPlayTime+=500;this.bWaitingForData=true;}else{this.fCurX+=_6d2/1000;if(this.fCurX>this.iMaxX){this.fCurX=this.iMaxX;}
var _6d3=Math.round(this.fCurX-this.dwDrawer.getGraph().getAllViewPort().iMinX);YSDOM.setValue("statduration",YSDateTime.getTimeString(_6d3));YSDOM.setValue("detailduration",YSDateTime.getTimeString(_6d3));if(this.iMaxX-this.fCurX>this.iMinBuffer+TrackPage.BUFFER_MARGE){var _6d4=Math.round((this.iMaxX-this.fCurX)*1000)-(this.iMinBuffer*1000);this.iLastPlayTime-=_6d4;YSLog.write("Graph SKIP "+_6d4+" ms");}
var _6d5=this.dwDrawer.getPixForX(this.fCurX);if(_6d5>=this.iMaxWidth){if(this.toMove==null){if(_6d5-this.iMaxWidth>0.25*this.iMaxWidth){var _6d6=this.dwDrawer.getTimeWidth();var _6d7=this.dwDrawer.getGraph();_6d7.getAllViewPort().iMaxX=Math.round(this.fCurX+0.75*_6d6);_6d7.onAllVPChanged();_6d7.setViewPortWidth(_6d6,Math.round(this.fCurX-0.75*_6d6));}else{this.iVPMaxX=this.dwDrawer.getGraph().getViewPort().iMaxX;this.toMove=new YSTimeout(30,GraphPlayer.prototype.onMove,this,Math.round(this.iMaxWidth*0.25),true);}}}else{YSCSS.setStyle(this.divGraphHolder,"width",_6d5+"px");}}};function GraphPoint(iX,iY){this.iX=iX;this.iY=iY;this.iControl1X=iX;this.iControl1Y=iY;this.iControl2X=iX;this.iControl2Y=iY;};GraphPoint.prototype.getC1X=function(){return this.iControl1X;};GraphPoint.prototype.getC1Y=function(_6da,_6db){if(isDefined(_6da)&&isDefined(_6db)){return Math.max(Math.min(_6da-this.iControl1Y,_6db),0);}else{return this.iControl1Y;}};GraphPoint.prototype.getC2X=function(){return this.iControl2X;};GraphPoint.prototype.getC2Y=function(_6dc,_6dd){if(isDefined(_6dc)&&isDefined(_6dd)){return Math.max(Math.min(_6dc-this.iControl2Y,_6dd),0);}else{return this.iControl2Y;}};GraphPoint.prototype.getX=function(){return this.iX;};GraphPoint.prototype.getY=function(){return this.iY;};GraphPoint.prototype.isControlValid=function(){return this.iY!=this.iControl1Y||this.iY!=this.iControl2Y||this.iX!=this.iControl1X||this.iX!=this.iControl2X;};GraphPoint.prototype.setC1=function(iX,iY){this.iControl1X=iX;this.iControl1Y=iY;};GraphPoint.prototype.setC2=function(iX,iY){this.iControl2X=iX;this.iControl2Y=iY;};function SVG(_6e2){Drawer.call(this,_6e2);this.sNS="http://www.w3.org/2000/svg";};SVG.prototype=new Drawer();SVG.prototype.onDrawGraphLine=function(_6e3,_6e4,_6e5,_6e6,_6e7,_6e8,_6e9,_6ea,_6eb){if(!isDefined(_6ea)){_6ea=0;}
if(!isDefined(_6eb)){_6eb=_6e3.length-1;}
if(_6eb==_6ea){return;}
var _6ec=this.getPixPerX();if(!isDefined(_6e5)||_6e5==null){_6e5=Math.round((_6e3[_6eb].getX()-_6e3[_6ea].getX())*_6ec);}
var _6ed=new Size(_6e5+this.iLineWidth,this.iGraphHeight+this.iLineWidth);var _6ee=document.createElement("div");YSCSS.setStyle(_6ee,"left",_6e4+"px");YSDOM.setSize(_6ee,_6ed);var svg=document.createElementNS(this.sNS,"svg:svg");var _6f0=document.createElementNS(this.sNS,"svg:g");svg.appendChild(_6f0);_6ee.appendChild(svg);var _6f1=document.createElementNS(this.sNS,"svg:path");YSXML.setAttribute(_6f1,"fill","none");YSXML.setAttribute(_6f1,"stroke",_6e9);YSXML.setAttribute(_6f1,"stroke-width",this.iLineWidth);YSXML.setAttribute(_6f1,"stroke-linecap","round");YSXML.setAttribute(_6f1,"stroke-linejoin","round");var _6f2=_6e3[_6ea].getX();var _6f3="M ";var _6f4;var _6f5=false,_6f6=false;for(var i=_6ea;i<=_6eb;i++){_6f4=_6e3[i];_6f6=!_6f4.isControlValid();if(i==_6ea+1||(i>_6ea&&_6f6!=_6f5)){_6f3+=_6f6?" L ":" C ";}else{if(i>_6ea){_6f3+=" ";}}
if(i>_6ea&&!_6f6){_6f3+=Math.round((_6f4.getC1X()-_6f2)*_6ec)+" "+Math.round(_6f4.getC1Y(_6e7,_6e8)*_6e6)+" "+Math.round((_6f4.getC2X()-_6f2)*_6ec)+" "+Math.round(_6f4.getC2Y(_6e7,_6e8)*_6e6)+" ";}
_6f3+=Math.round((_6f4.getX()-_6f2)*_6ec)+" "+Math.round((_6e7-_6f4.getY())*_6e6);_6f5=_6f6;}
YSXML.setAttribute(_6f1,"d",_6f3);_6f0.appendChild(_6f1);this.oGraphLineHolder.appendChild(_6ee);};SVG.prototype.onGenerateGraphHolder=function(_6f8){var _6f9=new Size(this.iGraphWidth*3,this.iGraphHeight+this.iLineWidth);this.oGraphLineHolder=document.createElement("div");YSDOM.setSize(this.oGraphLineHolder,_6f9);YSCSS.setStyle(this.oGraphLineHolder,"left",this.iInitXLinesLeft+"px");_6f8.appendChild(this.oGraphLineHolder);};SVG.prototype.onShowUnitText=function(_6fa,_6fb){var _6fc=this.iFontSize+3;var _6fd=document.createElement("div");YSDOM.setPosition(_6fd,new Pixel(_6fa==1?0:this.iPaddingLeft*2+this.iGraphWidth-_6fc,this.iPaddingTop));YSDOM.setSize(_6fd,new Size(_6fc,this.iGraphHeight));var svg=document.createElementNS(this.sNS,"svg:svg");var _6ff=document.createElementNS(this.sNS,"svg:g");svg.appendChild(_6ff);_6fd.appendChild(svg);var iX=Math.floor(this.iGraphHeight/2);if(_6fa==1){iX*=-1;}
var _701=document.createElementNS(this.sNS,"svg:text");YSXML.setAttribute(_701,"y",_6fa==1?this.iFontSize:-this.iHalfFontSize+2);YSXML.setAttribute(_701,"x",iX);YSXML.setAttribute(_701,"text-anchor","middle");YSXML.setAttribute(_701,"font-size",this.iFontSize);YSXML.setAttribute(_701,"transform","rotate("+(_6fa==1?"-90":"90")+")");YSXML.setAttribute(_701,"fill","white");YSXML.setAttribute(_701,"font-size","12px");var txt=document.createTextNode(_6fb);_701.appendChild(txt);_6ff.appendChild(_701);this.oYAxHolder.appendChild(_6fd);};function VML(_703){Drawer.call(this,_703);};VML.prototype=new Drawer();VML.prototype.onDrawGraphLine=function(_704,_705,_706,_707,_708,_709,_70a,_70b,_70c){if(!isDefined(_70b)){_70b=0;}
if(!isDefined(_70c)){_70c=_704.length-1;}
if(_70c==_70b){return;}
var _70d=this.getPixPerX();if(!isDefined(_706)||_706==null){_706=Math.round((_704[_70c].getX()-_704[_70b].getX())*_70d);}
var _70e=document.createElement("v:shape");YSDOM.setSize(_70e,new Size(_706,this.iGraphHeight));YSCSS.setStyle(_70e,"left",_705+"px");_70e.coordsize=_706+" "+this.iGraphHeight;_70e.strokeweight=this.iLineWidth+"px";_70e.strokecolor=_70a;var _70f=_704[_70b].getX();var _710=document.createElement("v:path");var _711="m";var _712;var _713=false,_714=false;for(var i=_70b;i<=_70c;i++){_712=_704[i];_714=!_712.isControlValid();if(i==_70b+1||(i>_70b&&_714!=_713)){_711+=_714?"l":"c";}else{if(i>_70b){_711+=",";}}
if(i>_70b&&!_714){_711+=Math.round((_712.getC1X()-_70f)*_70d)+","+Math.round(_712.getC1Y(_708,_709)*_707)+","+Math.round((_712.getC2X()-_70f)*_70d)+","+Math.round(_712.getC2Y(_708,_709)*_707)+",";}
_711+=Math.round((_712.getX()-_70f)*_70d)+","+Math.round((_708-_712.getY())*_707);_713=_714;}
_710.v=_711+"e";_70e.appendChild(_710);var _716=document.createElement("v:fill");_716.on="false";_70e.appendChild(_716);var _717=document.createElement("v:stroke");_717.joinstyle="round";_717.endcap="round";_70e.appendChild(_717);this.oGraphLineHolder.appendChild(_70e);};VML.prototype.onGenerateGraphHolder=function(_718){var _719=new Size(this.iGraphWidth*3,this.iGraphHeight+this.iLineWidth);this.oGraphLineHolder=document.createElement("v:group");YSDOM.setSize(this.oGraphLineHolder,_719);YSCSS.setStyle(this.oGraphLineHolder,"left",this.iInitXLinesLeft+"px");this.oGraphLineHolder.coordsize=_719.width+" "+_719.height;_718.appendChild(this.oGraphLineHolder);};VML.prototype.onInit=function(_71a){if(document.namespaces["v"]==null){document.namespaces.add("v","urn:schemas-microsoft-com:vml");}
Drawer.prototype.onInit.call(this,_71a);};VML.prototype.onShowUnitText=function(_71b,_71c){var _71d=this.iFontSize+3;var _71e=document.createElement("v:shape");YSDOM.setSize(_71e,new Size(this.iFontSize,this.iGraphHeight));YSDOM.setPosition(_71e,new Pixel(_71b==1?0:this.iPaddingLeft*2+this.iGraphWidth-_71d,this.iPaddingTop));YSCSS.setStyle(_71e,"antialias","true");_71e.coordsize=this.iFontSize+" "+this.iGraphHeight;var _71f=document.createElement("v:path");_71f.textpathok="true";_71f.v=_71b==1?"m"+this.iHalfFontSize+","+this.iGraphHeight+"l"+this.iHalfFontSize+",0":"m"+this.iHalfFontSize+",0"+"l"+this.iHalfFontSize+","+this.iGraphHeight;var _720=document.createElement("v:stroke");_720.on="false";var _721=document.createElement("v:fill");_721.on="true";_721.color="white";var _722=document.createElement("v:textpath");_722.on="true";_722.string=_71c;YSCSS.setStyle(_722,"fontSize","13px");_71e.appendChild(_71f);_71e.appendChild(_720);_71e.appendChild(_721);_71e.appendChild(_722);this.oYAxHolder.appendChild(_71e);};function BaseMap(_723,_724){if(isDefined(_723)){this.sTabID=_723;this.sContainerID=_724;this.divHolder=YSDOM.getObj(this.sContainerID).parentNode;this.divHolderParent=this.divHolder.parentNode;YSEventHandler.Instance().addHandler(document.body,"onmousewheel",BaseMap.prototype.onScroll,this);this.onInitColors();this.bMoving=false;this.divPhotoOverlay=null;this.bMouseAboveMap=false;YSEventHandler.Instance().addHandler(_724,"onmouseover",BaseMap.prototype.onMouseOver,this);YSEventHandler.Instance().addHandler(_724,"onmouseout",BaseMap.prototype.onMouseOut,this);this.aLines=[];this.aStaticLines=[];this.aTempLines=[];this.iTimeout=BaseMap.VIEWPORT_TIMEOUT;this.toVPTimeout=null;this.bDestructed=false;}};BaseMap.SMALL_VIEWPORT_OFFSET=10;BaseMap.VIEWPORT_TIMEOUT=2000;BaseMap.DEG2RAD=Math.PI/180;BaseMap.RAD2DEG=180/Math.PI;BaseMap.prototype.destruct=function(){this.aLines=null;this.aStaticLines=null;this.aTempLines=null;this.bDestructed=true;};BaseMap.prototype.clearLines=function(){this.removeLines(this.aLines);this.aLines=[];};BaseMap.prototype.clearStaticLines=function(){this.removeLines(this.aStaticLines);this.aStaticLines=[];};BaseMap.prototype.clearTempLines=function(_725){this.removeLines(this.aTempLines);this.aTempLines=[];};BaseMap.prototype.getContainer=function(){return YSDOM.getObj(this.sContainerID);};BaseMap.prototype.getDegPerPix=function(){var _726=this.getViewPort();var _727=this.getPixDiff(_726.getSW(),_726.getNW());var _728=this.getPixDiff(_726.getNW(),_726.getNE());return{latperpix:_726.getLatDiff()/_727,lngperpix:_726.getLngDiff()/_728};};BaseMap.prototype.getMaxPoints=function(){if(this.isMiniMap()){return 150;}else{return 350;}};BaseMap.prototype.getOuterViewPort=function(){return this.getViewPort().getOuterViewPort();};BaseMap.prototype.getPixDiff=function(_729,_72a){var _72b=this.getLatLngPixel(_729);var _72c=this.getLatLngPixel(_72a);return Math.sqrt(Math.pow(_72b.left-_72c.left,2)+Math.pow(_72b.top-_72c.top,2));};BaseMap.prototype.getPixelSize=function(){return YSDOM.getElementSize(this.getContainer());};BaseMap.prototype.getTabID=function(){return this.sTabID;};BaseMap.prototype.getTrackColor=function(_72d){return this.clrTrackColor;};BaseMap.prototype.getTrackIconURL=function(_72e){return IMAGE_PATH+"map_"+MapManager.getActivityID()+".png";};BaseMap.prototype.isMiniMap=function(){return!this.bAllowUserAction;};BaseMap.prototype.isMoving=function(){return this.bMoving;};BaseMap.prototype.isVisible=function(){return YSCSS.isVisible(this.sContainerID);};BaseMap.prototype.moveMe=function(){var _72f=this.getViewPort(true).getCenter();_72f.setLat(_72f.getLat()+0.00001);this.setCenterSmooth(_72f);};BaseMap.prototype.onCheckParentNode=function(){if(this.divHolder.parentNode!=this.divHolderParent){YSDOM.replaceElement(YSDOM.getObj(this.sContainerID+"_replace"),this.divHolder);}};BaseMap.prototype.onInitColors=function(){this.clrStaticColor=new Color();this.clrStaticColor.setHexColor("2672BB");this.clrStaticOverlayColor=new Color();this.clrStaticOverlayColor.setHexColor("B00C0F");this.clrTrackColor=new Color();this.clrTrackColor.setHexColor("B00C0F");};BaseMap.prototype.onMouseOver=function(){this.bMouseAboveMap=true;};BaseMap.prototype.onMouseOut=function(){this.bMouseAboveMap=false;};BaseMap.prototype.onRedraw=function(){this.redrawStaticLines();this.redrawLines();this.redrawTempLines();};BaseMap.prototype.onScroll=function(e,obj){if(this.bMouseAboveMap){YSEvent.cancelEvent(e,true);return false;}else{return true;}};BaseMap.prototype.onShowPhotoOverlay=function(_732,oPos,_734){if(!bPageLoaded){return;}
if(!isDefined(_734)){_734=true;}
var sSrc=PhotoManager.Instance().getPhotoByID(_732).getSrc(PhotoSize.Small);if(this.divPhotoOverlay==null){this.divPhotoOverlay=document.createElement("div");setObjMultStyle(this.divPhotoOverlay,["position","border","fontSize","display","zIndex"],["absolute","solid 1px black","1px","none",350]);document.body.appendChild(this.divPhotoOverlay);}else{removeElementChilds(this.divPhotoOverlay);}
var _736=document.createElement("img");_736.onload=function(){this.onload=function(){this.onload=null;setObjMultStyle(this,["width","height"],["auto","auto"]);};this.src=sSrc;};_736.src="images/loading.gif";this.divPhotoOverlay.appendChild(_736);var _737=new Pixel();if(_734){_737=getElementPosition(this.getContainer());}
setObjMultStyle(this.divPhotoOverlay,["left","top","display"],[(_737.left+oPos.left)+"px",(_737.top+oPos.top)+"px","block"]);};BaseMap.prototype.setOtherMapsViewPort=function(_738){if(!isDefined(_738)){_738=false;}
if(!_738&&this.iTimeout>0){if(this.toVPTimeout!=null){this.iTimeout-=this.toVPTimeout.getTimePassed();this.toVPTimeout.cancelTimeout();}
this.toVPTimeout=new YSTimeout(this.iTimeout,BaseMap.prototype.setOtherMapsViewPort,this,true);return;}else{this.toVPTimeout=null;this.iTimeout=BaseMap.VIEWPORT_TIMEOUT;var _739=this.getType()==MSMap.Type?MapManager.getGEMap(this.sTabID):MapManager.getMSMap(this.sTabID);if(_739!=null&&_739!=MapManager.getCurMap(this.sTabID)){YSLog.write("set other maps VP");_739.setViewPort(this.getSmallViewPort());}}};var G={};function GEMap(_73a,_73b,_73c,_73d){BaseMap.call(this,_73a,_73b);if(!isDefined(_73d)){_73d=true;}
this.bAllowUserAction=_73d;this.vpLastViewPort=new ViewPort();this.mGEMap=new G.Map2(YSDOM.getObj(this.sContainerID));this.mGEMap.sTabID=_73a;if(isDefined(_73c.zoomlvl)){this.setZoomCenter(_73c.zoomlvl,new LatLng(_73c.lat,_73c.lng));}else{this.setViewPort(_73c,true);}
this.vpLastViewPort=this.getViewPort(true);YSLog.write("GEMap constr. init: "+_73c.toString()+"; actual: "+this.vpLastViewPort.toString());this.onInit();this.bMoving=false;this.bHasImagery=true;this.iLastImageryZoomOut=0;this.oImageryInterval=new YSTimeout(500,GEMap.prototype.onImageryCheck,this,null,true);};GEMap.prototype=new BaseMap();GEMap.Loading=false;GEMap.Loaded=false;GEMap.LoadCallback={};GEMap.Type="GE";GEMap.MAX_ZOOM_SAT=21;GEMap.MAX_ZOOM_MAP=19;GEMap.IsWVMarkerSelected=function(_73e){return GroupMarker.IsSelected(_73e);};GEMap.Load=function(_73f,_740,_741,_742){GEMap.Loading=true;GEMap.LoadCallback.fn=_740;GEMap.LoadCallback.obj=_741;GEMap.LoadCallback.oParam=_742;YSJS.load("geapiloader","http://www.google.com/jsapi?key="+_73f+"&callback=GEMap.OnLoaderLoad");};GEMap.OnLoaderLoad=function(){google.load("maps",bIE?"2.91":"2",{callback:GEMap.OnMapLoad,language:LANGUAGE});};GEMap.OnMapLoad=function(){G=google.maps;GEMap.Loaded=true;GEMap.Loading=false;GroupMarker.Extend(new G.Marker(new G.LatLng(0,0)));GEMap.LoadCallback.fn.call(GEMap.LoadCallback.obj,GEMap.LoadCallback.oParam);GEMap.LoadCallback={};};GEMap.OnWVDeselect=function(){GroupMarker.OnDeselect();};GEMap.prototype.destruct=function(_743){if(this.bDestructed){return;}
if(!isDefined(_743)){_743=true;}
BaseMap.prototype.destruct.call(this);this.mGEMap.clearOverlays();this.vpLastViewPort.destruct();this.vpLastViewPort=null;this.mGEMap=null;if(this.oImageryInterval!=null){this.oImageryInterval.cancelTimeout();this.oImageryInterval=null;}
if(_743){G.Unload();}};GEMap.prototype.addIconMarker=function(_744,_745,_746,_747,_748,_749,_74a){if(_744 instanceof LatLng){var _74b=new G.Icon();_74b.image=_74b.mozPrintImage=_74b.prinImage=_745;_74b.iconSize=_746;_74b.iconAnchor=_747;var _74c={icon:_74b,clickable:_748,draggable:_749,autoPan:false};if(isDefined(_74a)){_74c.zIndexProcess=GEMap.prototype.onMarkerZIndex;}
var _74d=new G.Marker(_744.toGELatLng(),_74c);_74d.iZIndex=_74a;this.mGEMap.addOverlay(_74d);return _74d;}else{return null;}};GEMap.prototype.addSearchMarker=function(_74e){if(_74e instanceof SearchMarker){var _74f=MapManager.getNormalizedActivityID(_74e.iActivityID);var _750=this.addIconMarker(_74e.llPoint,IMAGE_PATH+"map_"+_74f+".png",new G.Size(37,43),new G.Point(7,43),true,false,1001);_750.bUseAnalysis=_74e.bUseAnalysis;_750.sTrackURL=_74e.sTrackURL;G.Event.addListener(_750,"click",GEMap.prototype.onSearchMarkerClick);return _750;}else{return null;}};GEMap.prototype.addTrackMarker=function(_751,_752){if(!_752){return null;}
return this.addIconMarker(_752,this.getTrackIconURL(_751),new G.Size(37,43),new G.Point(7,43),false,false,1001);};GEMap.prototype.addPhotoMarker=function(_753,_754,_755,_756){if(!isDefined(_755)){_755=false;}
if(!isDefined(_756)){_756=false;}
var _757=_755?"images/photomarker_red.gif":"images/photomarker.gif";var _758=this.addIconMarker(_753,_757,new G.Size(32,32),new G.Point(16,32),true,_756);G.Event.addListener(_758,"mouseover",GEMap.prototype.onPhotoMarkerMouseOver);G.Event.addListener(_758,"mouseout",GEMap.prototype.onPhotoMarkerMouseOut);_758.iPhotoID=_754;return _758;};GEMap.prototype.addWorldViewMarker=function(_759){if(_759 instanceof WorldViewMarker){var _75a=new GroupMarker(_759.llPoint.toGELatLng(),{wvMarker:_759,zindex:0,tabid:this.sTabID});this.mGEMap.addOverlay(_75a);G.Event.addListener(_75a,"click",GroupMarker.prototype.onClick);return _75a;}else{return null;}};GEMap.prototype.getLatLngPixel=function(_75b){if(_75b instanceof LatLng){_75b=new G.LatLng(_75b.getLat(),_75b.getLng());}
var _75c=this.mGEMap.fromLatLngToDivPixel(_75b);return new Pixel(_75c.x,_75c.y);};GEMap.prototype.getLatLngPixelGlobal=function(_75d){var fLat,fLng;var _760=new Pixel();if(_75d instanceof LatLng){fLat=_75d.getLat();fLng=_75d.getLng();}else{fLat=_75d.lat();fLng=_75d.lng();}
var _761=512*Math.pow(2,this.getZoomLevel()-1);var _762=_761/(2*Math.PI);if(fLat>85){_760.top=_761;}else{if(fLat<-85){_760.top=0;}else{var _763=fLat*BaseMap.DEG2RAD;_760.top=Math.min(Math.max((_762*0.5*Math.log((1+Math.sin(_763))/(1-Math.sin(_763))))+(_761*0.5),0),_761);}}
_760.left=(fLng*BaseMap.DEG2RAD*_762)+(_761*0.5);return _760;};GEMap.prototype.getLines=function(_764,_765,_766){if(!isDefined(_766)){_766=null;}
var _767=[];for(var _768 in _764){var _769=_766;if(_769==null){_769=this.clrTrackColor;}
var _76a=_764[_768];for(var _76b=0,_76c=_76a.length;_76b<_76c;_76b++){var _76d=[];for(var _76e=0,_76f=_76a[_76b].length;_76e<_76f;_76e++){_76d.push(_76a[_76b][_76e].toGELatLng());}
if(_76d.length>1){_767.push(new G.Polyline(_76d,_769.getCSSColor(),_765,0.9,{clickable:false}));}}}
return _767;};GEMap.prototype.getMapStyle=function(){switch(this.mGEMap.getCurrentMapType()){case G_NORMAL_MAP:return 0;break;case G_SATELLITE_MAP:return 1;break;case G_HYBRID_MAP:return 2;break;default:return 2;break;}};GEMap.prototype.getPixelLatLng=function(oPos){var _771=this.mGEMap.fromContainerPixelToLatLng(new G.Point(oPos.left,oPos.top));return new LatLng(_771.lat(),_771.lng());};GEMap.prototype.getPixelLatLngGlobal=function(oPos){var _773=new LatLng();var _774=512*Math.pow(2,this.getZoomLevel()-1);var _775=_774/(2*Math.PI);Math.atan(Math.exp());_773.setLat(((Math.PI*0.5)-(2*Math.atan(Math.exp(-1*(oPos.top-(_774*0.5))/_775))))*BaseMap.RAD2DEG);_773.setLng(((oPos.left-(_774*0.5))/_775)*BaseMap.RAD2DEG);return _773;};GEMap.prototype.getSmallViewPort=function(){var _776=new ViewPort();var _777=this.getPixelSize();var _778=this.mGEMap.fromContainerPixelToLatLng(new G.Point(BaseMap.SMALL_VIEWPORT_OFFSET,_777.height-BaseMap.SMALL_VIEWPORT_OFFSET));var _779=this.mGEMap.fromContainerPixelToLatLng(new G.Point(_777.width-BaseMap.SMALL_VIEWPORT_OFFSET,BaseMap.SMALL_VIEWPORT_OFFSET));_776.setSW(new LatLng(_778.lat(),_778.lng()));_776.setNE(new LatLng(_779.lat(),_779.lng()));return _776;};GEMap.prototype.getType=function(){return GEMap.Type;};GEMap.prototype.getViewPort=function(_77a){if((!isDefined(_77a)||!_77a)&&this.vpLastViewPort!=null){return this.vpLastViewPort;}
var _77b=this.mGEMap.getBounds();var _77c=new ViewPort(new LatLng(_77b.getSouthWest().lat(),_77b.getSouthWest().lng()),new LatLng(_77b.getNorthEast().lat(),_77b.getNorthEast().lng()));if(_77c.getCenter().isValid()){return _77c;}else{_77c.destruct();this.setViewPort(this.vpLastViewPort,true);return this.vpLastViewPort;}};GEMap.prototype.getZoomLevel=function(){return YSNumbers.checkInt(this.mGEMap.getZoom());};GEMap.prototype.hasStaticLines=function(){return this.aStaticLines.length>0;};GEMap.prototype.onImageryCheck=function(){if(this.bMoving){return;}
var _77d=this.getContainer().getElementsByTagName("p").length;if(_77d>5){var _77e=YSDateTime.getCurTime();if(_77e-this.iLastImageryZoomOut>1000&&this.getZoomLevel()>10){this.iLastImageryZoomOut=_77e;}
this.bHasImagery=false;}else{this.bHasImagery=true;}};GEMap.prototype.onInit=function(){G_HYBRID_MAP.getMinimumResolution=function(){return 1;};G_NORMAL_MAP.getMinimumResolution=function(){return 1;};this.setMapStyle(2);if(this.bAllowUserAction){this.mGEMap.enableContinuousZoom();this.mGEMap.enableScrollWheelZoom();this.mGEMap.addControl(new G.ScaleControl());new G.KeyboardHandler(this.mGEMap);G.Event.addListener(this.mGEMap,"moveend",GEMap.prototype.onViewChanged);}else{this.mGEMap.disableDragging();}};GEMap.prototype.onMarkerZIndex=function(_77f){return _77f.iZIndex;};GEMap.prototype.onPhotoMarkerMouseOver=function(){var _780=MapManager.getGEMap(this.sTabID);_780.showPhotoOverlay(this.iPhotoID,_780.latlngToPixel(this.getPoint()));};GEMap.prototype.onPhotoMarkerMouseOut=function(){var _781=MapManager.getGEMap(this.sTabID);YSCSS.setStyle(_781.divPhotoOverlay,"display","none");};GEMap.prototype.onSearchMarkerClick=function(){Searcher.onMarkerClick(this.sTrackURL,this.bUseAnalysis);};GEMap.prototype.onViewChanged=function(){var _782=MapManager.getGEMap(this.sTabID);_782.vpLastViewPort=_782.getViewPort(true);if(_782.isVisible()){MapManager.onViewChanged(_782);_782.setOtherMapsViewPort();}
_782.bMoving=false;};GEMap.prototype.redrawLines=function(){for(var i=0,_784=this.aLines.length;i<_784;i++){if(this.aLines[i]instanceof G.Polyline){this.mGEMap.removeOverlay(this.aLines[i]);this.mGEMap.addOverlay(this.aLines[i]);}}};GEMap.prototype.redrawStaticLines=function(){for(var i=0,_786=this.aStaticLines.length;i<_786;i++){if(this.aStaticLines[i]instanceof G.Polyline){this.mGEMap.removeOverlay(this.aStaticLines[i]);this.mGEMap.addOverlay(this.aStaticLines[i]);}}};GEMap.prototype.redrawTempLines=function(){for(var i=0,_788=this.aTempLines.length;i<_788;i++){if(this.aTempLines[i]instanceof G.Polyline){this.mGEMap.removeOverlay(this.aTempLines[i]);this.mGEMap.addOverlay(this.aTempLines[i]);}}};GEMap.prototype.removeLines=function(_789){if(!_789){return;}
for(var i=0,_78b=_789.length;i<_78b;i++){if(_789[i]instanceof G.Polyline){this.mGEMap.removeOverlay(_789[i]);}
_789[i]=null;}};GEMap.prototype.removeMarker=function(_78c){if(_78c==null||(!(_78c instanceof G.Marker)&&!(_78c instanceof GroupMarker))){return;}
this.mGEMap.removeOverlay(_78c);};GEMap.prototype.replaceLines=function(_78d,_78e,_78f,_790){if(!isDefined(_78f)){_78f=true;}
if(!isDefined(_790)){_790=true;}
var _791=_78f?null:this.clrStaticOverlayColor;var _792=this.getLines(_78d,_78e,_791);for(var i=0,_794=_792.length;i<_794;i++){this.mGEMap.addOverlay(_792[i]);if(!_790){this.aLines.push(_792[i]);}}
if(_790){this.clearLines();this.aLines=_792;}};GEMap.prototype.replaceStaticLines=function(_795,_796){var _797=this.getLines(_795,_796,this.clrStaticColor);for(var i=0,_799=_797.length;i<_799;i++){this.mGEMap.addOverlay(_797[i]);}
this.clearStaticLines();this.aStaticLines=_797;};GEMap.prototype.replaceTempLines=function(_79a,_79b,_79c){if(!isDefined(_79c)){_79c=true;}
var _79d=_79c?null:this.clrStaticOverlayColor;var _79e=this.getLines(_79a,_79b,_79d);for(var i=0,_7a0=_79e.length;i<_7a0;i++){this.mGEMap.addOverlay(_79e[i]);}
this.clearTempLines();this.aTempLines=_79e;};GEMap.prototype.setCenter=function(_7a1){if(_7a1 instanceof LatLng){this.bMoving=true;this.mGEMap.setCenter(_7a1.toGELatLng());}};GEMap.prototype.setCenterSmooth=function(_7a2){if(_7a2 instanceof LatLng){this.bMoving=true;this.mGEMap.panTo(_7a2.toGELatLng());}};GEMap.prototype.setMapStyle=function(_7a3){switch(_7a3){case 0:this.mGEMap.setMapType(G_NORMAL_MAP);break;case 1:this.mGEMap.setMapType(G_SATELLITE_MAP);break;case 2:this.mGEMap.setMapType(G_HYBRID_MAP);break;default:this.mGEMap.setMapType(G_HYBRID_MAP);break;}};GEMap.prototype.setViewPort=function(_7a4,_7a5){if(!isDefined(_7a5)){_7a5=false;}
if(_7a4 instanceof ViewPort&&(_7a5||(_7a4.isValid()&&!_7a4.equals(this.vpLastViewPort)))){var _7a6=_7a4.toGEViewPort();var pxSW=this.getLatLngPixelGlobal(_7a6.getSouthWest());var pxNE=this.getLatLngPixelGlobal(_7a6.getNorthEast());var _7a9=pxNE.left-pxSW.left;if(_7a9<0){_7a9=pxNE.left+(512*Math.pow(2,this.getZoomLevel()-1))-pxSW.left;}
var _7aa=this.getPixelLatLngGlobal(new Pixel(pxSW.left+_7a9*0.5,(pxSW.top+pxNE.top)*0.5));var _7ab=this.mGEMap.getBoundsZoomLevel(_7a6);if(_7ab!=this.getZoomLevel()||!_7aa.equals(this.getViewPort().getCenter())){this.bMoving=true;this.mGEMap.setCenter(_7aa.toGELatLng(),_7ab);if(!this.bAllowUserAction){this.vpLastViewPort=this.getViewPort(true);}}
return this.bMoving;}
return false;};GEMap.prototype.setMarkerLatLng=function(_7ac,_7ad){if(!_7ad||!(_7ac instanceof G.Marker)){return;}
_7ac.setLatLng(_7ad.toGELatLng());};GEMap.prototype.setZoomCenter=function(_7ae,_7af){if(_7ae>0){this.mGEMap.setCenter(_7af.toGELatLng(),_7ae);}};GEMap.prototype.setZoomLevel=function(_7b0){if(_7b0>0){this.mGEMap.setZoom(_7b0);}};GEMap.prototype.zoomIn=function(){this.bMoving=true;this.mGEMap.zoomIn();};GEMap.prototype.zoomOut=function(){if(this.getZoomLevel()>1){this.bMoving=true;this.mGEMap.zoomOut();}};function GroupMarker(_7b1,_7b2){_7b2=_7b2||{};this.wvMarker=_7b2.wvMarker;this.sTabID=_7b2.tabid||null;if(this.wvMarker.bSelected&&this.sTabID=="search"){GroupMarker.gmSelected=this;}
this.oSize=null;this.gMap=null;this.divText=null;this.iFontSize=11;var _7b3=new G.Icon();this.onDetermineIcon(_7b3);_7b2.icon=_7b3;_7b2.clickable=this.bClickable=true;_7b2.draggable=false;if(isDefined(_7b2.zindex)){this.iZIndex=_7b2.zindex;_7b2.zIndexProcess=GEMap.prototype.onMarkerZIndex;}
G.Marker.call(this,_7b1,_7b2);};GroupMarker.gmSelected=null;GroupMarker.Extend=function(_7b4){for(var _7b5 in _7b4){if(typeof _7b4[_7b5]=="function"&&!isDefined(GroupMarker.prototype[_7b5])){GroupMarker.prototype[_7b5]=_7b4[_7b5];}}};GroupMarker.GetEventFn=function(lm,_7b7){return function(e){if(e&&!window.event){window.event=e;}
GEvent.trigger(lm,_7b7);try{window.event=null;}
catch(e){}};};GroupMarker.GetImageInfo=function(_7b9,_7ba,_7bb){var _7bc=Math.min(String(_7b9).length,5);var _7bd=IMAGE_PATH+"pop"+_7bc;if(_7ba){_7bd+="live.gif";}else{if(_7bb){_7bd+="selected.png";}else{_7bd+=".png";}}
var _7be;switch(_7bc){case 1:_7be=16;break;case 2:_7be=22;break;case 3:_7be=30;break;case 4:_7be=36;break;case 5:_7be=44;break;}
return{iImageWidth:_7be,sImageSrc:_7bd};};GroupMarker.IsSelected=function(_7bf){return GroupMarker.gmSelected!=null&&GroupMarker.gmSelected.wvMarker.iTileID==_7bf&&GroupMarker.gmSelected.wvMarker.bSelected;};GroupMarker.OnDeselect=function(){if(GroupMarker.gmSelected!=null){GroupMarker.gmSelected.setSelected(false);}};GroupMarker.prototype.destruct=function(){if(GroupMarker.gmSelected==this){GroupMarker.gmSelected=null;}
this.gMap=null;this.oSize=null;this.wvMarker=null;GEvent.clearInstanceListeners(this.divText);YSDOM.removeElement(this.divText);this.divText=null;};GroupMarker.prototype.initialize=function(gMap){this.onInitialize(gMap);};GroupMarker.prototype.onClick=function(){this.setSelected(true);MarkerManager.onMarkerClick(this.wvMarker);};GroupMarker.prototype.onDetermineIcon=function(_7c1){var oImg=GroupMarker.GetImageInfo(this.wvMarker.iWeight,this.wvMarker.bLive,this.sTabID=="search"&&this.wvMarker.bSelected);_7c1.image=_7c1.mozPrintImage=_7c1.prinImage=oImg.sImageSrc;_7c1.iconSize=new G.Size(oImg.iImageWidth,oImg.iImageWidth);_7c1.iconAnchor=new G.Point(oImg.iImageWidth*0.5,oImg.iImageWidth*0.5);this.oSize=new Size(oImg.iImageWidth,oImg.iImageWidth);};GroupMarker.prototype.onInitialize=function(gMap){G.Marker.prototype.initialize.call(this,gMap);this.gMap=gMap;var _7c4=(this.oSize.height-this.iFontSize)*0.5;var _7c5=document.createElement("div");_7c5.innerHTML=this.wvMarker.iWeight;YSDOM.setSize(_7c5,new Size(this.oSize.width,this.oSize.height-_7c4));YSCSS.setMultiStyle(_7c5,["color","paddingTop","textAlign","position"],["white",_7c4+"px","center","absolute"]);gMap.getPane(G_MAP_MARKER_PANE).appendChild(_7c5);if(this.bClickable){var _7c6=["click","dblclick","mousedown","mouseup","mouseover","mouseout"];for(var i=0,_7c8=_7c6.length;i<_7c8;i++){var _7c9=_7c6[i];GEvent.addDomListener(_7c5,_7c9,GroupMarker.GetEventFn(this,_7c9));}
YSCSS.setStyle(_7c5,"cursor","pointer");}
this.divText=_7c5;};GroupMarker.prototype.onRedraw=function(_7ca){GMarker.prototype.redraw.call(this,_7ca);var _7cb=this.getLatLng();var _7cc=this.gMap.fromLatLngToDivPixel(_7cb);var _7cd=isDefined(this.iZIndex)?this.iZIndex:GOverlay.getZIndex(_7cb.lat());YSDOM.setPosition(this.divText,new Pixel(_7cc.x-this.oSize.width*0.5,_7cc.y-this.oSize.height*0.5-1));YSCSS.setStyle(this.divText,"zIndex",_7cd);};GroupMarker.prototype.redraw=function(_7ce){this.onRedraw(_7ce);};GroupMarker.prototype.remove=function(){this.destruct();G.Marker.prototype.remove.call(this);};GroupMarker.prototype.setSelected=function(_7cf){if(_7cf){if(GroupMarker.gmSelected!=null){GroupMarker.gmSelected.setSelected(false);}
MSMap.OnWVDeselect();GroupMarker.gmSelected=this;}else{GroupMarker.gmSelected=null;}
this.wvMarker.bSelected=_7cf;if(this.sTabID=="search"){var oImg=GroupMarker.GetImageInfo(this.wvMarker.iWeight,this.wvMarker.bLive,this.wvMarker.bSelected);this.setImage(oImg.sImageSrc);}};function IMarkerManager(){this.aMarkerWrappers={};this.aMarkers={};};IMarkerManager.prototype.destruct=function(){for(var _7d1 in this.aMarkers){var _7d2=MapManager.getCurMap(_7d1);if(_7d2){this.onMapRemove(_7d2);}}
this.aMarkerWrappers=null;this.aMarkers=null;};IMarkerManager.prototype.addMarkersToMap=function(_7d3,_7d4){var _7d5=_7d3.getTabID();var _7d6=isDefined(this.aMarkerWrappers[_7d5]);if(_7d6){var _7d7=[];var _7d8=this.aMarkerWrappers[_7d5];for(var i=0,_7da=_7d8.length;i<_7da;i++){_7d7[i]=this.onAddMarker(_7d3,_7d8[i]);}}
this.onRemoveMarkers(_7d4);if(_7d6){this.aMarkers[_7d5]=_7d7;}};IMarkerManager.prototype.onAddMarker=function(_7db,_7dc){return null;};IMarkerManager.prototype.onMapTypeChanged=function(_7dd,mpTo){this.addMarkersToMap(mpTo,_7dd);};IMarkerManager.prototype.onMapRemove=function(_7df){this.onRemoveMarkers(_7df);delete this.aMarkerWrappers[_7df.getTabID()];};IMarkerManager.prototype.onNewMarkers=function(_7e0,_7e1){if(_7e0!=null){this.aMarkerWrappers[_7e0.getTabID()]=_7e1;this.addMarkersToMap(_7e0,_7e0);}};IMarkerManager.prototype.onRemoveMarkers=function(_7e2){if(_7e2==null||!isDefined(this.aMarkers[_7e2.getTabID()])){return;}
var _7e3=_7e2.getTabID();var _7e4=this.aMarkers[_7e3];for(var i=0,_7e6=_7e4.length;i<_7e6;i++){_7e2.removeMarker(_7e4[i]);_7e4[i]=null;}
delete this.aMarkers[_7e3];};function MapManager(){this.aMaps={};this.mpMini=null;this.aoOnViewChanged={};this.aoOnBirdsEyeAvailable={};this.iActivityID=13;this.aActAvailable={2:true,3:true,4:true,5:true,6:true,8:true,9:true,11:true,12:true,13:true,15:true,17:true,18:true,19:true};};MapManager.prototype.destruct=function(){HomePage.destruct();SearchPage.destruct();TrackPage.destruct();GraphPage.destruct();MarkerManager.destruct();IFramePage.destruct();WorkoutsPage.destruct();SchedulePage.destruct();View.Destruct();for(var _7e7 in this.aMaps){if(this.aMaps[_7e7].mpGE){this.aMaps[_7e7].mpGE.destruct();}
if(this.aMaps[_7e7].mpMS){this.aMaps[_7e7].mpMS.destruct();}
this.aMaps[_7e7].mpCur=this.aMaps[_7e7].mpGE=this.aMaps[_7e7].mpMS=null;}
if(this.mpMini!=null){this.mpMini.destruct();this.mpMini=null;}
this.aoOnViewChanged=null;this.aActAvailable=null;};MapManager.prototype.getActivityID=function(){return this.iActivityID;};MapManager.prototype.getCurMap=function(_7e8){if(!isDefined(_7e8)){_7e8=Tabs.getCurTabID();}
if(isDefined(this.aMaps[_7e8])){return this.aMaps[_7e8].mpCur;}else{return null;}};MapManager.prototype.getGEMap=function(_7e9){if(!isDefined(_7e9)){_7e9=Tabs.getCurTabID();}
if(isDefined(this.aMaps[_7e9])){return this.aMaps[_7e9].mpGE;}else{return null;}};MapManager.prototype.getMSMap=function(_7ea){if(!isDefined(_7ea)){_7ea=Tabs.getCurTabID();}
if(isDefined(this.aMaps[_7ea])){return this.aMaps[_7ea].mpMS;}else{return null;}};MapManager.prototype.getMiniMap=function(){return this.mpMini;};MapManager.prototype.getMapContainer=function(_7eb){if(!isDefined(_7eb)){_7eb=Tabs.getCurTabID();}
return this.aMaps[_7eb].mpCur!=null?this.aMaps[_7eb].mpCur.getContainer():YSDOM.getObj(this.aMaps[_7eb].aMapHolders[this.aMaps[_7eb].sCurType]);};MapManager.prototype.getMapPosition=function(_7ec){var _7ed=this.getCurMap(_7ec);if(_7ed){return YSDOM.getElementPosition(_7ed.getContainer());}else{return new Pixel();}};MapManager.prototype.getMapSize=function(_7ee){var _7ef=this.getCurMap(_7ee);if(_7ef){return _7ef.getPixelSize();}else{return new Size();}};MapManager.prototype.getNormalizedActivityID=function(_7f0){if(isDefined(this.aActAvailable[_7f0])){return _7f0;}else{return 0;}};MapManager.prototype.hasMap=function(_7f1){return this.getCurMap(_7f1)!=null;};MapManager.prototype.isBirdseyeShown=function(_7f2){var _7f3=this.getCurMap(_7f2);return _7f3&&_7f3.getType()==MSMap.Type&&_7f3.isBirdseyeShown();};MapManager.prototype.isTrackPlaying=function(){return TrackPage.isTrackPlaying();};MapManager.prototype.onCheckBirdsEye=function(_7f4){var mpMS=this.getMSMap(_7f4);if(mpMS!=null){var _7f6=this.getCurMap(_7f4);if(_7f6==null||_7f6==mpMS||!mpMS.setViewPort(_7f6.getViewPort())){this.onBirdsEyeAvailable(mpMS,mpMS.isBirdseyeAvailable());}}};MapManager.prototype.onChkMaps=function(_7f7){if(!isDefined(this.aMaps[_7f7])){this.aMaps[_7f7]={sCurType:GEMap.Type,iPrevStyle:-1,sPrevType:"",aMapHolders:{},mpCur:null,mpGE:null,mpMS:null};}};MapManager.prototype.onBirdsEyeAvailable=function(_7f8,_7f9){var _7fa=_7f8.getTabID();var oMap=this.aMaps[_7fa];var _7fc=-1,_7fd="";if(!_7f9){_7fc=oMap.iPrevStyle;_7fd=oMap.sPrevType;}
if(!_7f9&&_7fc!=-1){_7f8.hideBirdseyeView(_7fc);if(_7fd==GEMap.Type){var mpGE=this.getGEMap(_7fa);if(mpGE!=null&&!mpGE.setViewPort(_7f8.getViewPort())){mpGE.moveMe();}}
this.onMapTypeChange(_7fa,_7fd,false);oMap.iPrevStyle=-1;oMap.sPrevType="";}
if(isDefined(this.aoOnBirdsEyeAvailable[_7fa])){this.aoOnBirdsEyeAvailable[_7fa].fn.call(this.aoOnBirdsEyeAvailable[_7fa].obj,_7f9,_7fc,_7fd);}};MapManager.prototype.onLoad=function(){if(!isDefined("Tabs",true)){setTimeout("MapManager.onLoad();",250);return;}
Tabs.setOnRemove(MapManager.onTabRemove,this);Tabs.setOnChange(MapManager.onTabChange,this);SettingsBar.setOnMetricChange(MapManager.onMetricChange,this);};MapManager.prototype.onLoadGEMap=function(_7ff){if(GEMap.Loaded){this.onGELoaded(_7ff);}else{if(GEMap.Loading){new YSTimeout(200,MapManager.onLoadGEMap,this,_7ff);}else{GEMap.Load(_7ff.sAPIKey,MapManager.onGELoaded,this,_7ff);}}};MapManager.prototype.onLoadMSMap=function(_800){if(MSMap.Loaded){this.onMSLoaded(_800);}else{if(MSMap.Loading){new YSTimeout(200,MapManager.onLoadMSMap,this,_800);}else{MSMap.Load(MapManager.onMSLoaded,this,_800);}}};MapManager.prototype.onLoadMaps=function(_801,_802,_803,_804,_805,_806){this.onChkMaps(_801);this.aMaps[_801].aMapHolders={GE:_803,MS:_804};if(_803){this.onLoadGEMap({sTabID:_801,sAPIKey:_802,sGEMapID:_803,sMiniMapID:_805,vpInitVP:_806});}
if(_804){this.onLoadMSMap({sTabID:_801,sMSMapID:_804,vpInitVP:_806});}};MapManager.prototype.onGELoaded=function(_807){if(!isDefined(this.aMaps[_807.sTabID])){return;}
var mpGE=new GEMap(_807.sTabID,_807.sGEMapID,_807.vpInitVP,_807.sTabID!="home");this.aMaps[_807.sTabID].mpGE=mpGE;if(YSDOM.getObj(_807.sMiniMapID)!=null){this.mpMini=new GEMap("minimap",_807.sMiniMapID,_807.vpInitVP,false);}
this.onMapLoaded(_807.sTabID,mpGE);};MapManager.prototype.onMSLoaded=function(_809){if(!isDefined(this.aMaps[_809.sTabID])){return;}
var mpMS=new MSMap(_809.sTabID,_809.sMSMapID,_809.vpInitVP);this.aMaps[_809.sTabID].mpMS=mpMS;this.onMapLoaded(_809.sTabID,mpMS);this.onBirdsEyeAvailable(mpMS,mpMS.isBirdseyeAvailable());};MapManager.prototype.onMapLoaded=function(_80b,_80c){if(this.aMaps[_80b].mpCur==null&&this.aMaps[_80b].sCurType==_80c.getType()){this.aMaps[_80b].mpCur=_80c;_80c.onCheckParentNode();this.onViewChanged(_80c);}};MapManager.prototype.onMapStyleChange=function(_80d,_80e){var _80f={bSucceeded:false,mpNewMap:null,mpPrevMap:null,bBEHidden:false};if(_80e<0||_80e>3){return _80f;}
if(isDefined(this.aMaps[_80d])){var oMap=this.aMaps[_80d];if(_80e==3){if(oMap.mpMS!=null&&oMap.mpMS.isBirdseyeAvailable()&&!oMap.mpMS.isBirdseyeShown()){oMap.iPrevStyle=oMap.mpCur!=null?oMap.mpCur.getMapStyle():2;oMap.sPrevType=oMap.mpCur!=null?oMap.mpCur.getType():GEMap.Type;if(oMap.mpCur!=oMap.mpMS){_80f.mpNewMap=oMap.mpMS;_80f.mpPrevMap=oMap.mpCur;}
oMap.mpMS.showBirdseyeView();this.onMapTypeChange(_80d,MSMap.Type,false);_80f.bSucceeded=true;}}else{var _811=true;if(this.isBirdseyeShown(_80d)){this.onMapTypeChange(_80d,oMap.sPrevType,false);oMap.mpMS.hideBirdseyeView(_80e);_80f.bBEHidden=true;_811=false;if(oMap.sPrevType!=MSMap.Type){_80f.mpNewMap=this.getCurMap(_80d);_80f.mpPrevMap=oMap.mpMS;}}
if(oMap.mpGE!=null){oMap.mpGE.setMapStyle(_80e);}
if(_811&&oMap.mpMS!=null){oMap.mpMS.setMapStyle(_80e);}
_80f.bSucceeded=true;}}
return _80f;};MapManager.prototype.onMapTypeChange=function(_812,_813,_814){this.onChkMaps(_812);var oMap=this.aMaps[_812];var _816={mpFrom:null,mpTo:null,iPrevStyle:-1};YSLog.write("change to "+_813);if(!isDefined(_814)||_814===true){_814=this.isBirdseyeShown(_812);}else{_814=false;}
if(_813!=oMap.sCurType){var _817=oMap.mpCur;var _818=this.getMapContainer(_812);if(_818){YSCSS.addClassName(_818.parentNode,"invisible");}
var mpTo=null;if(_813==MSMap.Type){mpTo=oMap.mpMS;}else{mpTo=oMap.mpGE;}
oMap.mpCur=mpTo;oMap.sCurType=_813;if(oMap.mpCur!=null){oMap.mpCur.onCheckParentNode();}
var _818=this.getMapContainer(_812);if(_818){YSCSS.removeClassName(_818.parentNode,"invisible");}
if(mpTo!=null){_816.mpTo=mpTo;_816.mpFrom=_817;MarkerManager.onMapTypeChanged(_817,mpTo);}}
if(_814){this.getMSMap(_812).hideBirdseyeView(oMap.iPrevStyle);_816.iPrevStyle=oMap.iPrevStyle;oMap.iPrevStyle=-1;oMap.sPrevType="";}
return _816;};MapManager.prototype.onMetricChange=function(bKM){if(isDefined("SearchPage",true)){SearchPage.onMetricChange(bKM);}
if(isDefined("TrackPage",true)){TrackPage.onMetricChange(bKM);}
if(isDefined("GraphPage",true)){GraphPage.onMetricChange(bKM);}
if(isDefined("WorkoutsPage",true)){WorkoutsPage.onMetricChange(bKM);}};MapManager.prototype.onTabChange=function(_81b,_81c){if(isDefined("TrackPage",true)){TrackPage.onTabChange(_81b,_81c);}};MapManager.prototype.onTabRemove=function(_81d,_81e){if(_81d.substr(0,4)=="map/"){TrackPage.onTabRemove(_81d,_81e);if(!_81e&&isDefined(this.aMaps[_81d])){if(this.aMaps[_81d].mpCur){MarkerManager.onMapRemove(this.aMaps[_81d].mpCur);Searcher.onMapRemove(this.aMaps[_81d].mpCur);}
if(this.aMaps[_81d].mpGE){this.aMaps[_81d].mpGE.destruct(false);}
if(this.aMaps[_81d].mpMS){this.aMaps[_81d].mpMS.destruct();}
if(this.mpMini!=null){this.mpMini.destruct(false);}
this.mpMini=this.aMaps[_81d].mpCur=this.aMaps[_81d].mpGE=this.aMaps[_81d].mpMS=null;delete this.aMaps[_81d];}}};MapManager.prototype.onViewChanged=function(_81f){if(isDefined(this.aoOnViewChanged[_81f.getTabID()])){this.aoOnViewChanged[_81f.getTabID()].fn.call(this.aoOnViewChanged[_81f.getTabID()].obj,_81f);}
MarkerManager.onRefreshMarkers(_81f);};MapManager.prototype.setActivityID=function(_820){this.iActivityID=this.getNormalizedActivityID(_820);};MapManager.prototype.setEventListener=function(_821,_822,_823,_824){var _825=isDefined(_821[_822]);if(_823==null){if(_825){delete _821[_822];}}else{if(!_825){_821[_822]={};}
_821[_822].fn=_823;_821[_822].obj=isDefined(_824)?_824:window;}};MapManager.prototype.setOnBirdsEyeAvailable=function(_826,_827,_828){this.setEventListener(this.aoOnBirdsEyeAvailable,_826,_827,_828);};MapManager.prototype.setOnViewChanged=function(_829,_82a,_82b){this.setEventListener(this.aoOnViewChanged,_829,_82a,_82b);};var MapManager=new MapManager();function MarkerManager(){this.acmdMarkerRequest={};this.iLastZoomLevel=0;this.bPreventSearchReset=false;};MarkerManager.prototype=new IMarkerManager();MarkerManager.prototype.destruct=function(){this.acmdMarkerRequest=null;};MarkerManager.prototype.onAddMarker=function(_82c,_82d){return _82c.addWorldViewMarker(_82d);};MarkerManager.prototype.onCommandResult=function(_82e,_82f){if(_82e instanceof GetWorldViewMarkers){var _830=_82e.getMap();if(_82f){this.onNewMarkers(_830,_82e.getWorldViewMarkers());}
delete this.acmdMarkerRequest[_830.getTabID()];}};MarkerManager.prototype.onMarkerClick=function(_831){if(TrackPage.isIFrame()||_831.sTabID=="home"){var sURL=SettingsBar.getURL("shared-workouts.html?t="+_831.iTileID+"&z="+_831.iZoomLevel);if(TrackPage.isIFrame()){window.open(sURL,"wvmarker");}else{YSEvent.cancelEvent(null,true);location.href=sURL;}}else{Searcher.onWorldViewSearch(_831);}};MarkerManager.prototype.onPreventSearchReset=function(){this.bPreventSearchReset=true;};MarkerManager.prototype.onRefreshMarkers=function(_833){if(_833==null||_833.bDestructed){return;}
if(isPageLoaded(MarkerManager.onRefreshMarkers,this,_833)){if(_833.getTabID()=="search"){if(this.bPreventSearchReset){this.bPreventSearchReset=false;}else{if(_833.getZoomLevel()!=this.iLastZoomLevel){this.iLastZoomLevel=_833.getZoomLevel();if(Searcher.isTileSearch()){Searcher.onResetSearch();}}}}
var _834=_833.getTabID();if(isDefined(this.acmdMarkerRequest[_834])){this.acmdMarkerRequest[_834].destruct();}
this.acmdMarkerRequest[_834]=new GetWorldViewMarkers(this,_833);this.acmdMarkerRequest[_834].sendRequest();}};MarkerManager.prototype.setLastZoomLevel=function(_835){this.iLastZoomLevel=_835;};var MarkerManager=new MarkerManager();if(!document.namespaces){document.namespaces={add:function(){}};}
function MSMap(_836,_837,_838){BaseMap.call(this,_836,_837);this.bAllowUserAction=true;this.vpLastViewPort=null;this.vpLastBEViewPort=null;var _839=document.createElement("div");_839.id=this.sContainerID+"_replace";this.divHolderParent.insertBefore(_839,this.divHolder);document.body.appendChild(this.divHolder);this.mMSMap=new VEMap(this.sContainerID);this.mMSMap.sTabID=_836;var _83a=isDefined(_838.zoomlvl);var _83b=_83a?new LatLng(_838.lat,_838.lng):_838.getCenter();this.mMSMap.LoadMap(_83b.toMSLatLng(),_83a?_838.zoomlvl:13,VEMapStyle.Hybrid,false,VEMapMode.Mode2D,false,2);if(_83a){this.setZoomCenter(_838.zoomlvl,_83b);}else{this.setViewPort(_838,true);}
this.vpLastViewPort=this.getViewPort(true);this.onInitMap();this.bMoving=false;this.toOrientationChangeTimeout=null;};MSMap.prototype=new BaseMap();MSMap.Loading=false;MSMap.Loaded=false;MSMap.LoadCallback={};MSMap.fnCapture=null;MSMap.Type="MS";MSMap.BirdseyeAccuracy=15;MSMap.MaxAccuracyTries=20;MSMap.PI1_2=Math.PI/2;MSMap.msSelected=null;MSMap.aMarkers={};MSMap.iUniqueMarkerID=1;MSMap.IsWVMarkerSelected=function(_83c){return MSMap.msSelected!=null&&MSMap.msSelected.wvMarker.iTileID==_83c&&MSMap.msSelected.wvMarker.bSelected;};MSMap.Load=function(_83d,_83e,_83f){MSMap.Loading=true;MSMap.LoadCallback.fn=_83d;MSMap.LoadCallback.obj=_83e;MSMap.LoadCallback.oParam=_83f;if(bIE){MSMap.OnCompatLoad("mscompatjs");}else{MSMap.LoadCompat();}};MSMap.LoadCompat=function(){if(isPageLoaded(MSMap.LoadCompat)){YSJS.load("mscompatjs",SCRIPT_PATH+"atlascompat-small.js",MSMap.OnCompatLoad);}};MSMap.OnCompatLoad=function(_840){MSMap.fnCapture=isDefined("HTMLElement",true)&&isDefined(window.HTMLElement.prototype.setCapture)?window.HTMLElement.prototype.setCapture:null;YSJS.load("msapi","http://dev.virtualearth.net/mapcontrol/"+"mapcontrol.ashx?v=6&onScriptLoad=MSMap.OnMapLoad");};MSMap.OnMapLoad=function(){if((bSafari||bChrome)&&MSMap.fnCapture!=null){window.HTMLElement.prototype.setCapture=MSMap.fnCapture;}
MSMap.Loaded=true;MSMap.Loading=false;MSMap.LoadCallback.fn.call(MSMap.LoadCallback.obj,MSMap.LoadCallback.oParam);MSMap.LoadCallback={};};MSMap.OnWVDeselect=function(){if(MSMap.msSelected!=null){var _841=MSMap.msSelected.wvMarker;_841.bSelected=false;YSDOM.getObj(MSMap.msSelected.sUniqueID).src=GroupMarker.GetImageInfo(_841.iWeight,_841.bLive,_841.bSelected).sImageSrc;MSMap.msSelected=null;}};MSMap.prototype.destruct=function(){if(this.bDestructed){return;}
BaseMap.prototype.destruct.call(this);this.mMSMap.DeleteAllShapeLayers();if(!isDefined("VE_TrafficManager",true)||VE_TrafficManager.m_vemap!=null){this.mMSMap.Clear();}
this.vpLastViewPort.destruct();this.vpLastViewPort=null;if(this.vpLastBEViewPort!=null){this.vpLastBEViewPort.destruct();this.vpLastBEViewPort=null;}
this.mMSMap.Dispose();this.mMSMap=null;};MSMap.prototype.addIconMarker=function(_842,_843,_844,_845,_846,_847,_848,_849,_84a){if(_842 instanceof LatLng){if(!isDefined(_845)){_845="";}
if(!isDefined(_846)){_846="";}
if(!isDefined(_847)){_847="";}
if(!isDefined(_848)){_848=0;}
if(!isDefined(_849)){_849="";}
if(!isDefined(_84a)){_84a="";}
_844.left-=13;_844.top-=13;var _84b=new VEShape(VEShapeType.Pushpin,[_842.toMSLatLng()]);_84b.SetCustomIcon("<div style=\"position: relative; margin-top: "+(_844.top*-1)+"px; margin-left: "+(_844.left*-1)+"px;\">"+"<img "+(_84a==""?"":"id=\""+_84a+"\" ")+"src=\""+_843+"\" onmouseover=\""+_845+"; return false;\" "+"onmouseout=\""+_846+"; return false;\" "+"onclick=\""+_847+"; return false;\" />"+_849+"</div>");if(_848){_84b.SetZIndex(_848);}
this.mMSMap.AddShape(_84b);_84b.Show();if(_84a!=""){_84b.sUniqueID=_84a;MSMap.aMarkers[_84a]=_84b;}
return _84b;}else{return null;}};MSMap.prototype.addPhotoMarker=function(_84c,_84d){};MSMap.prototype.addSearchMarker=function(_84e){if(_84e instanceof SearchMarker){var _84f=MapManager.getNormalizedActivityID(_84e.iActivityID);var _850="msMarker"+MSMap.iUniqueMarkerID++;var _851=this.addIconMarker(_84e.llPoint,IMAGE_PATH+"map_"+_84f+".png",new Pixel(7,43),"","","MSMap.prototype.onSearchMarkerClick('"+_850+"');",500,"",_850);_851.sTrackURL=_84e.sTrackURL;_851.bUseAnalysis=_84e.bUseAnalysis;return _851;}else{return null;}};MSMap.prototype.addTrackMarker=function(_852,_853){if(!_853){return null;}
return this.addIconMarker(_853,this.getTrackIconURL(_852),new Pixel(7,43));};MSMap.prototype.addWorldViewMarker=function(_854){if(_854 instanceof WorldViewMarker){var oImg=GroupMarker.GetImageInfo(_854.iWeight,_854.bLive,_854.bSelected);var _856=11;var iTop=(oImg.iImageWidth-_856)*0.5-1;var _858="msMarker"+MSMap.iUniqueMarkerID++;var _859=this.addIconMarker(_854.llPoint,oImg.sImageSrc,new Pixel(oImg.iImageWidth*0.5,oImg.iImageWidth*0.5),"","","MSMap.prototype.onWorldViewMarkerClick('"+_858+"');",49,"<div style=\"position: absolute; top: "+iTop+"px; left: 0px;"+"width: "+oImg.iImageWidth+"px; "+"height: 15px; text-align: center; color: white; "+"font-size: "+_856+"px;\" onclick=\""+"MSMap.prototype.onWorldViewMarkerClick('"+_858+"');"+"\">"+_854.iWeight+"</div>",_858);_859.wvMarker=_854;_859.sTabID=this.sTabID;if(_854.bSelected&&this.sTabID=="search"){MSMap.msSelected=_859;}
return _859;}else{return null;}};MSMap.prototype.getAngle=function(_85a,_85b){var _85c=_85a.top-_85b.top;var _85d=_85b.left-_85a.left;var _85e=0;if(_85c==0){_85e=0;}else{if(_85d==0){if(_85c>0){_85e=MSMap.PI1_2;}else{_85e=-MSMap.PI1_2;}}else{_85e=Math.atan(_85c/_85d);}}
return _85e;};MSMap.prototype.getBirdseyeViewPort=function(_85f,_860){if(!this.mMSMap.GetBirdseyeScene()){MSMap.prototype.onBirdsEyeChange.call(this.mMSMap,false);return this.vpLastViewPort;}
if(!isDefined(_85f)){_85f=1;}
if(!isDefined(_860)){if(this.vpLastViewPort){_860=this.vpLastViewPort.getCenter();}else{_860=MapManager.getGEMap(this.sTabID).getViewPort().getCenter();}}
var _861=this.mMSMap.GetBirdseyeScene().GetOrientation();var _862=this.getLatLngPixel(_860);var _863=new LatLng(_860.getLat()+0.001,_860.getLng());var _864=this.getLatLngPixel(_863);var _865=this.getAngle(_862,_864);if(_861==VEOrientation.North||_861==VEOrientation.South){if(_865>0){_865-=MSMap.PI1_2;}else{if(_865<0){_865+=MSMap.PI1_2;}}}
var _866=this.getPixelSize();var _867=new Pixel(_866.width/2,_866.height/2);var _868=this.getAngle(_867,_862);_868-=_865;var _869=Math.sqrt(Math.pow((_867.left-_862.left),2)+Math.pow((_867.top-_862.top),2));var _86a=Math.sin(_868)*_869;var _86b=Math.cos(_868)*_869;var _86c=_862.left-_867.left>=0?1:-1;_862=new Pixel(_867.left+_86b*_86c,_867.top-_86a*_86c);var _86d={x:0,y:0};switch(_861){case VEOrientation.North:_86d.y=_862.top-_866.height/2;_86d.x=_866.width/2-_862.left;break;case VEOrientation.East:_86d.y=_862.left-_866.width/2;_86d.x=_862.top-_866.height/2;break;case VEOrientation.South:_86d.y=_866.height/2-_862.top;_86d.x=_862.left-_866.width/2;break;case VEOrientation.West:_86d.y=_866.width/2-_862.left;_86d.x=_866.height/2-_862.top;break;}
var _86e=this.getPixDiff(_860,new LatLng(_860.getLat()+0.001,_860.getLng()));var _86f=this.getPixDiff(_860,new LatLng(_860.getLat(),_860.getLng()+0.001));var _870=0.001/_86e;var _871=0.001/_86f;if(_861==VEOrientation.West||_861==VEOrientation.East){_866.swap();}
var _872=(_866.height/3)*_870;var _873=(_866.width/3)*_871;if(Math.abs(_86d.x)<MSMap.BirdseyeAccuracy&&Math.abs(_86d.y)<MSMap.BirdseyeAccuracy){var _874=new ViewPort(new LatLng(_860.getLat()-_872,_860.getLng()-_873),new LatLng(_860.getLat()+_872,_860.getLng()+_873));return _874;}
if(Math.abs(_86d.y)>=MSMap.BirdseyeAccuracy){_860.setLat(_860.getLat()+_86d.y*_870);}
if(Math.abs(_86d.x)>=MSMap.BirdseyeAccuracy){_860.setLng(_860.getLng()+_86d.x*_871);}
if(_85f>=MSMap.MaxAccuracyTries){var _874=new ViewPort(new LatLng(_860.getLat()-_872,_860.getLng()-_873),new LatLng(_860.getLat()+_872,_860.getLng()+_873));return _874;}else{return this.getBirdseyeViewPort(_85f+1,_860);}};MSMap.prototype.getLatLngPixel=function(_875){var _876=null;if(_875 instanceof LatLng){_876=this.mMSMap.LatLongToPixel(_875.toMSLatLng());}else{if(_875 instanceof VELatLong){_876=this.mMSMap.LatLongToPixel(_875);}}
if(_876){return new Pixel(_876.x,_876.y);}else{return new Pixel();}};MSMap.prototype.getLines=function(_877,_878,_879){if(!isDefined(_879)){_879=null;}
var _87a=[];for(var _87b in _877){var _87c=_879;if(_87c==null){_87c=this.clrTrackColor;}
var _87d=_877[_87b];for(var _87e=0,_87f=_87d.length;_87e<_87f;_87e++){var _880=[];for(var _881=0,_882=_87d[_87e].length;_881<_882;_881++){_880.push(_87d[_87e][_881].toMSLatLng());}
if(_880.length>1){var _883=new VEShape(VEShapeType.Polyline,_880);_883.HideIcon();_883.SetAltitudeMode(VEAltitudeMode.RelativeToGround);_883.SetLineColor(new VEColor(_87c.Red,_87c.Green,_87c.Blue,0.9));_883.SetLineWidth(_878-(bIE?2:0));_87a.push(_883);}}}
return _87a;};MSMap.prototype.getMapStyle=function(){switch(this.mMSMap.GetMapStyle()){case VEMapStyle.Shaded:return 0;break;case VEMapStyle.Aerial:return 1;break;case VEMapStyle.Hybrid:return 2;break;default:return 2;break;}};MSMap.prototype.getSmallViewPort=function(){if(this.isBirdseyeShown()){return this.vpLastViewPort;}else{var _884=new ViewPort();var _885=this.getPixelSize();var _886=this.mMSMap.PixelToLatLong(new VEPixel(BaseMap.SMALL_VIEWPORT_OFFSET,_885.height-BaseMap.SMALL_VIEWPORT_OFFSET));var _887=this.mMSMap.PixelToLatLong(new VEPixel(_885.width-BaseMap.SMALL_VIEWPORT_OFFSET,BaseMap.SMALL_VIEWPORT_OFFSET));_884.setSW(new LatLng(_886.Latitude,_886.Longitude));_884.setNE(new LatLng(_887.Latitude,_887.Longitude));return _884;}};MSMap.prototype.getType=function(){return MSMap.Type;};MSMap.prototype.getViewPort=function(_888){if((!isDefined(_888)||!_888)&&this.vpLastViewPort!=null){return this.vpLastViewPort;}
var _889=false;var _88a=null;if(this.isBirdseyeShown()){_88a=this.getBirdseyeViewPort();_889=true;}else{var _88b=this.mMSMap.GetMapView();_88a=new ViewPort();_88a.setNW(new LatLng(_88b.TopLeftLatLong.Latitude,_88b.TopLeftLatLong.Longitude));_88a.setSE(new LatLng(_88b.BottomRightLatLong.Latitude,_88b.BottomRightLatLong.Longitude));}
if(_88a.getCenter().isValid()){if(_889){this.vpLastBEViewPort=_88a;}
return _88a;}else{_88a.destruct();this.setViewPort(this.vpLastViewPort,true);return this.vpLastViewPort;}};MSMap.prototype.getZoomLevel=function(){return YSNumbers.checkInt(this.mMSMap.GetZoomLevel());};MSMap.prototype.hasStaticLines=function(){return this.aStaticLines.length>0;};MSMap.prototype.hideBirdseyeView=function(_88c,_88d,iTry){if(typeof _88c=="object"){iTry=_88c.iTry;_88d=_88c.vpViewPort;_88c=_88c.iNewStyle;}else{if(!isDefined(iTry)){iTry=1;}
if(!isDefined(_88d)){_88d=this.vpLastViewPort;}}
if(this.isBirdseyeShown()){YSLog.write("hide birdseye view try "+iTry+"; to style: "+_88c);this.setMapStyle(_88c);if(this.isBirdseyeShown()){YSLog.write("retry hiding BE");new YSTimeout(500,MSMap.prototype.hideBirdseyeView,this,{iTry:iTry+1,vpViewPort:_88d,iNewStyle:_88c});return;}}
if(this.vpLastBEViewPort!=null){YSLog.write("set after hide BE VP:"+this.vpLastBEViewPort.toString());this.setViewPort(this.vpLastBEViewPort);}};MSMap.prototype.isBirdseyeAvailable=function(){if(!this.isBirdseyeShown()&&this.getZoomLevel()<15){return false;}else{return this.mMSMap.IsBirdseyeAvailable();}};MSMap.prototype.isBirdseyeShown=function(){return this.mMSMap.GetMapStyle()==VEMapStyle.BirdseyeHybrid;};MSMap.prototype.onBirdsEyeChange=function(_88f){if(!isDefined(_88f)||typeof _88f=="object"){_88f=this.isBirdseyeAvailable();}
MapManager.onBirdsEyeAvailable(this,_88f);};MSMap.prototype.onInitMap=function(){this.mMSMap.HideDashboard();this.mMSMap.SetScaleBarDistanceUnit(YSCookie.read("km")=="1"?VEDistanceUnit.Kilometers:VEDistanceUnit.Miles);this.mMSMap.SetMouseWheelZoomToCenter(false);this.onSetEvent("onchangeview","onViewChanged");this.onSetEvent("onobliqueenter","onBirdsEyeChange");this.onSetEvent("onobliqueleave","onBirdsEyeChange");};MSMap.prototype.onPhotoMarkerMouseOut=function(){};MSMap.prototype.onPhotoMarkerMouseOver=function(){};MSMap.prototype.onSearchMarkerClick=function(_890){var _891=MSMap.aMarkers[_890];Searcher.onMarkerClick(_891.sTrackURL,_891.bUseAnalysis);};MSMap.prototype.onSetEvent=function(_892,_893){var _894=_892+this.sContainerID;eval("MSMap.prototype."+_894+" = function(oParam) {"+"MapManager.getMSMap(\""+this.sTabID+"\")."+_893+"(oParam);"+"};");eval("this.mMSMap.AttachEvent(\""+_892+"\", MSMap.prototype."+_894+");");};MSMap.prototype.onUpdateCompassOrientation=function(){var _895=CompassOrientation.North;if(this.isBirdseyeShown()){switch(this.mMSMap.GetBirdseyeScene().GetOrientation()){case VEOrientation.North:_895=CompassOrientation.North;break;case VEOrientation.East:_895=CompassOrientation.East;break;case VEOrientation.South:_895=CompassOrientation.South;break;case VEOrientation.West:_895=CompassOrientation.West;break;}}
Compass.Instance().setOrientation(_895);};MSMap.prototype.onViewChanged=function(e){this.vpLastViewPort=this.getViewPort(true);if(!this.isBirdseyeShown()){MapManager.onBirdsEyeAvailable(this,this.isBirdseyeAvailable());}
if(this.isVisible()){if(this.toOrientationChangeTimeout!=null){this.toOrientationChangeTimeout.cancelTimeout();this.toOrientationChangeTimeout=null;}
MapManager.onViewChanged(this);this.setOtherMapsViewPort();}
this.bMoving=false;};MSMap.prototype.onWorldViewMarkerClick=function(_897){var _898=MSMap.aMarkers[_897];var _899=_898.sTabID;if(MSMap.msSelected!=null){var _89a=MSMap.msSelected.wvMarker;_89a.bSelected=false;if(_899=="search"){YSDOM.getObj(MSMap.msSelected.sUniqueID).src=GroupMarker.GetImageInfo(_89a.iWeight,_89a.bLive,this.sTabID=="search"&&_89a.bSelected).sImageSrc;}}
var _89a=_898.wvMarker;_89a.bSelected=true;if(_899=="search"){YSDOM.getObj(_897).src=GroupMarker.GetImageInfo(_89a.iWeight,_89a.bLive,_89a.bSelected).sImageSrc;}
MSMap.msSelected=_898;GEMap.OnWVDeselect();MarkerManager.onMarkerClick(_89a);};MSMap.prototype.redrawLines=function(){for(var i=0,_89c=this.aLines.length;i<_89c;i++){if(this.aLines[i]instanceof VEShape){this.mMSMap.DeleteShape(this.aLines[i]);this.mMSMap.AddShape(this.aLines[i]);this.aLines[i].Show();}}};MSMap.prototype.redrawStaticLines=function(){for(var i=0,_89e=this.aStaticLines.length;i<_89e;i++){if(this.aStaticLines[i]instanceof VEShape){this.mMSMap.DeleteShape(this.aStaticLines[i]);this.mMSMap.AddShape(this.aStaticLines[i]);this.aStaticLines[i].Show();}}};MSMap.prototype.redrawTempLines=function(){for(var i=0,_8a0=this.aTempLines.length;i<_8a0;i++){if(this.aTempLines[i]instanceof VEShape){this.mMSMap.DeleteShape(this.aTempLines[i]);this.mMSMap.AddShape(this.aTempLines[i]);this.aTempLines[i].Show();}}};MSMap.prototype.removeLines=function(_8a1){if(!_8a1){return;}
for(var i=0,_8a3=_8a1.length;i<_8a3;i++){if(_8a1[i]instanceof VEShape){this.mMSMap.DeleteShape(_8a1[i]);}
_8a1[i]=null;}};MSMap.prototype.removeMarker=function(_8a4){if(_8a4==null||!(_8a4 instanceof VEShape)){return;}
if(isDefined(_8a4.sUniqueID)&&isDefined(MSMap.aMarkers[_8a4.sUniqueID])){delete MSMap.aMarkers[_8a4.sUniqueID];}
if(MSMap.msSelected==_8a4){MSMap.msSelected=null;}
_8a4.Hide();this.mMSMap.DeleteShape(_8a4);};MSMap.prototype.replaceLines=function(_8a5,_8a6,_8a7,_8a8){if(!isDefined(_8a7)){_8a7=true;}
if(!isDefined(_8a8)){_8a8=true;}
var _8a9=_8a7?null:this.clrStaticOverlayColor;var _8aa=this.getLines(_8a5,_8a6,_8a9);for(var i=0,_8ac=_8aa.length;i<_8ac;i++){this.mMSMap.AddShape(_8aa[i]);_8aa[i].Show();if(!_8a8){this.aLines.push(_8aa[i]);}}
if(_8a8){this.clearLines();this.aLines=_8aa;}};MSMap.prototype.replaceStaticLines=function(_8ad,_8ae){var _8af=this.getLines(_8ad,_8ae,this.clrStaticColor);for(var i=0,_8b1=_8af.length;i<_8b1;i++){this.mMSMap.AddShape(_8af[i]);_8af[i].Show();}
this.clearStaticLines();this.aStaticLines=_8af;};MSMap.prototype.replaceTempLines=function(_8b2,_8b3,_8b4){if(!isDefined(_8b4)){_8b4=true;}
var _8b5=_8b4?null:this.clrStaticOverlayColor;var _8b6=this.getLines(_8b2,_8b3,_8b5);for(var i=0,_8b8=_8b6.length;i<_8b8;i++){this.mMSMap.AddShape(_8b6[i]);_8b6[i].Show();}
this.clearTempLines();this.aTempLines=_8b6;};MSMap.prototype.setCenter=function(_8b9){if(_8b9 instanceof LatLng){this.bMoving=true;try{this.vpLastViewPort=new ViewPort(_8b9.copyMe(),_8b9.copyMe());this.mMSMap.SetCenter(_8b9.toMSLatLng());}
catch(e){print_r(e);}}};MSMap.prototype.setCenterSmooth=function(_8ba){if(_8ba instanceof LatLng){this.bMoving=true;this.vpLastViewPort=new ViewPort(_8ba.copyMe(),_8ba.copyMe());this.mMSMap.PanToLatLong(_8ba.toMSLatLng());}};MSMap.prototype.setMapStyle=function(_8bb){this.mMSMap.HideMiniMap();try{switch(_8bb){case 0:this.mMSMap.SetMapStyle(VEMapStyle.Shaded);break;case 1:this.mMSMap.SetMapStyle(VEMapStyle.Aerial);break;case 2:this.mMSMap.SetMapStyle(VEMapStyle.Hybrid);break;default:this.mMSMap.SetMapStyle(VEMapStyle.Hybrid);break;}}
catch(e){print_r(e);}};MSMap.prototype.setMarkerLatLng=function(_8bc,_8bd){if(!_8bd||!(_8bc instanceof VEShape)){return;}
var _8be=_8bd.toMSLatLng();_8bc.SetPoints([_8be]);if(this.isBirdseyeShown()){if(!this.mMSMap.GetBirdseyeScene().ContainsLatLong(_8be)){if(MapManager.isTrackPlaying()){TrackPage.onMapMoveStart();this.setCenterSmooth(_8bd);}}}};MSMap.prototype.setOrientation=function(_8bf){if(!this.mMSMap.GetBirdseyeScene()){MSMap.prototype.onBirdsEyeChange.call(this.mMSMap,false);}else{switch(_8bf){case 0:this.mMSMap.SetBirdseyeOrientation(VEOrientation.North);break;case 1:this.mMSMap.SetBirdseyeOrientation(VEOrientation.East);break;case 2:this.mMSMap.SetBirdseyeOrientation(VEOrientation.South);break;case 3:this.mMSMap.SetBirdseyeOrientation(VEOrientation.West);break;default:this.mMSMap.SetBirdseyeOrientation(VEOrientation.North);break;}
this.clearLines();this.toOrientationChangeTimeout=new YSTimeout(1000,MSMap.prototype.onViewChanged,this);}};MSMap.prototype.setViewPort=function(_8c0,_8c1){if(!isDefined(_8c1)){_8c1=false;}
if(_8c0 instanceof ViewPort&&(_8c1||(_8c0.isValid()&&!_8c0.equals(this.vpLastViewPort)))){this.bMoving=true;this.mMSMap.SetMapView(_8c0.toMSViewPort());return true;}
return false;};MSMap.prototype.setZoomCenter=function(_8c2,_8c3){this.mMSMap.SetCenterAndZoom(_8c3.toMSLatLng(),_8c2);};MSMap.prototype.setZoomLevel=function(_8c4){this.mMSMap.SetZoomLevel(_8c4);};MSMap.prototype.showBirdseyeView=function(iTry){if(!isDefined(iTry)){iTry=1;}
if(iTry>20){return;}
if(!this.isBirdseyeShown()){var _8c6=this.getViewPort().getCenter();YSLog.write("show birdseye view try "+iTry);this.mMSMap.SetMapStyle(VEMapStyle.BirdseyeHybrid);if(!this.isBirdseyeShown()){new YSTimeout(500,MSMap.prototype.showBirdseyeView,this,iTry+1);return;}else{this.setCenter(_8c6);}}};MSMap.prototype.zoomIn=function(){this.mMSMap.ZoomIn();};MSMap.prototype.zoomOut=function(){this.mMSMap.ZoomOut();};function PlayerData(){this.aLines=[];this.iLastRequestTime=0;this.iLineNr=-1;this.iPointNr=-1;};PlayerData.PIX_PER_SECOND=70;PlayerData.prototype.destruct=function(){this.aLines=null;};PlayerData.prototype.getNextPoint=function(){if(this.aLines[this.iLineNr].length>this.iPointNr+1){return this.aLines[this.iLineNr][this.iPointNr+1];}else{if(this.aLines.length>this.iLineNr+1){return this.aLines[this.iLineNr+1][0];}else{return null;}}};PlayerData.prototype.onChangeTime=function(iMS){this.iLastRequestTime+=iMS;};PlayerData.prototype.onLowerBound=function(_8c8){if(this.aLines.length==0){return;}
if(this.aLines[0][0].getTimeMS()>_8c8){this.iLineNr=this.iPointNr=0;}else{var _8c9=this.aLines[this.aLines.length-1];if(_8c9[_8c9.length-1].getTimeMS()<_8c8){this.iLineNr=this.aLines.length-1;this.iPointNr=_8c9.length-1;}else{for(var i=0,_8cb=this.aLines.length;i<_8cb;i++){var _8cc=this.aLines[i];if(_8cc[0].getTimeMS()<=_8c8&&_8cc[_8cc.length-1].getTimeMS()>=_8c8){this.iLineNr=i;this.iPointNr=this.onLowerPointBound(i,_8c8);break;}}}}};PlayerData.prototype.onLowerPointBound=function(_8cd,_8ce){var _8cf=this.aLines[_8cd];var _8d0=_8cf.length;var _8d1=0;var _8d2=_8d0;var iCur=_8d0>>1;var _8d4=false;var _8d5;var _8d6=null;while(!_8d4){_8d6=_8cf[iCur];_8d5=iCur==_8d0-1;if(_8d5&&_8ce<_8d6.getTimeMS()){iCur=Math.max(iCur-1,0);_8d4=true;}else{if(iCur==0||_8d5||_8ce==_8d6.getTimeMS()){_8d4=true;}else{if(_8ce>_8d6.getTimeMS()){if(_8ce<_8cf[iCur+1].getTimeMS()){_8d4=true;}else{_8d1=iCur;iCur+=(_8d2-_8d1)>>1;}}else{if(_8ce<_8d6.getTimeMS()){if(_8ce>=_8cf[iCur-1].getTimeMS()){_8d4=true;iCur--;}else{_8d2=iCur;iCur-=(_8d2-_8d1)>>1;}}}}}}
return iCur;};PlayerData.prototype.onMoveToPixel=function(_8d7,_8d8){if(this.iLineNr==-1||this.iPointNr==-1){return _8d8;}
var _8d9=false;var _8da=0;var _8db=0;var _8dc=0;var _8dd=this.aLines[this.iLineNr][this.iPointNr];for(_8db=this.aLines.length;this.iLineNr<_8db;this.iLineNr++){var _8de=this.aLines[this.iLineNr];this.iPointNr++;for(_8dc=_8de.length;this.iPointNr<_8dc;this.iPointNr++){var _8df=_8da;var _8e0=_8de[this.iPointNr];if(_8dd!=null){var _8e1=(_8d7-_8dd.getTimeMS())/(_8e0.getTimeMS()-_8dd.getTimeMS());_8d8+=_8e0.getPixDist()*_8e1;_8dd=null;}
_8df+=_8e0.getPixDist();if(_8df>_8d8){this.iPointNr--;_8d9=true;break;}else{_8da=_8df;}}
if(_8d9){break;}else{this.iPointNr=0;}}
if(!_8d9){this.iLineNr=_8db-1;this.iPointNr=_8dc-1;}
return _8d8-_8da;};PlayerData.prototype.onMoveToTime=function(_8e2){var _8e3=false;var _8e4=0;var _8e5=0;for(_8e4=this.aLines.length;this.iLineNr<_8e4;this.iLineNr++){var _8e6=this.aLines[this.iLineNr];for(_8e5=_8e6.length;this.iPointNr<_8e5;this.iPointNr++){if(_8e2<_8e6[this.iPointNr].getTimeMS()){this.iPointNr--;if(this.iPointNr<0){this.iLineNr=Math.max(this.iLineNr-1,0);}
_8e3=true;break;}}
if(_8e3){break;}else{this.iPointNr=0;}}
if(!_8e3){this.iLineNr=_8e4-1;this.iPointNr=_8e5-1;}};PlayerData.prototype.onNextPoint=function(_8e7,_8e8){var _8e9=_8e7;var _8ea=YSDateTime.getCurTime();var _8eb=_8ea-this.iLastRequestTime;var _8ec=false;var _8ed=_8e8==TrackPlayer.AUTO_SPEED;var _8ee=0;var _8ef=_8e7.getTimeMS();if(!_8ed){_8ef+=_8eb*_8e8;}
if(this.iLineNr==-1||this.iPointNr==-1){this.onLowerBound(_8ef);}else{if(!_8ed){this.onMoveToTime(_8ef);}}
if(_8ed){_8ee=this.onMoveToPixel(_8ef,(_8eb/1000)*PlayerData.PIX_PER_SECOND);}
if(this.iLineNr!=-1&&this.iPointNr!=-1){var _8f0=this.aLines[this.iLineNr][this.iPointNr];var _8f1=this.getNextPoint();if(_8f1==null){_8e9=_8f0;_8ec=true;}else{var _8f2=0;var _8f3=_8f1.getTimeDiffMS(_8f0);if(_8ed){_8f2=_8ee/_8f1.getPixDist();}else{_8f2=(_8ef-_8f0.getTimeMS())/_8f3;}
var _8f4=_8ed?_8f0.getTimeMS()+_8f2*_8f3:_8ef;var fLat=_8f0.getLat()+_8f2*_8f1.getLatDiff(_8f0,false);var fLng=_8f0.getLng()+_8f2*_8f1.getLngDiff(_8f0,false);var _8f7=_8f0.getSpeed()+_8f2*_8f1.getSpeedDiff(_8f0);var _8f8=Math.round(_8f0.getHeart()+_8f2*_8f1.getHeartDiff(_8f0));var fAlt=_8f0.getAltitude()+_8f2*_8f1.getAltitudeDiff(_8f0);var _8fa=_8f0.getDistance()+_8f2*_8f1.getDistanceDiff(_8f0);var fPix=_8ed?_8ee:_8f2*_8f1.getPixDist();_8e9=new GPSPoint(_8f4/1000,fLat,fLng,_8f7,_8f8,fAlt,_8fa,fPix);}}else{_8ec=true;}
this.iLastRequestTime=_8ea;return{gpsPoint:_8e9,iElapsedTime:_8eb,bEndOfData:_8ec};};PlayerData.prototype.onNewData=function(_8fc){this.aLines=_8fc;this.iLineNr=-1;this.iPointNr=-1;};PlayerData.prototype.onNewDataAppend=function(_8fd){var _8fe=this.aLines.length;if(_8fe>0&&_8fd.length==1){this.aLines[_8fe-1]=this.aLines[_8fe-1].concat(_8fd[0]);}else{this.onNewData(_8fd);}};PlayerData.prototype.onPlayStart=function(){this.iLastRequestTime=YSDateTime.getCurTime();};PlayerData.prototype.onReset=function(){this.iLineNr=this.iPointNr=-1;};function Track(_8ff,_900,_901,_902){this.sTrackURL=_8ff;this.bLive=isDefined(_902)?_902:false;this.bPlayable=_902||_901;this.bFirstRequest=true;this.bDestructed=false;this.cmdLast=null;this.cmdLastLive=null;this.cmdLastMini=null;this.iLastLiveRequest=0;this.gtrLines=null;this.sTabID=_900;this.iLiveBuffer=4;this.plPlayer=this.bPlayable?new TrackPlayer(this,_902):null;this.toLive=null;this.toMiniLive=null;this.iLastLiveRefreshRequest=0;if(this.bLive){this.onStartLiveRequests(true);}};Track.prototype.destruct=function(_903){this.bDestructed=true;if(this.toLive!=null){this.toLive.cancelTimeout();this.toLive=null;}
if(this.toMiniLive!=null){this.toMiniLive.cancelTimeout();this.toMiniLive=null;}
if(this.plPlayer!=null){this.plPlayer.destruct();this.plPlayer=null;}
if(this.cmdLastLive!=null){this.cmdLastLive.destruct();this.cmdLastLive=null;}
if(this.cmdLastMini!=null){this.cmdLastMini.destruct();this.cmdLastMini=null;}
if(this.cmdLast!=null){this.cmdLast.destruct();this.cmdLast=this.gtrLines=null;}else{if(this.gtrLines!=null){if(!isDefined(_903)||_903){this.gtrLines.removeLines();}
this.gtrLines.destruct();this.gtrLines=null;}}};Track.prototype.getDuration=function(){if(this.plPlayer==null){return 0;}else{return this.plPlayer.getDuration();}};Track.prototype.getLiveBuffer=function(){return this.iLiveBuffer;};Track.prototype.getTabID=function(){return this.sTabID;};Track.prototype.getURL=function(){return this.sTrackURL;};Track.prototype.isAuto3D=function(){return this.plPlayer!=null&&this.plPlayer.isAuto3D();};Track.prototype.isLive=function(){return this.bLive;};Track.prototype.isPlaying=function(){return this.plPlayer!=null&&this.plPlayer.isPlaying();};Track.prototype.onAuto3DChange=function(obj,_905){if(this.plPlayer!=null){this.plPlayer.onAuto3DChange(obj,_905);}};Track.prototype.onBirdsEyeAvailable=function(_906){if(this.plPlayer!=null){this.plPlayer.onBirdsEyeAvailable(_906);}};Track.prototype.onCommandResult=function(_907,_908){if(_908){this.iLiveBuffer=_907.getLiveBuffer();var oID=_907.getCommandID();if(oID.showentiretrack){MapManager.getCurMap(this.sTabID).setViewPort(_907.getViewPort());}else{if(oID.live){this.plPlayer.onNewLivePoints(_907.getRequest(1),true);this.cmdLastLive=null;}else{_907.drawRequests();if(oID.timevp||this.gtrLines==null){return;}
if(oID.minilive){_907.applyViewPort(1);this.cmdLastMini=null;return;}
this.bFirstRequest=false;this.gtrLines.setAllowDestruct(false);if(GraphPage.hasMiniGraph()){var _90a=_907.getRequest(oID.minioverlay);if(_90a!=null){GraphPage.setMiniShades(this.gtrLines.getTimes(this.sTrackURL));}}
if(this.plPlayer!=null){if(oID.liverefresh){var _90b=this.gtrLines.getLastPoint(this.sTrackURL);if(_90b!=null){this.plPlayer.onNewLivePoints(_907.getRequest(oID.livereqnr),false,_90b);}
_907.applyViewPort(oID.minireqnr);}else{this.plPlayer.onNewPoints(this.gtrLines);if(this.bLive){var _90c=this.gtrLines.getMap();if(_90c!=null){_90c.setZoomCenter(18,this.plPlayer.getCurPoint());}}}}
this.cmdLast=null;}}}else{this.gtrLines=null;}};Track.prototype.onLiveChange=function(_90d){var _90e=this.bLive;this.bLive=_90d;if(this.plPlayer!=null){this.plPlayer.onLiveChange(_90d);}
if(_90e&&!_90d){if(this.toLive!=null){this.toLive.cancelTimeout();this.toLive=null;}
if(this.toMiniLive!=null){this.toMiniLive.cancelTimeout();this.toMiniLive=null;}
this.onPlay(null,false);this.onShowEntireTrack();}else{if(!_90e&&_90d){MapManager.getCurMap(this.sTabID).setZoomCenter(18,this.plPlayer.getLastPoint());this.onPlay(null,true,true);}}};Track.prototype.onLiveRequest=function(){if(YSDateTime.getCurTime()-this.iLastLiveRefreshRequest>10000){this.onViewChanged(MapManager.getCurMap(this.sTabID));}else{var _90f=this.plPlayer.getLastPoint();if(_90f==null){return;}
var iNow=YSDateTime.getCurTime();if(this.cmdLastLive!=null){if(iNow-this.iLastLiveRequest<10000){return;}else{this.cmdLastLive.destruct();}}
this.iLastLiveRequest=iNow;this.cmdLastLive=new GetTrackCommand(this,this.sTrackURL);this.cmdLastLive.setCommandID({live:true});var _911=new GetTrackRequest(1,MapManager.getCurMap(TrackPage.getMapTabID(this.sTrackURL)));_911.setTimeBounds(_90f.getTime());this.cmdLastLive.addRequest(_911);this.cmdLastLive.sendRequest();}};Track.prototype.onMapMoveStart=function(){if(this.plPlayer!=null){this.plPlayer.onMapMoveStart();}};Track.prototype.onMapRemove=function(_912){};Track.prototype.onMapTypeChanged=function(_913,mpTo){if(this.plPlayer!=null){this.plPlayer.onMapTypeChanged(_913,mpTo);}
this.onRedraw(mpTo);};Track.prototype.onMiniLiveRequest=function(){var _915=MapManager.getMiniMap();if(_915!=null){if(this.cmdLastMini!=null){this.cmdLastMini.destruct();}
this.cmdLastMini=new GetTrackCommand(this,this.sTrackURL);var _916=new GetTrackRequest(1,_915,true);var oVP=GraphPage.getViewPort();if(oVP!=null){_916.setTimeBounds(oVP.iMaxX-7200);}
this.cmdLastMini.addRequest(_916);_916=new GetTrackRequest(2,_915);if(oVP!=null){_916.setTimeBounds(oVP.iMinX,oVP.iMaxX);this.cmdLastMini.addRequest(_916);}else{_916.useInnerViewPort(true);}
this.cmdLastMini.includeViewPort(true);this.cmdLastMini.sendRequest();}};Track.prototype.onPlay=function(obj,_919,_91a){if(this.plPlayer!=null){this.plPlayer.onPlay(obj,_919,_91a);if(_91a==true){if(_919==true&&this.toLive==null){this.onStartLiveRequests();if(this.toMiniLive!=null){this.toMiniLive.cancelTimeout();this.toMiniLive=null;}}else{if(_919==false&&this.toLive!=null){this.toLive.cancelTimeout();this.toLive=null;if(this.toMiniLive==null){this.toMiniLive=new YSTimeout(4000,Track.prototype.onMiniLiveRequest,this,null,true);this.onMiniLiveRequest();}}}}}};Track.prototype.onRedraw=function(mpTo){if(this.gtrLines!=null&&this.gtrLines.hasResult()){this.gtrLines.setMap(mpTo);this.gtrLines.drawLines();if(this.bLive&&this.plPlayer!=null){this.plPlayer.onRedrawLive(mpTo);}}else{this.onViewChanged(mpTo);}};Track.prototype.onResetPlay=function(){if(this.plPlayer!=null){this.plPlayer.onResetPlay();}};Track.prototype.onShowEntireTrack=function(){var gtc=new GetTrackCommand(this,this.sTrackURL);gtc.setCommandID({showentiretrack:true});gtc.includeViewPort(true);gtc.sendRequest();};Track.prototype.onStartLiveRequests=function(_91d){if(!_91d||MapManager.getCurMap(this.sTabID)!=null){this.onLiveRequest();}
this.toLive=new YSTimeout(2000,Track.prototype.onLiveRequest,this,null,true);};Track.prototype.onTimeVPChanged=function(oVP){var _91f=MapManager.getMiniMap();if(_91f!=null){var _920=new GetTrackCommand(this,this.sTrackURL);var _921=new GetTrackRequest(1,_91f);_921.setTimeBounds(oVP.iMinX,oVP.iMaxX);_921.useInnerViewPort();_920.addRequest(_921);_920.setCommandID({timevp:true});_920.sendRequest();}};Track.prototype.onViewChanged=function(_922){if(isPageLoaded(Track.prototype.onViewChanged,this,_922)&&!this.bDestructed){var _923=this.bLive&&!this.bFirstRequest;if(this.plPlayer!=null){this.plPlayer.onViewChanged(_922);}
if(this.cmdLast!=null){this.cmdLast.destruct();}else{if(this.gtrLines!=null){this.gtrLines.destruct();}}
var _924=1;var _925=_923?this.plPlayer.getCurPoint().getTime():0;this.cmdLast=new GetTrackCommand(this,this.sTrackURL);this.gtrLines=new GetTrackRequest(_924++,_922);if(this.bLive&&this.bFirstRequest){this.gtrLines.setTimeBounds(0,-4);}else{this.gtrLines.useOuterViewPort(true);}
if(this.bPlayable&&!this.bLive){this.gtrLines.includePixels();}
if(_923){this.iLastLiveRefreshRequest=YSDateTime.getCurTime();this.gtrLines.setTimeBounds(_925-7200,_925);this.cmdLast.setCommandID({liverefresh:true});}
this.cmdLast.addRequest(this.gtrLines);var _926=MapManager.getMiniMap();if(this.bPlayable&&_926!=null){var _927=_922.getViewPort();if(this.bFirstRequest||_923){this.cmdLast.includeViewPort(true);this.cmdLast.setCommandID({minireqnr:_924});var _928=new GetTrackRequest(_924++,_926,true);if(_923){_928.setTimeBounds(_925-7200);}
if(this.bFirstRequest){_928.setViewPortToUse(_927);}
this.cmdLast.addRequest(_928);}
this.cmdLast.setCommandID({minioverlay:_924});var _928=new GetTrackRequest(_924++,_926);if(_923){_928.setTimeBounds(_925-7200);}
_928.setViewPortToUse(_927);this.cmdLast.addRequest(_928);}
if(_923){this.cmdLast.setCommandID({livereqnr:_924});var _929=new GetTrackRequest(_924++,_922);_929.setTimeBounds(_925-1);_929.setAllowDrawing(false);this.cmdLast.addRequest(_929);}
this.cmdLast.sendRequest();}};Track.prototype.setPlaySpeed=function(_92a){if(this.plPlayer!=null){return this.plPlayer.setPlaySpeed(_92a);}else{return false;}};function TrackPlayer(_92b,_92c){this.trTrack=_92b;this.bLive=_92c;this.iPlaySpeed=_92c?1:TrackPlayer.AUTO_SPEED;this.sTrackURL=this.trTrack.getURL();this.sTabID=this.trTrack.getTabID();this.bMilitary=location.href.indexOf("military.html");this.aTempLines={};this.aTempLines[this.sTrackURL]=[];this.aTempLines[this.sTrackURL][0]=[];this.aTempPoints=this.aTempLines[this.sTrackURL][0];var _92d=Tabs.getCurTab()==null||Tabs.getCurTabID()==this.sTabID;this.bPlaying=_92d?(_92c?true:false):false;if(this.sTrackURL=="military-boekelo-demo"){this.bPlaying=true;this.iPlaySpeed=1;YSDOM.getObj("playbutton").className="pause";}
this.bWaitForMoveEnd=false;this.bWaitForLines=false;this.bCheckBirdsEye=false;this.bAuto3D=true;this.bBirdsEyeShown=false;this.iMvtTill3D=0;this.iTimePlayAllowed=0;this.iLastZoomOutTime=0;this.iLastStatShowTime=0;this.bZoomOut=false;this.oMarker=null;this.vpMapViewPort=null;this.vpAlteredVP=null;this.gpsCurPoint=null;this.gpsFirstPoint=null;this.gpsLastPoint=null;this.pdData=new PlayerData();this.iMinBuffer=TrackPage.getLiveBuffer();this.bWaitingForData=false;this.iTimeout=150;this.toRun=new YSTimeout(this.iTimeout,TrackPlayer.prototype.run,this);YSDOM.getObj("playbutton").className=this.bLive?"pause":"play";};TrackPlayer.AUTO_SPEED=-1;TrackPlayer.MAX_PIX_PER_MS=0.25;TrackPlayer.BORDER_SIZE=50;TrackPlayer.BORDER_SIZE_BE=15;TrackPlayer.BORDER_SIZE_MIL=75;TrackPlayer.BORDER_SIZE_BE_MIL=30;TrackPlayer.prototype.destruct=function(){this.toRun.cancelTimeout();this.toRun=null;this.gpsCurPoint=this.gpsFirstPoint=this.gpsLastPoint=null;this.vpMapViewPort=this.vpAlteredVP=null;var _92e=MapManager.getCurMap(this.sTabID);if(this.oMarker!=null){_92e.removeMarker(this.oMarker);this.oMarker=null;}
_92e.clearTempLines(this.aTempLines);this.aTempLines=null;this.trTrack=null;};TrackPlayer.prototype.getCurPoint=function(){return this.gpsCurPoint;};TrackPlayer.prototype.getDuration=function(){if(this.gpsFirstPoint==null||this.gpsLastPoint==null){return 0;}else{return this.gpsLastPoint.getTimeDiff(this.gpsFirstPoint);}};TrackPlayer.prototype.getLastPoint=function(){return this.gpsLastPoint;};TrackPlayer.prototype.isAuto3D=function(){return this.bAuto3D;};TrackPlayer.prototype.isPlaying=function(){return this.bPlaying;};TrackPlayer.prototype.onAlterVP=function(_92f,_930){var _931=_930.getDegPerPix();var bBE=MapManager.isBirdseyeShown(this.sTabID);var _933=bBE?TrackPlayer.BORDER_SIZE_BE:TrackPlayer.BORDER_SIZE;var _934=_933*_931.lngperpix;var _935,_936;if(this.bMilitary){_936=(bBE?TrackPlayer.BORDER_SIZE_BE_MIL:TrackPlayer.BORDER_SIZE_MIL)*_931.latperpix;_935=(bBE?TrackPlayer.BORDER_SIZE_BE-5:TrackPlayer.BORDER_SIZE-20)*_931.latperpix;}else{_935=_936=_933*_931.latperpix;}
var llSW=_92f.getSW();var llNE=_92f.getNE();llSW.setLat(llSW.getLat()+_935);llSW.setLng(llSW.getLng()+_934);llNE.setLat(llNE.getLat()-_936);llNE.setLng(llNE.getLng()-_934);_92f.storeDiffs();};TrackPlayer.prototype.onAuto3DChange=function(obj,_93a){this.bAuto3D=isDefined(_93a)?_93a:!this.bAuto3D;if(!isDefined(obj)||obj==null){obj=YSDOM.getObj("auto3dbutton");}
obj.className=this.bAuto3D?"auto3d":"noauto3d";if(this.bPlaying){this.bCheckBirdsEye=true;}};TrackPlayer.prototype.onBirdsEyeAvailable=function(_93b){if(this.bPlaying&&this.bAuto3D){if(_93b){if(this.iMvtTill3D<=0){this.bWaitForLines=true;var _93c=YSListbox.GetLst("lstTrackMapStyle");if(_93c!=null){_93c.setKey("3");this.bBirdsEyeShown=true;}}}else{if(this.bBirdsEyeShown){this.bBirdsEyeShown=false;this.iMvtTill3D=2;}}}};TrackPlayer.prototype.onCheckViewPort=function(_93d){if(_93d.isMoving()){return;}
var _93e=_93d.getViewPort();if(!_93e.equals(this.vpMapViewPort)){this.vpMapViewPort=_93e;_93e=_93e.getCopy();this.onAlterVP(_93e,_93d);this.vpAlteredVP=_93e;}else{_93e=this.vpAlteredVP;}
if(!_93e.contains(this.gpsCurPoint)){this.bWaitForMoveEnd=true;var _93f=_93e.getCenter();var _940=this.gpsCurPoint.getLat()-_93f.getLat();var _941=this.gpsCurPoint.getLng()-_93f.getLng();var _942=0,_943=0;if(Math.abs(_940)<_93e.getLatDiff()*0.2){_943=_93e.getLngDiff()*0.5;}else{if(Math.abs(_941)<_93e.getLngDiff()*0.2){_942=_93e.getLatDiff()*0.5;}else{_942=Math.min(Math.abs(_940),0.5*_93e.getLatDiff());_943=Math.min(Math.abs(_941),0.5*_93e.getLngDiff());}}
if(this.bMilitary){_942-=_93e.getNE().getLatDiff(this.vpMapViewPort.getNE())-_93e.getSW().getLatDiff(this.vpMapViewPort.getSW());}
if(_940<0){_942*=-1;}
if(_941<0){_943*=-1;}
var _944=0.9;if(MapManager.isBirdseyeShown(this.sTabID)){_944=0.5;}
_93f.setLat(this.gpsCurPoint.getLat()+_942*_944);_93f.setLng(this.gpsCurPoint.getLng()+_943*_944);_93d.setCenterSmooth(_93f);return true;}
return false;};TrackPlayer.prototype.onLiveChange=function(_945){var _946=this.bLive;this.bLive=_945;if(_946&&!_945){if(this.oMarker!=null){MapManager.getCurMap(this.sTabID).removeMarker(this.oMarker);this.oMarker=null;}
this.pdData.onNewData([]);this.iPlaySpeed=TrackPlayer.AUTO_SPEED;}else{if(!_946&&_945){this.iPlaySpeed=1;this.gpsCurPoint=this.gpsLastPoint;}}};TrackPlayer.prototype.onMapMoveStart=function(){this.bWaitForMoveEnd=true;};TrackPlayer.prototype.onMapTypeChanged=function(_947,mpTo){mpTo.removeMarker(this.oMarker);if(_947!=null){_947.removeMarker(this.oMarker);}
this.oMarker=mpTo.addTrackMarker(this.sTrackURL,this.gpsCurPoint);};TrackPlayer.prototype.onNewPoints=function(_949){var _94a=this.oMarker==null;if(_94a){this.gpsFirstPoint=_949.getFirstPoint(this.sTrackURL);this.gpsLastPoint=_949.getLastPoint(this.sTrackURL);this.gpsCurPoint=this.bLive?this.gpsLastPoint:this.gpsFirstPoint;if(this.bLive){this.aTempPoints.push(this.gpsCurPoint);this.onShowStats();}
var _94b=MapManager.getCurMap(this.sTabID);if(_94b!=null){this.oMarker=MapManager.getCurMap(this.sTabID).addTrackMarker(this.sTrackURL,this.gpsCurPoint);if(this.isPlaying()){this.pdData.onPlayStart();}}}
if(_94a||!this.bLive){this.pdData.onNewData(_949.getLinePoints(this.sTrackURL));if(this.bWaitForLines){this.pdData.onPlayStart();this.bWaitForLines=false;}}};TrackPlayer.prototype.onNewLivePoints=function(_94c,_94d,_94e){if(_94c==null){return;}
var _94f=_94c.getLinePoints(this.sTrackURL);if(_94f.length==0){return;}
this.iMinBuffer=TrackPage.getLiveBuffer();this.gpsLastPoint=_94c.getLastPoint(this.sTrackURL);if(_94d){this.pdData.onNewDataAppend(_94f);}else{var _950=_94e.getTime();var _951=[];for(var i=this.aTempPoints.length-1;i>=0;i--){if(this.aTempPoints[i].getTime()>_950){_951.unshift(this.aTempPoints[i]);}}
_951.unshift(_94e);this.aTempPoints=this.aTempLines[this.sTrackURL][0]=_951;var _953=MapManager.getCurMap(this.sTabID);if(_953!=null){_953.replaceTempLines(this.aTempLines,7);}
this.pdData.onNewData(_94f);}};TrackPlayer.prototype.onPlay=function(obj,_955,_956){if(this.bLive&&!_956){return;}
this.bPlaying=isDefined(_955)?_955:!this.bPlaying;if(!isDefined(obj)||obj==null){obj=YSDOM.getObj("playbutton");}
obj.className=this.bPlaying?"pause":"play";if(this.bPlaying){this.bCheckBirdsEye=true;this.pdData.onPlayStart();}};TrackPlayer.prototype.onRedrawLive=function(_957){if(_957!=null){_957.replaceTempLines(this.aTempLines,7);}};TrackPlayer.prototype.onResetPlay=function(){if(this.bLive){return;}
this.onPlay(null,false);this.iMvtTill3D=0;if(this.gpsCurPoint!=null&&!this.gpsCurPoint.equals(this.gpsFirstPoint)){var _958=MapManager.getCurMap(this.sTabID);this.gpsCurPoint=this.gpsFirstPoint;if(this.vpMapViewPort==null||!this.vpMapViewPort.contains(this.gpsCurPoint)){_958.setCenterSmooth(this.gpsCurPoint);}else{this.pdData.onReset();}
if(this.oMarker!=null){_958.setMarkerLatLng(this.oMarker,this.gpsCurPoint);}
this.onResetStats();}};TrackPlayer.prototype.onResetStats=function(){YSDOM.setValue("statspeed","-.-");YSDOM.setValue("statpace","--:--");YSDOM.setValue("statduration","--:--:--");YSDOM.setValue("statheart","--");YSDOM.setValue("stataltitude","--");YSDOM.setValue("statdistance","-.-");};TrackPlayer.prototype.onShowStats=function(){var bKM=SettingsBar.isKM();var _95a=this.gpsCurPoint.getSpeed();var _95b=Math.round(Math.min(1200,3600/_95a));var _95c=this.gpsCurPoint.getHeart();var fAlt=this.gpsCurPoint.getAltitude()/(bKM?1:SettingsBar.MPERFT);var _95e=this.gpsCurPoint.getDistance()/(bKM?1:SettingsBar.KMPERMILE);var _95f=this.gpsCurPoint.getTime()-this.gpsFirstPoint.getTime();if(_95a==-1){YSDOM.setValue("statspeed","-.-");YSDOM.setValue("statpace","--:--");YSDOM.setValue("statduration","--:--:--");}else{if(!bKM){_95a/=SettingsBar.KMPERMILE;}
YSDOM.setValue("statspeed",YSNumbers.roundNumber(_95a,1,false));if(_95b==1200){YSDOM.setValue("statpace","--:--");}else{YSDOM.setValue("statpace",YSDateTime.getTimeString(_95b,false));}
YSDOM.setValue("statduration",YSDateTime.getTimeString(_95f));if(this.bLive){YSDOM.setValue("detailduration",YSDateTime.getTimeString(_95f));}}
YSDOM.setValue("statheart",_95c==0?"--":_95c);YSDOM.setValue("stataltitude",fAlt==0?"--":Math.round(fAlt));YSDOM.setValue("statdistance",YSNumbers.roundNumber(_95e,1,false));};TrackPlayer.prototype.onViewChanged=function(_960){if(this.bWaitForMoveEnd){if(!this.bLive){this.pdData.onPlayStart();}
this.bWaitForMoveEnd=false;}
this.iMvtTill3D--;};TrackPlayer.prototype.run=function(){var _961=YSDateTime.getCurTime();if(this.bPlaying&&_961>=this.iTimePlayAllowed&&(this.bLive||!this.bWaitForMoveEnd&&!this.bWaitForLines)&&this.oMarker!=null){try{var _962=MapManager.getCurMap(this.sTabID);if(this.bLive&&this.bWaitingForData){var _963=this.gpsLastPoint.getTimeMS()-this.gpsCurPoint.getTimeMS();if(_963<this.iMinBuffer*1000){this.iTimePlayAllowed=_961+500;this.pdData.onChangeTime(500);}else{YSLog.write("Map Enough: "+_963+" ms");this.bWaitingForData=false;}}else{if(this.gpsCurPoint.getTimeMS()>=this.gpsLastPoint.getTimeMS()){if(this.bLive){this.iTimePlayAllowed=_961+500;this.pdData.onChangeTime(500);this.bWaitingForData=true;YSLog.write("Map WAIT for "+this.iMinBuffer+" seconds of data");}else{this.gpsCurPoint=this.gpsFirstPoint;if(this.vpMapViewPort==null||!this.vpMapViewPort.contains(this.gpsCurPoint)){this.bWaitForLines=true;_962.setCenterSmooth(this.gpsCurPoint);}else{this.pdData.onReset();}
this.onShowStats();}}else{if(!_962.getOuterViewPort().contains(this.gpsCurPoint)){this.bWaitForLines=true;_962.setCenterSmooth(this.gpsCurPoint);}else{if(this.bCheckBirdsEye){if(!MapManager.isBirdseyeShown(this.sTabID)){MapManager.onCheckBirdsEye(this.sTabID);_962=MapManager.getCurMap(this.sTabID);}else{if(!this.bAuto3D){MapManager.onBirdsEyeAvailable(MapManager.getMSMap(this.sTabID),false);}}
this.bCheckBirdsEye=false;}
if(this.bZoomOut&&_961-this.iLastZoomOutTime>1500){this.iLastZoomOutTime=_961;this.bZoomOut=false;_962.zoomOut();}
var _964=this.pdData.onNextPoint(this.gpsCurPoint,this.iPlaySpeed);var _963=this.gpsLastPoint.getTimeMS()-_964.gpsPoint.getTimeMS();var _965=_963==0;if(!this.bLive&&_962.getZoomLevel()>1&&((_964.bEndOfData&&!_965)||(this.iPlaySpeed!=TrackPlayer.AUTO_SPEED&&_962.getPixDiff(_964.gpsPoint,this.gpsCurPoint)/_964.iElapsedTime>TrackPlayer.MAX_PIX_PER_MS))){if(_964.bEndOfData){this.bWaitForLines=true;}else{this.bWaitForMoveEnd=true;}
this.bZoomOut=true;}
this.gpsCurPoint=_964.gpsPoint;if(_961-this.iLastStatShowTime>(this.bLive?1000:250)){this.iLastStatShowTime=_961;this.onShowStats();}
if(this.bLive){if(this.aTempPoints.length==0||_962.getPixDiff(this.gpsCurPoint,this.aTempPoints[this.aTempPoints.length-1])>=3.5){this.aTempPoints.push(this.gpsCurPoint);_962.replaceTempLines(this.aTempLines,7);}
if(_963>(this.iMinBuffer+TrackPage.BUFFER_MARGE)*1000){this.pdData.onChangeTime(this.iMinBuffer*1000-_963);YSLog.write("Map SKIP "+(_963-this.iMinBuffer*1000)+" ms");}}
this.onCheckViewPort(_962);if(_965){this.gpsCurPoint=this.gpsLastPoint;this.onShowStats();this.onPlay(null,false);}}}}
_962.setMarkerLatLng(this.oMarker,this.gpsCurPoint);}
catch(e){if(DEBUG_MODE){YSDebug.print_r(e);}}
this.iTimeout=75;}else{this.iTimeout=125;}
this.toRun=new YSTimeout(this.iTimeout,TrackPlayer.prototype.run,this);};TrackPlayer.prototype.setPlaySpeed=function(_966){if(this.bLive){return false;}
if(_966<0){this.iPlaySpeed=TrackPlayer.AUTO_SPEED;}else{if(_966>0){this.iPlaySpeed=_966;}}
return true;};function SchedulePage(){this.iProgramID=0;this.iScheduleID=0;this.iSessionID=0;this.sTabID="schedule";this.sgGraph=null;this.bPreviewShown=false;this.oHidePreview=null;this.oFold=this.oUnFold=null;this.FOLD_DURATION=500;};SchedulePage.prototype.destruct=function(){if(this.sgGraph!=null){this.sgGraph.destruct();this.sgGraph=null;}};SchedulePage.prototype.getExtraParams=function(){return"wscheduleid="+this.iScheduleID+"&wsessionid="+this.iSessionID;};SchedulePage.prototype.isPreviewShown=function(){return this.bPreviewShown;};SchedulePage.prototype.onFold=function(_967,_968){var _969=Math.min(1,_968/SchedulePage.FOLD_DURATION);if(_969==1){YSCSS.addClassName(_967.type+"preview","hide");if(this.oFold!=null&&this.oFold.type==_967.type){this.oFold=null;}
return false;}else{var _96a=_967.totalheight*(1-_969);YSCSS.setStyle("previewcontent"+_967.type,"height",_96a+"px");}};SchedulePage.prototype.onHidePreview=function(_96b){var _96c=0;var _96d="auto";if(this.oUnFold!=null){_96c=SchedulePage.FOLD_DURATION-this.oUnFold.timeout.getTimePassed();_96d=YSCSS.getInnerHeight("previewcontent"+this.oUnFold.type)+"px";this.oUnFold.timeout.cancelTimeout();this.oUnFold=null;}
var sID="previewcontent"+_96b;YSCSS.setStyle(sID,"height","auto");var _96f=YSCSS.getInnerHeight(sID);YSCSS.setStyle(sID,"height",_96d);this.oFold={type:_96b,timeout:new YSTimeout(30,SchedulePage.onFold,this,{type:_96b,totalheight:_96f},true,_96c)};this.bPreviewShown=false;this.oHidePreview=null;};SchedulePage.prototype.onHidePreviewDirect=function(_970){YSCSS.addClassName(_970+"preview","hide");this.bPreviewShown=false;};SchedulePage.prototype.onLoad=function(){Tabs.onCacheTab(this.sTabID);TrackPage.onCheckOnLoadHash();};SchedulePage.prototype.onLoadSchedule=function(_971){this.iScheduleID=_971;this.onReloadTab();};SchedulePage.prototype.onLoadSession=function(_972){this.iSessionID=_972;this.onReloadTab();};SchedulePage.prototype.onMouseOver=function(e,obj){var _975=obj.id=="zonepreview"||obj.id=="zonebuttonevent"?"zone":"line";var _976=-1;var _977="1px";if(this.oUnFold!=null){_976=this.oUnFold.timeout.getTimePassed();_977=YSCSS.getInnerHeight("previewcontent"+this.oUnFold.type)+"px";this.onHidePreviewDirect(this.oUnFold.type);this.oUnFold.timeout.cancelTimeout();this.oUnFold=null;}
if(this.oFold!=null){_976=SchedulePage.FOLD_DURATION-this.oFold.timeout.getTimePassed();_977=YSCSS.getInnerHeight("previewcontent"+this.oFold.type)+"px";this.onHidePreviewDirect(this.oFold.type);this.oFold.timeout.cancelTimeout();this.oFold=null;}
if(this.oHidePreview!=null){this.onHidePreviewDirect(this.oHidePreview.type);this.oHidePreview.timeout.cancelTimeout();this.oHidePreview=null;if(_976==-1){_976=SchedulePage.FOLD_DURATION;_977="auto";}}
if(_976<0){_976=0;}
var _978=YSDOM.getObj(_975+"preview");if(_978==null){return;}
if(_978.parentNode!=document.body){document.body.appendChild(_978);}
var _979=YSDOM.getElementPosition("addcontrols").left+70;var iTop=YSCSS.getStyle("addbutton"+_975,"height",true)+YSDOM.getElementPosition("addbutton"+_975).top;YSDOM.setPosition(_978,new Pixel(_979,iTop));YSCSS.removeClassName(_978,"hide");var sID="previewcontent"+_975;YSCSS.setStyle(sID,"height","auto");var _97c=YSCSS.getInnerHeight(sID);YSCSS.setStyle(sID,"height",_977);this.oUnFold={type:_975,timeout:new YSTimeout(30,SchedulePage.onUnFold,this,{totalheight:_97c,type:_975},true,_976)};this.bPreviewShown=true;};SchedulePage.prototype.onMouseOut=function(e,obj){var _97f;if(obj.id=="zonepreview"||obj.id=="zonebuttonevent"){_97f="zone";}else{_97f="line";}
if(YSCSS.hasClassName(_97f+"preview","hide")){return;}
this.oHidePreview={type:_97f,timeout:new YSTimeout(200,SchedulePage.onHidePreview,this,_97f)};};SchedulePage.prototype.onReloadTab=function(){if(this.sgGraph!=null){this.sgGraph.destruct();this.sgGraph=null;}
Tabs.onReload(this.sTabID,this.getExtraParams());};SchedulePage.prototype.onSessionLoaded=function(_980){this.sgGraph=new SessionGraph(_980);};SchedulePage.prototype.onUnFold=function(_981,_982){var _983=Math.min(1,_982/SchedulePage.FOLD_DURATION);if(_983==1){YSCSS.setStyle("previewcontent"+_981.type,"height","auto");if(this.oUnFold!=null&&this.oUnFold.type==_981.type){this.oUnFold=null;}
return false;}else{var _984=Math.round(_981.totalheight*_983);YSCSS.setStyle("previewcontent"+_981.type,"height",_984+"px");}};SchedulePage.prototype.onZoomIn=function(){if(this.sgGraph!=null){this.sgGraph.onZoomIn();}};SchedulePage.prototype.onZoomOut=function(){if(this.sgGraph!=null){this.sgGraph.onZoomOut();}};var SchedulePage=new SchedulePage();function SessionGraph(_985){SessionGraph.sgCur=this;this.iVersion=0;this.oRequest=null;this.aSendQueue=new Array();this.bKM=true;this.bTimeBased=_985;this.iHeartMethod=1;this.oVP={minx:0,maxx:0,miny1:0,maxy1:0,miny2:0,maxy2:0};this.fMaxX=0;this.fIntensityPerSpeed=1;this.fZoladzPerHeart=1;this.iUserMinHeart=75;this.iLineType1=SessionGraph.TYPE_NONE;this.iLineType2=SessionGraph.TYPE_NONE;this.iCurLineType=SessionGraph.TYPE_NONE;this.aLines={};this.aYValueNames=["",""];this.aGridZones={};this.aSpecificZones={};this.oGraphHolder=YSDOM.getObj("wsgraph");YSDOM.removeElementChilds(this.oGraphHolder);this.dwDrawer=Graph.VML?new WSVML(this,_985):new WSSVG(this,_985);this.dwDrawer.onInit(this.oGraphHolder);this.dwDrawer.onShowLoading(false);this.bInitExpected=true;this.onSendRequest("oninit=1");};SessionGraph.sgCur=null;SessionGraph.TYPE_NONE=0;SessionGraph.TYPE_INTENSITYLINE=1;SessionGraph.TYPE_INTENSITYZONE=2;SessionGraph.TYPE_SPEEDLINE=3;SessionGraph.TYPE_SPEEDZONE=4;SessionGraph.TYPE_PACELINE=5;SessionGraph.TYPE_PACEZONE=6;SessionGraph.TYPE_HEARTPERCLINE=7;SessionGraph.TYPE_HEARTPERCZONE=8;SessionGraph.TYPE_HEARTLINE=9;SessionGraph.TYPE_HEARTZONE=10;SessionGraph.TYPE_KARVONENLINE=11;SessionGraph.TYPE_KARVONENZONE=12;SessionGraph.TYPE_ZOLADZLINE=13;SessionGraph.TYPE_ZOLADZZONE=14;SessionGraph.METHOD_USER=1;SessionGraph.METHOD_HASKELL=2;SessionGraph.METHOD_KARVONEN=3;SessionGraph.METHOD_ZOLADZ=4;SessionGraph.MAX_PACE=1800;SessionGraph.MAX_SPEED=100;SessionGraph.MIN_PACE=30;SessionGraph.OnZoneboxChange=function(_986,sKey){var _988=document.createElement("div");_988.innerHTML=_986.getValue();_986.getSelector().firstChild.childNodes[1].innerHTML=_988.childNodes[1].innerHTML;};SessionGraph.prototype.destruct=function(){SessionGraph.sgCur=null;this.onDestructControls();this.onDestructSettings();this.onDestructViewControls();this.dwDrawer.destruct();this.dwDrawer=null;this.oGraphHolder=null;this.onDestructLines();this.aLines=null;this.aYValueNames=null;this.aGridZones=null;this.aSpecificZones=null;this.oVP=null;};SessionGraph.prototype.getCurLineType=function(){return this.iCurLineType;};SessionGraph.prototype.getGridZones=function(_989){if(!isDefined(_989)){_989=this.iCurLineType;}
return this.aSpecificZones[_989];};SessionGraph.prototype.getIntensityPerSpeed=function(){return this.fIntensityPerSpeed;};SessionGraph.prototype.getLeftLineType=function(){return this.iLineType1;};SessionGraph.prototype.getLine=function(_98a){if(!isDefined(_98a)){_98a=this.iCurLineType;}
if(isDefined(this.aLines[_98a])){return this.aLines[_98a];}else{return null;}};SessionGraph.prototype.getLines=function(){return this.aLines;};SessionGraph.prototype.getMaxX=function(){return this.fMaxX;};SessionGraph.prototype.getPace=function(_98b){return Math.min(SessionGraph.MAX_PACE,Math.max(SessionGraph.MIN_PACE,Math.round(3600/_98b)));};SessionGraph.prototype.getRightLineType=function(){return this.iLineType2;};SessionGraph.prototype.getSimilarValues=function(_98c,_98d,_98e,_98f){var _990=this.getLine(_98f?this.iLineType1:this.iLineType2);if(_990==null){return{miny:0,maxy:0};}
var _991=_98e.maxy-_98e.miny;var _992=_990.maxy-_990.miny;var _993=_98f?this.oVP.miny1:this.oVP.miny2;var _994=_98f?this.oVP.maxy1:this.oVP.maxy2;var _995=((_98d-_98c)/_991)*_992;var _996=Math.max(((_98c-_98e.miny)/_991)*_992+_990.miny,_990.miny);return{miny:_996,maxy:_996+_995};};SessionGraph.prototype.getBPM=function(_997){var _998=_997/this.fZoladzPerHeart;return Math.round(this.getGridZones(SessionGraph.TYPE_HEARTLINE).miny+_998);};SessionGraph.prototype.getSpeed=function(_999){var _99a=_999/this.fIntensityPerSpeed;return this.getGridZones(SessionGraph.TYPE_SPEEDLINE).miny+_99a;};SessionGraph.prototype.getValueName=function(_99b){var _99c=_99b?0:1;if(this.aYValueNames[_99c]!=""){return this.aYValueNames[_99c];}else{var _99d=YSListbox.GetValue("lstSessionLine"+(_99c+1));if(_99d==""){_99d=YSDOM.getObj("lstSessionLine"+(_99c+1)).firstChild.innerHTML;}
var _99e=document.createElement("div");_99e.innerHTML=_99d;var _99f=_99e.childNodes[1].innerHTML;this.aYValueNames[_99c]=_99f;return _99f;}};SessionGraph.prototype.getVP=function(){return this.oVP;};SessionGraph.prototype.isHeart=function(_9a0){return _9a0==SessionGraph.TYPE_HEARTPERCLINE||_9a0==SessionGraph.TYPE_HEARTPERCZONE||_9a0==SessionGraph.TYPE_HEARTLINE||_9a0==SessionGraph.TYPE_HEARTZONE||_9a0==SessionGraph.TYPE_KARVONENLINE||_9a0==SessionGraph.TYPE_KARVONENZONE||_9a0==SessionGraph.TYPE_ZOLADZLINE||_9a0==SessionGraph.TYPE_ZOLADZZONE;};SessionGraph.prototype.isHeartBPM=function(_9a1){return _9a1==SessionGraph.TYPE_HEARTLINE||_9a1==SessionGraph.TYPE_HEARTZONE;};SessionGraph.prototype.isIntensity=function(_9a2){return _9a2==SessionGraph.TYPE_INTENSITYLINE||_9a2==SessionGraph.TYPE_INTENSITYZONE;};SessionGraph.prototype.isLeftLine=function(_9a3){return _9a3==this.iLineType1;};SessionGraph.prototype.isLine=function(_9a4){return _9a4==SessionGraph.TYPE_INTENSITYLINE||_9a4==SessionGraph.TYPE_SPEEDLINE||_9a4==SessionGraph.TYPE_PACELINE||_9a4==SessionGraph.TYPE_HEARTPERCLINE||_9a4==SessionGraph.TYPE_HEARTLINE||_9a4==SessionGraph.TYPE_KARVONENLINE||_9a4==SessionGraph.TYPE_ZOLADZLINE;};SessionGraph.prototype.isPace=function(_9a5){return _9a5==SessionGraph.TYPE_PACELINE||_9a5==SessionGraph.TYPE_PACEZONE;};SessionGraph.prototype.isPerc=function(_9a6){return _9a6==SessionGraph.TYPE_HEARTPERCLINE||_9a6==SessionGraph.TYPE_HEARTPERCZONE||_9a6==SessionGraph.TYPE_KARVONENLINE||_9a6==SessionGraph.TYPE_KARVONENZONE;};SessionGraph.prototype.isZoladz=function(_9a7){return _9a7==SessionGraph.TYPE_ZOLADZLINE||_9a7==SessionGraph.TYPE_ZOLADZZONE;};SessionGraph.prototype.onActiveLineChange=function(_9a8){if(_9a8){this.iCurLineType=this.iLineType1;}else{this.iCurLineType=this.iLineType2;}
this.onCheckActiveIndicators();this.onViewChanged();};SessionGraph.prototype.onAddLine=function(_9a9,_9aa){if(this.iLineType1!=SessionGraph.TYPE_NONE&&this.iLineType2!=SessionGraph.TYPE_NONE){return;}
this.dwDrawer.onShowLoading(false);this.onSendRequest("addline="+_9a9+"&interval="+_9aa,SessionGraph.prototype.onAddLineResult,this);SchedulePage.onHidePreviewDirect("zone");SchedulePage.onHidePreviewDirect("line");};SessionGraph.prototype.onAddLineResult=function(xml){var _9ac=YSNumbers.checkInt(YSXML.getChildData(xml,"hmethod"));if(_9ac>0){this.iHeartMethod=_9ac;YSListbox.GetLst("heartmethod");}
if(YSXML.exists(xml,"line")){var _9ad=YSXML.getChild(xml,"line");this.iCurLineType=YSNumbers.checkInt(YSXML.getAttribute(_9ad,"type"));this.onRefreshControls(xml);var _9ae=this.iLineType1;this.iLineType1=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine1"));this.iLineType2=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine2"));if(_9ae==this.iLineType2){this.oVP.miny2=this.oVP.miny1;this.oVP.maxy2=this.oVP.maxy1;}
this.onCheckActiveIndicators();this.onReadXMLLine(_9ad);this.onAfterReadLine();this.onViewChanged();}
this.dwDrawer.onHideLoading();};SessionGraph.prototype.onAfterReadLine=function(){this.dwDrawer.setPreventZoneCheck();var _9af=this.getLine();if(_9af==null){return;}
var _9b0=this.iCurLineType==this.iLineType1;this.onCheckActiveIndicators();var _9b1=this.getSimilarValues(_9b0?this.oVP.miny1:this.oVP.miny2,_9b0?this.oVP.maxy1:this.oVP.maxy2,_9af,!_9b0);if(_9b0){this.oVP.miny2=_9b1.miny;this.oVP.maxy2=_9b1.maxy;}else{this.oVP.miny1=_9b1.miny;this.oVP.maxy1=_9b1.maxy;}};SessionGraph.prototype.onCalcSpecificZones=function(){this.aSpecificZones[SessionGraph.TYPE_SPEEDLINE]=this.aSpecificZones[SessionGraph.TYPE_SPEEDZONE]=this.aGridZones[1];this.aSpecificZones[SessionGraph.TYPE_HEARTLINE]=this.aSpecificZones[SessionGraph.TYPE_HEARTZONE]=this.aGridZones[2];var _9b2=this.aGridZones[1];var _9b3=[];var _9b4=[];var _9b5=_9b2.maxy-_9b2.miny;this.fIntensityPerSpeed=10/_9b5;for(var i=0,_9b7=_9b2.zones.length;i<_9b7;i++){_9b3.push({y1:(_9b2.zones[i].y1-_9b2.miny)/_9b5*10,y2:(_9b2.zones[i].y2-_9b2.miny)/_9b5*10,name:_9b2.zones[i].name,axisname:_9b2.zones[i].axisname,infinite:_9b2.zones[i].infinite});var _9b8={y1:this.getPace(_9b2.zones[i].y2),y2:this.getPace(_9b2.zones[i].y1),name:_9b2.zones[i].name,axisname:_9b2.zones[i].axisname};_9b8.infinite=_9b2.zones[i].y1==_9b2.miny;_9b4.push(_9b8);}
this.aSpecificZones[SessionGraph.TYPE_INTENSITYLINE]=this.aSpecificZones[SessionGraph.TYPE_INTENSITYZONE]={zones:_9b3,miny:0,maxy:10};this.aSpecificZones[SessionGraph.TYPE_PACELINE]=this.aSpecificZones[SessionGraph.TYPE_PACEZONE]={zones:_9b4,miny:this.getPace(_9b2.maxy),maxy:this.getPace(_9b2.miny)};_9b2=this.aGridZones[2];var _9b9=[];var _9ba=[];var _9bb=[];var _9bc,_9bd;var _9be=_9b2.maxy-this.iUserMinHeart;var _9bf=_9b2.maxy-_9b2.miny;this.fZoladzPerHeart=10/_9bf;for(var i=0,_9b7=_9b2.zones.length;i<_9b7;i++){_9bc=_9b2.zones[i].y1/_9b2.maxy*100;_9bd=_9b2.zones[i].y2/_9b2.maxy*100;_9b9.push({y1:Math.round(_9bc),y2:Math.round(_9bd),name:_9b2.zones[i].name,axisname:_9b2.zones[i].axisname,infinite:_9b2.zones[i].infinite});_9bc=(_9b2.zones[i].y1-this.iUserMinHeart)/_9be*100;_9bd=(_9b2.zones[i].y2-this.iUserMinHeart)/_9be*100;_9ba.push({y1:Math.round(_9bc),y2:Math.round(_9bd),name:_9b2.zones[i].name,axisname:_9b2.zones[i].axisname,infinite:_9b2.zones[i].infinite});_9bc=(_9b2.zones[i].y1-_9b2.miny)/_9bf*10;_9bd=(_9b2.zones[i].y2-_9b2.miny)/_9bf*10;_9bb.push({y1:_9bc,y2:_9bd,name:_9b2.zones[i].name,axisname:_9b2.zones[i].axisname,infinite:_9b2.zones[i].infinite});}
this.aSpecificZones[SessionGraph.TYPE_HEARTPERCLINE]=this.aSpecificZones[SessionGraph.TYPE_HEARTPERCZONE]={zones:_9b9,miny:_9b2.miny/_9b2.maxy*100,maxy:100};this.aSpecificZones[SessionGraph.TYPE_KARVONENLINE]=this.aSpecificZones[SessionGraph.TYPE_KARVONENZONE]={zones:_9ba,miny:_9ba[0].y1,maxy:100};this.aSpecificZones[SessionGraph.TYPE_ZOLADZLINE]=this.aSpecificZones[SessionGraph.TYPE_ZOLADZZONE]={zones:_9bb,miny:0,maxy:10};};SessionGraph.prototype.onCheckActiveIndicators=function(){var _9c0=this.dwDrawer.getColor(this.iCurLineType);if(this.iCurLineType==this.iLineType1){YSCSS.setClassName("rightlineind","curlineind disabled");YSCSS.setClassName("leftlineind","curlineind "+_9c0);}else{if(this.iCurLineType==this.iLineType2){YSCSS.setClassName("leftlineind","curlineind disabled");YSCSS.setClassName("rightlineind","curlineind "+_9c0);}}};SessionGraph.prototype.onConvertResult=function(xml){var _9c2=YSXML.getChild(xml,"line");if(_9c2!=null){if(YSXML.exists(xml,"heartmethod")){this.onReadGridZones(xml);}
this.onReadXMLLine(_9c2);this.onAfterReadLine();this.onViewChanged();}
this.dwDrawer.onHideLoading();};SessionGraph.prototype.onDestructLines=function(){for(var _9c3 in this.aLines){this.aLines[_9c3].line.destruct();this.aLines[_9c3].line=null;delete this.aLines[_9c3];}};SessionGraph.prototype.onDestructControls=function(){YSListbox.DestructLst("lstSessionLine1");YSListbox.DestructLst("lstSessionLine2");YSDOM.removeElement("zonepreview");YSDOM.removeElement("linepreview");};SessionGraph.prototype.onDestructSettings=function(){};SessionGraph.prototype.onDestructViewControls=function(){YSListbox.DestructLst("heartmethod");};SessionGraph.prototype.onHeartMethodChange=function(_9c4,sKey){if(_9c4.getOption(sKey).className=="disabled"){return false;}
var _9c6=YSNumbers.checkInt(sKey);_9c4.getSelector().firstChild.firstChild.innerHTML=_9c4.getValue();if(_9c6==this.iHeartMethod){return false;}
this.iHeartMethod=_9c6;this.onSendRequest("hmethod="+this.iHeartMethod,SessionGraph.prototype.onHeartMethodResult,this);return true;};SessionGraph.prototype.onHeartMethodResult=function(xml){this.onReadGridZones(xml);for(var _9c8 in this.aLines){var _9c9=this.getGridZones(_9c8);this.aLines[_9c8].zonemaxy=_9c9.maxy;this.aLines[_9c8].zoneminy=Math.max(_9c9.miny,this.aLines[_9c8].miny);}
this.dwDrawer.setZonesVisible(true,false);};SessionGraph.prototype.onInitResult=function(xml){this.dwDrawer.onLineRemoved();this.onDestructLines();this.onRefreshControls(xml);this.onRefreshSettings(xml);this.onRefreshViewControls(xml);this.iLineType1=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine1"));this.iLineType2=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine2"));if(this.iCurLineType==0||this.iCurLineType!=this.iLineType1&&this.iCurLineType!=this.iLineType2){this.iCurLineType=this.iLineType1;}
this.onCheckActiveIndicators();var _9cb=YSXML.getChild(xml,"info");this.bKM=YSXML.getAttribute(_9cb,"km")=="true";this.dwDrawer.setMeasureUnit(this.bKM,false);this.dwDrawer.setExpandableX(YSXML.getAttribute(_9cb,"expandablex")=="true");var _9cc=YSNumbers.checkFloat(YSXML.getAttribute(_9cb,"maxx"));this.onReadGridZones(xml);var _9cd=YSXML.getChildren(xml,"line");for(var i=0,_9cf=_9cd.length;i<_9cf;i++){this.onReadXMLLine(_9cd[i]);}
this.onAfterReadLine();this.dwDrawer.iCurLineType=-1;this.dwDrawer.setMaxX(_9cc);this.dwDrawer.onHideLoading();};SessionGraph.prototype.onLineTypeChange=function(_9d0,sKey){var _9d2=document.createElement("div");_9d2.innerHTML=_9d0.getValue();var _9d3=_9d2.childNodes[1].innerHTML;if(_9d0.getID()=="lstSessionLine1"){this.aYValueNames[0]=_9d3;}else{this.aYValueNames[1]=_9d3;}
_9d0.getSelector().firstChild.childNodes[1].innerHTML=_9d3;_9d0.getSelector().firstChild.firstChild.className=_9d2.firstChild.className;var _9d4=_9d0.getID()=="lstSessionLine1";var _9d5=YSNumbers.checkInt(sKey);if(_9d4&&_9d5==this.iLineType1||!_9d4&&_9d5==this.iLineType2){return;}
var _9d6=_9d4?this.iLineType1:this.iLineType2;var _9d7="convertline="+this.getLine(_9d6).id+"&newtype="+_9d5+"&storetypes=1&";delete this.aLines[_9d6];this.dwDrawer.onShowLoading(false);this.dwDrawer.onLineRemoved();if(_9d4){this.iLineType1=_9d5;}else{this.iLineType2=_9d5;}
this.iCurLineType=_9d5;this.onCheckActiveIndicators();this.onSendRequest(_9d7+"left="+this.iLineType1+"&right="+this.iLineType2,SessionGraph.prototype.onConvertResult,this);};SessionGraph.prototype.onReadGridZones=function(xml){this.iHeartMethod=YSNumbers.checkInt(YSXML.getChildText(xml,"heartmethod"));var _9d9=YSListbox.GetLst("heartmethod");if(_9d9!=null){_9d9.setKey(String(this.iHeartMethod));}
var _9da=YSXML.getChildren(xml,"gridzones");for(var i=0,_9dc=_9da.length;i<_9dc;i++){var _9dd=YSNumbers.checkInt(YSXML.getAttribute(_9da[i],"type"));var _9de=YSNumbers.checkInt(YSXML.getAttribute(_9da[i],"userminheart"));if(_9de>0){this.iUserMinHeart=_9de;}
var _9df={miny:0,maxy:0,zones:[]};var _9e0=YSXML.getChildren(_9da[i],"zone");for(var j=0,_9e2=_9e0.length;j<_9e2;j++){var dY1=YSNumbers.checkFloat(YSXML.getAttribute(_9e0[j],"y1"));var dY2=YSNumbers.checkFloat(YSXML.getAttribute(_9e0[j],"y2"));var _9e5=YSXML.getChildData(_9e0[j],"name");var _9e6=YSXML.getChildData(_9e0[j],"yaxis");_9df.zones.push({y1:dY1,y2:dY2,name:_9e5,axisname:_9e6,infinite:false});}
_9df.zones.sort(this.onSortZones);var _9e7=_9df.zones[_9df.zones.length-1];_9e7.infinite=true;_9df.maxy=_9e7.y2;_9df.miny=_9df.zones[0].y1;this.aGridZones[_9dd]=_9df;}
this.onCalcSpecificZones();};SessionGraph.prototype.onReadXMLLine=function(_9e8){var _9e9=YSNumbers.checkInt(YSXML.getAttribute(_9e8,"type"));var _9ea=this.isHeart(_9e9);var _9eb=this.isLine(_9e9);var _9ec=this.isPace(_9e9);var _9ed=this.dwDrawer.getXRoundOn();var _9ee=0.01;if(_9ea||_9ec){_9ee=1;}
var _9ef=YSNumbers.checkFloat(YSXML.getAttribute(_9e8,"miny"));var _9f0=YSNumbers.checkFloat(YSXML.getAttribute(_9e8,"maxy"));var _9f1=this.getGridZones(_9e9);if(_9f1.miny<_9ef){_9f1.miny=_9ef;}
var _9f2=this.dwDrawer.isGridZoneShown();this.aLines[_9e9]={};this.aLines[_9e9].roundon=_9ee;this.aLines[_9e9].miny=_9ef;this.aLines[_9e9].maxy=_9f2?_9f1.maxy:_9f0;this.aLines[_9e9].origmaxy=_9f0;this.aLines[_9e9].zonemaxy=_9f1.maxy;this.aLines[_9e9].zoneminy=_9f1.miny;this.aLines[_9e9].id=YSNumbers.checkInt(YSXML.getAttribute(_9e8,"id"));this.aLines[_9e9].line=new WSLine(this.aLines[_9e9].id);var _9f3=YSXML.getChildren(_9e8,"pt");var _9f4,_9f5,fY1,fY2,fX;for(var i=0,_9fa=_9f3.length;i<_9fa;i++){_9f5=_9f3[i];fX=YSNumbers.checkFloat(YSXML.getAttribute(_9f5,"x"));fY1=YSNumbers.checkFloat(YSXML.getAttribute(_9f5,"y"));fY2=YSNumbers.checkFloat(YSXML.getAttribute(_9f5,"y2"));if(_9ec){fY1=Math.min(SessionGraph.MAX_PACE,3600/fY1);fY2=Math.min(SessionGraph.MAX_PACE,3600/fY2);if(!_9eb){var _9fb=fY1;fY1=fY2;fY2=_9fb;}}
_9f4=new WSGraphPoint(YSNumbers.checkInt(YSXML.getAttribute(_9f5,"id")),fX,fY1,_9eb?0:fY2,YSXML.getAttribute(_9f5,"del")=="true",YSNumbers.checkInt(YSXML.getAttribute(_9f5,"nextid")));this.aLines[_9e9].line.add(_9f4);this.aLines[_9e9].maxy=Math.max(Math.max(this.aLines[_9e9].maxy,_9f4.fY),_9f4.fY2);this.aLines[_9e9].miny=Math.min(this.aLines[_9e9].miny,_9f4.fY);}
if(!_9f2){var _9fc=this.dwDrawer.getYScale(this.aLines[_9e9].maxy-this.aLines[_9e9].miny,_9ec,_9ea?1:0.1);this.aLines[_9e9].maxy=Math.ceil(this.aLines[_9e9].maxy/_9fc)*_9fc;}
if(_9e9==this.iLineType1){if(_9f2){this.oVP.miny1=_9f1.miny;}else{this.oVP.miny1=this.aLines[_9e9].miny;}
this.oVP.maxy1=this.aLines[_9e9].maxy;}else{if(_9e9==this.iLineType2){if(_9f2){this.oVP.miny2=_9f1.miny;}else{this.oVP.miny2=this.aLines[_9e9].miny;}
this.oVP.maxy2=this.aLines[_9e9].maxy;}}
this.aLines[_9e9].line.onStore();};SessionGraph.prototype.onRefreshControls=function(xml){if(YSXML.exists(xml,"controlshtml")){this.onDestructControls();this.aYValueNames=["",""];YSDOM.setInnerHTML("addcontrols",YSXML.getChildData(xml,"controlshtml"));}};SessionGraph.prototype.onRefreshSettings=function(xml){if(YSXML.exists(xml,"wssettings")){this.onDestructSettings();YSDOM.setInnerHTML("wssettings",YSXML.getChildData(xml,"wssettings"));}};SessionGraph.prototype.onRefreshViewControls=function(xml){if(YSXML.exists(xml,"viewcontrols")){this.onDestructViewControls();YSDOM.setInnerHTML("viewcontrols",YSXML.getChildData(xml,"viewcontrols"));}};SessionGraph.prototype.onRemoveCurLine=function(){this.dwDrawer.onShowLoading(false);this.onSendRequest("removeline="+this.getLine().id,SessionGraph.prototype.onRemoveLineResult,this);};SessionGraph.prototype.onRemoveLineResult=function(xml){this.aLines[this.iCurLineType].line.destruct();this.aLines[this.iCurLineType].line=null;delete this.aLines[this.iCurLineType];this.onRefreshControls(xml);var _a01=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine1"));if(_a01==this.iLineType2){this.oVP.miny1=this.oVP.miny2;this.oVP.maxy1=this.oVP.maxy2;this.oVP.miny2=this.oVP.maxy2=0;}
this.iLineType1=_a01;this.iLineType2=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine2"));this.iCurLineType=this.iLineType1;this.onCheckActiveIndicators();this.dwDrawer.onLineRemoved();this.onViewChanged();this.dwDrawer.onHideLoading();};SessionGraph.prototype.onSendRequest=function(_a02,_a03,_a04){if(this.oRequest!=null){this.aSendQueue.push({params:_a02,fn:_a03,obj:_a04});}else{this.oRequest=YSAJAX.sendRequest(null,"tab="+SchedulePage.sTabID+"&"+SchedulePage.getExtraParams()+"&"+"version="+this.iVersion+"&"+_a02,false,SessionGraph.prototype.onSendRequestResult,this,{fn:_a03,obj:_a04});}};SessionGraph.prototype.onSendRequestResult=function(_a05,_a06){var xml=YSAJAX.getXML(_a05);if(xml!=null){if(YSXML.exists(xml,"initws")){if(!this.bInitExpected){YSConfirm.CreateAlert("Someone else changed your training session.","OK","wsgraphrect");while(this.aSendQueue.length>0){this.aSendQueue.pop();}}
this.onInitResult(xml);this.bInitExpected=false;}else{if(isDefined(_a06.fn)){_a06.fn.call(_a06.obj,xml);}}
this.iVersion=YSNumbers.checkInt(YSXML.getChildText(xml,"version"));}
this.oRequest=null;if(this.aSendQueue.length>0){var _a08=this.aSendQueue.shift();this.onSendRequest(_a08.params,_a08.fn,_a08.obj);}};SessionGraph.prototype.onSortZones=function(_a09,_a0a){if(_a09.y1<_a0a.y1||_a09.y2<_a0a.y2){return-1;}else{return 1;}};SessionGraph.prototype.onSwapLineTypes=function(){this.onSendRequest("swaptypes=1",SessionGraph.prototype.onSwapLineTypesResult,this);};SessionGraph.prototype.onSwapLineTypesResult=function(xml){this.onRefreshControls(xml);this.iLineType1=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine1"));this.iLineType2=YSNumbers.checkInt(YSListbox.GetKey("lstSessionLine2"));this.onCheckActiveIndicators();var _a0c=this.oVP.miny1;var _a0d=this.oVP.maxy1;this.oVP.miny1=this.oVP.miny2;this.oVP.maxy1=this.oVP.maxy2;this.oVP.miny2=_a0c;this.oVP.maxy2=_a0d;this.onViewChanged();};SessionGraph.prototype.onToggleZones=function(_a0e){var bOn=_a0e.className=="noauto3d";_a0e.className=bOn?"auto3d":"noauto3d";this.dwDrawer.setZonesVisible(bOn);};SessionGraph.prototype.onViewChanged=function(){this.dwDrawer.onViewChanged(this.oVP);var _a10=this.getLine();if(_a10!=null){_a10.line.onViewChanged(this.dwDrawer.getPixPerX(),this.dwDrawer.getPixPerY(this.iCurLineType==this.iLineType1));}};SessionGraph.prototype.onZoomX=function(_a11,_a12){var _a13=this.oVP.minx+((this.oVP.maxx-this.oVP.minx)*_a12);this.oVP.minx=Math.max(_a13-(_a12*_a11),0);this.oVP.maxx=this.oVP.minx+_a11;if(this.oVP.maxx>this.fMaxX){this.oVP.maxx=this.fMaxX;this.oVP.minx=this.oVP.maxx-_a11;}
this.onViewChanged();};SessionGraph.prototype.onZoomY=function(_a14,_a15){var _a16=this.isLeftLine(this.iCurLineType);var _a17=_a16?this.oVP.miny1:this.oVP.miny2;var _a18=_a16?this.oVP.maxy1:this.oVP.maxy2;var _a19=_a18-((_a18-_a17)*_a15);var _a1a=this.getLine();_a18=Math.min(_a19+(_a15*_a14),_a1a.maxy);_a17=_a18-_a14;if(_a17<_a1a.miny){_a17=_a1a.miny;_a18=_a17+_a14;}
if(_a16){this.oVP.miny1=_a17;this.oVP.maxy1=_a18;}else{this.oVP.miny2=_a17;this.oVP.maxy2=_a18;}
if(this.iLineType2!=SessionGraph.TYPE_NONE){var _a1b=this.getSimilarValues(_a17,_a18,_a1a,!_a16);if(_a16){this.oVP.miny2=_a1b.miny;this.oVP.maxy2=_a1b.maxy;}else{this.oVP.miny1=_a1b.miny;this.oVP.maxy1=_a1b.maxy;}}
this.onViewChanged();};SessionGraph.prototype.onZoomIn=function(){this.dwDrawer.onMouseWheel(null,null,true);};SessionGraph.prototype.onZoomOut=function(){this.dwDrawer.onMouseWheel(null,null,false);};SessionGraph.prototype.setMaxX=function(_a1c){this.oVP.maxx=this.fMaxX=_a1c;this.onViewChanged();};SessionGraph.prototype.setMaxY=function(_a1d,_a1e){var _a1f=this.getLine();_a1f.maxy=_a1d;if(_a1e){this.oVP.maxy1=_a1d;var _a20=this.getSimilarValues(this.oVP.miny1,_a1d,_a1f,!_a1e);this.oVP.miny2=_a20.miny;this.oVP.maxy2=_a20.maxy;}else{this.oVP.maxy2=_a1d;var _a20=this.getSimilarValues(this.oVP.miny2,_a1d,_a1f,!_a1e);this.oVP.miny1=_a20.miny;this.oVP.maxy1=_a20.maxy;}
this.onViewChanged();};SessionGraph.prototype.setVP=function(_a21,_a22,_a23,_a24,_a25,_a26){this.oVP.minx=_a21;this.oVP.maxx=_a22;if(this.isLeftLine(this.iCurLineType)){this.oVP.miny1=_a23;this.oVP.maxy1=_a24;this.oVP.miny2=_a25;this.oVP.maxy2=_a26;}else{this.oVP.miny2=_a23;this.oVP.maxy2=_a24;this.oVP.miny1=_a25;this.oVP.maxy1=_a26;}
this.onViewChanged();};function WSDOM(){};WSDOM.prototype.getNewElement=function(_a27){var obj=document.createElement(isDefined(_a27)?_a27:"div");YSEvent.disableSelect(obj);return obj;};WSDOM.prototype.getScrollbar=function(_a29,_a2a){var _a2b=this.getNewElement();YSDOM.setSize(_a2b,_a2a?new Size(_a29.iGraphWidth-2,9):new Size(9,_a29.iGraphHeight-2));YSCSS.setMultiStyle(_a2b,["zIndex","display"],[4,"none"]);_a2b.className="graphscroll "+(_a2a?"hor":"vert");var divL=this.getNewElement();divL.className="l";var divC=this.getNewElement();divC.className="c";YSDOM.setSize(divC,_a2a?new Size((_a29.iGraphWidth-8),6):new Size(6,(_a29.iGraphHeight-8)));var divR=this.getNewElement();divR.className="r";_a2b.appendChild(divL);_a2b.appendChild(divC);_a2b.appendChild(divR);var _a2f=this.getNewElement();_a2f.className="bar";YSDOM.setSize(_a2f,_a2a?new Size(_a29.iGraphWidth-4,8):new Size(8,_a29.iGraphHeight-4));var _a30=this.getNewElement();_a30.className="l";var _a31=this.getNewElement();_a31.className="c";YSDOM.setSize(_a31,_a2a?new Size((_a29.iGraphWidth-8),4):new Size(4,(_a29.iGraphHeight-8)));var _a32=this.getNewElement();_a32.className="r";_a2f.appendChild(_a30);_a2f.appendChild(_a31);_a2f.appendChild(_a32);_a2b.appendChild(_a2f);return{scrollholder:_a2b,bar:_a2f,barcenter:_a31};};WSDOM.prototype.getValueBox=function(){var _a33=this.getNewElement();_a33.className="valuebox";var _a34=this.getNewElement();_a34.className="left";var _a35=this.getNewElement();_a35.className="right";_a33.appendChild(_a34);_a33.appendChild(_a35);return _a33;};WSDOM.prototype.getXValueBox=function(){var _a36=this.getValueBox();_a36.className+=" xvalue";var _a37=this.getNewElement();_a37.className="arrow";_a36.appendChild(_a37);return _a36;};WSDOM.prototype.onCreateContextMenu=function(_a38){_a38.divCM=this.getNewElement();_a38.divCM.className="graphcm";YSCSS.setMultiStyle(_a38.divCM,["display","position","zIndex"],["none","absolute",5]);document.body.appendChild(_a38.divCM);};WSDOM.prototype.onCreateDot=function(_a39,_a3a){_a3a.top-=WSLine.PIX_MARGIN;_a3a.left-=WSLine.PIX_MARGIN;var _a3b=this.getNewElement("img");_a3b.src=_a39.sDotSrc;YSCSS.setMultiStyle(_a3b,["position","top","left"],["absolute",Math.round(_a3a.top)+"px",Math.round(_a3a.left)+"px"]);return _a3b;};WSDOM.prototype.onCreateEventCatcher=function(_a3c,_a3d){_a3c.divEventCatcher=this.getNewElement();YSDOM.setPosition(_a3c.divEventCatcher,new Pixel(_a3c.iPaddingLeft,_a3c.iPaddingTop));YSDOM.setSize(_a3c.divEventCatcher,new Size(_a3c.iGraphWidth,_a3c.iGraphHeight));YSCSS.setMultiStyle(_a3c.divEventCatcher,["backgroundColor","zIndex"],["black",2]);YSCSS.setTransparency(_a3c.divEventCatcher,100);_a3d.appendChild(_a3c.divEventCatcher);};WSDOM.prototype.onCreateGraphLineHolder=function(_a3e,_a3f){var _a40=Math.floor(_a3e.iLineWidth/2);_a3e.iInitGraphTop=-_a3e.iGraphHeight+_a40;_a3e.divGraphClip=this.getNewElement();YSDOM.setSize(_a3e.divGraphClip,new Size(_a3e.iGraphWidth,_a3e.iGraphHeight+_a40*2));YSDOM.setPosition(_a3e.divGraphClip,new Pixel(_a3e.iPaddingLeft,_a3e.iPaddingTop-_a40));YSCSS.setStyle(_a3e.divGraphClip,"overflow","hidden");_a3e.divGraphLineHolder=this.getNewElement();YSDOM.setSize(_a3e.divGraphLineHolder,new Size(_a3e.iGraphWidth*3,_a3e.iGraphHeight*3));YSDOM.setPosition(_a3e.divGraphLineHolder,new Pixel(-_a3e.iGraphWidth,_a3e.iInitGraphTop));_a3e.divGraphClip.appendChild(_a3e.divGraphLineHolder);_a3f.appendChild(_a3e.divGraphClip);};WSDOM.prototype.onCreateGraphRect=function(_a41,_a42){var _a43=this.getNewElement();YSDOM.setSize(_a43,_a41.oInnerSize);YSDOM.setPosition(_a43,new Pixel(_a41.iPaddingLeft,_a41.iPaddingTop));_a43.className="graphrect";_a43.id="wsgraphrect";_a42.appendChild(_a43);};WSDOM.prototype.onCreateGridHolders=function(_a44,_a45){var _a46=this.getNewElement();YSDOM.setSize(_a46,_a44.oInnerSize);YSDOM.setPosition(_a46,new Pixel(_a44.iPaddingLeft+1,_a44.iPaddingTop+1));YSCSS.setStyle(_a46,"overflow","hidden");_a44.divYGridLines=this.getNewElement();YSDOM.setSize(_a44.divYGridLines,new Size(_a44.oInnerSize.width,_a44.iGraphHeight*3));YSDOM.setPosition(_a44.divYGridLines,new Pixel(0,-_a44.iGraphHeight));YSCSS.setStyle(_a44.divYGridLines,"fontSize",_a44.sGridZoneFontSize);_a46.appendChild(_a44.divYGridLines);_a44.divXGridLines=this.getNewElement();YSDOM.setSize(_a44.divXGridLines,new Size(_a44.iGraphWidth*3,_a44.oInnerSize.height));YSDOM.setPosition(_a44.divXGridLines,new Pixel(-_a44.iGraphWidth,0));_a46.appendChild(_a44.divXGridLines);_a45.appendChild(_a46);};WSDOM.prototype.onCreateHoverElements=function(_a47){_a47.imgTempDot=this.getNewElement("img");_a47.imgTempDot.src=_a47.sActiveDotSrc;YSCSS.setMultiStyle(_a47.imgTempDot,["position","display"],["absolute","none"]);_a47.divGraphClip.appendChild(_a47.imgTempDot);_a47.divZoneLine=this.getNewElement();YSCSS.setMultiStyle(_a47.divZoneLine,["display","width"],["none",_a47.iLineWidth+"px"]);_a47.divGraphClip.appendChild(_a47.divZoneLine);};WSDOM.prototype.onCreateLoadingIcon=function(_a48){_a48.imgLoading=this.getNewElement("img");_a48.imgLoading.src=IMAGE_PATH+"loadingbig.gif";YSDOM.setPosition(_a48.imgLoading,new Pixel(_a48.oInnerSize.width*0.5-33,_a48.oInnerSize.height*0.5-33));YSCSS.setMultiStyle(_a48.imgLoading,["display","position"],["none","absolute"]);_a48.divEventCatcher.appendChild(_a48.imgLoading);};WSDOM.prototype.onCreateScrollBars=function(_a49,_a4a){var _a4b=this.getScrollbar(_a49,true);_a49.oXScroll=_a4b;YSDOM.setPosition(_a4b.scrollholder,new Pixel(_a49.iPaddingLeft,_a49.iPaddingTop+_a49.iGraphHeight));_a4a.appendChild(_a4b.scrollholder);_a4b=this.getScrollbar(_a49,false);_a49.oY1Scroll=_a4b;YSDOM.setPosition(_a4b.scrollholder,new Pixel(_a49.iPaddingLeft-12,_a49.iPaddingTop));_a4a.appendChild(_a4b.scrollholder);_a4b=this.getScrollbar(_a49,false);_a49.oY2Scroll=_a4b;YSDOM.setPosition(_a4b.scrollholder,new Pixel(_a49.iPaddingLeft+_a49.iGraphWidth,_a49.iPaddingTop));_a4a.appendChild(_a4b.scrollholder);};WSDOM.prototype.onCreateValueHover=function(_a4c,_a4d){_a4c.divValueHover=this.getValueBox();_a4c.divMaxXValue=this.getXValueBox();_a4c.divMaxYValue=this.getValueBox();_a4c.divZoneHoverX1=this.getXValueBox();_a4c.divZoneHoverX2=this.getXValueBox();_a4c.divZoneHoverY1=this.getValueBox();_a4c.divZoneHoverY2=this.getValueBox();var _a4e=document.createElement("input");_a4e.type="text";_a4e.id="sessionmaxx";var _a4f=document.createElement("input");_a4f.type="text";_a4f.id="sessionmaxy";YSCSS.setMultiStyle([_a4e,_a4f],["fontSize"],[_a4c.iFontSize+"px"]);YSCSS.setStyle(_a4f,"textAlign","right");_a4c.divMaxXValue.firstChild.appendChild(_a4e);_a4c.divMaxYValue.firstChild.appendChild(_a4f);_a4d.appendChild(_a4c.divMaxXValue);_a4d.appendChild(_a4c.divMaxYValue);YSCSS.setMultiStyle([_a4c.divMaxXValue,_a4c.divMaxYValue],["display"],["block"]);oSize=YSDOM.getElementSize(_a4c.divMaxXValue,true);YSDOM.setPosition(_a4c.divMaxXValue,new Pixel(_a4c.iPaddingLeft+_a4c.iGraphWidth-oSize.width/2,_a4c.iPaddingTop+_a4c.iGraphHeight));YSCSS.setStyle(_a4c.divMaxXValue.lastChild,"left",(oSize.width/2-7)+"px");oSize=YSDOM.getElementSize(_a4c.divMaxYValue,true);_a4c.divMaxYValue.mywidth=oSize.width;YSCSS.setStyle(_a4c.divMaxYValue,"top",(_a4c.iPaddingTop-oSize.height/2)+"px");YSCSS.setMultiStyle([_a4c.divMaxXValue,_a4c.divMaxYValue],["display"],["none"]);document.body.appendChild(_a4c.divValueHover);_a4d.appendChild(_a4c.divZoneHoverX1);_a4d.appendChild(_a4c.divZoneHoverX2);_a4d.appendChild(_a4c.divZoneHoverY1);_a4d.appendChild(_a4c.divZoneHoverY2);var _a50=_a4c.iIndicatorWidth+"px";_a4c.divZoneIndicatorX=this.getNewElement();_a4c.divZoneIndicatorY=this.getNewElement();YSCSS.setMultiStyle([_a4c.divZoneIndicatorX,_a4c.divZoneIndicatorY],["display","zIndex"],["none",4]);var _a51=this.getNewElement();var _a52=this.getNewElement();var _a53=this.getNewElement();YSCSS.setMultiStyle([_a51,_a53],["width","height","backgroundColor"],[_a50,"100%","#777777"]);YSCSS.setMultiStyle(_a53,["left","right"],["auto","0px"]);YSCSS.setMultiStyle(_a52,["left","backgroundColor","height"],[_a50,"#afafaf","100%"]);YSCSS.setTransparency(_a52,93);_a4c.divZoneIndicatorX.appendChild(_a51);_a4c.divZoneIndicatorX.appendChild(_a52);_a4c.divZoneIndicatorX.appendChild(_a53);var _a54=this.getNewElement();var _a55=this.getNewElement();var _a56=this.getNewElement();YSCSS.setMultiStyle([_a54,_a56],["height","width","backgroundColor"],[_a50,"100%","#777777"]);YSCSS.setMultiStyle(_a56,["top","bottom"],["auto","0px"]);YSCSS.setMultiStyle(_a55,["top","backgroundColor","width"],[_a50,"#afafaf","100%"]);YSCSS.setTransparency(_a55,90);_a4c.divZoneIndicatorY.appendChild(_a54);_a4c.divZoneIndicatorY.appendChild(_a55);_a4c.divZoneIndicatorY.appendChild(_a56);_a4d.appendChild(_a4c.divZoneIndicatorX);_a4d.appendChild(_a4c.divZoneIndicatorY);};WSDOM.prototype.onCreateXAxisText=function(_a57,_a58,_a59){var _a5a=this.getNewElement();YSDOM.setSize(_a5a,new Size(100,_a57.iFontSize));YSCSS.setMultiStyle(_a5a,["left","textAlign"],[_a58+"px","center"]);_a5a.innerHTML=_a59;_a57.divXAxisTexts.appendChild(_a5a);};WSDOM.prototype.onCreateXAxisTextHolder=function(_a5b,_a5c){var _a5d=2*_a5b.iFontSize;_a5b.iInitXTextLeft=-_a5b.iGraphWidth-50+_a5d;var _a5e=this.getNewElement();YSDOM.setSize(_a5e,new Size(_a5b.iGraphWidth+_a5d*2,_a5b.iFontSize));YSDOM.setPosition(_a5e,new Pixel(_a5b.iPaddingLeft-_a5d,_a5b.iPaddingTop+_a5b.iGraphHeight+_a5b.iXScaleExtWidth+1));YSCSS.setStyle(_a5e,"overflow","hidden");_a5b.divXAxisTexts=this.getNewElement();YSDOM.setSize(_a5b.divXAxisTexts,new Size(_a5b.iGraphWidth*3+100,_a5b.iFontSize));YSDOM.setPosition(_a5b.divXAxisTexts,new Pixel(_a5b.iInitXTextLeft,0));_a5e.appendChild(_a5b.divXAxisTexts);_a5c.appendChild(_a5e);};WSDOM.prototype.onCreateXExpander=function(_a5f,_a60){_a5f.divXExpander=this.getNewElement();YSDOM.setSize(_a5f.divXExpander,new Size(10,_a5f.iGraphHeight));YSDOM.setPosition(_a5f.divXExpander,new Pixel(_a5f.iPaddingLeft+_a5f.iGraphWidth-10,_a5f.iPaddingTop));YSCSS.setMultiStyle(_a5f.divXExpander,["backgroundColor","display","zIndex"],["black","none",3]);YSCSS.setTransparency(_a5f.divXExpander,100);_a60.appendChild(_a5f.divXExpander);};WSDOM.prototype.onCreateXExt=function(_a61,_a62){var _a63=this.getNewElement();YSDOM.setSize(_a63,new Size(1,_a61.iXScaleExtWidth));YSCSS.setMultiStyle(_a63,["left","backgroundColor"],[_a62+"px",WSDrawer.EXT_COLOR]);_a61.divXExtLines.appendChild(_a63);};WSDOM.prototype.onCreateXExtHolder=function(_a64,_a65){var _a66=this.getNewElement();YSDOM.setSize(_a66,new Size(_a64.iGraphWidth,_a64.iXScaleExtWidth));YSDOM.setPosition(_a66,new Pixel(_a64.iPaddingLeft,_a64.iPaddingTop+_a64.iGraphHeight));YSCSS.setStyle(_a66,"overflow","hidden");_a64.divXExtLines=this.getNewElement();YSDOM.setSize(_a64.divXExtLines,new Size(_a64.iGraphWidth*3,_a64.iXScaleExtWidth));YSDOM.setPosition(_a64.divXExtLines,new Pixel(-_a64.iGraphWidth,0));_a66.appendChild(_a64.divXExtLines);_a65.appendChild(_a66);};WSDOM.prototype.onCreateXGrid=function(_a67,_a68){var _a69=this.getNewElement();_a69.className="xgrid";YSDOM.setSize(_a69,new Size(1,_a67.oInnerSize.height));YSCSS.setStyle(_a69,"left",(_a68-1)+"px");_a67.divXGridLines.appendChild(_a69);};WSDOM.prototype.onCreateXLegend=function(_a6a,_a6b){var _a6c=this.getNewElement();YSDOM.setSize(_a6c,new Size(_a6a.iGraphWidth,_a6a.iFontSize));YSDOM.setPosition(_a6c,new Pixel(_a6a.iPaddingLeft,_a6a.iPaddingTop+_a6a.iGraphHeight+_a6a.iXScaleExtWidth+_a6a.iFontSize*2));YSCSS.setMultiStyle(_a6c,["textAlign","fontWeight"],["center","bold"]);_a6c.innerHTML=YSText.get(_a6a.bTimeBased?"[?LegendTime?]":"[?LegendDistance?]");_a6b.appendChild(_a6c);};WSDOM.prototype.onCreateYAxisLine=function(_a6d,_a6e,_a6f,_a70){var _a71=this.getNewElement();var _a72=_a6e?_a6d.iYScaleExtWidth-_a6d.iYAxisLineWidth:0;YSCSS.setMultiStyle(_a71,["width","height","left","backgroundColor"],["2px",(_a6d.iGraphHeight*3)+"px",_a72+"px",_a70]);_a6f.appendChild(_a71);};WSDOM.prototype.onCreateYAxisText=function(_a73,_a74,iTop,_a76){var _a77=this.getNewElement();YSDOM.setSize(_a77,new Size(_a73.iYTextWidth,_a73.iFontSize));YSCSS.setMultiStyle(_a77,["textAlign","top"],[YSCSS.getStyle(_a74,"textAlign"),iTop+"px"]);_a77.innerHTML=_a76;_a74.appendChild(_a77);};WSDOM.prototype.onCreateYAxisTextHolders=function(_a78,_a79){_a78.iYTextWidth=_a78.iPaddingLeft-_a78.iYScaleExtWidth-_a78.iYExtTextDist;var _a7a=this.getNewElement();YSDOM.setSize(_a7a,new Size(_a78.iYTextWidth,_a78.iGraphHeight+_a78.iHalfFontSize*2));YSDOM.setPosition(_a7a,new Pixel(0,_a78.iPaddingTop-_a78.iHalfFontSize));YSCSS.setStyle(_a7a,"overflow","hidden");_a78.divYAxisTexts=this.getNewElement();YSDOM.setSize(_a78.divYAxisTexts,new Size(_a78.iYTextWidth,_a78.iGraphHeight*3));YSDOM.setPosition(_a78.divYAxisTexts,new Pixel(0,-_a78.iGraphHeight));YSCSS.setStyle(_a78.divYAxisTexts,"textAlign","right");_a7a.appendChild(_a78.divYAxisTexts);_a79.appendChild(_a7a);_a78.divYAxisUnit=this.getNewElement();YSDOM.setSize(_a78.divYAxisUnit,new Size(_a78.iFontSize+2,_a78.iGraphHeight));YSDOM.setPosition(_a78.divYAxisUnit,new Pixel(0,_a78.iPaddingTop));_a79.appendChild(_a78.divYAxisUnit);var _a7b=this.getNewElement();YSDOM.setSize(_a7b,new Size(_a78.iYTextWidth,_a78.iGraphHeight+_a78.iHalfFontSize*2));YSDOM.setPosition(_a7b,new Pixel(_a78.iPaddingLeft+_a78.iGraphWidth+_a78.iYScaleExtWidth+_a78.iYExtTextDist,_a78.iPaddingTop-_a78.iHalfFontSize));YSCSS.setStyle(_a7b,"overflow","hidden");_a78.divYAxis2Texts=this.getNewElement();YSDOM.setSize(_a78.divYAxis2Texts,new Size(_a78.iYTextWidth,_a78.iGraphHeight*3));YSDOM.setPosition(_a78.divYAxis2Texts,new Pixel(0,-_a78.iGraphHeight));YSCSS.setStyle(_a78.divYAxis2Texts,"textAlign","left");_a7b.appendChild(_a78.divYAxis2Texts);_a79.appendChild(_a7b);_a78.divYAxis2Unit=this.getNewElement();YSDOM.setSize(_a78.divYAxis2Unit,new Size(_a78.iFontSize+2,_a78.iGraphHeight));var _a7c=_a78.iPaddingLeft*2+_a78.iGraphWidth-_a78.iFontSize-2;YSDOM.setPosition(_a78.divYAxis2Unit,new Pixel(_a7c,_a78.iPaddingTop));_a79.appendChild(_a78.divYAxis2Unit);};WSDOM.prototype.onCreateYExpander=function(_a7d,_a7e){_a7d.divYExpander=this.getNewElement();YSDOM.setSize(_a7d.divYExpander,new Size(_a7d.iGraphWidth-5,10));YSDOM.setPosition(_a7d.divYExpander,new Pixel(_a7d.iPaddingLeft,_a7d.iPaddingTop-5));YSCSS.setMultiStyle(_a7d.divYExpander,["backgroundColor","display","zIndex"],["black","none",3]);YSCSS.setTransparency(_a7d.divYExpander,100);_a7e.appendChild(_a7d.divYExpander);};WSDOM.prototype.onCreateYExt=function(_a7f,_a80,iTop,_a82){var _a83=this.getNewElement();YSDOM.setSize(_a83,new Size(_a7f.iYScaleExtWidth,1));YSCSS.setMultiStyle(_a83,["top","backgroundColor"],[iTop+"px",_a82]);_a80.appendChild(_a83);};WSDOM.prototype.onCreateYExtHolders=function(_a84,_a85){var _a86=this.getNewElement();YSDOM.setSize(_a86,new Size(_a84.iYScaleExtWidth,_a84.iGraphHeight));YSDOM.setPosition(_a86,new Pixel(_a84.iPaddingLeft-_a84.iYScaleExtWidth+1,_a84.iPaddingTop));YSCSS.setStyle(_a86,"overflow","hidden");_a84.divYExtLines=this.getNewElement();YSDOM.setSize(_a84.divYExtLines,new Size(_a84.iYScaleExtWidth,_a84.iGraphHeight*3));YSDOM.setPosition(_a84.divYExtLines,new Pixel(0,-_a84.iGraphHeight));_a86.appendChild(_a84.divYExtLines);_a85.appendChild(_a86);var _a87=this.getNewElement();YSDOM.setSize(_a87,new Size(_a84.iYScaleExtWidth,_a84.iGraphHeight));YSDOM.setPosition(_a87,new Pixel(_a84.iPaddingLeft+_a84.iGraphWidth-1,_a84.iPaddingTop));YSCSS.setStyle(_a87,"overflow","hidden");_a84.divYExt2Lines=this.getNewElement();YSDOM.setSize(_a84.divYExt2Lines,new Size(_a84.iYScaleExtWidth,_a84.iGraphHeight*3));YSDOM.setPosition(_a84.divYExt2Lines,new Pixel(0,-_a84.iGraphHeight));_a87.appendChild(_a84.divYExt2Lines);_a85.appendChild(_a87);};WSDOM.prototype.onCreateYGrid=function(_a88,iTop){var _a8a=this.getNewElement();_a8a.className="ygrid";YSDOM.setSize(_a8a,new Size(_a88.oInnerSize.width,1));YSCSS.setStyle(_a8a,"top",(iTop-1)+"px");_a88.divYGridLines.appendChild(_a8a);};WSDOM.prototype.onCreateYGridZone=function(_a8b,iTop,_a8d,_a8e,_a8f){var _a90=this.getNewElement();_a90.className="gridzone";var _a91=_a8b.iGridZonePaddingTop;_a8d-=_a91;if(_a8d<0){_a91+=_a8d;if(_a91<5){return;}
_a8d=0;}
_a8d=Math.min(_a8d,35-_a91);YSDOM.setSize(_a90,new Size(_a8b.oInnerSize.width-_a8b.iGridZonePaddingLeft,_a8d));var _a92="paddingLeft";var _a93="left";if(!_a8f){_a92="paddingRight";_a93="right";}
YSCSS.setMultiStyle(_a90,["top","paddingTop",_a92,"textAlign","overflow"],[(iTop-1)+"px",_a91+"px",_a8b.iGridZonePaddingLeft+"px",_a93,"hidden"]);_a90.innerHTML=_a8e;_a8b.divYGridLines.appendChild(_a90);};WSDOM.prototype.onCreateZone=function(_a94,_a95,_a96,_a97,_a98){var _a99=this.getNewElement();YSDOM.setPosition(_a99,{left:_a95.left,top:_a95.top-Math.floor(_a94.iLineWidth/2)});YSCSS.setStyle(_a99,"borderTop","solid "+_a94.iLineWidth+"px "+_a97);YSCSS.setStyle(_a99,"borderBottom","solid "+_a94.iLineWidth+"px "+_a97);var _a9a=Math.abs(Math.round(_a96.left)-Math.round(_a95.left));var _a9b=Math.abs(Math.round(_a96.top)-Math.round(_a95.top))+_a94.iLineWidth;YSDOM.setSize(_a99,{width:_a9a,height:_a9b});var _a9c=this.getNewElement();YSDOM.setSize(_a9c,new Size(_a9a,Math.max(_a9b-2*_a94.iLineWidth,0)));_a9c.className="zone "+_a98;_a99.appendChild(_a9c);return _a99;};WSDOM.prototype.onFillValueHolder=function(_a9d,_a9e,sX,sY){YSDOM.removeElementChilds(_a9e.firstChild,false);var _aa1="<table class=\"valuehover\">";if(isDefined(sX)&&sX.length>0){_aa1+="<tr><td class=\"title\">"+_a9d.sXLabel+":</td><td>"+sX+"</td></tr>";}
if(isDefined(sY)&&sY.length>0){_aa1+="<tr><td class=\"title\">"+_a9d.sCurValueLabel+":</td><td>"+sY+"</td></tr>";}
_aa1+="</table>";_a9e.firstChild.innerHTML=_aa1;YSCSS.setStyle(_a9e,"display","block");return YSDOM.getElementSize(_a9e,true);};WSDOM.prototype.onMoveGraph=function(_aa2,_aa3){YSCSS.setMultiStyle([_aa2.divGraphLineHolder,_aa2.divXGridLines,_aa2.divXExtLines],["left"],[(-_aa2.iGraphWidth+_aa3.left)+"px"]);YSCSS.setStyle(_aa2.divXAxisTexts,"left",(_aa2.iInitXTextLeft+_aa3.left)+"px");var _aa4=_aa2.aLineHolders;for(var _aa5 in _aa4){var _aa6=_aa2.sgGraph.isLeftLine(_aa5);YSCSS.setStyle(_aa4[_aa5],"top",_aa3.top+"px");var _aa7=_aa6?_aa2.divYAxisTexts:_aa2.divYAxis2Texts;var _aa8=_aa6?_aa2.divYExtLines:_aa2.divYExt2Lines;YSCSS.setMultiStyle([_aa2.divYGridLines,_aa7,_aa8],["top"],[(-_aa2.iGraphHeight+_aa3.top)+"px"]);}};WSDOM.prototype.onRemoveCM=function(_aa9){YSEventHandler.Instance().removeEvent("splitzone","onmouseup");YSEventHandler.Instance().removeEvent("removepoint","onmouseup");YSEventHandler.Instance().removeEvent("removeline","onmouseup");YSDOM.removeElementChilds(_aa9.divCM,false);YSCSS.setStyle(_aa9.divCM,"display","none");};WSDOM.prototype.onResetCursors=function(_aaa){YSCSS.setStyle(document.body,"cursor","auto");YSCSS.setStyle(_aaa.divEventCatcher,"cursor",_aaa.sCursorOpenHand);if(_aaa.oVP.maxx==WSDrawer.MIN_XWIDTH){YSCSS.setStyle(_aaa.divXExpander,"cursor",_aaa.sCursorResizeRight);}else{if(_aaa.oVP.maxx==WSDrawer.MAX_XWIDTH){YSCSS.setStyle(_aaa.divXExpander,"cursor",_aaa.sCursorResizeLeft);}else{YSCSS.setStyle(_aaa.divXExpander,"cursor",_aaa.sCursorResizeHor);}}
var _aab=_aaa.bCurIsLeft?_aaa.oVP.maxy1:_aaa.oVP.maxy2;var _aac=_aaa.sgGraph.getLine();if(_aac!=null){if(_aab<=(_aaa.bShowGridZones?_aac.zonemaxy:_aac.origmaxy)){YSCSS.setStyle(_aaa.divYExpander,"cursor",_aaa.sCursorResizeTop);}else{if(_aab>=(_aaa.bCurIsPace?SessionGraph.MAX_PACE:SessionGraph.MAX_SPEED)){YSCSS.setStyle(_aaa.divYExpander,"cursor",_aaa.sCursorResizeBottom);}else{YSCSS.setStyle(_aaa.divYExpander,"cursor",_aaa.sCursorResizeVert);}}}};WSDOM.prototype.onResetXAxis=function(_aad){YSDOM.removeElementChilds(_aad.divXAxisTexts,false);YSDOM.removeElementChilds(_aad.divXExtLines,false);YSDOM.removeElementChilds(_aad.divXGridLines,false);YSCSS.setStyle(_aad.divXAxisTexts,"left",_aad.iInitXTextLeft+"px");YSCSS.setMultiStyle([_aad.divXExtLines,_aad.divXGridLines],["left"],[-_aad.iGraphWidth+"px"]);};WSDOM.prototype.onResetYAxis=function(_aae,_aaf,_ab0,_ab1){YSDOM.removeElementChilds(_aaf,false);YSDOM.removeElementChilds(_ab0,false);YSCSS.setMultiStyle([_aaf,_ab0],["top"],[-_aae.iGraphHeight+"px"]);if(_ab1){YSDOM.removeElementChilds(_aae.divYGridLines,false);YSCSS.setStyle(_aae.divYGridLines,"top",-_aae.iGraphHeight+"px");}};WSDOM.prototype.onShowCursor=function(_ab2,_ab3){YSCSS.setMultiStyle([document.body,_ab2.divEventCatcher,_ab2.divXExpander,_ab2.divYExpander],["cursor"],[_ab3]);};WSDOM.prototype.onShowCM=function(_ab4,e){var _ab6=_ab4.gpCM.divZone!=null;if(_ab6){var _ab7=this.getNewElement();_ab7.id="splitzone";_ab7.innerHTML=YSText.get("[?SplitZone?]");_ab4.divCM.appendChild(_ab7);if(YSCSS.getStyle(_ab4.divZoneLine,"display")!="none"){YSEventHandler.Instance().addHandler(_ab7,"onmouseup",WSDrawer.prototype.onMouseUp,_ab4);}else{_ab7.className="disabled";}}
var _ab8=this.getNewElement();_ab8.id="removepoint";_ab8.innerHTML=_ab6?YSText.get("[?RemovePart?]"):YSText.get("[?RemovePoint?]");YSCSS.setMultiStyle(_ab8,["position","cursor"],["static","default"]);_ab4.divCM.appendChild(_ab8);if(_ab4.gpCM.bDeletable||(_ab6&&_ab4.gpCM.gpPrev.bDeletable)){YSEventHandler.Instance().addHandler(_ab8,"onmouseup",WSDrawer.prototype.onMouseUp,_ab4);}else{_ab8.className="disabled";}
var _ab9=this.getNewElement();_ab9.id="removeline";_ab9.innerHTML=_ab6?YSText.get("[?RemoveZone?]"):YSText.get("[?RemoveLine?]");YSCSS.setMultiStyle(_ab9,["position","cursor"],["static","default"]);_ab4.divCM.appendChild(_ab9);YSEventHandler.Instance().addHandler(_ab9,"onmouseup",WSDrawer.prototype.onMouseUp,_ab4);var oPos=YSEvent.getGlobalMousePosition(e);oPos.left++;oPos.top++;YSDOM.setPosition(_ab4.divCM,oPos);YSCSS.setStyle(_ab4.divCM,"display","block");};WSDOM.prototype.onShowTempValues=function(_abb,sX,sY){YSCSS.addClassName(_abb.divValueHover,"dotvalue");var _abe=this.onFillValueHolder(_abb,_abb.divValueHover,sX,sY);var _abf={};_abf.left=YSCSS.getStyle(_abb.imgTempDot,"left",true)+_abb.pxTopLeft.left+_abb.iGraphWidth-_abe.width;_abf.top=YSCSS.getStyle(_abb.imgTempDot,"top",true)+_abb.pxTopLeft.top+-_abb.iInitGraphTop-_abe.height;YSDOM.setPosition(_abb.divValueHover,_abf);};WSDOM.prototype.onShowValues=function(_ac0,sX,sY,oPos,_ac4){var _ac5=this.onFillValueHolder(_ac0,_ac0.divValueHover,sX,sY);var _ac6={left:0,top:0};if(_ac4.divZone!=null){YSCSS.removeClassName(_ac0.divValueHover,"dotvalue");var _ac7;if(YSCSS.getStyle(_ac0.divZoneLine,"display")=="none"){_ac7=oPos.left-1;}else{_ac7=YSCSS.getStyle(_ac0.divZoneLine,"left",true)+_ac0.pxTopLeft.left+_ac0.iGraphWidth;}
_ac6.left=_ac7-_ac5.width;_ac6.top=oPos.top-_ac5.height/2;}else{if(_ac4.imgDot!=null){YSCSS.addClassName(_ac0.divValueHover,"dotvalue");_ac6.left=YSCSS.getStyle(_ac4.imgDot,"left",true)+_ac0.pxTopLeft.left-_ac5.width;_ac6.top=YSCSS.getStyle(_ac4.imgDot,"top",true)+_ac0.pxTopLeft.top-_ac5.height;}}
YSDOM.setPosition(_ac0.divValueHover,_ac6);};WSDOM.prototype.onShowZoneIndicatorX=function(_ac8,iX1,iX2,iY1,iY2,_acd){var _ace=true;if(iY1!=0){iY1+=Math.ceil(_ac8.iLineWidth/2);var _acf=_ac8.iPaddingTop+_ac8.iGraphHeight-iY1-1;if(_acf>0){var _ad0=0;var _ad1,_ad2;if(iX1!=0){_ad1=iX1;_ad0+=_ac8.iIndicatorWidth;YSCSS.setStyle(_ac8.divZoneIndicatorX.childNodes[0],"display","block");}else{_ad1=_ac8.iPaddingLeft;YSCSS.setStyle(_ac8.divZoneIndicatorX.childNodes[0],"display","none");}
if(iX2!=0){_ad2=iX2;_ad0+=_ac8.iIndicatorWidth;YSCSS.setStyle(_ac8.divZoneIndicatorX.childNodes[2],"display","block");}else{_ad2=_ac8.iPaddingLeft+_ac8.iGraphWidth;YSCSS.setStyle(_ac8.divZoneIndicatorX.childNodes[2],"display","none");}
var _ad3=_ad2-_ad1;var _ad4=_ad3-_ad0;YSCSS.setMultiStyle(_ac8.divZoneIndicatorX,["width","height","left","top","display"],[_ad3+"px",_acf+"px",_ad1+"px",iY1+"px","block"]);YSCSS.setStyle(_ac8.divZoneIndicatorX.childNodes[1],"width",_ad4+"px");_ace=false;}
iY1-=_acd;}
if(_ace){YSCSS.setStyle(_ac8.divZoneIndicatorX,"display","none");}
return iY1;};WSDOM.prototype.onShowZoneIndicatorY=function(_ad5,iX1,iX2,iY1,iY2,_ada){var _adb=true;if(_ad5.bCurIsLeft&&iX1!=0||!_ad5.bCurIsLeft&&iX2!=0){var _adc;if(_ad5.bCurIsLeft){_adc=iX1-_ad5.iPaddingLeft-1;}else{_adc=_ad5.iPaddingLeft+_ad5.iGraphWidth-iX2-1;}
if(_adc>0){var _add;if(_ad5.bCurIsLeft){_add=_ad5.iPaddingLeft+1;}else{_add=iX2;}
var _ade=0;var _adf,_ae0;if(iY2!=0){_ae0=iY2-Math.floor(_ad5.iLineWidth/2)+_ada;_ade+=_ad5.iIndicatorWidth;YSCSS.setStyle(_ad5.divZoneIndicatorY.childNodes[0],"display","block");}else{_ae0=_ad5.iPaddingTop;YSCSS.setStyle(_ad5.divZoneIndicatorY.childNodes[0],"display","none");}
if(iY1!=0){_adf=iY1;_ade+=_ad5.iIndicatorWidth;YSCSS.setStyle(_ad5.divZoneIndicatorY.childNodes[2],"display","block");}else{_adf=_ad5.iPaddingTop+_ad5.iGraphHeight;YSCSS.setStyle(_ad5.divZoneIndicatorY.childNodes[0],"display","none");}
var _ae1=_adf-_ae0;var _ae2=_ae1-_ade;YSCSS.setMultiStyle(_ad5.divZoneIndicatorY,["width","height","left","top","display"],[_adc+"px",_ae1+"px",_add+"px",_ae0+"px","block"]);YSCSS.setStyle(_ad5.divZoneIndicatorY.childNodes[1],"height",_ae2+"px");_adb=false;}}
if(_adb){YSCSS.setStyle(_ad5.divZoneIndicatorY,"display","none");}};WSDOM.prototype.onShowZoneValues=function(_ae3,sX1,sX2,sY1,sY2,_ae8){var _ae9={top:_ae3.iPaddingTop+_ae3.iGraphHeight};var iX1=0,iX2=0,iY1=0,iY2=0;var _aee=YSCSS.getStyle(_ae8.divZone,"left",true)-_ae3.iGraphWidth+_ae3.iPaddingLeft;if(_aee>=_ae3.iPaddingLeft){_ae3.divZoneHoverX1.firstChild.innerHTML=sX1;YSCSS.setStyle(_ae3.divZoneHoverX1,"display","block");var _aef=YSDOM.getElementSize(_ae3.divZoneHoverX1,true);YSCSS.setStyle(_ae3.divZoneHoverX1.lastChild,"left",(_aef.width/2-6)+"px");_ae9.left=_aee-_aef.width/2;YSDOM.setPosition(_ae3.divZoneHoverX1,_ae9);iX1=_aee;}
_aee+=YSCSS.getStyle(_ae8.divZone,"width",true);if(_aee<=_ae3.iPaddingLeft+_ae3.iGraphWidth){_ae3.divZoneHoverX2.firstChild.innerHTML=sX2;YSCSS.setStyle(_ae3.divZoneHoverX2,"display","block");var _aef=YSDOM.getElementSize(_ae3.divZoneHoverX2,true);YSCSS.setStyle(_ae3.divZoneHoverX2.lastChild,"left",(_aef.width/2-6)+"px");_ae9.left=_aee-_aef.width/2-1;YSDOM.setPosition(_ae3.divZoneHoverX2,_ae9);iX2=_aee;}
_aee=_ae3.iPaddingLeft;if(_ae3.bCurIsLeft){_aee-=_ae3.iYAxisLineWidth-1;}else{_aee+=_ae3.iGraphWidth+_ae3.iYAxisLineWidth-1;}
var iTop=YSCSS.getStyle(_ae8.divZone,"top",true)-(-_ae3.iInitGraphTop)+_ae3.iPaddingTop;if(iTop>=_ae3.iPaddingTop){_ae3.divZoneHoverY2.firstChild.innerHTML=sY2;YSCSS.setStyle(_ae3.divZoneHoverY2,"display","block");var _aef=YSDOM.getElementSize(_ae3.divZoneHoverY2,true);if(_ae3.bCurIsLeft){_ae9.left=_aee-_aef.width;YSCSS.removeClassName(_ae3.divZoneHoverY2,"reverse");}else{_ae9.left=_aee;YSCSS.addClassName(_ae3.divZoneHoverY2,"reverse");}
_ae9.top=iTop-_aef.height/2;YSDOM.setPosition(_ae3.divZoneHoverY2,_ae9);iY2=iTop;}
iTop+=YSCSS.getStyle(_ae8.divZone,"height",true)-_ae3.iLineWidth;if(iTop<=_ae3.iPaddingTop+_ae3.iGraphHeight){_ae3.divZoneHoverY1.firstChild.innerHTML=sY1;YSCSS.setStyle(_ae3.divZoneHoverY1,"display","block");var _aef=YSDOM.getElementSize(_ae3.divZoneHoverY1,true);if(_ae3.bCurIsLeft){_ae9.left=_aee-_aef.width;YSCSS.removeClassName(_ae3.divZoneHoverY1,"reverse");}else{_ae9.left=_aee;YSCSS.addClassName(_ae3.divZoneHoverY1,"reverse");}
_ae9.top=iTop-_aef.height/2;YSDOM.setPosition(_ae3.divZoneHoverY1,_ae9);iY1=iTop;}
var _af1=Math.round((_ae3.iLineWidth-_ae3.iIndicatorWidth)/2);iY1=this.onShowZoneIndicatorX(_ae3,iX1,iX2,iY1,iY2,_af1);this.onShowZoneIndicatorY(_ae3,iX1,iX2,iY1,iY2,_af1);};var WSDOM=new WSDOM();function WSDrawer(_af2,_af3){if(!isDefined(_af2)){return;}
this.sgGraph=_af2;this.divXGridLines=null;this.divYGridLines=null;this.divXExtLines=null;this.divYExtLines=null;this.divYExt2Lines=null;this.divYAxisTexts=null;this.divYAxis2Texts=null;this.divYAxisUnit=null;this.divYAxis2Unit=null;this.divXAxisTexts=null;this.divGraphClip=null;this.divGraphLineHolder=null;this.divEventCatcher=null;this.divXLegend=null;this.divXExpander=null;this.divYExpander=null;this.imgLoading=null;this.imgTempDot=null;this.divZoneLine=null;this.divValueHover=null;this.divZoneHoverX1=null;this.divZoneHoverX2=null;this.divZoneHoverY1=null;this.divZoneHoverY2=null;this.divZoneIndicatorX=null;this.divZoneIndicatorY=null;this.divMaxXValue=null;this.divMaxYValue=null;this.gpHover=null;this.gpDragging=null;this.gpCM=null;this.divCM=null;this.oXScroll=null;this.oY1Scroll=null;this.oY2Scroll=null;this.bTimeBased=_af3;this.bExpandableX=true;this.bKM=true;var _af4=YSCookie.read("wsshowzones");this.bShowGridZones=_af4==null||_af4=="1";this.sXLabel=_af3?YSText.get("[?HoverTime?]"):YSText.get("[?HoverDistance?]");this.bPreventCMHide=false;this.bPreventZoneCheck=false;this.bExpandingX=false;this.bExpandingY=false;this.bDragging=false;this.bScrollingX=false;this.bScrollingY=false;this.bZoomingX=false;this.bZoomingY=false;this.bZoomOnY=false;this.oStartPos=null;this.oStartCache={maxx:0,pixperx:0,minnewx:0,maxnewx:0,xsnap:0,maxy:0,pixpery:0,minnewy:0,maxnewy:0,ysnap:0};this.iGraphHeight=350;this.iGraphWidth=600;this.oInnerSize=new Size(this.iGraphWidth-2,this.iGraphHeight-2);this.iFontSize=11;this.iHalfFontSize=6;this.iYExtTextDist=4;this.iLineWidth=5;this.iYAxisLineWidth=2;this.iIndicatorWidth=2;this.iPaddingTop=10;this.iPaddingLeft=61;this.iMaxYScales=6;this.iMaxXScales=7;this.fXScale=0;this.fYScale=0;this.iXScaleExtWidth=12;this.iYScaleExtWidth=13;this.sGridZoneFontSize="16px";this.iGridZonePaddingLeft=10;this.iGridZonePaddingTop=5;this.sDotSrc=IMAGE_PATH+"dot.png";this.sActiveDotSrc=IMAGE_PATH+"dot_active.png";this.oVP={minx:0,maxx:0,miny1:0,maxy1:0,miny2:0,maxy2:0};this.fXRoundOn=1;this.fPixPerX=0;this.fPixPerY1=0;this.fPixPerY2=0;this.fLastXWidth=0;this.fLastYWidth=0;this.iInitXTextLeft=0;this.iInitGraphTop=0;this.iYTextWidth=0;this.iCurLineType=SessionGraph.TYPE_NONE;this.bCurIsLine=true;this.bCurIsLeft=true;this.bCurIsPace=false;this.bCurIsHeart=false;this.bCurIsPerc=false;this.bCurIsIntensity=false;this.bCurIsZoladz=false;this.fCurPixPerY=0;this.fCurMinY=0;this.fCurMaxY=0;this.fCurYRoundOn=1;this.sCurUnit="";this.sCurValueLabel="";this.fCurXSnap=1;this.fCurYSnap=1;this.pxOriginLeft=new Pixel();this.pxOriginRight=new Pixel();this.pxTopLeft=new Pixel();WSDrawer.MIN_XWIDTH=this.bTimeBased?WSDrawer.MIN_TIMEWIDTH:WSDrawer.MIN_DISTWIDTH;WSDrawer.MAX_XWIDTH=this.bTimeBased?WSDrawer.MAX_TIMEWIDTH:WSDrawer.MAX_DISTWIDTH;this.aTimeScales=[1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,10800,21600,43200,86400,172800,259200,345600];this.aValueScales=[0.1,0.2,0.25,0.5];this.aXSnapValues=this.bTimeBased?[1,5,10,15,30,60,300,600,900,1800,3600]:[0.1,0.5,1,2.5,5,10];this.aPaceSnapValues=[10,20,30,60];this.aSpeedSnapValues=[0.1,0.25,0.5,1,2,5,10];this.aHeartSnapValues=[1,2,5,10,25,50];this.aIntensitySnapValues=[];this.iLastZoomTime=0;this.toHideDot=null;this.toRemoveLoading=null;this.bAutoHideLoading=true;this.toXHoverEnd=null;this.toYHoverEnd=null;this.toVPAnimation=null;this.sCursorResizeHor=YSCSS.getCustomCursor("http://www.coachr.com/images/hresize.cur",new Pixel(14,16),"ew-resize");this.sCursorResizeRight=YSCSS.getCustomCursor("http://www.coachr.com/images/right_resize.cur",new Pixel(14,16),"e-resize");this.sCursorResizeLeft=YSCSS.getCustomCursor("http://www.coachr.com/images/left_resize.cur",new Pixel(14,16),"w-resize");this.sCursorResizeVert=YSCSS.getCustomCursor("http://www.coachr.com/images/vresize.cur",new Pixel(14,16),"ns-resize");this.sCursorResizeTop=YSCSS.getCustomCursor("http://www.coachr.com/images/top_resize.cur",new Pixel(14,16),"n-resize");this.sCursorResizeBottom=YSCSS.getCustomCursor("http://www.coachr.com/images/bottom_resize.cur",new Pixel(14,16),"s-resize");this.sCursorOpenHand=YSCSS.getCustomCursor("http://www.coachr.com/images/openhand.cur",new Pixel(7,8),"move");this.sCursorClosedHand=YSCSS.getCustomCursor("http://www.coachr.com/images/closedhand.cur",new Pixel(7,8),"move");};WSDrawer.ZOOM_INTERVAL=250;WSDrawer.MIN_TIMEWIDTH=600;WSDrawer.MIN_DISTWIDTH=1;WSDrawer.MIN_XWIDTH=0;WSDrawer.MAX_TIMEWIDTH=86400;WSDrawer.MAX_DISTWIDTH=500;WSDrawer.MAX_XWIDTH=0;WSDrawer.MIN_INTENSITYWIDTH=10;WSDrawer.MIN_SPEEDWIDTH=2;WSDrawer.MIN_PACEWIDTH=60;WSDrawer.MIN_HEARTWIDTH=20;WSDrawer.MIN_YWIDTH=0;WSDrawer.MIN_SCROLLBAR_LENGTH=20;WSDrawer.VP_ANIMATION_DURATION=250;WSDrawer.POINT_CURSOR="default";WSDrawer.GRID_COLOR="#868686";WSDrawer.EXT_COLOR="#474747";WSDrawer.INACTIVE_COLOR="#555555";WSDrawer.bDocEventsSet=false;WSDrawer.OnDocKeyDown=function(e,obj){if(SessionGraph.sgCur!=null&&Tabs.getCurTabID()==SchedulePage.sTabID){return SessionGraph.sgCur.dwDrawer.onKeyDown(e);}else{return true;}};WSDrawer.OnDocKeyUp=function(e,obj){if(SessionGraph.sgCur!=null&&Tabs.getCurTabID()==SchedulePage.sTabID){return SessionGraph.sgCur.dwDrawer.onKeyUp(e);}else{return true;}};WSDrawer.OnDocMouseCM=function(e,obj){if(SessionGraph.sgCur!=null){return SessionGraph.sgCur.dwDrawer.onMouseCM(e);}else{return true;}};WSDrawer.OnDocMouseDown=function(e,obj){if(SessionGraph.sgCur!=null){SessionGraph.sgCur.dwDrawer.onMouseDown(e,obj);}};WSDrawer.OnDocMouseMove=function(obj,oPos){if(SessionGraph.sgCur!=null){SessionGraph.sgCur.dwDrawer.onMouseMove(oPos);}};WSDrawer.OnDocMouseUp=function(e,obj){if(SessionGraph.sgCur!=null){SessionGraph.sgCur.dwDrawer.onMouseUp(e,obj);}};WSDrawer.OnWindowResize=function(e,obj){if(SessionGraph.sgCur!=null){SessionGraph.sgCur.dwDrawer.onWindowResize();}};WSDrawer.prototype.destruct=function(){if(this.toRemoveLoading!=null){this.toRemoveLoading.cancelTimeout();this.toRemoveLoading=null;}
if(this.toHideDot!=null){this.toHideDot.cancelTimeout();this.toHideDot=null;}
if(this.toXHoverEnd!=null){this.toXHoverEnd.cancelTimeout();this.toXHoverEnd=null;}
if(this.toYHoverEnd!=null){this.toYHoverEnd.cancelTimeout();this.toYHoverEnd=null;}
if(this.toVPAnimation!=null){this.toVPAnimation.cancelTimeout();this.toVPAnimation=null;}
YSEventHandler.Instance().removeEvent(this.divCM,"onmousedown");YSEventHandler.Instance().removeEvent(this.divXExpander,"onmousedown");YSEventHandler.Instance().removeEvent(this.divYExpander,"onmousedown");YSEventHandler.Instance().removeEvent(this.divEventCatcher,"onmousedown");YSEventHandler.Instance().removeEvent(this.divGraphClip,"onmousedown");YSEventHandler.Instance().removeEvent(this.divEventCatcher,"onmousewheel");YSEventHandler.Instance().removeEvent(this.oXScroll.scrollholder,"onmouseover");YSEventHandler.Instance().removeEvent(this.oXScroll.scrollholder,"onmouseout");YSEventHandler.Instance().removeEvent(this.oXScroll.bar,"onmousedown");YSEventHandler.Instance().removeEvent(this.oY1Scroll.scrollholder,"onmouseover");YSEventHandler.Instance().removeEvent(this.oY1Scroll.scrollholder,"onmouseout");YSEventHandler.Instance().removeEvent(this.oY1Scroll.bar,"onmousedown");YSEventHandler.Instance().removeEvent(this.oY2Scroll.scrollholder,"onmouseover");YSEventHandler.Instance().removeEvent(this.oY2Scroll.scrollholder,"onmouseout");YSEventHandler.Instance().removeEvent(this.oY2Scroll.bar,"onmousedown");YSEventHandler.Instance().removeEvent(this.divValueHover,"onmousedown");YSEventHandler.Instance().removeEvent(this.divValueHover,"onmouseup");this.divXGridLines=null;this.divYGridLines=null;this.divXExtLines=null;this.divYExtLines=null;this.divYExt2Lines=null;this.divYAxisTexts=null;this.divYAxis2Texts=null;this.divYAxisUnit=null;this.divYAxis2Unit=null;this.divXAxisTexts=null;this.divGraphClip=null;this.divGraphLineHolder=null;this.divEventCatcher=null;this.divXLegend=null;this.divXExpander=null;this.divYExpander=null;this.imgLoading=null;this.imgTempDot=null;this.divZoneLine=null;this.gpHover=null;this.gpDragging=null;this.gpCM=null;this.oXScroll=null;this.oY1Scroll=null;this.oY2Scroll=null;this.divZoneHoverX1=null;this.divZoneHoverX2=null;this.divZoneHoverY1=null;this.divZoneHoverY2=null;this.divZoneIndicatorX=null;this.divZoneIndicatorY=null;this.divMaxXValue=null;this.divMaxYValue=null;YSDOM.removeElement(this.divValueHover);YSDOM.removeElement(this.divCM);this.divCM=null;this.divValueHover=null;this.sgGraph=null;this.oStartPos=null;this.oStartCache=null;this.aLines=null;this.aHeartSnapValues=null;this.aIntensitySnapValues=null;this.aPaceSnapValues=null;this.aSpeedSnapValues=null;this.aTimeScales=null;this.aValueScales=null;this.aXSnapValues=null;this.aLineHolders=null;};WSDrawer.prototype.getColor=function(_b03){switch(_b03){case SessionGraph.TYPE_INTENSITYLINE:case SessionGraph.TYPE_INTENSITYZONE:case SessionGraph.TYPE_SPEEDLINE:case SessionGraph.TYPE_SPEEDZONE:return"blue";case SessionGraph.TYPE_PACELINE:case SessionGraph.TYPE_PACEZONE:return"yellow";case SessionGraph.TYPE_HEARTPERCLINE:case SessionGraph.TYPE_HEARTPERCZONE:case SessionGraph.TYPE_HEARTLINE:case SessionGraph.TYPE_HEARTZONE:case SessionGraph.TYPE_KARVONENLINE:case SessionGraph.TYPE_KARVONENZONE:case SessionGraph.TYPE_ZOLADZLINE:case SessionGraph.TYPE_ZOLADZZONE:return"red";default:"disabled";}};WSDrawer.prototype.getCSSColor=function(_b04){switch(_b04){case SessionGraph.TYPE_INTENSITYLINE:case SessionGraph.TYPE_INTENSITYZONE:case SessionGraph.TYPE_SPEEDLINE:case SessionGraph.TYPE_SPEEDZONE:return"#2869A3";case SessionGraph.TYPE_PACELINE:case SessionGraph.TYPE_PACEZONE:return"#ABA000";case SessionGraph.TYPE_HEARTPERCLINE:case SessionGraph.TYPE_HEARTPERCZONE:case SessionGraph.TYPE_HEARTLINE:case SessionGraph.TYPE_HEARTZONE:case SessionGraph.TYPE_KARVONENLINE:case SessionGraph.TYPE_KARVONENZONE:case SessionGraph.TYPE_ZOLADZLINE:case SessionGraph.TYPE_ZOLADZZONE:return"#940B0E";}
return"transparent";};WSDrawer.prototype.getOriginPx=function(_b05){var _b06=_b05?this.fPixPerY1:this.fPixPerY2;var _b07=_b05?this.oVP.miny1:this.oVP.miny2;return{left:this.iGraphWidth-this.oVP.minx*this.fPixPerX,top:this.iGraphHeight*2+_b07*_b06};};WSDrawer.prototype.getPixPerX=function(){return this.fPixPerX;};WSDrawer.prototype.getPixPerY=function(_b08){return _b08?this.fPixPerY1:this.fPixPerY2;};WSDrawer.prototype.getScale=function(_b09,_b0a,_b0b,_b0c){if(_b0b){var _b0d=1;for(var i=0,_b0f=this.aTimeScales.length;i<_b0f;i++){_b0d=this.aTimeScales[i];if(_b09/_b0d<=_b0a){break;}}
return _b0d;}else{if(!isDefined(_b0c)){_b0c=1;}
var _b10=1;var _b11=_b0c;var _b12=true;while(_b12){for(var i=0,_b0f=this.aValueScales.length;i<_b0f;i++){_b11=this.aValueScales[i]*_b10;if(_b09/_b11<=_b0a){_b12=false;break;}}
_b10*=10;}
return _b11;}};WSDrawer.prototype.getSnappedVP=function(_b13){var _b14=this.oVP.minx;if(_b14>0){_b14=Math.ceil(_b14/_b13)*_b13;}else{_b14=0;}
var _b15=this.oVP.maxx;var _b16=this.sgGraph.getMaxX();if(_b15<_b16){_b15=Math.floor(_b15/_b13)*_b13;}else{_b15=_b16;}
return{minx:_b14,maxx:_b15};};WSDrawer.prototype.getSnappingValue=function(_b17,_b18){var _b19=10000000,_b1a;var _b1b=1;for(var i=0,_b1d=_b18.length;i<_b1d;i++){_b1a=Math.abs(_b18[i]-_b17);if(_b1a<_b19){_b19=_b1a;_b1b=_b18[i];}else{break;}}
return _b1b;};WSDrawer.prototype.getXRoundOn=function(){return this.fXRoundOn;};WSDrawer.prototype.getXSnapValue=function(_b1e){return this.getSnappingValue(_b1e/this.fPixPerX,this.aXSnapValues);};WSDrawer.prototype.getXValue=function(fX,_b20){fX=Math.round(fX/this.fXRoundOn)*this.fXRoundOn;if(this.bTimeBased){return YSDateTime.getTimeString(fX);}else{var _b21="";if(!isDefined(_b20)||_b20){if(bKM){_b21="km";}else{_b21="mi";}}
return String(fX)+_b21;}};WSDrawer.prototype.getYScale=function(_b22,_b23,_b24){return this.getScale(_b22,this.iMaxYScales,_b23,_b24);};WSDrawer.prototype.getYSnappingValues=function(_b25){var _b26=[];var _b27=this.sgGraph.getLine();var _b28=_b27.miny;if(this.bCurIsPace){_b28=SessionGraph.MIN_PACE;}
var _b29=this.fCurMinY;if(_b29<=_b28){_b29=_b28;}else{_b29=Math.ceil(_b29/_b25)*_b25;}
var _b2a=this.fCurMaxY;if(_b2a>=_b27.maxy){_b2a=_b27.maxy;}else{_b2a=Math.floor(_b2a/_b25)*_b25;}
_b26.push(_b29);_b26.push(_b2a);var _b2b=(Math.floor(_b29/_b25)+1)*_b25;while(_b2b<_b2a){_b26.push(_b2b);_b2b+=_b25;}
var _b2c=this.sgGraph.getGridZones().zones;for(var i=0,_b2e=_b2c.length;i<_b2e;i++){if(_b2c[i].y1>_b29){_b26.push(_b2c[i].y1);}
if(_b2c[i].y2<_b2a){_b26.push(_b2c[i].y2);}}
return _b26.sort(YSList.compare);};WSDrawer.prototype.getYSnapValue=function(_b2f){var _b30=this.aSpeedSnapValues;if(this.bCurIsPace){_b30=this.aPaceSnapValues;}else{if(this.bCurIsHeart){_b30=this.aHeartSnapValues;}else{if(this.bCurIsIntensity){_b30=this.aIntensitySnapValues;}}}
return this.getSnappingValue(_b2f/this.fCurPixPerY,_b30);};WSDrawer.prototype.getYValue=function(fY,_b32){if(this.bCurIsIntensity){fY=this.sgGraph.getSpeed(fY);}else{if(this.bCurIsZoladz){fY=this.sgGraph.getBPM(fY);}}
var iLog=Math.round(Math.log(1/this.fCurYRoundOn)/Math.LN10);fY=YSNumbers.roundNumber(fY,iLog);if(this.bCurIsPace){return YSDateTime.getTimeString(fY,false);}else{var _b34="";if(this.sCurUnit=="%"||!isDefined(_b32)||_b32){_b34=" "+this.sCurUnit;}
return String(fY)+_b34;}};WSDrawer.prototype.isGridZoneShown=function(){return this.bShowGridZones;};WSDrawer.prototype.onActiveChange=function(_b35,_b36,oPos){var _b38=isDefined(oPos)&&oPos!=null;if(_b35!=null){_b38=_b38&&_b36;var sX,sY;if(_b35.imgDot!=null){_b35.imgDot.src=_b36?this.sActiveDotSrc:this.sDotSrc;YSCSS.setStyle(_b35.imgDot,"zIndex",_b36?1:0);if(_b38){sX=this.getXValue(_b35.fX);sY=this.getYValue(_b35.fY);}}else{if(_b35.divZone!=null){if(_b36){YSCSS.addClassName(_b35.divZone.firstChild,"active");}else{YSCSS.removeClassName(_b35.divZone.firstChild,"active");}
if(_b38){sX1=this.getXValue(_b35.gpPrev.fX,false);sX2=this.getXValue(_b35.fX,false);sY1=this.getYValue(_b35.fY,this.bCurIsPerc);sY2=this.getYValue(_b35.fY2,this.bCurIsPerc);WSDOM.onShowZoneValues(this,sX1,sX2,sY1,sY2,_b35);switch(_b35.iResizing){case WSGraphPoint.RS_NONE:if(YSCSS.getStyle(this.divZoneLine,"display")=="none"){sX=sY=undefined;}else{sX=this.getXValue(this.divZoneLine.fX);}
break;case WSGraphPoint.RS_TOP:sX="";sY=this.getYValue(_b35.fY2);break;case WSGraphPoint.RS_BOTTOM:sX="";sY=this.getYValue(_b35.fY);break;case WSGraphPoint.RS_LEFT:sX=this.getXValue(_b35.gpPrev.fX);break;case WSGraphPoint.RS_RIGHT:sX=this.getXValue(_b35.fX);break;}}}}
if(_b38){if(sX==undefined&&sY==undefined){YSCSS.setStyle(this.divValueHover,"display","none");}else{WSDOM.onShowValues(this,sX,sY,oPos,_b35);}}}
if(!_b38){if(_b35!=null&&_b35.imgDot!=null){YSCSS.setStyle(this.divValueHover,"display","none");}else{YSCSS.setMultiStyle([this.divValueHover,this.divZoneHoverX1,this.divZoneHoverX2,this.divZoneHoverY1,this.divZoneHoverY2,this.divZoneIndicatorX,this.divZoneIndicatorY],["display"],["none"]);}}};WSDrawer.prototype.onAddPoint=function(oPos){var _b3c=this.sgGraph.getLine();if(_b3c!=null){var fX=YSNumbers.checkFloat(YSXML.getAttribute(this.imgTempDot,"ws_x"));var fY=YSNumbers.checkFloat(YSXML.getAttribute(this.imgTempDot,"ws_y"));var _b3f=new WSGraphPoint(0,fX,fY,0,true);var _b40=new WSGraphPoint(0,fX,fY,0,true);_b3c.line.add(_b3f);if(_b3f.gpPrev.fX==_b3f.gpNext.fX){_b3f.bVertical=true;_b3f.bUpDown=_b3f.gpPrev.fY>_b3f.gpNext.fY;}
_b3c.line.add(_b40,_b3f);_b40.bVertical=_b3f.bVertical;_b40.bUpDown=_b3f.bUpDown;_b3f.setBuddy(_b40);this.gpHover=_b40;this.onHideLineDot();this.onRedraw({curline:true});this.onDragDotStart(oPos);}};WSDrawer.prototype.onAnimateVP=function(_b41,_b42){var _b43=Math.min(_b42/WSDrawer.VP_ANIMATION_DURATION,1);var _b44=this.sgGraph.getVP();_b44.miny1=_b41.start.miny1+(_b43*(_b41.end.miny1-_b41.start.miny1));_b44.maxy1=_b41.start.maxy1+(_b43*(_b41.end.maxy1-_b41.start.maxy1));_b44.miny2=_b41.start.miny2+(_b43*(_b41.end.miny2-_b41.start.miny2));_b44.maxy2=_b41.start.maxy2+(_b43*(_b41.end.maxy2-_b41.start.maxy2));this.sgGraph.onViewChanged();if(_b43==1){this.toVPAnimation.cancelTimeout();this.toVPAnimation=null;}};WSDrawer.prototype.onAutoHideLoading=function(){if(this.bAutoHideLoading){YSCSS.setTransparency(this.divEventCatcher,100);YSCSS.setStyle(this.imgLoading,"display","none");}
this.toRemoveLoading=null;};WSDrawer.prototype.onCMClick=function(obj){if((obj.id=="removepoint"||obj.id=="removeline"||obj.id=="splitzone")&&this.gpCM!=null){var _b46=false;if(obj.id=="removepoint"){this.gpCM.onRemove();this.sgGraph.getLine().line.onStore();_b46=true;}else{if(obj.id=="removeline"){var _b47=this.bCurIsLine?YSText.get("[?SureToRemoveLine?]"):YSText.get("[?SureToRemoveZone?]");new YSConfirm("removeline",_b47,YSText.get("[?Yes?]"),YSText.get("[?No?]"),WSDrawer.prototype.onConfirmResult,this,this.divGraphClip);}else{if(obj.id=="splitzone"){var _b48=this.sgGraph.getLine();var _b49=this.bCurIsPace?SessionGraph.MIN_PACE:_b48.miny;this.gpCM.onSplitZone(this.divZoneLine.fX,_b48.line,_b49,_b48.maxy,this.fCurYSnap);_b46=true;}}}
WSDOM.onRemoveCM(this);this.onActiveChange(this.gpCM,false);this.gpCM=null;if(this.gpHover!=null){WSDOM.onShowCursor(this,WSDrawer.POINT_CURSOR);this.gpHover=null;}else{WSDOM.onResetCursors(this);}
if(_b46){this.onRedraw({curline:true});}
return true;}
return false;};WSDrawer.prototype.onConfirmResult=function(sID,_b4b){if(sID=="removeline"&&_b4b){this.sgGraph.onRemoveCurLine();}};WSDrawer.prototype.onDragDot=function(oPos){var _b4d=false;this.gpDragging.oCurPos=oPos;var _b4e={left:oPos.left-this.oStartPos.left,top:this.oStartPos.top-oPos.top};if(this.gpDragging.iTempID!=0){if(this.gpDragging.bVertical){_b4e.left=Math.max(0,_b4e.left);}}
_b4d=this.gpDragging.onDrag(_b4e);if(this.gpDragging.divZone!=null){var _b4f=this.gpDragging.getCursor();switch(_b4f){case 1:WSDOM.onShowCursor(this,this.sCursorResizeVert);break;case 2:WSDOM.onShowCursor(this,this.sCursorResizeTop);break;case 3:WSDOM.onShowCursor(this,this.sCursorResizeBottom);break;case 4:WSDOM.onShowCursor(this,this.sCursorResizeHor);break;case 5:WSDOM.onShowCursor(this,this.sCursorResizeLeft);break;case 6:WSDOM.onShowCursor(this,this.sCursorResizeRight);break;}}
if(!this.bCurIsLine&&this.gpDragging.isDragged()){YSCSS.setStyle(this.divZoneLine,"display","none");}
if(_b4d){this.onRedraw({curline:true});}};WSDrawer.prototype.onDragDotEnd=function(e){delete this.gpDragging.oCurPos;var _b51=this.gpDragging.isDragged();this.gpDragging.onDragEnd();if(this.sgGraph.getLine().line.onStore()){this.onRedraw({curline:true});}
var _b52=YSEvent.getGlobalMousePosition(e);if(this.bCurIsLine){this.gpHover=this.gpDragging;this.onShowTempDot(_b52);}else{this.onZoneHover(_b52);}
this.gpDragging=null;};WSDrawer.prototype.onDragDotStart=function(oPos){if(this.bCurIsLine){this.onActiveChange(this.gpHover,true,oPos);}
this.gpDragging=this.gpHover;this.gpHover=null;this.gpDragging.oCurPos=oPos;if(this.bCurIsLine&&this.gpDragging.gpBuddy==null){if(this.gpDragging.gpNext!=null&&this.gpDragging.gpNext.fX==this.gpDragging.fX){this.gpDragging.setBuddy(this.gpDragging.gpNext);}else{if(this.gpDragging.gpPrev!=null&&this.gpDragging.gpPrev.fX==this.gpDragging.fX){this.gpDragging.setBuddy(this.gpDragging.gpPrev);}}}
var _b54=this.getYSnappingValues(this.fCurYSnap);var _b55=this.getSnappedVP(this.fCurXSnap);this.gpDragging.onDragStart(this.fCurXSnap,this.fCurYSnap,this.fPixPerX,this.fCurPixPerY,this.bCurIsLine,_b55,_b54);};WSDrawer.prototype.onDragGraph=function(oPos){var _b57=oPos.left-this.oStartPos.left;var _b58=this.oVP.minx-_b57/this.fPixPerX;var _b59=this.oVP.maxx-this.oVP.minx;var _b5a=this.sgGraph.getMaxX();var _b5b=1/this.fPixPerX;if(_b58<0){_b58+=Math.round(-_b58/_b5b)*_b5b;}
if(_b58+_b59>_b5a){_b58=_b5a-_b59;}
var _b5c=_b58+_b59;this.oStartCache.maxx=_b5c;_b57=Math.round((this.oVP.minx-_b58)*this.fPixPerX);var _b5d=0;var _b5e=this.sgGraph.getLine();if(_b5e!=null){_b5d=oPos.top-this.oStartPos.top;var _b5f=this.fCurMinY;var _b60=this.fCurMaxY;var _b61=_b60-_b5f;var _b62=_b5f+_b5d/this.fCurPixPerY;_b5b=1/this.fCurPixPerY;if(_b62<_b5e.miny){_b62+=Math.round((_b5e.miny-_b62)/_b5b)*_b5b;}
if(_b62+_b61>_b5e.maxy){_b62=_b5e.maxy-_b61;}
var _b63=_b62+_b61;this.oStartCache.maxy=_b63;_b5d=Math.round((_b62-_b5f)*this.fCurPixPerY);this.onResetYScroll(_b62,_b63,0);if(this.oStartCache.maxy2>0){var _b64=this.sgGraph.getSimilarValues(_b62,_b63,_b5e,!this.bCurIsLeft);this.oStartCache.maxy2=_b64.maxy;}}
WSDOM.onMoveGraph(this,{left:_b57,top:_b5d});this.onResetXScroll(_b58,_b5c,0);};WSDrawer.prototype.onDragGraphEnd=function(){var _b65=this.oVP.maxx-this.oVP.minx;var _b66=this.fCurMaxY-this.fCurMinY;var _b67=this.bCurIsLeft?this.oVP.maxy2-this.oVP.miny2:this.oVP.maxy1-this.oVP.miny1;this.sgGraph.setVP(this.oStartCache.maxx-_b65,this.oStartCache.maxx,this.oStartCache.maxy-_b66,this.oStartCache.maxy,this.oStartCache.maxy2-_b67,this.oStartCache.maxy2);this.bDragging=this.bScrollingX=this.bScrollingY=false;};WSDrawer.prototype.onDragGraphStart=function(){this.bDragging=true;this.oStartCache.maxx=this.oVP.maxx;var _b68=this.sgGraph.getLine();if(_b68!=null){this.oStartCache.maxy=this.fCurMaxY;}
if(this.sgGraph.getRightLineType()!=SessionGraph.TYPE_NONE){this.oStartCache.maxy2=this.bCurIsLeft?this.oVP.maxy2:this.oVP.maxy1;}else{this.oStartCache.maxy2=0;}
if(this.toHideDot!=null){this.toHideDot.onInterrupt();this.toHideDot=null;}else{this.onHideLineDot();}};WSDrawer.prototype.onDragXScroll=function(oPos){var _b6a=this.oStartPos.left-oPos.left;var _b6b=_b6a/(this.iGraphWidth-4);var _b6c=this.sgGraph.getMaxX()*_b6b;var _b6d=Math.round(_b6c*this.fPixPerX);oPos.top=this.oStartPos.top;oPos.left=this.oStartPos.left+_b6d;this.onDragGraph(oPos);};WSDrawer.prototype.onDragYScroll=function(oPos){var _b6f=this.sgGraph.getLine();if(_b6f==null){return;}
var _b70=this.oStartPos.top-oPos.top;var _b71=_b70/(this.iGraphHeight-4);var _b72=(_b6f.maxy-_b6f.miny)*_b71;var _b73=Math.round(_b72*this.fCurPixPerY);oPos.left=this.oStartPos.left;oPos.top=this.oStartPos.top+_b73;this.onDragGraph(oPos);};WSDrawer.prototype.onDrawGridZones=function(_b74,_b75,_b76,_b77,_b78){var _b79=this.sgGraph.getGridZones(this.iCurLineType).zones;for(var i=0,_b7b=_b79.length;i<_b7b;i++){var _b7c=_b79[i];var fY1=_b7c.y1;var fY2=_b7c.y2;if(_b7c.infinite){fY2=_b77.maxy;}
if(fY2>_b75&&fY2<_b76+20/this.fCurPixPerY){var _b7f=Math.round((fY2-fY1)*this.fCurPixPerY);var iTop=Math.round(_b74-((fY2-_b75)*this.fCurPixPerY));WSDOM.onCreateYGridZone(this,iTop,_b7f,_b7c.name,_b78);}}};WSDrawer.prototype.onDrawLine=function(_b81,_b82){if(!_b82){return;}
var _b83=_b82.line;if(_b83.isEmpty()){return;}
var _b84;if(!isDefined(this.aLineHolders[_b81])){_b84=WSDOM.getNewElement();this.divGraphLineHolder.appendChild(_b84);this.aLineHolders[_b81]=_b84;}else{_b84=this.aLineHolders[_b81];YSDOM.removeElementChilds(_b84,false);YSDOM.setPosition(_b84,{left:0,top:0});}
var _b85=this.sgGraph.isLeftLine(_b81);var _b86=_b85?this.pxOriginLeft:this.pxOriginRight;var _b87=_b85?this.fPixPerY1:this.fPixPerY2;var _b88=this.iCurLineType==_b81;var _b89=_b88?this.bCurIsLine:this.sgGraph.isLine(_b81);var _b8a=_b88?this.getCSSColor(_b81):WSDrawer.INACTIVE_COLOR;var _b8b="disabled";if(_b89){this.onLineStart(_b8a,_b84);}else{if(_b88){_b8b=this.getColor(_b81);}}
var _b8c=undefined;var _b8d=_b83.begin();while(_b8d!=null){var _b8e={left:_b8c==undefined?_b8d.fX*this.fPixPerX+_b86.left:_b8c,top:_b86.top-_b8d.fY*_b87};if(_b8d.gpNext!=null){_b8c=_b8d.gpNext.fX*this.fPixPerX+_b86.left;}
if(_b8e.left<0&&_b8c<0){_b8d=_b8d.gpNext;continue;}
if(_b8d.fY==_b82.miny){_b8e.top-=1;}
if(_b89){this.onAddLinePoint(_b8e);}else{if(_b8d.gpPrev!=null&&_b8d.gpPrev.fX!=_b8d.fX){var _b8f={left:_b8d.gpPrev.fX*this.fPixPerX+_b86.left,top:_b86.top-_b8d.gpPrev.fY2*_b87};var _b90=WSDOM.onCreateZone(this,_b8f,_b8e,_b8a,_b8b);if(_b88){_b8d.divZone=_b90;}else{_b8d.divZone=null;}
_b84.appendChild(_b90);}}
if(_b88&&_b89){var _b91=WSDOM.onCreateDot(this,_b8e);_b8d.imgDot=_b91;_b84.appendChild(_b91);}else{_b8d.imgDot=null;}
if(_b8d==this.gpDragging){this.onActiveChange(_b8d,true,this.gpDragging.oCurPos);}
_b8d=_b8d.gpNext;if(_b8e.left>this.iGraphWidth*3&&_b8c>this.iGraphWidth*3){break;}}
if(_b89){this.onLineEnd();}};WSDrawer.prototype.onDrawLines=function(){YSDOM.removeElementChilds(this.divGraphLineHolder,false);YSDOM.setPosition(this.divGraphLineHolder,new Pixel(-this.iGraphWidth,this.iInitGraphTop));this.aLineHolders={};var _b92=this.sgGraph.getLines();for(var _b93 in _b92){_b93=YSNumbers.checkInt(_b93);if(_b93!=this.iCurLineType){this.onDrawLine(_b93,_b92[_b93]);break;}}
this.onDrawLine(this.iCurLineType,this.sgGraph.getLine());};WSDrawer.prototype.onGenerateXAxis=function(){WSDOM.onResetXAxis(this);var _b94=250;if(this.bExpandingX){_b94=0;}else{if(this.bZoomingX){_b94=1000;}}
this.onResetXScroll(this.oVP.minx,this.oVP.maxx,_b94);var _b95=this.sgGraph.getMaxX();var _b96=this.oVP.maxx-this.oVP.minx;if(!this.bExpandingX||this.fXScale==0){this.fXScale=this.getScale(_b96,this.iMaxXScales,this.bTimeBased);}
var _b97=this.oVP.minx-(this.iGraphWidth/this.fPixPerX);if(_b97<0){_b97=0;}else{_b97=Math.ceil(_b97/this.fXScale)*this.fXScale;}
var _b98=Math.min(_b95,this.oVP.minx+_b96+(this.iGraphWidth/this.fPixPerX));var _b99=_b96/this.fXScale>this.iMaxXScales;var _b9a=0;var _b9b=this.iGraphWidth-((this.oVP.minx-_b97)*this.fPixPerX);var _b9c;var _b9d;var _b9e=this.fXScale!=Math.round(this.fXScale)?1:0;while(_b97<=_b98){_b9c=Math.round(_b9b);if(_b97==_b95){_b9c--;}
_b9d=this.bTimeBased?YSDateTime.getTimeString(_b97):YSNumbers.roundNumber(_b97,_b9e,false);if(!_b99||_b9a%2==0){WSDOM.onCreateXAxisText(this,_b9c,_b9d);}
WSDOM.onCreateXExt(this,_b9c);WSDOM.onCreateXGrid(this,_b9c);_b97+=this.fXScale;_b9b+=this.fXScale*this.fPixPerX;_b9a++;}
if(this.bExpandableX){YSCSS.setMultiStyle([this.divXExpander,this.divMaxXValue],["display"],[this.oVP.maxx==_b95?"block":"none"]);}};WSDrawer.prototype.onGenerateYAxis=function(_b9f,_ba0){var _ba1=_ba0?this.divYExtLines:this.divYExt2Lines;var _ba2=_ba0?this.divYAxisTexts:this.divYAxis2Texts;var _ba3=this.iCurLineType==_b9f;WSDOM.onResetYAxis(this,_ba1,_ba2,_ba3);var _ba4=_ba0?this.oY1Scroll:this.oY2Scroll;var _ba5=this.sgGraph.getLine(_b9f);if(_ba5==null){YSCSS.setStyle(_ba4.scrollholder,"display","none");return;}
var _ba6=_ba0?this.oVP.miny1:this.oVP.miny2;var _ba7=_ba0?this.oVP.maxy1:this.oVP.maxy2;var _ba8=_ba0?this.fPixPerY1:this.fPixPerY2;var _ba9=_ba7-_ba6;var _baa=_ba3?this.bCurIsPace:this.sgGraph.isPace(_b9f);var _bab=_ba3?this.bCurIsHeart:this.sgGraph.isHeart(_b9f);var _bac=_ba3?this.bCurIsIntensity:this.sgGraph.isIntensity(_b9f);_bac=_bac||this.sgGraph.isZoladz(_b9f);var _bad=_ba3?this.bCurIsPerc:this.sgGraph.isPerc(_b9f);var _bae=1;if(_ba3&&this.bExpandingY&&this.fYScale!=0){_bae=this.fYScale;}else{if(!_bac){_bae=this.getScale(_ba9,this.iMaxYScales,_baa,_bab?1:0.1);}}
if(_ba3){this.fYScale=_bae;}
var _baf=_ba6-(this.iGraphHeight/_ba8);var _bb0=_baf;var _bb1;if(_bac){_bb1=this.sgGraph.getGridZones(_b9f);_baf=_bb1.miny;}else{if(_baf<_ba5.miny){_baf=_ba5.miny;}
_baf=Math.ceil(_baf/_bae)*_bae;}
var _bb2=this.iGraphHeight*2+((_ba6-_baf)*_ba8);var _bb3=this.iGraphHeight*2+((_ba6-_bb0)*_ba8);var _bb4=_ba3?this.getCSSColor(_b9f):WSDrawer.EXT_COLOR;var _bb5;var _bb6;if(_bac){_bb5=Math.max(_bb1.maxy,_ba5.maxy);for(var i=0,_bb8=_bb1.zones.length;i<_bb8;i++){var _bb9=_bb1.zones[i];var fY=_bb9.infinite?_ba5.maxy:_bb9.y2;_bb6=Math.round(_bb3-((fY-_bb0)*_ba8));WSDOM.onCreateYAxisText(this,_ba2,_bb6,_bb9.axisname);WSDOM.onCreateYExt(this,_ba1,_bb6,_bb4);if(_ba3){WSDOM.onCreateYGrid(this,_bb6);}}}else{_bb5=Math.min(_ba5.maxy,_ba6+_ba9+(this.iGraphHeight/_ba8));var _bbb=_bae!=Math.round(_bae)?1:0;var _bbc=_ba9/_bae>this.iMaxYScales;var _bbd=0;var _bbe;while(_baf<=_bb5){_bb6=Math.round(_bb2);if(_baf==_ba5.miny){_bb6--;}
_bbe=_baa?YSDateTime.getTimeString(_baf,false):YSNumbers.roundNumber(_baf,_bbb,false);if(_bad){_bbe+=" %";}
if(!_bbc||_bbd%2==0){WSDOM.onCreateYAxisText(this,_ba2,_bb6,_bbe);}
WSDOM.onCreateYExt(this,_ba1,_bb6,_bb4);if(_ba3){WSDOM.onCreateYGrid(this,_bb6);}
_bb2-=_bae*_ba8;_baf+=_bae;_bbd++;}}
if(!_ba3||_ba9>=_ba5.maxy-_ba5.miny){YSCSS.setStyle(_ba4.scrollholder,"display","none");}else{YSCSS.setStyle(_ba4.scrollholder,"display","block");}
if(_ba3){var _bbf=!(_bab||_bac)&&_ba7==_ba5.maxy;if(_bbf){if(this.bCurIsLeft){YSCSS.removeClassName(this.divMaxYValue,"reverse");}else{YSCSS.addClassName(this.divMaxYValue,"reverse");}
YSCSS.setStyle(this.divMaxYValue,"left",(this.bCurIsLeft?this.iPaddingLeft-this.divMaxYValue.mywidth-this.iYAxisLineWidth+1:this.iPaddingLeft+this.iGraphWidth+this.iYAxisLineWidth)+"px");YSCSS.setStyle("sessionmaxy","textAlign",this.bCurIsLeft?"right":"left");YSDOM.setValue("sessionmaxy",this.bCurIsPace?YSDateTime.getTimeString(_ba5.maxy,false):String(_ba5.maxy));}
YSCSS.setMultiStyle([this.divYExpander,this.divMaxYValue],["display"],[_bbf?"block":"none"]);WSDOM.onCreateYAxisLine(this,_ba0,_ba1,_bb4);if(this.bShowGridZones){this.onDrawGridZones(_bb3,_bb0,_bb5,_ba5,_ba0);}
var _bc0=250;if(this.bExpandingY){_bc0=0;}else{if(this.bZoomingY){_bc0=1000;}}
this.onResetYScroll(_ba6,_ba7,_bc0);}else{this.onHoverEnd(_ba4.scrollholder);}};WSDrawer.prototype.onHideLineDot=function(){YSCSS.setStyle(this.imgTempDot,"display","none");if(this.gpHover==null){YSCSS.setStyle(this.divValueHover,"display","none");}
this.toHideDot=null;};WSDrawer.prototype.onHideLoading=function(){this.bAutoHideLoading=true;if(this.toRemoveLoading==null){this.onAutoHideLoading();}};WSDrawer.prototype.onHoverEnd=function(obj){YSCSS.removeClassName(obj,"hover");};WSDrawer.prototype.onInit=function(_bc2){YSEvent.disableSelect(_bc2);WSDOM.onCreateGraphRect(this,_bc2);WSDOM.onCreateGridHolders(this,_bc2);WSDOM.onCreateYAxisTextHolders(this,_bc2);WSDOM.onCreateYExtHolders(this,_bc2);WSDOM.onCreateXAxisTextHolder(this,_bc2);WSDOM.onCreateXExtHolder(this,_bc2);WSDOM.onCreateScrollBars(this,_bc2);WSDOM.onCreateGraphLineHolder(this,_bc2);WSDOM.onCreateHoverElements(this);WSDOM.onCreateXLegend(this,_bc2);WSDOM.onCreateEventCatcher(this,_bc2);WSDOM.onCreateLoadingIcon(this);WSDOM.onCreateContextMenu(this);WSDOM.onCreateXExpander(this,_bc2);WSDOM.onCreateYExpander(this,_bc2);WSDOM.onCreateValueHover(this,_bc2);this.onInitEvents();this.onWindowResize();};WSDrawer.prototype.onInitEvents=function(){WSDOM.onResetCursors(this);YSEventHandler.Instance().addHandler(this.divCM,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divXExpander,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divYExpander,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divEventCatcher,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divGraphClip,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divEventCatcher,"onmousewheel",WSDrawer.prototype.onMouseWheel,this);YSEventHandler.Instance().addHandler(this.oXScroll.scrollholder,"onmouseover",WSDrawer.prototype.onMouseOver,this);YSEventHandler.Instance().addHandler(this.oXScroll.scrollholder,"onmouseout",WSDrawer.prototype.onMouseOut,this);YSEventHandler.Instance().addHandler(this.oXScroll.bar,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.oY1Scroll.scrollholder,"onmouseover",WSDrawer.prototype.onMouseOver,this);YSEventHandler.Instance().addHandler(this.oY1Scroll.scrollholder,"onmouseout",WSDrawer.prototype.onMouseOut,this);YSEventHandler.Instance().addHandler(this.oY1Scroll.bar,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.oY2Scroll.scrollholder,"onmouseover",WSDrawer.prototype.onMouseOver,this);YSEventHandler.Instance().addHandler(this.oY2Scroll.scrollholder,"onmouseout",WSDrawer.prototype.onMouseOut,this);YSEventHandler.Instance().addHandler(this.oY2Scroll.bar,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divValueHover,"onmousedown",WSDrawer.prototype.onMouseDown,this);YSEventHandler.Instance().addHandler(this.divValueHover,"onmouseup",WSDrawer.prototype.onMouseDown,this);if(!WSDrawer.bDocEventsSet){WSDrawer.bDocEventsSet=true;var _bc3=(bSafari||bChrome)?document.body:document;YSEventHandler.Instance().addHandler(_bc3,"oncontextmenu",WSDrawer.OnDocMouseCM);YSMouseMoveEvent.Instance().registerElement(document,100,WSDrawer.OnDocMouseMove);YSEventHandler.Instance().addHandler(document,"onmouseup",WSDrawer.OnDocMouseUp);YSEventHandler.Instance().addHandler(document,"onmousedown",WSDrawer.OnDocMouseDown);YSEventHandler.Instance().addHandler(document,"onkeyup",WSDrawer.OnDocKeyUp);YSEventHandler.Instance().addHandler(document,"onkeydown",WSDrawer.OnDocKeyDown);YSEventHandler.Instance().addHandler(window,"onresize",WSDrawer.OnWindowResize);}};WSDrawer.prototype.onKeyDown=function(e){var _bc5=YSEvent.getKeyCode(e);switch(_bc5){case 187:case 107:this.onMouseWheel(e,null,true);return false;case 189:case 109:this.onMouseWheel(e,null,false);return false;}};WSDrawer.prototype.onKeyUp=function(e){var _bc7=YSEvent.getKeyCode(e);switch(_bc7){}};WSDrawer.prototype.onLineRemoved=function(){this.onHideLineDot();YSCSS.setStyle(this.divZoneLine,"display","none");this.gpHover=this.gpDragging=this.gpCM=null;};WSDrawer.prototype.onMouseCM=function(e){var _bc9=this.gpCM;if(this.gpHover!=null){this.gpCM=this.gpHover;}else{if(this.gpDragging!=null&&this.gpDragging.iID!=0&&!this.gpDragging.isDragged()){this.gpCM=this.gpDragging;}}
if(this.gpCM!=_bc9){if(_bc9!=null){WSDOM.onRemoveCM(this);}
bResetCursors=false;WSDOM.onShowCM(this,e);return false;}
return true;};WSDrawer.prototype.onMouseDown=function(e,obj){if(obj==document){if(this.bPreventCMHide){this.bPreventCMHide=false;}else{if(this.gpCM!=null){this.gpCM=null;WSDOM.onRemoveCM(this);}}
return;}
if(this.toVPAnimation!=null||this.bDragging||this.bExpandingX||this.bExpandingY||this.bScrollingX||this.bScrollingY||this.gpDragging!=null){return;}
if(obj==this.divCM){this.bPreventCMHide=true;return;}
YSEvent.disableSelect(document);var oPos=YSEvent.getGlobalMousePosition(e);var _bcd=this.gpCM;this.gpCM=null;this.onMouseMove(oPos);this.gpCM=_bcd;if(this.gpHover!=null){this.onDragDotStart(oPos);if(this.gpDragging==this.gpCM){this.gpDragging.setDragged();}}else{if(YSCSS.getStyle(this.divEventCatcher,"cursor")==WSDrawer.POINT_CURSOR){this.onAddPoint(oPos);}else{if(obj==this.divEventCatcher){this.onDragGraphStart();WSDOM.onShowCursor(this,this.sCursorClosedHand);}else{if(obj==this.oXScroll.bar){this.bScrollingX=true;this.onDragGraphStart();this.bDragging=false;}else{if(this.bCurIsLeft&&obj==this.oY1Scroll.bar||!this.bCurIsLeft&&obj==this.oY2Scroll.bar){this.bScrollingY=true;this.onDragGraphStart();this.bDragging=false;}else{if(obj==this.divXExpander){this.onXExpandStart();}else{if(obj==this.divYExpander){this.onYExpandStart();}}}}}}}
this.oStartPos=oPos;};WSDrawer.prototype.onMouseMove=function(oPos){if(this.bDragging){this.onDragGraph(oPos);}else{if(this.bScrollingX){this.onDragXScroll(oPos);}else{if(this.bScrollingY){this.onDragYScroll(oPos);}else{if(this.gpDragging!=null){this.onDragDot(oPos);}else{if(this.bExpandingX){this.onXExpand(oPos);}else{if(this.bExpandingY){this.onYExpand(oPos);}else{if(!SchedulePage.isPreviewShown()&&YSDOM.posAboveElement(oPos,this.divGraphClip)){this.bAboveGraph=true;if(this.gpCM==null&&!YSListbox.IsAboveOptions(null,oPos)){if(this.bCurIsLine){this.onShowTempDot(oPos);}else{this.onZoneHover(oPos);}}}else{if(this.bAboveGraph){this.bAboveGraph=false;this.onActiveChange(this.gpHover,false);this.gpHover=null;WSDOM.onResetCursors(this);YSCSS.setStyle(this.imgTempDot,"display","none");YSCSS.setStyle(this.divZoneLine,"display","none");}}}}}}}}};WSDrawer.prototype.onMouseOut=function(e,obj){if(this.bCurIsLeft&&obj==this.oY2Scroll.scrollholder||!this.bCurIsLeft&&obj==this.oY1Scroll.scrollholder){return;}
this.onMouseOver(e,obj);if(obj==this.oXScroll.scrollholder){this.toXHoverEnd=new YSTimeout(250,WSDrawer.prototype.onHoverEnd,this,obj);}else{this.toYHoverEnd=new YSTimeout(250,WSDrawer.prototype.onHoverEnd,this,obj);}};WSDrawer.prototype.onMouseOver=function(e,obj){if(this.bCurIsLeft&&obj==this.oY2Scroll.scrollholder||!this.bCurIsLeft&&obj==this.oY1Scroll.scrollholder){return;}
YSCSS.addClassName(obj,"hover");if(obj==this.oXScroll.scrollholder){if(this.toXHoverEnd!=null){this.toXHoverEnd.cancelTimeout();this.toXHoverEnd=null;}}else{if(this.toYHoverEnd!=null){this.toYHoverEnd.cancelTimeout();this.toYHoverEnd=null;}}};WSDrawer.prototype.onMouseUp=function(e,obj){YSEvent.enableSelect(document);if(this.onCMClick(obj)){return;}
var _bd5=true;if(this.gpDragging!=null){if(YSEvent.getMouseButton(e)==1){this.onMouseCM(e);}
this.onDragDotEnd(e);_bd5=false;}
if(this.bDragging){this.onDragGraphEnd();}
if(this.bScrollingX){this.onDragGraphEnd();if(YSEvent.isMouseAboveElement(e,this.oXScroll.scrollholder)){this.onMouseOver(e,this.oXScroll.scrollholder);}}
if(this.bScrollingY){this.onDragGraphEnd();var _bd6=this.bCurIsLeft?this.oY1Scroll.scrollholder:this.oY2Scroll.scrollholder;if(YSEvent.isMouseAboveElement(e,_bd6)){this.onMouseOver(e,_bd6);}}
if(this.bExpandingX){this.onXExpandEnd();}
if(this.bExpandingY){this.onYExpandEnd();}
this.oStartPos=null;if(_bd5){WSDOM.onResetCursors(this);this.onMouseMove(YSEvent.getGlobalMousePosition(e));}};WSDrawer.prototype.onMouseWheel=function(e,obj,_bd9){var _bda=!isDefined(_bd9);var _bdb=_bda?YSEvent.getScrollWheelDirection(e)>0:_bd9;var _bdc=false;var _bdd=YSEvent.getEvent(e);if(_bdd!=null){_bdc=_bdd.ctrlKey||_bdd.shiftKey;}
var _bde=YSDateTime.getCurTime();if(_bde-this.iLastZoomTime>WSDrawer.ZOOM_INTERVAL){this.iLastZoomTime=_bde;if(_bdc){this.onZoomY(e,obj,_bdb,_bda);}else{this.onZoomX(e,obj,_bdb,_bda);}}
if(_bda){YSEvent.cancelEvent(e,true);}
return false;};WSDrawer.prototype.onRedraw=function(_bdf){if(_bdf.all||_bdf.xgrid){this.onGenerateXAxis();}
if(_bdf.all||_bdf.ygrid1){this.onGenerateYAxis(this.sgGraph.getLeftLineType(),true);}
if(_bdf.all||_bdf.ygrid2){this.onGenerateYAxis(this.sgGraph.getRightLineType(),false);}
if(_bdf.all||_bdf.units){YSDOM.removeElementChilds(this.divYAxisUnit,false);YSDOM.removeElementChilds(this.divYAxis2Unit,false);if(this.sgGraph.getLeftLineType()!=SessionGraph.TYPE_NONE){this.onShowUnitText(true,this.sgGraph.getValueName(true));}
if(this.sgGraph.getRightLineType()!=SessionGraph.TYPE_NONE){this.onShowUnitText(false,this.sgGraph.getValueName(false));}}
if(_bdf.all||_bdf.lines){this.onDrawLines();}else{if(_bdf.curline){this.onDrawLine(this.iCurLineType,this.sgGraph.getLine());}}};WSDrawer.prototype.onResetXScroll=function(_be0,_be1,_be2){var _be3=_be1-_be0;var _be4=this.sgGraph.getMaxX();if(_be3<_be4){YSCSS.setStyle(this.oXScroll.scrollholder,"display","block");var _be5=this.iGraphWidth-4;var _be6=Math.round(Math.max((_be3/_be4)*_be5,WSDrawer.MIN_SCROLLBAR_LENGTH));var _be7=((_be0+_be3*0.5)/_be4)*_be5;var _be8=_be7-Math.round(0.5*_be6);if(_be1==_be4){_be8=_be5-_be6;}
YSCSS.setStyle(this.oXScroll.bar,"left",_be8+"px");YSCSS.setStyle(this.oXScroll.barcenter,"width",(_be6-4)+"px");this.onMouseOver(null,this.oXScroll.scrollholder);if(_be2>0){this.toXHoverEnd=new YSTimeout(_be2,WSDrawer.prototype.onHoverEnd,this,this.oXScroll.scrollholder);}}else{YSCSS.setStyle(this.oXScroll.scrollholder,"display","none");}};WSDrawer.prototype.onResetYScroll=function(_be9,_bea,_beb,_bec,_bed){if(!isDefined(_bec)){_bec=this.bCurIsLeft?this.oY1Scroll:this.oY2Scroll;}
var _bee=this.sgGraph.getLine(_bed);var _bef=_bee.maxy-_bee.miny;var _bf0=_bea-_be9;if(_bf0>=_bef){return;}
var _bf1=this.iGraphHeight-4;var _bf2=Math.round(Math.max((_bf0/_bef)*_bf1,WSDrawer.MIN_SCROLLBAR_LENGTH));var _bf3=_bf1-((((_be9+_bf0*0.5)-_bee.miny)/_bef)*_bf1);var iTop=_bf3-Math.round(0.5*_bf2);if(_be9==_bee.miny){iTop=_bf1-_bf2;}
YSCSS.setStyle(_bec.bar,"top",iTop+"px");YSCSS.setStyle(_bec.barcenter,"height",(_bf2-4)+"px");this.onMouseOver(null,_bec.scrollholder);if(_beb>0){this.toYHoverEnd=new YSTimeout(_beb,WSDrawer.prototype.onHoverEnd,this,_bec.scrollholder);}};WSDrawer.prototype.onShowLoading=function(_bf5){if(!isDefined(_bf5)){_bf5=true;}
if(this.toRemoveLoading!=null){this.toRemoveLoading.cancelTimeout();}
YSCSS.setTransparency(this.divEventCatcher,50);YSCSS.setStyle(this.imgLoading,"display","block");this.bAutoHideLoading=_bf5;this.toRemoveLoading=new YSTimeout(300,WSDrawer.prototype.onAutoHideLoading,this);};WSDrawer.prototype.onShowTempDot=function(oPos){var _bf7=true;var _bf8=this.sgGraph.getLine();if(_bf8!=null){_bf7=false;var _bf9=this.bCurIsLeft?this.pxOriginLeft:this.pxOriginRight;var _bfa={left:_bf9.left+this.pxTopLeft.left,top:_bf9.top+this.pxTopLeft.top};var _bfb=_bf8.line.getClosestPoint({left:oPos.left-_bfa.left,top:_bfa.top-oPos.top});if(_bfb!=null&&_bfb.gpHover==null){this.onActiveChange(this.gpHover,false);this.gpHover=null;var fX=_bfb.left/this.fPixPerX;var fY=_bfb.top/this.fCurPixPerY;if(_bfb.bVertical){fY=Math.round(fY/this.fCurYSnap)*this.fCurYSnap;}else{fX=Math.round(fX/this.fCurXSnap)*this.fCurXSnap;}
YSXML.setAttribute(this.imgTempDot,"ws_x",fX);YSXML.setAttribute(this.imgTempDot,"ws_y",fY);_bfb.left=fX*this.fPixPerX;_bfb.top=fY*this.fCurPixPerY;_bfb.left+=_bf9.left-this.iGraphWidth-WSLine.PIX_MARGIN;_bfb.top=Math.round(_bf9.top-_bfb.top+this.iInitGraphTop-WSLine.PIX_MARGIN);YSDOM.setPosition(this.imgTempDot,_bfb);YSCSS.setStyle(this.imgTempDot,"display","block");WSDOM.onShowCursor(this,WSDrawer.POINT_CURSOR);WSDOM.onShowTempValues(this,this.getXValue(fX),this.getYValue(fY));if(this.toHideDot!=null){this.toHideDot.cancelTimeout();this.toHideDot=null;}}else{if(_bfb!=null&&_bfb.gpHover!=null){this.onActiveChange(this.gpHover,false);this.gpHover=_bfb.gpHover;this.onActiveChange(this.gpHover,true,oPos);WSDOM.onShowCursor(this,WSDrawer.POINT_CURSOR);}else{this.onActiveChange(this.gpHover,false,oPos);this.gpHover=null;WSDOM.onResetCursors(this);}
if(this.gpHover==null){if(this.toHideDot==null){this.toHideDot=new YSTimeout(250,WSDrawer.prototype.onHideLineDot,this);}}else{if(this.toHideDot!=null){this.toHideDot.onInterrupt();this.toHideDot=null;}else{this.onHideLineDot();}}}}
if(_bf7){YSCSS.setStyle(this.imgTempDot,"display","none");}};WSDrawer.prototype.onShowZoneCursor=function(){if(this.gpHover.iResizing<=WSGraphPoint.RS_BOTTOM){var _bfe=this.gpHover.fY2-this.gpHover.fY;if(_bfe<=this.fCurYSnap){if(this.gpHover.iResizing==WSGraphPoint.RS_TOP){WSDOM.onShowCursor(this,this.sCursorResizeTop);}else{WSDOM.onShowCursor(this,this.sCursorResizeBottom);}}else{WSDOM.onShowCursor(this,this.sCursorResizeVert);}}else{var _bff=this.gpHover.fX-this.gpHover.gpPrev.fX;if(_bff<=this.fCurXSnap){if(this.gpHover.iResizing==WSGraphPoint.RS_LEFT){WSDOM.onShowCursor(this,this.sCursorResizeLeft);}else{WSDOM.onShowCursor(this,this.sCursorResizeRight);}}else{WSDOM.onShowCursor(this,this.sCursorResizeHor);}}
YSCSS.setStyle(this.divZoneLine,"display","none");};WSDrawer.prototype.onShowZoneLine=function(oPos){WSDOM.onShowCursor(this,"default");var _c01=YSCSS.getStyle(this.gpHover.divZone,"borderTopColor");var iTop=YSCSS.getStyle(this.gpHover.divZone,"top",true)+this.iInitGraphTop+this.iLineWidth;var _c03=Math.floor(this.iLineWidth/2);var _c04=this.gpHover.fY2-this.gpHover.fY;var _c05=_c04*this.fCurPixPerY-_c03*2;var _c06=this.bCurIsLeft?this.pxOriginLeft:this.pxOriginRight;var _c07=_c06.left+this.pxTopLeft.left;var _c08=(oPos.left-_c07)/this.fPixPerX;_c08=Math.round(_c08/this.fCurXSnap)*this.fCurXSnap;if(_c08>this.gpHover.gpPrev.fX&&_c08<this.gpHover.fX){this.divZoneLine.fX=_c08;var _c09=(_c08-this.oVP.minx)*this.fPixPerX-1;YSCSS.setMultiStyle(this.divZoneLine,["display","backgroundColor","height","top","left"],["block",_c01,_c05+"px",iTop+"px",_c09+"px"]);}else{if(_c08<=this.gpHover.gpPrev.fX){if(this.gpHover.gpPrev.gpPrev!=null){this.gpHover.iResizing=WSGraphPoint.RS_LEFT;this.onShowZoneCursor();}}else{if(_c08>=this.gpHover.fX){if(this.gpHover.gpNext!=null){this.gpHover.iResizing=WSGraphPoint.RS_RIGHT;this.onShowZoneCursor();}}}
YSCSS.setStyle(this.divZoneLine,"display","none");}};WSDrawer.prototype.onViewChanged=function(oVP){if(this.aIntensitySnapValues.length==0){var _c0b=this.sgGraph.getIntensityPerSpeed();for(var i=0,_c0d=this.aSpeedSnapValues.length;i<_c0d;i++){this.aIntensitySnapValues.push(this.aSpeedSnapValues[i]*_c0b);}}
var _c0e=this.sgGraph.getCurLineType();if(this.sgGraph.isHeartBPM(_c0e)){YSCSS.setStyle("heartmethod","visibility","visible");}else{YSCSS.setStyle("heartmethod","visibility","hidden");}
var _c0f=_c0e!=this.iCurLineType;this.bCurIsLeft=_c0e==this.sgGraph.getLeftLineType();if(this.bPreventZoneCheck){this.bPreventZoneCheck=false;}else{if(_c0f&&this.bShowGridZones){this.onZoomToZones(_c0e,oVP,true);}}
this.fPixPerX=this.iGraphWidth/(oVP.maxx-oVP.minx);this.fPixPerY1=this.iGraphHeight/(oVP.maxy1-oVP.miny1);this.fPixPerY2=this.iGraphHeight/(oVP.maxy2-oVP.miny2);var _c10={};_c10.units=_c0f;_c10.xgrid=oVP.minx!=this.oVP.minx||oVP.maxx!=this.oVP.maxx;_c10.ygrid1=_c0f||oVP.miny1!=this.oVP.miny1||oVP.maxy1!=this.oVP.maxy1;_c10.ygrid2=_c0f||oVP.miny2!=this.oVP.miny2||oVP.maxy2!=this.oVP.maxy2;this.oVP.minx=oVP.minx;this.oVP.maxx=oVP.maxx;this.oVP.miny1=oVP.miny1;this.oVP.maxy1=oVP.maxy1;this.oVP.miny2=oVP.miny2;this.oVP.maxy2=oVP.maxy2;this.iCurLineType=_c0e;this.bCurIsLine=this.sgGraph.isLine(this.iCurLineType);this.bCurIsPace=this.sgGraph.isPace(this.iCurLineType);this.bCurIsHeart=this.sgGraph.isHeart(this.iCurLineType);this.bCurIsPerc=this.sgGraph.isPerc(this.iCurLineType);this.bCurIsZoladz=this.sgGraph.isZoladz(this.iCurLineType);this.bCurIsIntensity=this.sgGraph.isIntensity(this.iCurLineType);this.fCurPixPerY=this.bCurIsLeft?this.fPixPerY1:this.fPixPerY2;this.fCurMinY=this.bCurIsLeft?this.oVP.miny1:this.oVP.miny2;this.fCurMaxY=this.bCurIsLeft?this.oVP.maxy1:this.oVP.maxy2;var _c11=this.sgGraph.getLine();if(_c11!=null){this.fCurYRoundOn=_c11.roundon;}
if(this.bCurIsHeart){this.sCurUnit=this.bCurIsPerc?"%":"bpm";}else{this.sCurUnit=this.bCurIsPace?"":(this.bKM?"km/h":"mph");}
this.sCurValueLabel=this.bCurIsPace?YSText.get("[?HoverPace?]"):(this.bCurIsHeart?YSText.get("[?HoverHeart?]"):YSText.get("[?HoverSpeed?]"));this.pxOriginLeft=this.getOriginPx(true);this.pxOriginRight=this.getOriginPx(false);if(this.bCurIsPace){WSDrawer.MIN_YWIDTH=WSDrawer.MIN_PACEWIDTH;}else{if(this.bCurIsHeart){WSDrawer.MIN_YWIDTH=WSDrawer.MIN_HEARTWIDTH;}else{if(this.bCurIsIntensity){WSDrawer.MIN_YWIDTH=WSDrawer.MIN_INTENSITYWIDTH;}else{WSDrawer.MIN_YWIDTH=WSDrawer.MIN_SPEEDWIDTH;}}}
if(_c0f){this.fLastYWidth=this.fCurMaxY-this.fCurMinY;}
_c10.lines=_c10.xgrid||(_c10.ygrid1&&!this.bCurIsLeft)||(_c10.ygrid2&&this.bCurIsLeft);_c10.curline=(_c10.ygrid1&&this.bCurIsLeft)||(_c10.ygrid2&&!this.bCurIsLeft);this.fCurXSnap=this.getXSnapValue(WSLine.PIX_MARGIN*2);this.fCurYSnap=this.getYSnapValue(WSLine.PIX_MARGIN*2);this.onRedraw(_c10);};WSDrawer.prototype.onWindowResize=function(){this.pxTopLeft=YSDOM.getElementPosition(this.divGraphLineHolder);};WSDrawer.prototype.onXExpand=function(oPos){var _c13=oPos.left-this.oStartPos.left;var _c14=-1;if(_c13>0){_c13*=2;}else{_c14=this.oStartCache.maxx;}
var _c15=_c13/this.oStartCache.pixperx;var _c16=_c15+this.oStartCache.maxx;if(_c16>=this.oStartCache.maxnewx){WSDOM.onShowCursor(this,this.sCursorResizeLeft);_c16=this.oStartCache.maxnewx;}else{if(_c16<=this.oStartCache.minnewx){WSDOM.onShowCursor(this,this.sCursorResizeRight);_c16=this.oStartCache.minnewx;}else{WSDOM.onShowCursor(this,this.sCursorResizeHor);}}
if(_c14==-1){_c14=_c16;}
var _c17=this.sgGraph.getLines();for(var _c18 in _c17){_c17[_c18].line.end().fX=_c14;}
var _c19=Math.round(_c16/this.oStartCache.xsnap)*this.oStartCache.xsnap;this.setMaxX(_c16,_c19);};WSDrawer.prototype.onXExpandEnd=function(){this.onShowLoading();this.fXScale=0;this.bExpandingX=false;var _c1a=Math.round(this.oVP.maxx/this.oStartCache.xsnap)*this.oStartCache.xsnap;var _c1b=this.sgGraph.getLines();for(var _c1c in _c1b){_c1b[_c1c].line.onXClip(_c1a);_c1b[_c1c].line.onStore();}
this.oVP.maxx=0;this.setMaxX(_c1a);this.sgGraph.onSendRequest("setmaxx="+this.oVP.maxx);};WSDrawer.prototype.onXExpandStart=function(){this.bExpandingX=true;this.oStartCache.maxx=this.oVP.maxx;this.oStartCache.pixperx=this.fPixPerX;this.oStartCache.xsnap=this.getXSnapValue(30);var _c1d=Math.ceil(this.oVP.minx/this.fXScale)*this.fXScale;if(_c1d==this.oVP.minx){_c1d+=this.fXScale;}
var _c1e=_c1d+this.fXScale;_c1e+=25*((_c1e-this.oVP.minx)/this.iGraphWidth);this.oStartCache.minnewx=Math.max(_c1e,WSDrawer.MIN_XWIDTH);this.oStartCache.maxnewx=Math.min(_c1d+this.iMaxXScales*2*this.fXScale,WSDrawer.MAX_XWIDTH);if(this.oVP.maxx==WSDrawer.MIN_XWIDTH){WSDOM.onShowCursor(this,this.sCursorResizeRight);}else{if(this.oVP.maxx==WSDrawer.MAX_XWIDTH){WSDOM.onShowCursor(this,this.sCursorResizeLeft);}else{WSDOM.onShowCursor(this,this.sCursorResizeHor);}}};WSDrawer.prototype.onYExpand=function(oPos){var _c20=(this.oStartPos.top-oPos.top)/this.oStartCache.pixpery;var _c21=_c20+this.oStartCache.maxy;if(_c21>=this.oStartCache.maxnewy){WSDOM.onShowCursor(this,this.sCursorResizeBottom);_c21=this.oStartCache.maxnewy;}else{if(_c21<=this.oStartCache.minnewy){WSDOM.onShowCursor(this,this.sCursorResizeTop);_c21=this.oStartCache.minnewy;}else{WSDOM.onShowCursor(this,this.sCursorResizeVert);}}
this.sgGraph.getLine().line.onYClip(_c21,this.oStartCache.ysnap,true);var _c22=_c21==this.oStartCache.totalminy?_c21:Math.round(_c21/this.oStartCache.ysnap)*this.oStartCache.ysnap;this.setMaxY(_c21,_c22);};WSDrawer.prototype.onYExpandEnd=function(){this.onShowLoading();this.fYScale=0;this.bExpandingY=false;var _c23=this.fCurMaxY;var _c24=this.sgGraph.getLine();if(_c23!=this.oStartCache.totalminy){_c23=Math.max(Math.round(_c23/this.oStartCache.ysnap)*this.oStartCache.ysnap,this.oStartCache.totalminy);}
_c24.line.onYClip(_c23,this.oStartCache.ysnap,false);_c24.line.onStore();this.oVP.maxy1=this.oVP.maxy2=0;this.setMaxY(_c23);};WSDrawer.prototype.onYExpandStart=function(){var _c25=this.sgGraph.getLine();if(_c25==null){return;}
this.bExpandingY=true;this.oStartCache.maxy=this.fCurMaxY;this.oStartCache.pixpery=this.fCurPixPerY;this.oStartCache.ysnap=this.getYSnapValue(20);var _c26=this.bShowGridZones?_c25.zonemaxy:_c25.origmaxy;var _c27=this.bCurIsPace?SessionGraph.MAX_PACE:SessionGraph.MAX_SPEED;var _c28=Math.ceil(this.fCurMinY/this.fYScale)*this.fYScale;if(_c28==this.fCurMinY){_c28+=this.fYScale;}
var _c29=_c28+this.fYScale;_c29+=25*((_c29-this.fCurMinY)/this.iGraphWidth);this.oStartCache.totalminy=_c26;this.oStartCache.minnewy=Math.max(_c26,_c29);this.oStartCache.maxnewy=Math.min(_c27,_c28+this.iMaxYScales*2*this.fYScale);_c25.line.onYClip(this.fCurMaxY,this.oStartCache.ysnap,true);if(this.oStartCache.maxy<=_c26){WSDOM.onShowCursor(this,this.sCursorResizeTop);}else{if(this.oStartCache.maxy>=_c27){WSDOM.onShowCursor(this,this.sCursorResizeBottom);}else{WSDOM.onShowCursor(this,this.sCursorResizeVert);}}};WSDrawer.prototype.onZoneHover=function(oPos){var _c2b=this.sgGraph.getLine();if(_c2b!=null){var _c2c=_c2b.line.onZoneHover(oPos);if(this.gpHover!=null&&this.gpHover!=_c2c){this.onActiveChange(this.gpHover,false);this.gpHover.iResizing=WSGraphPoint.RS_NONE;}
this.gpHover=_c2c;if(this.gpHover!=null){if(this.gpHover.iResizing!=WSGraphPoint.RS_NONE){this.onShowZoneCursor();}else{this.onShowZoneLine(oPos);}}else{YSCSS.setStyle(this.divZoneLine,"display","none");WSDOM.onResetCursors(this);}
this.onActiveChange(this.gpHover,true,oPos);}};WSDrawer.prototype.onZoomToZones=function(_c2d,oVP,_c2f,_c30){var _c31=this.sgGraph.getLine(_c2d);if(_c31!=null){if(_c31.maxy!=_c31.zonemaxy){var _c32=_c31.line.getExtremes();if(_c32.maxy<=_c31.zonemaxy){_c31.maxy=_c31.zonemaxy;}}
if(!_c2f){var _c33=_c31.maxy-_c31.zoneminy;var _c34=(this.bCurIsLeft?this.oVP.maxy1:this.oVP.maxy2)-(this.bCurIsLeft?this.oVP.miny1:this.oVP.miny2);if(_c33>=_c34){return false;}}
var _c35={start:{miny1:oVP.miny1,maxy1:oVP.maxy1,miny2:oVP.miny2,maxy2:oVP.maxy2}};if(this.bCurIsLeft){oVP.miny1=_c31.zoneminy;oVP.maxy1=_c31.maxy;}else{oVP.miny2=_c31.zoneminy;oVP.maxy2=_c31.maxy;}
var _c36=this.sgGraph.getSimilarValues(this.bCurIsLeft?oVP.miny1:oVP.miny2,this.bCurIsLeft?oVP.maxy1:oVP.maxy2,_c31,!this.bCurIsLeft);if(this.bCurIsLeft){oVP.miny2=_c36.miny;oVP.maxy2=_c36.maxy;}else{oVP.miny1=_c36.miny;oVP.maxy1=_c36.maxy;}
if(isDefined(_c30)&&_c30){_c35.end={miny1:oVP.miny1,maxy1:oVP.maxy1,miny2:oVP.miny2,maxy2:oVP.maxy2};oVP.miny1=_c35.start.miny1;oVP.maxy1=_c35.start.maxy1;oVP.miny2=_c35.start.miny2;oVP.maxy2=_c35.start.maxy2;this.toVPAnimation=new YSTimeout(30,WSDrawer.prototype.onAnimateVP,this,_c35,true);}
return true;}
return false;};WSDrawer.prototype.onZoomX=function(e,obj,_c39,_c3a){var _c3b=this.oVP.maxx-this.oVP.minx;var _c3c=this.sgGraph.getMaxX();if((_c3b<_c3c||_c39)&&(_c3b>WSDrawer.MIN_XWIDTH||!_c39)){this.bZoomingX=true;var _c3d;if(_c3b==WSDrawer.MIN_XWIDTH&&this.fLastXWidth>_c3b){_c3d=this.fLastXWidth;}else{_c3d=Math.round(_c3b*(_c39?0.75:1.34)/this.fXRoundOn)*this.fXRoundOn;_c3d=Math.min(Math.max(_c3d,WSDrawer.MIN_XWIDTH),_c3c);}
var _c3e=_c3a?YSEvent.getObjMousePosition(e,obj).left/this.iGraphWidth:0.5;this.sgGraph.onZoomX(_c3d,_c3e);this.fLastXWidth=this.oVP.maxx-this.oVP.minx;if(_c3a){this.onMouseMove(YSEvent.getGlobalMousePosition(e));}
this.bZoomingX=false;}};WSDrawer.prototype.onZoomY=function(e,obj,_c41,_c42){var _c43=this.sgGraph.getLine();if(_c43==null){return;}
var _c44=this.fCurMaxY-this.fCurMinY;var _c45=_c43.maxy-_c43.miny;if((_c44<_c45||_c41)&&(_c44>WSDrawer.MIN_YWIDTH||!_c41)){this.bZoomingY=true;var _c46;if(_c44==WSDrawer.MIN_YWIDTH&&this.fLastYWidth>_c44){_c46=this.fLastYWidth;}else{_c46=Math.round(_c44*(_c41?0.75:1.34)/_c43.roundon)*_c43.roundon;_c46=Math.min(Math.max(_c46,WSDrawer.MIN_YWIDTH),_c45);}
var _c47=_c42?YSEvent.getObjMousePosition(e,obj).top/this.iGraphHeight:0.5;this.sgGraph.onZoomY(_c46,_c47);this.fLastYWidth=this.fCurMaxY-this.fCurMinY;if(_c42){this.onMouseMove(YSEvent.getGlobalMousePosition(e));}
this.bZoomingY=false;}};WSDrawer.prototype.setExpandableX=function(_c48){this.bExpandableX=_c48;};WSDrawer.prototype.setMaxX=function(_c49,_c4a){if(!isDefined(_c4a)){_c4a=_c49;}
this.sgGraph.setMaxX(_c49);YSDOM.setValue("sessionmaxx",this.bTimeBased?YSDateTime.getTimeString(_c4a):YSNumbers.roundNumber(_c4a,this.bKM?3:1));};WSDrawer.prototype.setMaxY=function(_c4b,_c4c){if(!isDefined(_c4c)){_c4c=_c4b;}
this.sgGraph.setMaxY(_c4b,this.bCurIsLeft);YSDOM.setValue("sessionmaxy",this.bCurIsPace?YSDateTime.getTimeString(_c4c,false):String(_c4c));};WSDrawer.prototype.setMeasureUnit=function(bKM,_c4e){this.bKM=bKM;this.fXRoundOn=this.bTimeBased?1:0.1;if(!isDefined(_c4e)||_c4e){this.onRedraw({all:true});}};WSDrawer.prototype.setPreventZoneCheck=function(){this.bPreventZoneCheck=true;};WSDrawer.prototype.setZonesVisible=function(_c4f,_c50){if(!isDefined(_c50)){_c50=true;}
this.bShowGridZones=_c4f;YSCookie.create("wsshowzones",this.bShowGridZones?"1":"0");var _c51=true;if(this.bShowGridZones&&_c50){_c51=!this.onZoomToZones(this.iCurLineType,this.sgGraph.getVP(),false,true);}
if(_c51){var _c52={};if(this.bCurIsLeft){_c52.ygrid1=true;}else{_c52.ygrid2=true;}
this.onRedraw(_c52);}};function WSGraphPoint(iID,fX,fY,fY2,_c57,_c58){this.iTempID=iID==0?WSGraphPoint.TEMPID++:0;this.iID=iID;this.fX=fX;this.fY=fY;this.fY2=fY2;this.bDeletable=_c57;this.iNextID=isDefined(_c58)?_c58:0;this.bChanged=false;this.bVertical=false;this.bUpDown=false;this.gpBuddy=null;this.oDragging=null;this.imgDot=null;this.divZone=null;this.iResizing=WSGraphPoint.RS_NONE;this.gpNext=null;this.gpPrev=null;};WSGraphPoint.TEMPID=1;WSGraphPoint.RS_NONE=0;WSGraphPoint.RS_TOP=1;WSGraphPoint.RS_BOTTOM=2;WSGraphPoint.RS_LEFT=3;WSGraphPoint.RS_RIGHT=4;WSGraphPoint.prototype.destruct=function(_c59){if(isDefined(_c59)&&_c59&&this.gpNext!=null){this.gpNext.destruct(_c59);}
this.gpPrev=null;this.gpNext=null;this.imgDot=null;this.divZone=null;this.oDragging=null;this.gpBuddy=null;};WSGraphPoint.prototype.getClosestYSnap=function(_c5a){var _c5b=this.oDragging.yvalues;var _c5c=10000;var _c5d=_c5b[0];for(var i=0,_c5f=_c5b.length;i<_c5f;i++){var _c60=Math.abs(_c5a-_c5b[i]);if(_c60<=_c5c){_c5d=_c5b[i];_c5c=_c60;}else{break;}}
return _c5d;};WSGraphPoint.prototype.getCursor=function(){if(this.divZone==null||this.oDragging==null||this.iResizing==WSGraphPoint.RS_NONE){return 0;}
if(this.iResizing<=WSGraphPoint.RS_BOTTOM){if(this.fY2-this.fY>this.oDragging.ysnap){return 1;}else{if(this.iResizing==WSGraphPoint.RS_TOP){return 2;}}
return 3;}else{if(this.fX-this.gpPrev.fX>this.oDragging.xsnap){return 4;}else{if(this.iResizing==WSGraphPoint.RS_LEFT){return 5;}else{return 6;}}}
return 0;};WSGraphPoint.prototype.getHigherYSnap=function(_c61){var _c62=this.oDragging.yvalues;for(var i=0,_c64=_c62.length;i<_c64;i++){if(_c62[i]>=_c61){return _c62[i];}}
return this.oDragging.vp.maxy;};WSGraphPoint.prototype.getLowerYSnap=function(_c65){var _c66=this.oDragging.yvalues;for(var i=_c66.length-1;i>=0;i--){if(_c66[i]<=_c65){return _c66[i];}}
return _c66[0];};WSGraphPoint.prototype.getParam=function(){var _c68="";if(this.iID==0||this.bChanged){if(this.iID==0){_c68="add|"+this.iTempID;}else{_c68="mod|"+this.iID;}
var _c69="0";if(this.gpNext!=null){if(this.gpNext.iID==0){_c69="t"+this.gpNext.iTempID;}else{_c69=this.gpNext.iID;}}
_c68+="|"+this.fX+"|"+this.fY+"|"+this.fY2+"|"+_c69+"|";}
this.bChanged=false;return _c68;};WSGraphPoint.prototype.isDragged=function(){return this.oDragging!=null&&this.oDragging.moved;};WSGraphPoint.prototype.isDragging=function(){return this.oDragging!=null;};WSGraphPoint.prototype.isSameY=function(_c6a){return _c6a!=null&&Math.round(_c6a.fY*1000)==Math.round(this.fY*1000);};WSGraphPoint.prototype.isSameY2=function(_c6b){return _c6b!=null&&Math.round(_c6b.fY2*1000)==Math.round(this.fY2*1000);};WSGraphPoint.prototype.isValid=function(){if(this.gpPrev==null||this.gpNext==null||!this.bDeletable){return true;}
if(this.gpPrev.fX==this.fX&&this.fX==this.gpNext.fX){return false;}
if(this.fY2==0){return!(this.gpPrev.isSameY(this)&&this.isSameY(this.gpNext));}else{return!(this.gpPrev.isSameY(this)&&this.gpPrev.isSameY2(this)&&this.isSameY(this.gpNext)&&this.isSameY2(this.gpNext));}};WSGraphPoint.prototype.isYTooClose=function(_c6c,_c6d,_c6e){return _c6c!=null&&_c6c.fX==_c6d.fX&&Math.abs(_c6e-_c6c.fY)<this.oDragging.ysnap;};WSGraphPoint.prototype.onChangeCandidate=function(_c6f,_c70,_c71,_c72){var gpN,gpP;if(this.gpBuddy==this.gpNext){gpN=this.gpBuddy.gpNext;gpP=this.gpPrev;}else{gpN=this.gpNext;gpP=this.gpBuddy.gpPrev;}
if(_c70){if(this.bVertical){if(this.bUpDown){if(_c72>gpP.fY-this.oDragging.ysnap){_c72=Math.max(this.getLowerYSnap(gpP.fY-this.oDragging.ysnap),this.fY);}else{if(_c72<gpN.fY+this.oDragging.ysnap){fnewY=Math.min(this.getHigherYSnap(gpN.fY+this.oDragging.ysnap),this.fY);}}}else{if(_c72<gpP.fY+this.oDragging.ysnap){_c72=Math.min(this.getHigherYSnap(gpP.fY+this.oDragging.ysnap),this.fY);}else{if(_c72>gpN.fY-this.oDragging.ysnap){_c72=Math.max(this.getLowerYSnap(gpN.fY-this.oDragging.ysnap),this.fY);}}}
this.gpBuddy.fY=_c72;}else{if(this.isYTooClose(this.gpBuddy,this,_c72)){_c72=this.gpBuddy.fY;}
if(this.isYTooClose(this.gpNext.gpNext,this.gpNext,_c72)){_c72=this.gpNext.gpNext.fY;}
this.gpNext.fY=_c72;this.gpNext.bChanged=true;}}
if(_c6f){if(this.bVertical){if(this.gpNext.gpNext!=null&&_c71>this.gpNext.gpNext.fX-this.oDragging.xsnap){_c71=Math.max((Math.floor(this.gpNext.gpNext.fX/this.oDragging.xsnap)-1)*this.oDragging.xsnap,this.fX);}
this.gpNext.fX=_c71;this.gpNext.bChanged=true;}else{if(_c71<gpP.fX+this.oDragging.xsnap){_c71=Math.min((Math.ceil(gpP.fX/this.oDragging.xsnap)+1)*this.oDragging.xsnap,this.fX);}else{if(_c71>gpN.fX-this.oDragging.xsnap){_c71=Math.max((Math.floor(gpN.fX/this.oDragging.xsnap)-1)*this.oDragging.xsnap,this.fX);}}
this.gpBuddy.fX=_c71;}}
return{x:_c71,y:_c72};};WSGraphPoint.prototype.onChangeExisting=function(_c75,_c76,_c77,_c78){if(_c76){if(this.isYTooClose(this.gpPrev,this,_c78)){_c78=this.gpPrev.fY;}else{if(this.isYTooClose(this.gpNext,this,_c78)){_c78=this.gpNext.fY;}}
var _c79=null;if(this.isSameY(this.gpNext)){if(this.fX==this.gpNext.fX&&this.isSameY(this.gpPrev)){if(this.isYTooClose(this.gpPrev.gpPrev,this.gpPrev,_c78)){_c78=this.gpPrev.gpPrev.fY;}
_c79=this.gpPrev==this.gpBuddy?this.gpNext:this.gpPrev;}else{if(this.isYTooClose(this.gpNext.gpNext,this.gpNext,_c78)){_c78=this.gpNext.gpNext.fY;}
_c79=this.gpNext==this.gpBuddy?this.gpPrev:this.gpNext;}}else{if(this.isSameY(this.gpPrev)){if(this.isYTooClose(this.gpPrev.gpPrev,this.gpPrev,_c78)){_c78=this.gpPrev.gpPrev.fY;}
_c79=this.gpPrev==this.gpBuddy?this.gpNext:this.gpPrev;}}
if(_c79!=null&&_c79!=this.gpBuddy){_c79.bChanged=_c79.bChanged||_c79.fY!=_c78;_c79.fY=_c78;}}
if(this.gpBuddy==null||!this.bDeletable){_c77=this.fX;}else{var gpN,gpP,_c7c,_c7d;if(this.gpBuddy==this.gpNext){gpN=this.gpBuddy.gpNext;gpP=this.gpPrev;_c7d=this.gpBuddy.fY>_c78;_c7c=!_c7d;}else{gpN=this.gpNext;gpP=this.gpBuddy.gpPrev;_c7c=this.gpBuddy.fY>_c78;_c7d=!_c7c;}
if(_c77<gpP.fX+this.oDragging.xsnap){_c77=gpP.fX;if(!(gpP!=null&&gpP.gpPrev!=null&&(_c7c&&gpP.gpPrev.fY>gpP.fY||!_c7c&&gpP.gpPrev.fY<gpP.fY))){_c77=(Math.ceil(_c77/this.oDragging.xsnap)+1)*this.oDragging.xsnap;if(_c77>=gpN.fX){_c77=this.fX;}}}
if(_c77>gpN.fX-this.oDragging.xsnap){_c77=gpN.fX;if(!(gpN!=null&&gpN.gpNext!=null&&(_c7d&&gpN.gpNext.fY>gpN.fY||!_c7d&&gpN.gpNext.fY<gpN.fY))){_c77=(Math.floor(_c77/this.oDragging.xsnap)-1)*this.oDragging.xsnap;if(_c77<=gpP.fX){_c77=this.fX;}}}
this.gpBuddy.bChanged=this.gpBuddy.bChanged||this.gpBuddy.fX!=_c77;this.gpBuddy.fX=_c77;}
return{x:_c77,y:_c78};};WSGraphPoint.prototype.onChangeZone=function(_c7e,_c7f,_c80,_c81,_c82,_c83,_c84){if(_c7f){if(this.iResizing==WSGraphPoint.RS_BOTTOM){if(_c81>this.fY2-this.oDragging.ysnap){_c81=Math.max(this.getLowerYSnap(this.fY2-this.oDragging.ysnap),this.fY);}}else{if(this.iResizing==WSGraphPoint.RS_TOP){if(_c82<this.fY+this.oDragging.ysnap){_c82=Math.min(this.getHigherYSnap(this.fY+this.oDragging.ysnap),this.fY2);}}else{var _c85=_c82-(this.fY2-this.fY);var _c86=_c81+(this.fY2-this.fY);if(_c85<this.oDragging.vp.miny&&_c86>this.oDragging.vp.maxy){_c81=this.fY;_c82=this.fY2;}else{if(_c86>this.oDragging.vp.maxy){_c81=_c85;}else{if(_c85<this.oDragging.vp.miny){_c82=_c86;}else{var _c87=Math.abs(_c81-_c83);var _c88=Math.abs(_c82-_c84);if(_c87<_c88){_c82=_c86;}else{_c81=_c85;}}}}}}
this.gpPrev.fY=_c81;this.gpPrev.fY2=_c82;this.gpPrev.bChanged=true;}
if(_c7e){if(!this.gpPrev.bDeletable&&!this.bDeletable){_c80=this.fX;}else{if(this.gpNext==null||this.iResizing==WSGraphPoint.RS_LEFT){_c80=this.onChangeZoneToLeft(_c80);}else{if(this.gpPrev.gpPrev==null||this.iResizing==WSGraphPoint.RS_RIGHT){_c80=this.onChangeZoneToRight(_c80);}else{if(this.gpNext!=null&&this.gpNext.gpNext!=null&&this.gpPrev.gpPrev!=null&&this.gpPrev.gpPrev.gpPrev!=null){_c80=this.onChangeZoneX(_c80);}}}}}
return{x:_c80,y:_c81,y2:_c82};};WSGraphPoint.prototype.onChangeZoneToLeft=function(_c89){var gpP=this.gpPrev.gpPrev.gpPrev;if(_c89<gpP.fX+this.oDragging.xsnap){_c89=gpP.fX;_c89=Math.min((Math.ceil(_c89/this.oDragging.xsnap)+1)*this.oDragging.xsnap,this.gpPrev.fX);}else{if(_c89>this.fX-this.oDragging.xsnap){_c89=this.fX;_c89=Math.max((Math.floor(_c89/this.oDragging.xsnap)-1)*this.oDragging.xsnap,this.gpPrev.fX);}}
this.gpPrev.fX=this.gpPrev.gpPrev.fX=_c89;this.gpPrev.bChanged=this.gpPrev.gpPrev.bChanged=true;return this.fX;};WSGraphPoint.prototype.onChangeZoneToRight=function(_c8b){var gpN=this.gpNext.gpNext;if(_c8b>gpN.fX-this.oDragging.xsnap){_c8b=gpN.fX;_c8b=Math.max((Math.floor(_c8b/this.oDragging.xsnap)-1)*this.oDragging.xsnap,this.fX);}else{if(_c8b<this.gpPrev.fX+this.oDragging.xsnap){_c8b=this.gpPrev.fX;_c8b=Math.min((Math.ceil(_c8b/this.oDragging.xsnap)+1)*this.oDragging.xsnap,this.fX);}}
this.gpNext.fX=_c8b;this.gpNext.bChanged=true;return _c8b;};WSGraphPoint.prototype.onChangeZoneX=function(_c8d){var gpN=this.gpNext.gpNext;var gpP=this.gpPrev.gpPrev.gpPrev;var _c90=this.fX-this.gpPrev.fX;if(_c8d>gpN.fX-this.oDragging.xsnap){_c8d=gpN.fX;_c8d=Math.max((Math.floor(_c8d/this.oDragging.xsnap)-1)*this.oDragging.xsnap,this.fX);}else{if(_c8d-_c90<gpP.fX+this.oDragging.xsnap){var _c91=gpP.fX;_c91=Math.min((Math.ceil(_c91/this.oDragging.xsnap)+1)*this.oDragging.xsnap,this.gpPrev.fX);_c8d=_c91+_c90;}}
this.fX=_c8d;this.gpPrev.fX=this.fX-_c90;this.gpPrev.gpPrev.fX=this.gpPrev.fX;this.gpNext.fX=this.fX;this.gpPrev.bChanged=this.gpPrev.gpPrev.bChanged=this.gpNext.bChanged=true;return _c8d;};WSGraphPoint.prototype.onDrag=function(_c92){this.oDragging.moved=this.oDragging.moved||Math.abs(_c92.left)>WSLine.PIX_MARGIN||Math.abs(_c92.top)>WSLine.PIX_MARGIN;var oVP=this.oDragging.vp;var _c94=this.fX;var _c95=this.fY;var _c96=this.fY2;var _c97=_c95;var _c98=_c96;if(this.bDeletable||this.oDragging.changex){_c94=this.oDragging.startx+_c92.left/this.oDragging.pixperx;_c94=Math.round(_c94/this.oDragging.xsnap)*this.oDragging.xsnap;_c94=Math.min(Math.max(_c94,oVP.minx),oVP.maxx);}
if(this.oDragging.changey){if(this.iResizing!=WSGraphPoint.RS_TOP){_c97=this.oDragging.starty+_c92.top/this.oDragging.pixpery;_c95=this.getClosestYSnap(_c97);}
if(!this.oDragging.isline&&this.iResizing!=WSGraphPoint.RS_BOTTOM){_c98=this.oDragging.starty2+_c92.top/this.oDragging.pixpery;_c96=this.getClosestYSnap(_c98);}}
var _c99=_c94!=this.fX;var _c9a=_c95!=this.fY||_c96!=this.fY2;var _c9b;if(this.oDragging.isline){if(this.iTempID==0){_c9b=this.onChangeExisting(_c99,_c9a,_c94,_c95);}else{_c9b=this.onChangeCandidate(_c99,_c9a,_c94,_c95);}}else{_c9b=this.onChangeZone(_c99,_c9a,_c94,_c95,_c96,_c97,_c98);}
this.fX=_c9b.x;this.fY=_c9b.y;if(isDefined(_c9b.y2)){this.fY2=_c9b.y2;}
this.bChanged=this.fX!=this.oDragging.startx||this.fY!=this.oDragging.starty||this.fY2!=this.oDragging.starty2;if(!this.bChanged){if(this.gpNext!=null){this.gpNext.bChanged=false;}
if(this.gpPrev!=null){this.gpPrev.bChanged=false;}}else{this.oDragging.moved=true;}
return _c99||_c9a;};WSGraphPoint.prototype.onDragEnd=function(_c9c){this.oDragging=null;if(this.gpBuddy!=null&&(!isDefined(_c9c)||_c9c)){this.gpBuddy.onDragEnd(false);}
this.gpBuddy=null;this.iResizing=WSGraphPoint.RS_NONE;};WSGraphPoint.prototype.onDragStart=function(_c9d,_c9e,_c9f,_ca0,_ca1,oVP,_ca3){oVP.miny=_ca3[0];oVP.maxy=_ca3[_ca3.length-1];this.oDragging={startx:this.fX,starty:this.fY,starty2:this.fY2,xsnap:_c9d,ysnap:_c9e,pixperx:_c9f,pixpery:_ca0,isline:_ca1,vp:oVP,yvalues:_ca3,moved:false,changex:this.iResizing>=WSGraphPoint.RS_LEFT||this.iResizing==WSGraphPoint.RS_NONE,changey:this.iResizing<=WSGraphPoint.RS_BOTTOM};if(this.iResizing==WSGraphPoint.RS_LEFT||!_ca1&&this.gpNext==null){this.oDragging.startx=this.gpPrev.fX;}
if(this.gpBuddy!=null){this.gpBuddy.oDragging=this.oDragging;}};WSGraphPoint.prototype.onNewIDs=function(aIDs){if(isDefined(aIDs[this.iTempID])){this.iID=aIDs[this.iTempID];this.iTempID=0;}};WSGraphPoint.prototype.onRemove=function(){if(this.divZone!=null){this.onRemoveZone();return;}
if(!this.bDeletable){return;}
if(this.gpPrev.gpPrev==null){this.fY=this.gpPrev.fY=this.gpNext.fY;this.bChanged=this.gpPrev.bChanged=true;}else{if(this.gpNext.gpNext==null){this.fY=this.gpNext.fY=this.gpPrev.fY;this.bChanged=this.gpNext.bChanged=true;}else{var _ca5,gpN,gpP;if(this.isSameY(this.gpNext)){_ca5=this.gpNext;gpN=_ca5.gpNext;gpP=this.gpPrev;}else{_ca5=this.gpPrev;gpN=this.gpNext;gpP=_ca5.gpPrev;}
if((gpN.fY>this.fY)==(gpP.fY>this.fY)){if(Math.abs(gpN.fY-this.fY)<Math.abs(gpP.fY-this.fY)){this.fY=_ca5.fY=gpN.fY;}else{this.fY=_ca5.fY=gpP.fY;}
this.bChanged=_ca5.bChanged=true;}else{if(_ca5==this.gpNext){this.fY=gpP.fY;}else{this.fY=gpN.fY;}
this.fX=_ca5.fX;this.bChanged=true;}}}};WSGraphPoint.prototype.onRemoveZone=function(){if(!this.bDeletable&&!this.gpPrev.bDeletable){return;}
if(this.gpNext==null&&this.gpPrev.gpPrev==null){return;}
var _ca8,_ca9;var gpP=this.gpPrev.gpPrev;if(gpP==null){_ca8=this.gpNext.fY;_ca9=this.gpNext.fY2;}else{if(this.gpNext==null){_ca8=gpP.fY;_ca9=gpP.fY2;}else{fDiffLeft=Math.abs(gpP.fY-this.fY)+Math.abs(gpP.fY2-this.fY2);fDiffRight=Math.abs(this.gpNext.fY-this.fY)+Math.abs(this.gpNext.fY2-this.fY2);if(fDiffLeft<fDiffRight){_ca8=gpP.fY;_ca9=gpP.fY2;}else{_ca8=this.gpNext.fY;_ca9=this.gpNext.fY2;}}}
this.gpPrev.fY=this.fY=_ca8;this.gpPrev.fY2=this.fY2=_ca9;this.gpPrev.bChanged=this.bChanged=true;};WSGraphPoint.prototype.onSplitZone=function(fX,_cac,_cad,_cae,_caf){var gpP=this.gpPrev.gpPrev;var gpN=this.gpNext;if(gpP==null&&gpN==null){if(this.fY2==_cae&&this.fY==_cad){this.gpPrev.fY2-=_caf;}else{this.fY2=Math.min(this.fY2+2*_caf,_cae);}
this.fY=Math.min(this.fY+2*_caf,this.fY2-_caf);}else{if(gpP==null){this.gpPrev.fY=gpN.fY;this.gpPrev.fY2=gpN.fY2;}else{if(gpN==null){this.fY=gpP.fY;this.fY2=gpP.fY2;}else{var _cb2=_cae-_cad;if(_cb2-(this.fY2-this.fY)<=_caf&&_cb2-(gpN.fY2-gpN.fY)<=_caf){if(_cae-this.fY2>this.fY-_cad){this.fY2=this.gpPrev.fY2=Math.floor((this.fY2-_caf)/_caf)*_caf;gpN.fY=gpN.gpNext.fY=Math.ceil((gpN.fY+_caf)/_caf)*_caf;}else{this.fY=this.gpPrev.fY=Math.ceil((this.fY+_caf)/_caf)*_caf;gpN.fY2=gpN.gpNext.fY2=Math.ceil((gpN.fY2-_caf)/_caf)*_caf;}
gpN.bChanged=gpN.gpNext.bChanged=true;}
var _cb3=Math.abs(gpN.fY-this.fY)>=2*_caf;var _cb4=Math.abs(gpN.fY2-this.fY2)>=2*_caf;if(_cb3||_cb4){this.fY=Math.round((gpN.fY+this.fY)*0.5/_caf)*_caf;this.fY2=Math.round((gpN.fY2+this.fY2)*0.5/_caf)*_caf;}else{if(gpN.fY2<this.fY2){_caf*=-1;}
var _cb5=Math.round((gpN.fY2+_caf)/_caf)*_caf;var _cb6=_cb5-(this.fY2-this.fY);if(_cb6>=_cad&&_cb5<=_cae){this.fY=_cb6;this.fY2=_cb5;}else{var _cb5=Math.round((this.fY2-_caf)/_caf)*_caf;var _cb6=_cb5-(this.fY2-this.fY);if(_cb6>=_cad&&_cb5<=_cae){this.fY=_cb6;this.fY2=_cb5;}}}}}}
this.fY2=Math.min(this.fY2,_cae);this.fY=Math.max(this.fY,_cad);this.bChanged=true;var _cb7=new WSGraphPoint(0,fX,this.gpPrev.fY,this.gpPrev.fY2,true);var _cb8=new WSGraphPoint(0,fX,this.fY,this.fY2,true);_cac.add(_cb7,this.gpPrev);_cac.add(_cb8,_cb7);_cac.onStore();};WSGraphPoint.prototype.setBuddy=function(_cb9){this.gpBuddy=_cb9;_cb9.gpBuddy=this;};WSGraphPoint.prototype.setDragged=function(_cba){if(this.oDragging!=null){this.oDragging.moved=isDefined(_cba)?_cba:true;}};function WSLine(_cbb){this.aByID={};this.gpFirst=null;this.gpLast=null;this.iLineID=_cbb;this.fPixPerX=1;this.fPixPerY=1;this.aDelete=[];};WSLine.PIX_MARGIN=8;WSLine.PIX_MARGINDIST=WSLine.PIX_MARGIN*WSLine.PIX_MARGIN;WSLine.PIX_POINTDIST=(WSLine.PIX_MARGIN*2)*(WSLine.PIX_MARGIN*2);WSLine.prototype.destruct=function(){this.gpFirst.destruct(true);this.gpFirst=this.gpLast=null;this.aByID=null;};WSLine.prototype.add=function(_cbc,_cbd){this.aByID[_cbc.iID]=_cbc;if(this.gpFirst==null){this.gpFirst=this.gpLast=_cbc;}else{if(!isDefined(_cbd)){_cbd=this.getLowerBound(_cbc);}
if(_cbd==null){_cbc.gpNext=this.gpFirst;this.gpFirst.gpPrev=_cbc;this.gpFirst=_cbc;}else{if(_cbd==this.gpLast){_cbc.gpPrev=this.gpLast;this.gpLast.gpNext=_cbc;this.gpLast=_cbc;}else{_cbc.gpNext=_cbd.gpNext;_cbc.gpNext.gpPrev=_cbc;_cbc.gpPrev=_cbd;_cbd.gpNext=_cbc;}}
if(_cbc.iNextID==0&&_cbc.gpPrev!=null){_cbc.gpPrev.bChanged=true;}}};WSLine.prototype.begin=function(){return this.gpFirst;};WSLine.prototype.end=function(){return this.gpLast;};WSLine.prototype.get=function(_cbe){return isDefined(this.aByID[_cbe])?this.aByID[_cbe]:null;};WSLine.prototype.getClosestPoint=function(_cbf){if(this.gpFirst==this.gpLast){return null;}
var _cc0={left:0,top:0,gpHover:null,bVertical:false};var _cc1=_cbf.left;var _cc2=_cbf.top;var _cc3=true;var _cc4=99999;var _cc5=this.gpFirst;var fX=_cc5.fX*this.fPixPerX+1;var fY=_cc5.fY*this.fPixPerY;var _cc8=_cc1-fX;var _cc9=_cc2-fY;var _cca=_cc8*_cc8+_cc9*_cc9;if(_cca<=WSLine.PIX_POINTDIST){if(_cca<=WSLine.PIX_MARGINDIST&&_cca<_cc4){_cc0.gpHover=_cc5;_cc4=_cca;}
_cc3=false;}
var _ccb,_ccc;var _ccd=fX;var _cce=fY;var _ccf=99999;while((_cc5=_cc5.gpNext)!=null){_ccb=fX;_ccc=fY;fX=_cc5.fX*this.fPixPerX;fY=_cc5.fY*this.fPixPerY;_cc8=_cc1-fX;_cc9=_cc2-fY;_cca=_cc8*_cc8+_cc9*_cc9;if(_cca<=WSLine.PIX_POINTDIST){if(_cca<=WSLine.PIX_MARGINDIST&&_cca<_cc4){_cc0.gpHover=_cc5;_cc4=_cca;}
_cc3=false;}
if(!_cc3){continue;}
if((fX<_cc1-WSLine.PIX_MARGIN&&_ccb<_cc1-WSLine.PIX_MARGIN)||(fX>_cc1+WSLine.PIX_MARGIN&&_ccb>_cc1+WSLine.PIX_MARGIN)||(fY<_cc2-WSLine.PIX_MARGIN&&_ccc<_cc2-WSLine.PIX_MARGIN)||(fY>_cc2+WSLine.PIX_MARGIN&&_ccc>_cc2+WSLine.PIX_MARGIN)){continue;}
var dX=fX-_ccb;var dY=fY-_ccc;var _cd2=dX*dX+dY*dY;var u=((_cc1-fX)*dX+(_cc2-fY)*dY)/_cd2;var _cd4=fX+(u*dX);var _cd5=fY+(u*dY);_cc8=_cc1-_cd4;_cc9=_cc2-_cd5;var _cd6=_cc8*_cc8+_cc9*_cc9;if(_ccf>_cd6){_ccf=_cd6;_ccd=_cd4;_cce=_cd5;_cc0.bVertical=_cc5.fX==_cc5.gpPrev.fX;}}
if((!_cc3||_ccf>WSLine.PIX_POINTDIST)&&_cc0.gpHover==null){return null;}else{_cc0.left=_ccd;_cc0.top=_cce;return _cc0;}};WSLine.prototype.getExtremes=function(){if(this.gpFirst==null){return{miny:0,maxy:0};}
var _cd7=this.gpFirst;var _cd8={miny:10000,maxy:0};while(_cd7!=null){_cd8.miny=Math.min(_cd8.miny,_cd7.fY);if(_cd7.fY2!=0){_cd8.maxy=Math.max(_cd8.maxy,_cd7.fY2);}else{_cd8.maxy=Math.max(_cd8.maxy,_cd7.fY);}
_cd7=_cd7.gpNext;}
return _cd8;};WSLine.prototype.getLowerBound=function(_cd9){var _cda=null;var _cdb=this.gpFirst;while(_cdb!=null){if(_cdb.fX>_cd9.fX){break;}
if(_cdb.fX==_cd9.fX){if(_cd9.iNextID==0||_cd9.iNextID!=_cdb.iID){return _cdb;}else{break;}}
_cda=_cdb;_cdb=_cdb.gpNext;}
return _cda;};WSLine.prototype.isEmpty=function(){return this.gpFirst==this.gpLast;};WSLine.prototype.onStore=function(){var _cdc="";var _cdd=this.gpFirst;var _cde=false;while(_cdd!=null){while(_cdd.gpNext!=null&&!_cdd.gpNext.isValid()){_cde=true;if(_cdd.gpNext.iID>0){this.aDelete.push(_cdd.gpNext.iID);}
var _cdf=_cdd.gpNext;_cdd.gpNext=_cdf.gpNext;_cdd.gpNext.gpPrev=_cdd;_cdf.destruct();_cdd.bChanged=true;}
var _ce0=_cdd.getParam();if(_ce0.indexOf("add")!=-1){_cdc=_ce0+_cdc;}else{_cdc+=_ce0;}
_cdd=_cdd.gpNext;}
for(var i=0,_ce2=this.aDelete.length;i<_ce2;i++){_cdc+="del|"+this.aDelete[i]+"|";}
this.aDelete=[];if(_cdc.length>0){_cdc=_cdc.substr(0,_cdc.length-1);SessionGraph.sgCur.onSendRequest("lineid="+this.iLineID+"&storeline="+_cdc,WSLine.prototype.onStoreResult,this);}
return _cde;};WSLine.prototype.onStoreResult=function(xml){var _ce4={};var _ce5=YSXML.getChildren(xml,"newid");for(var i=0,_ce7=_ce5.length;i<_ce7;i++){_ce4[YSNumbers.checkInt(YSXML.getAttribute(_ce5[i],"tempid"))]=YSNumbers.checkInt(YSXML.getAttribute(_ce5[i],"id"));}
if(_ce5.length>0){var _ce8=this.gpFirst;while(_ce8!=null){_ce8.onNewIDs(_ce4);this.aByID[_ce8.iID]=_ce8;_ce8=_ce8.gpNext;}
if(isDefined(this.aByID[0])){delete this.aByID[0];}}};WSLine.prototype.onViewChanged=function(_ce9,_cea){this.fPixPerX=_ce9;this.fPixPerY=_cea;};WSLine.prototype.onXClip=function(_ceb){var _cec=this.gpFirst;var _ced=_cec;while(_cec!=null){if(_cec==this.gpLast){break;}
if(_cec.fX>=_ceb){this.aDelete.push(_cec.iID);}else{_ced=_cec;}
_cec=_cec.gpNext;}
_ced.gpNext=this.gpLast;this.gpLast.gpPrev=_ced;this.gpLast.fX=_ceb;this.gpLast.fY=_ced.fY;this.gpLast.bChanged=_ced.bChanged=true;};WSLine.prototype.onYClip=function(_cee,_cef,_cf0){var _cf1=this.gpFirst;while(_cf1!=null){if(_cf0&&_cf1.oOrig==null){_cf1.oOrig={x:_cf1.fX,y:_cf1.fY,y2:_cf1.fY2};}
if(_cf1.fY2!=0){_cf1.fY2=Math.min(_cee,_cf1.oOrig.y2);if(_cf1.fY2==_cee){_cf1.fY=Math.min(_cf1.fY2-_cef,_cf1.oOrig.y);}}else{_cf1.fY=Math.min(_cee,_cf1.oOrig.y);}
_cf1.bChanged=_cf1.fY2!=_cf1.oOrig.y2||_cf1.fY!=_cf1.oOrig.y;if(!_cf0){_cf1.oOrig=null;}
_cf1=_cf1.gpNext;}};WSLine.prototype.onZoneHover=function(oPos){var _cf3=null;var _cf4=this.gpFirst;while(_cf4!=null){if(_cf4.divZone!=null){var _cf5=YSDOM.getElementPosition(_cf4.divZone);var _cf6=YSDOM.getElementSize(_cf4.divZone,true);_cf5.top-=5;_cf5.left-=5;_cf6.height+=10;_cf6.width+=10;if(YSDOM.posWithinBounds(oPos,_cf5.left,_cf5.top,_cf6.width,_cf6.height)){_cf3=_cf4;var _cf7=WSGraphPoint.RS_NONE;var _cf8=Math.min(Math.floor((_cf6.height-20)/2)-1,5);if(oPos.left>_cf5.left+5&&oPos.left<_cf5.left+_cf6.width-5){if(oPos.top<_cf5.top+10+_cf8){_cf7=WSGraphPoint.RS_TOP;}else{if(oPos.top>_cf5.top+_cf6.height-10-_cf8){_cf7=WSGraphPoint.RS_BOTTOM;}}}
_cf3.iResizing=_cf7;break;}}
_cf4=_cf4.gpNext;}
return _cf3;};function WSSVG(_cf9,_cfa){WSDrawer.call(this,_cf9,_cfa);this.sNS="http://www.w3.org/2000/svg";this.oPath=null;this.divCurLine=null;this.sPath="";this.iLinePoints=0;this.divCurHolder=null;};WSSVG.prototype=new WSDrawer();WSSVG.prototype.onAddLinePoint=function(_cfb){if(this.oPath==null){return;}
if(this.iLinePoints==0){this.sPath="M ";}else{if(this.iLinePoints==1){this.sPath+=" L ";}else{this.sPath+=" ";}}
this.sPath+=Math.round(_cfb.left)+" "+Math.round(_cfb.top);this.iLinePoints++;};WSSVG.prototype.onLineEnd=function(){if(this.iLinePoints<2){YSDOM.removeElement(this.divCurLine);}else{YSXML.setAttribute(this.oPath,"d",this.sPath);}
this.sPath="";this.iLinePoints=0;this.divCurLine=null;this.oPath=null;};WSSVG.prototype.onLineStart=function(_cfc,_cfd){this.divCurLine=document.createElement("div");YSDOM.setSize(this.divCurLine,new Size(this.iGraphWidth*3,this.iGraphHeight*3));var svg=document.createElementNS(this.sNS,"svg:svg");var _cff=document.createElementNS(this.sNS,"svg:g");this.oPath=document.createElementNS(this.sNS,"svg:path");YSXML.setAttribute(this.oPath,"fill","none");YSXML.setAttribute(this.oPath,"stroke",_cfc);YSXML.setAttribute(this.oPath,"stroke-width",this.iLineWidth);YSXML.setAttribute(this.oPath,"stroke-linecap","round");YSXML.setAttribute(this.oPath,"stroke-linejoin","round");_cff.appendChild(this.oPath);svg.appendChild(_cff);this.divCurLine.appendChild(svg);_cfd.appendChild(this.divCurLine);};WSSVG.prototype.onShowUnitText=function(_d00,_d01){var _d02=this.iFontSize+2;var _d03=document.createElement("div");YSDOM.setSize(_d03,new Size(_d02,this.iGraphHeight));YSCSS.setStyle(_d03,"left","-1px");var svg=document.createElementNS(this.sNS,"svg:svg");var _d05=document.createElementNS(this.sNS,"svg:g");svg.appendChild(_d05);_d03.appendChild(svg);var iX=Math.floor(this.iGraphHeight/2);if(_d00){iX*=-1;}
var _d07=document.createElementNS(this.sNS,"svg:text");YSXML.setAttribute(_d07,"y",_d00?this.iFontSize:-this.iHalfFontSize+2);YSXML.setAttribute(_d07,"x",iX);YSXML.setAttribute(_d07,"text-anchor","middle");YSXML.setAttribute(_d07,"font-size",this.iFontSize);YSXML.setAttribute(_d07,"transform","rotate("+(_d00?"-90":"90")+")");YSXML.setAttribute(_d07,"fill","white");YSXML.setAttribute(_d07,"font-size","12px");var txt=document.createTextNode(_d01);_d07.appendChild(txt);_d05.appendChild(_d07);var _d09=_d00?this.divYAxisUnit:this.divYAxis2Unit;_d09.appendChild(_d03);};function WSVML(_d0a,_d0b){WSDrawer.call(this,_d0a,_d0b);this.oCurShape=null;this.sPath="";this.iLinePoints=0;};WSVML.prototype=new WSDrawer();WSVML.prototype.destruct=function(){WSDrawer.prototype.destruct.call(this);};WSVML.prototype.onAddLinePoint=function(_d0c){if(this.oCurShape==null){return;}
if(this.iLinePoints==0){this.sPath="m";}else{if(this.iLinePoints==1){this.sPath+="l";}else{this.sPath+=",";}}
this.sPath+=Math.round(_d0c.left)+","+Math.round(_d0c.top);this.iLinePoints++;};WSVML.prototype.onInit=function(_d0d){if(document.namespaces["v"]==null){document.namespaces.add("v","urn:schemas-microsoft-com:vml");}
WSDrawer.prototype.onInit.call(this,_d0d);};WSVML.prototype.onLineEnd=function(){if(this.iLinePoints<2){YSDOM.removeElement(this.oCurShape);}else{var _d0e=document.createElement("v:path");_d0e.v=this.sPath+"e";this.oCurShape.appendChild(_d0e);var _d0f=document.createElement("v:fill");_d0f.on="false";this.oCurShape.appendChild(_d0f);var _d10=document.createElement("v:stroke");_d10.joinstyle="round";_d10.endcap="round";this.oCurShape.appendChild(_d10);}
this.sPath="";this.iLinePoints=0;this.oCurShape=null;};WSVML.prototype.onLineStart=function(_d11,_d12){var _d13=document.createElement("v:group");_d13.coordsize=this.iGraphWidth*3+" "+this.iGraphHeight*3;YSDOM.setSize(_d13,new Size(this.iGraphWidth*3,this.iGraphHeight*3));this.oCurShape=document.createElement("v:shape");YSDOM.setSize(this.oCurShape,new Size(this.iGraphWidth*3,this.iGraphHeight*3));this.oCurShape.coordsize=this.iGraphWidth*3+" "+this.iGraphHeight*3;this.oCurShape.strokeweight=this.iLineWidth+"px";this.oCurShape.strokecolor=_d11;_d13.appendChild(this.oCurShape);_d12.appendChild(_d13);};WSVML.prototype.onShowUnitText=function(_d14,_d15){var _d16=this.iFontSize+2;var _d17=document.createElement("v:shape");YSDOM.setSize(_d17,new Size(_d16,this.iGraphHeight));YSCSS.setMultiStyle(_d17,["antialias","left"],["true","-1px"]);_d17.coordsize=this.iFontSize+" "+this.iGraphHeight;var _d18=document.createElement("v:path");_d18.textpathok="true";_d18.v=_d14?"m"+this.iHalfFontSize+","+this.iGraphHeight+"l"+this.iHalfFontSize+",0":"m"+this.iHalfFontSize+",0"+"l"+this.iHalfFontSize+","+this.iGraphHeight;var _d19=document.createElement("v:stroke");_d19.on="false";var _d1a=document.createElement("v:fill");_d1a.on="true";_d1a.color="white";var _d1b=document.createElement("v:textpath");_d1b.on="true";_d1b.string=_d15;YSCSS.setStyle(_d1b,"fontSize","13px");_d17.appendChild(_d18);_d17.appendChild(_d19);_d17.appendChild(_d1a);_d17.appendChild(_d1b);var _d1c=_d14?this.divYAxisUnit:this.divYAxis2Unit;_d1c.appendChild(_d17);};