function createBusinessClass(F,D,A,G,E,B){var C=function(I){this.code=parseInt(I.getElementsByTagName("code")[0].firstChild.nodeValue);this.name=I.getElementsByTagName("name")[0].firstChild.nodeValue;this.address=I.getElementsByTagName("address")[0].firstChild.nodeValue;this.phone=getOptionalProperty(I,"phone");this.comments=getOptionalProperty(I,"comments");this.site=getOptionalProperty(I,"site");this.schedule=new Schedule(I);if(E!=null){this.reviews=new Array();for(i in E){this.reviews.push(getThreads(I,E[i].name))}}else{this.reviews=null}var K=I.getElementsByTagName("position")[0];var H=parseFloat(K.getAttribute("lng"));var J=parseFloat(K.getAttribute("lat"));this.position=new GLatLng(J,H);this.shown=false;this.info_shown=false;this.marker=null};C.prototype.map=F;C.prototype.streetViewer=D;C.prototype.dbTable=A;C.prototype.directions=new GDirections(F);C.prototype.businessType=G;C.prototype.boards=E;C.prototype.lng=B;C.prototype.isReviewed=businessIsReviewed;C.prototype.toHtml=businessToHtml;C.prototype.contactToHtml=contactToHtml;C.prototype.scheduleToHtml=scheduleToHtml;C.prototype.ratingToHtml=ratingToHtml;C.prototype.smsToHtml=smsToHtml;C.prototype.createMarker=createBusinessMarker;C.prototype.show=showBusiness;C.prototype.hide=hideBusiness;C.prototype.toggle=toggleBusiness;C.prototype.goTo=goToBusiness;C.prototype.zoom=zoomBusiness;C.prototype.showWithMetro=goToBusinessAndMetro;C.prototype.hasKeyword=businessHasKeyword;C.prototype.hasAnyKeyword=businessHasAnyKeyword;return C}function businessHasKeyword(B){var C=this.name.split(/\W+/);var B=B.toLowerCase();for(var A in C){if(C[A].toLowerCase()==B){return true}}return false}function businessHasAnyKeyword(A){for(var B in A){if(this.hasKeyword(A[B])){return true}}return false}function businessIsReviewed(){if(this.reviews!=null){for(i in this.reviews){if(this.reviews[i].length!=0){return true}}return false}return false}function businessToHtml(){var A=new Array();var B=4;if(this.schedule.entriesCount()){B++}A.push(this.contactToHtml(B));if(this.schedule.entriesCount()!=0){A.push(this.scheduleToHtml())}A.push(this.smsToHtml());A.push(this.ratingToHtml());A.push(drivingDirectionsForm(this.lng,this.name,this.address));return A}function contactToHtml(D){var G="";var A={"eng":"Address:","fr":"Adresse :"};var C={"eng":"Phone Number:","fr":"Téléphone :"};var B={"eng":"Web site:","fr":"Site internet :"};var H={"eng":"Comments:","fr":"Commentaires :"};var E={"eng":"Contact","fr":"Info"};var F=D*88;G='<div style="white-space:nowrap;width:'+F+'px;"><div class="club_name">'+this.name+"</div>";G+="<strong>"+A[this.lng]+" </strong>"+this.address+"<br/>";if(this.phone){G+="<strong>"+C[this.lng]+" </strong>"+this.phone+"<br/>"}if(this.site){G+="<strong>"+B[this.lng]+' </strong><a target="_blank" href="'+this.site+'">'+this.name+"</a><br/>"}if(this.comments){G+="<strong>"+H[this.lng]+" </strong>"+this.comments+"<br/>"}G+="</div>";return new GInfoWindowTab(E[this.lng],G)}function scheduleToHtml(){var A={"eng":"Hours","fr":"Horaires"};var B='<div style="white-space:nowrap;">';B+=this.schedule.toHtml(this.lng);B+="</div>";return new GInfoWindowTab(A[this.lng],B)}function ratingToHtml(){var D={"eng":"Selected Reviews:","fr":"Revues :"};var A={"eng":"Latest Posts on ","fr":"Derniers messages sur "};var E={"eng":"Reviews","fr":"Revues"};var G='<div style="white-space:nowrap;">';if(this.boards!=null){for(var C=0;C<this.boards.length;C++){if(this.boards[C].hasSearch()){G+='<a href="'+this.boards[C].url+this.boards[C].sh_script+this.name+'" target="_blank">'+A[this.lng]+this.boards[C].name+"</a><br />"}}}if(this.isReviewed()){G+="<strong>"+D[this.lng]+" </strong>";for(var C=0;C<this.boards.length;C++){if(this.reviews[C].length!=0){G+='<strong><font color="blue">'+this.boards[C].name+" </font></strong>(";for(var B=0;B<this.reviews[C].length;B++){var F=B+1;G+=' <a target="_blank" href="'+this.boards[C].url+this.boards[C].th_script+this.reviews[C][B]+'">r'+F+"</a> "}G+=") "}}G+="<br />"}getRating(this.dbTable,this.code,this.businessType,this.lng);G+='<span id="rating"><br/></span>';G+="</div>";return new GInfoWindowTab(E[this.lng],G)}function smsToHtml(){var A={"eng":"Send","fr":"Envoyez les infos sur"};var B={"eng":"details on your cell phone","fr":"sur votre cellulaire"};var C={"eng":"Phone:","fr":"Tél :"};var E='<div style="white-space:nowrap;">';E+='<div id="sms_form">';E+="<p>"+A[this.lng]+" <strong>"+this.name+" </strong>"+B[this.lng]+".</br></p>";var D="this.phone.value,'"+this.name+"' , '"+this.address+"', '"+this.phone+"', '"+this.lng+"'";E+='<form onsubmit="this.sms('+D+'); return false;" action="#"><strong>';E+=C[this.lng];E+='</strong> <input type="text" name="phone" size="10" maxlength="10" alt="Phone number" value="0000000021"  onclick="this.value = \'\';"><br/><input type="hidden" name="loc_name" value="';E+=this.name;E+='" /><input type="hidden" name="loc_address" value="';E+=this.address;E+='" />';if(this.phone!=null){E+='<input type="hidden" name="loc_phone" value="';E+=this.phone;E+='" />'}E+='<center><input type="submit" name="sms" value="SMS"></center></form>';E+="</div>";E+="</div>";return new GInfoWindowTab("SMS",E)}function createBusinessMarker(){this.marker=new GMarker(this.position,{title:this.name});var A=this;GEvent.addListener(this.marker,"click",function(){if(A.info_shown){A.hide()}else{A.marker.openInfoWindowTabsHtml(A.toHtml());A.info_shown=true}});GEvent.addListener(this.marker,"infowindowclose",function(){A.info_shown=false})}function showBusiness(){if(!this.shown){this.map.addOverlay(this.marker);this.shown=true}}function zoomBusiness(){this.marker.showMapBlowup({zoomLevel:15});this.closeup_shown=true;this.info_shown=false}function hideBusiness(){if(this.shown){this.map.removeOverlay(this.marker);this.shown=false}if(this.info_shown){this.map.closeInfoWindow();this.info_shown=false}}function goToBusiness(){this.map.panTo(this.position);if(this.streetViewer){this.streetViewer.setLocation(this.position);this.streetViewer.rotate()}this.show();this.marker.openInfoWindowTabsHtml(this.toHtml())}function goToBusinessAndMetro(A){this.map.panTo(this.position);this.show();this.marker.openInfoWindowTabsHtml(this.toHtml());var B=closestStation(A,this.position);A[B].show(this.map)}function toggleBusiness(){if(this.shown){this.show()}else{this.hide()}}function getOptionalProperty(B,A){var C=B.getElementsByTagName(A);if(C.length!=0){return C[0].firstChild.nodeValue}return null}function getThreads(C,D){var E=new Array();var A=C.getElementsByTagName(D);if(A.length==0){return E}for(var B=0;B<A.length;B++){E.push(parseInt(A[B].firstChild.nodeValue))}return E}function drivingDirectionsForm(I,J,D){var A={"eng":"Directions","fr":"Itinéraire"};var E={"eng":"Get Driving Directions to: ","fr":"Itinéraire vers : "};var F={"eng":"Start Address: ","fr":"Lieu de départ : "};var C={"eng":"Get Directions","fr":"Soumettre"};var G={"eng":"en","fr":"fr"};var B="'"+I+"',this.saddr.value,'"+D+"'";var H='<div style="white-space:nowrap;">';H+='<br/><div align="center"><strong>'+E[I]+J+"</strong></div><br/>";H+='<form onsubmit="getDirections('+B+'); return false;" action="#" >';H+='<label for="saddr">'+F[I]+"</label>";H+='<input type="text" size="10" maxlength="60" name="saddr" value="" />';H+='<br /><div align="center"><button type="SUBMIT" value="Get Directions">'+C[I]+"</button></div>";H+="</form><br/></div>";return new GInfoWindowTab(A[I],H)}function getDirections(D,F,A){var E=F+" to "+A;var C="Driving directions";var B="en_US";if(D=="fr"){B="fr";C="Votre itinéraire"}directions.clear();directions.load(E);directionsPanel.setHeader(C);directionsPanel.render();directionsPanel.show()}function sms1(G,B,A,F,E,D){smsRequest=getXmlHttpObject();if(smsRequest==null){alert("Browser does not support HTTP Request");return }var C=phpDir+"sms.php";C=C+"?carrier="+G;C+="&phone="+B;C+="&loc_name="+A;C+="&loc_address="+F;if(this.phone!="null"){C+="&loc_phone="+E}smsRequest.onreadystatechange=function(){if(smsRequest.readyState==4||smsRequest.readyState=="complete"){if(D=="fr"){document.getElementById("sms_form").innerHTML="<center><strong>SMS envoyé.</strong></center>"}else{document.getElementById("sms_form").innerHTML="<center><strong>SMS sent.</strong></center>"}}};smsRequest.open("GET",C,true);smsRequest.send(null)}