if(typeof (IXIGO)=="undefined"){IXIGO={}}IXIGO.RailInfo=function(){var A=null;var B=null;this.currentTab=null;
this.init=function(C){A=this;B=C;if(!B){return }A.currentTab=$("div.tab-wrapper > div.tab > div.selected").parent().attr("tabId");
$("div.tab-wrapper > div.tab").click(function(D){A.onTabClick(this)});$("#bookNow").click(function(){A.selectTab("searchBox")
}).mouseover(function(D){IXIGO.buttonHover("#bookNow","","")}).mouseout(function(D){IXIGO.buttonHover("#bookNow","","")
})};this.onTabClick=function(D){var C=$(D);if(C.attr("tabId")){this.selectTab(C.attr("tabId"))}};this.selectTab=function(C){if(this.currentTab==C){return 
}$("div.tab-wrapper > div.tab[@tabId='"+this.currentTab+"'] > div.title").removeClass("selected");$("div.tab-wrapper > div.tab[@tabId='"+C+"'] > div.title").addClass("selected");
$.showHide($("#"+B+"InfoBox #"+C),$("#"+B+"InfoBox #"+this.currentTab));this.currentTab=C}};IXIGO.TrainInfo=function(){var A=null;
this.locations=[];this.mapRendered=false;this.init=function(){A=this};this.addLocation=function(B,C){if(this.isValidLocation(C)){this.locations[B-1]=this.locations[B-1]||[];
this.locations[B-1][this.locations[B-1].length]=C}};this.isValidLocation=function(B){return B.lat&&B.lat!=0&&B.lng&&B.lng!=0
};this.moderateMapTab=function(){var C=$("div.tab-wrapper > div.tab[@tabId='map']");if(this.locations[0]&&this.locations[0].length>0){C.click(function(){if(!A.mapRendered){A.initializeMap()
}})}else{C.hide();var B=$("div.tab-wrapper > div.tab.lateral");B.width(B.width()+100)}};this.initializeMap=function(){if(location.hostname.indexOf("ixigo")!==-1){var B=document.createElement("script");
B.type="text/javascript";B.src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAaFkhHqRKxmIC55Cw5dS1cRSVVb5P-P-81vc8SJK_4LEGVkGjEhSfxXw_tms7NnWvDcBG8yfIUb1Mxw&async=2&callback=window.traininfo.drawRoute";
$("body")[0].appendChild(B)}};this.drawRoute=function(){if(GBrowserIsCompatible()&&this.locations.length>0){$("#trainInfoBox #map").show();
var F=new GMap2($("#map_canvas").get(0));F.setCenter(new GLatLng(0,0),0);var E=new GLatLngBounds();F.addControl(new GLargeMapControl());
var C=[];$.each(this.locations[0],function(G,H){C[C.length]=new GLatLng(H.lat,H.lng)});var D=new GPolyline(C,"#ff6600",7);
F.addOverlay(D);var B=this.locations[0].length;$.each(this.locations[0],function(H,J){var G=new GIcon(G_DEFAULT_ICON);
if(J.arr=="starts"){G.image="/img/icons/icon_start.png"}else{if(J.dep=="ends"){G.image="/img/icons/icon_end.png"
}else{G=new GIcon();G.image="/img/hotel/marker_small_railway.gif";G.iconSize=new GSize(15,18);G.iconAnchor=new GPoint(5,16);
G.infoWindowAnchor=new GPoint(0,0)}}E.extend(new GLatLng(J.lat,J.lng));var I=new GMarker(new GLatLng(J.lat,J.lng),{icon:G});
F.addOverlay(I);GEvent.addListener(I,"click",function(){I.openInfoWindowHtml(A.getTextNode(J),{maxWidth:"160"})
})});F.setZoom(F.getBoundsZoomLevel(E));F.setCenter(E.getCenter());this.mapRendered=true}};this.getTextNode=function(B){return""+"<div style='font-family: arial,verdana,helvetica,sans-serif; font-size: 12px; color: #333;'>"+"<h4 style='margin: 5px 0;'>"+B.name+" ("+B.code+")</h4>"+(B.city?"<div><strong>City: </strong>"+B.city+"</div>":"")+(B.state?"<div><strong>State: </strong>"+B.state+"</div>":"")+"<div style='margin: 5px 0;'>"+"<div><strong>Arrives: </strong>"+B.arr+"</div>"+"<div><strong>Departs: </strong>"+B.dep+"</div>"+"</div>"+"</div>"
}};