
var i=0;var gmarkers=[];var sIcon=new GIcon();sIcon.image="/img/LAURASTARMarker.png";sIcon.shadow="/img/ShadowMarker.png";sIcon.iconSize=new GSize(34,34);sIcon.shadowSize=new GSize(68,49);sIcon.iconAnchor=new GPoint(9,32);sIcon.infoWindowAnchor=new GPoint(9,2);sIcon.infoShadowAnchor=new GPoint(9,2);sIcon.transparent="http://www.google.com/intl/en_ALL/mapfiles/markerTransparent.png";sIcon.printImage="/img/LAURASTARMarker.png";sIcon.mozPrintImage="/img/LAURASTARMarker.png";function createMarker(point,name,html,state){var marker=new GMarker(point,sIcon);marker.state=state;GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(html);});return marker;}
var map=new GMap2(document.getElementById("map"));map.addControl(new GLargeMapControl());map.setCenter(new GLatLng(40,-95.667068000000006),3);function showState(val){hideState('ALL');new Request({url:"php/dealers.xml",method:'get',onSuccess:function(tr){var xmlDoc=GXml.parse(tr);var markers=xmlDoc.documentElement.getElementsByTagName("marker");for(var i=0;i<markers.length;i++){var lat=parseFloat(markers[i].getAttribute("lat"));var lng=parseFloat(markers[i].getAttribute("lng"));var state=markers[i].getAttribute("state");var point=new GLatLng(lat,lng);var label=markers[i].getAttribute("address");var html='<h4>'+markers[i].getAttribute("name")+'<\/h4>'+'<br /><span class="mapAddress">'+markers[i].getAttribute("address")+'<br />'+markers[i].getAttribute("address2")+'<br /><br />'+'Phone: '+markers[i].getAttribute("phone");if(markers[i].getAttribute("fax")!='')html=html+'<br />Fax: '+markers[i].getAttribute("fax");html=html+'<\/span>';if(state==val){var marker=createMarker(point,label,html,state);gmarkers.push(marker);map.addOverlay(marker);}}}}).send();};function hideState(stateName){map.getInfoWindow().hide();if(stateName=='ALL'){for(var i=0;i<gmarkers.length;i++)
map.removeOverlay(gmarkers[i]);}else{for(var i=0;i<gmarkers.length;i++)
if(gmarkers[i].state==stateName)
map.removeOverlay(gmarkers[i]);}};function zoomState(val){var sw;var ne;var zoom=0;switch(val){case'AL':sw=new GLatLng(29.11377539511439,-92.7685546875);ne=new GLatLng(35.96022296929667,-80.4638671875);break;case'AK':sw=new GLatLng(58.17070248348609,-175.166015625);ne=new GLatLng(71.63599288330606,-125.94726562500001);break;case'AZ':sw=new GLatLng(30.977609093348686,-117.421875);ne=new GLatLng(37.68382032669382,-105.1171875);break;case'AR':sw=new GLatLng(31.409912194070973,-97.998046875);ne=new GLatLng(38.08268954483802,-85.693359375);break;case'CA':sw=new GLatLng(30.14512718337613,-127.13378906250001);ne=new GLatLng(43.13306116240612,-102.5244140625);break;case'CO':sw=new GLatLng(35.55010533588551,-111.6650390625);ne=new GLatLng(41.88592102814744,-99.3603515625);break;case'CT':zoom=8;sw=new GLatLng(40.75557964275588,-74.24560546875);ne=new GLatLng(42.27730877423709,-71.16943359375);break;case'DE':sw=new GLatLng(37.361425501905146,-78.321533203125);ne=new GLatLng(40.52215098562377,-72.169189453125);break;case'DC':sw=new GLatLng(37.142803443716836,-80.101318359375);ne=new GLatLng(40.3130432088809,-73.948974609375);break;case'FL':sw=new GLatLng(24.86650252692691,-89.4287109375);ne=new GLatLng(32.008075959291055,-77.1240234375);break;case'GA':sw=new GLatLng(29.286398892934763,-89.296875);ne=new GLatLng(36.12012758978146,-76.9921875);break;case'HI':sw=new GLatLng(18.656654486539995,-160.499267578125);ne=new GLatLng(22.46180203533398,-154.346923828125);break;case'ID':sw=new GLatLng(39.061849134291535,-127.17773437499999);ne=new GLatLng(50.54136296522161,-102.568359375);break;case'IL':sw=new GLatLng(36.79169061907076,-95.009765625);ne=new GLatLng(43.02071359427862,-82.705078125);break;case'IN':sw=new GLatLng(36.84446074079564,-92.26318359375);ne=new GLatLng(43.068887774169625,-79.95849609375);break;case'IA':sw=new GLatLng(38.99357205820944,-99.99755859375);ne=new GLatLng(45.02695045318543,-87.69287109375);break;case'KS':sw=new GLatLng(35.28150065789119,-104.39208984375);ne=new GLatLng(41.64007838467891,-92.08740234375);break;case'KY':sw=new GLatLng(34.488447837809304,-91.4501953125);ne=new GLatLng(40.91351257612757,-79.1455078125);break;case'LA':sw=new GLatLng(27.955591004642528,-98.67919921875);ne=new GLatLng(34.88593094075315,-86.37451171875);break;case'ME':sw=new GLatLng(42.212245162885814,-75.12451171875);ne=new GLatLng(47.945786463687185,-62.81982421875);break;case'MD':sw=new GLatLng(37.509725842937485,-80.057373046875);ne=new GLatLng(40.66397287638688,-73.905029296875);break;case'MA':sw=new GLatLng(40.6723059714534,-75.047607421875);ne=new GLatLng(43.683763524273346,-68.895263671875);break;case'MI':sw=new GLatLng(40.38002840251183,-90.17578125);ne=new GLatLng(46.28622391806705,-77.87109375);break;case'MN':sw=new GLatLng(40.58058466412761,-105.5126953125);ne=new GLatLng(51.781435604431195,-80.9033203125);break;case'MS':sw=new GLatLng(29.24806324379655,-95.361328125);ne=new GLatLng(36.08462129606931,-83.056640625);break;case'MO':sw=new GLatLng(35.40696093270201,-98.7451171875);ne=new GLatLng(41.75492216766298,-86.4404296875);break;case'MT':sw=new GLatLng(40.58058466412761,-122.12402343749999);ne=new GLatLng(51.781435604431195,-97.5146484375);break;case'NE':sw=new GLatLng(38.70265930723801,-106.23779296875);ne=new GLatLng(44.762336674810996,-93.93310546875);break;case'NV':sw=new GLatLng(35.79999392988527,-122.80517578125);ne=new GLatLng(42.114523952464246,-110.50048828125);break;case'NH':sw=new GLatLng(42.512601715736665,-74.77294921875);ne=new GLatLng(45.43700828867389,-68.62060546875);break;case'NJ':sw=new GLatLng(37.86618078529668,-77.926025390625);ne=new GLatLng(41.004775422229464,-71.773681640625);break;case'NM':sw=new GLatLng(30.902224705171417,-111.708984375);ne=new GLatLng(37.614231415424165,-99.404296875);break;case'NY':zoom=6;sw=new GLatLng(40.212440718286466,-80.88134765625);ne=new GLatLng(46.13417004624326,-68.57666015625);break;case'NC':sw=new GLatLng(31.9148675032762,-87.1435546875);ne=new GLatLng(38.54816542304656,-74.8388671875);break;case'ND':sw=new GLatLng(44.49650533109345,-106.80908203125);ne=new GLatLng(50.00773901463685,-94.50439453125);break;case'OH':sw=new GLatLng(37.35269280367273,-87.978515625);ne=new GLatLng(43.5326204268101,-75.673828125);break;case'OK':sw=new GLatLng(31.877557643340015,-104.12841796875);ne=new GLatLng(38.51378825951165,-91.82373046875);break;case'OR':sw=new GLatLng(41.21172151054787,-126.123046875);ne=new GLatLng(47.040182144806664,-113.818359375);break;case'PA':sw=new GLatLng(37.63163475580643,-83.43017578125);ne=new GLatLng(43.78695837311561,-71.12548828125);break;case'RI':sw=new GLatLng(41.3500103516271,-72.2186279296875);ne=new GLatLng(42.108411365705855,-70.6805419921875);break;case'SC':sw=new GLatLng(32.01739159980399,-83.814697265625);ne=new GLatLng(35.398005947151056,-77.662353515625);break;case'SD':sw=new GLatLng(41.73852846935917,-106.36962890625);ne=new GLatLng(47.517200697839414,-94.06494140625);break;case'TN':sw=new GLatLng(32.287132632616355,-92.900390625);ne=new GLatLng(38.89103282648846,-80.595703125);break;case'TX':sw=new GLatLng(24.5271348225978,-112.060546875);ne=new GLatLng(38.341656192795924,-87.451171875);break;case'UT':sw=new GLatLng(36.29741818650808,-117.44384765625);ne=new GLatLng(42.56926437219384,-105.13916015625);break;case'VT':sw=new GLatLng(42.36666166373274,-75.706787109375);ne=new GLatLng(45.29807513870794,-69.554443359375);break;case'VA':sw=new GLatLng(34.397844946449844,-85.4736328125);ne=new GLatLng(40.83043687764923,-73.1689453125);break;case'WA':sw=new GLatLng(44.99588261816546,-126.58447265624999);ne=new GLatLng(50.45750402042055,-114.27978515625);break;case'WV':sw=new GLatLng(35.79999392988527,-86.41845703125);ne=new GLatLng(42.114523952464246,-74.11376953125);break;case'WI':sw=new GLatLng(41.62365539068639,-95.80078125);ne=new GLatLng(47.41322033016902,-83.49609375);break;case'WY':sw=new GLatLng(39.99395569397331,-113.8623046875);ne=new GLatLng(45.93587062119052,-101.5576171875);break;case'BC':sw=new GLatLng(53.7267,-127.6476);ne=new GLatLng(53.7267,-127.6476);zoom=4;break;case'AB':sw=new GLatLng(53.9333,-116.5765);ne=new GLatLng(53.9333,-116.5765);zoom=4;break;case'SK':sw=new GLatLng(52.9399,-106.4509);ne=new GLatLng(52.9399,-106.4509);zoom=4;break;case'MB':sw=new GLatLng(53.7609,-98.8139);ne=new GLatLng(53.7609,-98.8139);zoom=4;break;case'ON':sw=new GLatLng(51.2538,-85.3232);ne=new GLatLng(51.2538,-85.3232);zoom=4;break;case'QC':sw=new GLatLng(46.8128,-71.2152);ne=new GLatLng(46.8128,-71.2152);zoom=4;break;case'NB':sw=new GLatLng(46.5653,-66.4619);ne=new GLatLng(46.5653,-66.4619);zoom=6;break;case'NL':sw=new GLatLng(48.4027,-54.6724);ne=new GLatLng(48.4027,-54.6724);zoom=4;break;case'YT':sw=new GLatLng(64.2823,-135.0000);ne=new GLatLng(64.2823,-135.0000);zoom=4;break;case'NS':sw=new GLatLng(44.6923,-62.6572);ne=new GLatLng(44.6923,-62.6572);zoom=6;break;case'NT':sw=new GLatLng(59.4795,-121.0485);ne=new GLatLng(59.4795,-121.0485);zoom=4;break;case'NU':sw=new GLatLng(52.9636,-78.9438);ne=new GLatLng(52.9636,-78.9438);zoom=4;break;case'PE':sw=new GLatLng(46.2191,-62.9158);ne=new GLatLng(46.2191,-62.9158);zoom=4;break;default:sw=new GLatLng(10.141931686131018,-145.1953125);ne=new GLatLng(59.88893689676585,-46.7578125);break;}
bound=new GLatLngBounds(sw,ne);if(zoom==0)map.setZoom(map.getBoundsZoomLevel(bound)+1);if(zoom>0)map.setZoom(zoom);map.panTo(bound.getCenter());showState(val);}