
var firstTab;$(document).ready(function(){$('#Form1').submit(function(){return verEmailForm();});$('a.url').mouseover(function(){window.status=this.innerHTML;});$('#emailLnk').click(function(){return tabs.showTab("contact");});$('#mapLnk').click(function(){return tabs.showTab("map");});});var tabs={init:function()
{if(typeof firstTab=='undefined')return false;$('#tab1Content,#tab2Content,#tab3Content,#tab4Content,#tab5Content').hide();$(firstTab).show();var firstLink=firstTab.substr(0,5);$(firstLink).addClass("selected");var tabLinks=$("#tabMenu a");tabLinks.each(function(i){$(this).click(function(){var tabNo=$(this).parent().get(0).id.substr(3,1);$("#tab1Content,#tab2Content,#tab3Content,#tab4Content,#tab5Content").hide();$('#tab1,#tab2,#tab3,#tab4,#tab5').removeClass("selected");$("#tab"+tabNo+"Content").show();$(this).parent().addClass("selected");return false;});});},showTab:function(tabName)
{if(document.getElementById(tabName)==null)return;$('#tab1Content,#tab2Content,#tab3Content,#tab4Content,#tab5Content').hide();$('#tab1,#tab2,#tab3,#tab4,#tab5').removeClass("selected");var tab=$("#"+tabName).parent().attr("id").substr(0,4);document.getElementById(tab).className='selected';$("#"+tab+"Content").show();return false;}};function verEmailForm(){var fName=document.getElementById('firstNameTxtBox');var sName=document.getElementById('surnameNameTxtBox');var em=document.getElementById('emailTxtBox');var mess=document.getElementById('commentsTxtBox');var sec=document.getElementById('CodeNumberTxtBox');if(fName.value==""){if(document.getElementById("err1")==null){createErrSpan(fName,"first name is required","err1");}return false;}else{if($('#err1')){$('#err1').remove();}};if(sName.value==""){if(document.getElementById("err2")==null){createErrSpan(sName,"surname is required","err2");}return false;}else{if($('#err2')){$('#err2').remove();}};if(em.value==""){if(document.getElementById("err3")==null){createErrSpan(em,"email address is required","err3");}return false;}else{if($('#err3')){$('#err3').remove();}};if(verEmail(em.value)){if(document.getElementById("err5")==null){createErrSpan(em,"your email address in invalid. It should be of the form name@website.com","err5");}return false;}
else{if($('#err5')){$('#err5').remove();}};if(mess.value==""){if(document.getElementById("err4")==null){createErrSpan(mess,"please enter your message","err4");}return false;}else{if($('#err4')){$('#err4').remove();}};if(sec.value==""){if(document.getElementById("err6")==null){createErrSpan(sec,"please enter the security code","err6");}return false;}else{if($('#err6')){$('#err6').remove();}};};function prePrint(){$("#tab1Content").show();$("#tab2Content").show();$("#tab3Content").show();if($("fieldset.forms").parent().get(0)!=undefined)var contactForm=$("fieldset.forms").parent().get(0).id;$("#"+contactForm).hide();if($("#tab2Content")!=undefined)$("#tab1Content").css("page-break-after","always");if(window.print)window.print();};function writeRoutingHTML(){document.write("<div id='routing'><fieldset id='destination'>");document.write("<legend>Find directions to <strong>"+destination+"</strong>:</legend>");document.write("<div id='addr1'><label for='qs1'>starting at:</label><input type='text' name='qs1' id='qs1' /></div>");document.write("<div id='matches1' class='hidden'><label for='select1' >Multiple results found. Please select one:</label><select id='select1'></select></div>");document.write("</fieldset>");document.write("<fieldset id='options1'>");document.write("<label for='quickest'>Quickest </label><input id='quickest' name='mode' checked='checked' type='radio'/><br/>");document.write("<label for='shortest'>Shortest </label><input id='shortest' name='mode' type='radio'/>");document.write("</fieldset>");document.write("<fieldset id='options2'>");document.write("<label for='driving'>Driving </label><input id='driving' name='optimizeFor' checked='checked' type='radio'/><br/>");document.write("<label for='walking'>Walking </label><input id='walking' name='optimizeFor' type='radio'/>");document.write("</fieldset>");document.write("<label for='exclude_highways' id='lbl_exclude_highways'><input id='exclude_highways' name='exclude_highways' type='checkbox'/> Exclude motorways</label><br/>");document.write("<input id='submitbtn' value='Get Directions' onclick='callRoute()' type='button'/> <input id='submitbtn1' value='New search' onclick='resetData()' type='button'/>");document.write("<p id='loading'><img src='http://images.thomsonlocal.com/tlc/loading.gif' alt='calculating route' align='middle'/> calculating your route</p>");document.write("</div><div id='routeSteps' style='border:1px solid #C2D6EB;'></div>");}
function writeMapHTML(){document.write("<div id='mapWrapper'>");document.write("<ul id='maptab'>");document.write("<li><a href='' id='mapView'>map view</a></li>");document.write("<li><a href='' id='airView'>aerial view</a></li>");document.write("</ul>");document.write("<div id='MMmap'>");document.write("<img src='http://images.thomsonlocal.com/tlc/loading.gif' alt='loading map' id='mapLoading'/>");document.write("</div></div>");};
