var jg_ok,jg_ie,jg_fast,jg_dom,jg_moz;function _chkDHTM(c,a,b){a=c.document.body||null;
jg_ie=a&&typeof a.insertAdjacentHTML!="undefined"&&c.document.createElement;jg_dom=(a&&!jg_ie&&typeof a.appendChild!="undefined"&&typeof c.document.createRange!="undefined"&&typeof(b=c.document.createRange()).setStartBefore!="undefined"&&typeof b.createContextualFragment!="undefined");
jg_fast=jg_ie&&c.document.all&&!c.opera;jg_moz=jg_dom&&typeof a.style.MozOpacity!="undefined";
jg_ok=!!(jg_ie||jg_dom)}function _pntCnvDom(){var a=this.wnd.document.createRange();
a.setStartBefore(this.cnv);a=a.createContextualFragment(jg_fast?this._htmRpc():this.htm);
if(this.cnv){this.cnv.appendChild(a)}this.htm=""}function _pntCnvIe(){if(this.cnv){this.cnv.insertAdjacentHTML("BeforeEnd",jg_fast?this._htmRpc():this.htm)
}this.htm=""}function _mkDiv(a,d,b,c){this.htm+='<div style="position:absolute;left:'+a+"px;top:"+d+"px;width:"+b+"px;height:"+c+"px;clip:rect(0,"+b+"px,"+c+"px,0);background-color:"+this.color+(!jg_moz?";overflow:hidden":"")+';"></div>'
}function _mkDivIe(a,d,b,c){this.htm+="%%"+this.color+";"+a+";"+d+";"+b+";"+c+";"
}var _regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;function _htmRpc(){return this.htm.replace(_regex,'<div style="overflow:hidden;position:absolute;background-color:$1;left:$2px;top:$3px;width:$4px;height:$5px"></div>\n')
}function _mkLin2D(t,b,r,a){if(t>r){var f=r;var o=a;r=t;a=b;t=f;b=o}var k=r-t,j=Math.abs(a-b),h=t,g=b,n=(b>a)?-1:1;
var l=this.stroke;if(k>=j){if(k>0&&l-3>0){var u=(l*k*Math.sqrt(1+j*j/(k*k))-k-(l>>1)*j)/k;
u=(!(l-4)?Math.ceil(u):Math.round(u))+1}else{var u=l}var v=Math.ceil(l/2);var q=j<<1,e=q-(k<<1),m=q-k,d=h;
while(k>0){--k;++h;if(m>0){this._mkDiv(d,g,h-d+v,u);g+=n;m+=e;d=h}else{m+=q}}this._mkDiv(d,g,r-d+v+1,u)
}else{if(l-3>0){var u=(l*j*Math.sqrt(1+k*k/(j*j))-(l>>1)*k-j)/j;u=(!(l-4)?Math.ceil(u):Math.round(u))+1
}else{var u=l}var v=Math.round(l/2);var q=k<<1,e=q-(j<<1),m=q-j,c=g;if(a<=b){++v;
while(j>0){--j;if(m>0){this._mkDiv(h++,g,u,c-g+v);g+=n;m+=e;c=g}else{g+=n;m+=q}}this._mkDiv(r,a,u,c-a+v)
}else{while(j>0){--j;g+=n;if(m>0){this._mkDiv(h++,c,u,g-c+v);m+=e;c=g}else{m+=q
}}this._mkDiv(r,c,u,a-c+v+1)}}}function jsgFont(){this.PLAIN="font-weight:normal;";
this.BOLD="font-weight:bold;";this.ITALIC="font-style:italic;";this.ITALIC_BOLD=this.ITALIC+this.BOLD;
this.BOLD_ITALIC=this.ITALIC_BOLD}var Font=new jsgFont();function jsgStroke(){this.DOTTED=-1
}var Stroke=new jsgStroke();function jsGraphicsLight(a){this.setColor=function(b){this.color=b.toLowerCase()
};this.setStroke=function(b){this.stroke=b};this.clear=function(){this.htm="";if(this.cnv){this.cnv.innerHTML=""
}};this.wnd=window;if(!jg_ok){_chkDHTM(this.wnd)}if(jg_ok){if(typeof(a)=="string"){this.cont=document.all?(this.wnd.document.all[a]||null):document.getElementById?(this.wnd.document.getElementById(a)||null):null
}else{if(a==window.document){this.cont=document.getElementsByTagName("body")[0]
}else{this.cont=a}}this.cnv=this.wnd.document.createElement("div");this.cnv.style.fontSize=0;
this.cont.appendChild(this.cnv);this.paint=jg_dom?_pntCnvDom:_pntCnvIe;this.drawLine=_mkLin2D
}else{this.paint=_pntN}if(jg_fast){this._mkDiv=_mkDivIe;this._htmRpc=_htmRpc}else{this._mkDiv=_mkDiv
}}var overlay;var timetableOverlay;var timetableChoices;var timetableLastChoice;
var cacheCells,cacheHeaders,cacheInputs;function timetableOnLoad(){for(var b=0,a=null;
a=document.getElementById("jsonly"+b);b++){a.style.visibility="visible"}overlay=document.getElementById("overlay");
if(overlay){timetableOverlay=new jsGraphicsLight("overlay");timetableOverlay.setColor("blue");
timetableOverlay.setStroke(3)}if(timetableChoices){timetableLastChoice=[];refresh()
}changesChangeHandler();peopleCountClickHandler();activeChangeHandler();fromChangeHandler();
if(window.customOnLoad){customOnLoad()}}function line(d,g,c,e,f){var b=Math.atan2(e-g,c-d);
d+=f*Math.cos(b);g+=f*Math.sin(b);c-=f*Math.cos(b);e-=f*Math.sin(b);timetableOverlay.clear();
timetableOverlay.drawLine(d,g,c,e);timetableOverlay.paint()}function over(f){var a=findDefaultTown();
if(f==a){return}var c=a.offsetLeft;var e=a.offsetTop;var b=f.offsetLeft;var d=f.offsetTop;
line(c,e,b,d,15);a.firstChild.src="images/dot2.png";f.firstChild.src="images/dot2.png"
}function out(a){if(a==findDefaultTown()){return}timetableOverlay.clear();a.className="";
a.firstChild.src="images/dot1.png"}function down(c,b){var a;if(!b){var b=window.event
}if(b.which){a=(b.which==3)}else{if(b.button){a=(b.button==2)}}if(a){c.oncontextmenu=new Function("return false");
c.oncontextmenu=undefined}}function up(c,b){var a;if(!b){var b=window.event}if(b.which){a=(b.which==3)
}else{if(b.button){a=(b.button==2)}}if(a){c.oncontextmenu=undefined}}function click(b,a){}function findDefaultTown(){var b=document.getElementById("query.from")||document.getElementById("query.legs.0.from");
var a=b.options[b.selectedIndex];return document.getElementById("town_"+a.value)
}function fromChangeHandler(){var d=document.getElementById("query.from")||document.getElementById("query.legs.0.from");
if(d){for(var a=0;a<d.options.length;a++){var c=document.getElementById("town_"+d.options[a].value);
var b=(d.selectedIndex==a);c.firstChild.src=b?"images/dot2.png":"images/dot1.png";
c.href=b?"javascript:;":d.options[d.selectedIndex].value+"-"+d.options[a].value
}}}function updateChangeTimeList(c){var b=document.getElementById(c+".changes");
if(b){var a=document.getElementById(c+".minChangeTime");a.disabled=(b.value=="NONE")
}return(b!=null)}function changesChangeHandler(){updateChangeTimeList("query");
var a=0;while(updateChangeTimeList("query.legs."+a)){a++}}function peopleCountClickHandler(){var c=0;
for(var a=1;true;a++){var b=document.getElementById("query.peopleCount."+a);if(!b){break
}if(b.checked){c=a}}if(c){var d=document.getElementById("query.discount");if(d){for(var a=0;
a<d.options.length;a++){d.options[a].disabled=(a>c)}if(d.selectedIndex>c){d.selectedIndex=c
}}}}function updateActiveRows(b){for(var a=0,c=null;c=document.getElementById(b+"."+a+".active");
a++){if(a==0){c.checked=true}var d=document.getElementById(b+"."+a+".params");d.style.visibility=c.checked?"visible":"hidden"
}return true}function activeChangeHandler(){updateActiveRows("query.legs");updateActiveRows("query.people")
}function common(c,b){for(var a=0;true;a++){if(a==c.length||a==b.length){return a
}if(c[a]!=b[a]){return a}}}function settext(c,b){b=b?b:"";var a=document.getElementById(c);
if(a){if(a.firstChild){a.firstChild.nodeValue=b}else{a.appendChild(document.createTextNode(b))
}}}function setprice(a,c){var d=c?c:"";var b=a.nextSibling;if(b.firstChild){b.firstChild.nodeValue=d
}else{b.appendChild(document.createTextNode(d))}a.disabled=c?false:true;a.style.visibility=c?"visible":"hidden";
a.style.cursor=c?"pointer":"auto";a.parentNode.style.cursor=c?"pointer":"auto"}function getcells(){if(!cacheCells){cacheCells=document.getElementsByTagName("td")
}return cacheCells}function getheaders(){if(!cacheHeaders){cacheHeaders=document.getElementsByTagName("th")
}return cacheHeaders}function getinputs(d){if(!cacheInputs){cacheInputs=[]}if(!cacheInputs[d]){var a=[];
var b=document.getElementsByTagName("input");for(var c=0;c!=b.length;c++){if(b.item(c).name=="choice"+d){a.push(b.item(c))
}}cacheInputs[d]=a}return cacheInputs[d]}function getchoice(c){var a=getinputs(c);
for(var b in a){if(a[b].checked){return a[b].value}}return null}function getallchoices(){var a=[];
var d=0;var b=null;while(b=getchoice(d)){a[d++]=b}return a}function uncheck(c){var a=getinputs(c);
for(var b in a){a[b].checked=false}return a.length!=0}function uncheckabove(b){var a=b+1;
while(uncheck(a)){a++}}function lookupchoice(d){var e=timetableChoices;var b=null;
for(i in d){var a=e[d[i]];if(a){b=a;e=a[3]}else{return null}}return b}function lookupprice(e,c,d){var b=d.slice(0,e);
if(b.length!=e){return null}b.push(c.value);var a=lookupchoice(b);return a?a[1]:null
}function showtickets(a){var c=document.getElementById("tickets");var e=c.parentNode;
if(a.length==0){e.style.display="none"}var b=0;for(var d in a){var f=document.getElementById("ticket"+a[d]);
c.insertBefore(f,c.childNodes[b++]);f.style.display=""}while(b!=c.childNodes.length){var f=c.childNodes[b++];
f.style.display="none"}if(a.length!=0){e.style.display=""}}function highlightadd(a){a.className+=" highlight"
}function highlightremove(b){var a=b.className.indexOf(" highlight");if(a!=-1){b.className=b.className.substring(0,a)
}}function highlightobject(e,d,c){if(e.className.indexOf(d)!=-1){highlightremove(e)
}var b=e.className.split(" ");for(var a in b){if(b[a]==c){highlightadd(e);return
}}}function highlightlevel(b,e){var j=e.split("_");var c=getcells();var h="itinerary"+b;
var g=h+"_"+j[0];for(var d=0;d!=c.length;d++){highlightobject(c.item(d),h,g)}var a=getheaders();
h="restriction"+b;g=h+"_"+j[1];for(var d=0;d!=a.length;d++){highlightobject(a.item(d),h,g)
}var f=getinputs(b);for(var d in f){var k=f[d];highlightremove(k.parentNode);if(k.value==e){highlightadd(k.parentNode)
}}}function refreshprices(d,c){var a=getinputs(d);for(var b in a){setprice(a[b],lookupprice(d,a[b],c))
}}function refreshhighlight(b,a){if(a[b]){highlightlevel(b,a[b])}else{highlightlevel(b,"x_x")
}}function refreshhint(c,a){var b=document.getElementById("hint"+c);if(b){b.style.visibility=(c==a.length)?"visible":"hidden"
}}function refreshtickets(d,c){var a=getinputs(d);if(a.length==0){if(c.length==d){var b=lookupchoice(c);
settext("total",b[0]);settext("perperson",b[1]);showtickets(b[2])}else{settext("total",null);
settext("perperson",null);showtickets([])}}}function refresh(){var a=getallchoices();
uncheckabove(common(timetableLastChoice,a));timetableLastChoice=a=getallchoices();
for(var b=0;true;b++){refreshprices(b,a);refreshhighlight(b,a);refreshtickets(b,a);
refreshhint(b,a);if(getinputs(b).length==0){break}}}function frame(b,a){if(!parent.frames[b]){return true
}parent.frames[b].location=a;return false}function changecss(h,b,g){var a;var d=false;
for(var c=0;c<document.styleSheets.length;c++){if(document.styleSheets[c]["rules"]){a="rules"
}else{if(document.styleSheets[c]["cssRules"]){a="cssRules"}}for(var f=0;f<document.styleSheets[c][a].length;
f++){if(document.styleSheets[c][a][f].selectorText==h){if(document.styleSheets[c][a][f].style[b]){document.styleSheets[c][a][f].style[b]=g;
d=true;break}}}if(!d){try{document.styleSheets[c].insertRule(h+" { "+b+": "+g+"; }",document.styleSheets[c][a].length)
}catch(e){try{document.styleSheets[c].addRule(h,b+": "+g+";")}catch(e){}}}}};
