function DuaneReadeClass(_1,_2,_3,_4,_5,_6,_7){
var _8=this;
this.ajax=null;
this.map=null;
this.map_bounds=null;
this.map_markers=null;
this.dir_map_bounds=null;
this.dir_map_polylines=null;
this.dir_map_markers=null;
this.current_map="";
this.city1="";
this.county1="";
this.address1="";
this.x1="";
this.y1="";
this.clear_end_point=function(){
this.city2="";
this.county2="";
this.address2="";
this.x2="";
this.y2="";
this.location_id2=0;
};
this.clear_end_point();
this.filter_params="";
this.locations=new Array();
this.pages_cached=new Array();
this.cache_c_time=0;
this.cache_update_period=900;
this.do_correct_time=1;
this.highlighting_enabled=1;
this.show_panel=function(id){
this.hide_other_panels(id);
var _a=document.getElementById(id);
if(!_a){
return;
}
if(_a.style.display!="block"){
_a.style.display="block";
}
if(_a=document.getElementById(id+"_icon")){
_a.src=_a.src.replace(/_off\.gif$/i,"_on.gif");
}
if(_a=document.getElementById(id+"_icon2")){
_a.src=_a.src.replace(/_off\.gif$/i,"_on.gif");
}
if(id=="search"&&(_a=document.getElementById("go1"))){
_a.style.display="none";
}
};
this.hide_panel=function(id){
var _c=document.getElementById(id);
if(!_c){
return;
}
if(_c.style.display!="none"){
_c.style.display="none";
}
if(_c=document.getElementById(id+"_icon")){
_c.src=_c.src.replace(/_on\.gif$/i,"_off.gif");
}
if(_c=document.getElementById(id+"_icon2")){
_c.src=_c.src.replace(/_on\.gif$/i,"_off.gif");
}
if(id=="search"&&(_c=document.getElementById("go1"))){
_c.style.display="block";
}
};
this.switch_panel=function(_d){
var _e=document.getElementById(_d);
if(!_e){
return;
}
if(_e.style.display=="none"){
this.show_panel(_d);
switch(_d){
case "locations":
this.map_locations();
break;
case "directions":
this.map_directions();
break;
}
}else{
this.hide_panel(_d);
}
};
this.hide_other_panels=function(_f){
switch(_f){
case "search":
this.hide_panel("directions");
this.hide_panel("locations");
break;
case "locations":
this.hide_panel("directions");
this.hide_panel("search");
break;
case "directions":
this.hide_panel("search");
this.hide_panel("locations");
break;
}
};
this.showMessage=function(_10){
var box=document.getElementById("message_box");
if(box!=null){
box.innerHTML="<div style=\"background-color:#E8D04E; border: 2px solid #909090; padding: 30px 30px 30px 30px; align:center; font: bold 19px Arial, Verdana, Helvetica, sans-serif;\">"+_10+"</div>";
var w=box.offsetWidth;
var h=box.offsetHeight;
var x=(window.screen.width-w)/2;
var y=(window.screen.height-h)/4;
if(x<0||x>window.screen.width/2){
x=0;
}
if(y<0||y>window.screen.height/4){
y=0;
}
box.style.left=Math.round(x)+"px";
box.style.top=Math.round(y)+"px";
box.style.visibility="visible";
}
};
this.show_error=function(_16,_17){
var _18=document.getElementById("error_box").innerHTML;
_18=_18.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
_18=_18.replace(/%text/,_17);
var _19=_16=="directions"?"directions_results":_16;
if(_16=="directions"){
_8.show_panel("directions_link");
}
document.getElementById(_19).innerHTML=_18;
this.show_panel(_16);
};
this.hideMessage=function(){
var box=document.getElementById("message_box");
if(box!=null){
box.innerHTML="";
box.style.visibility="hidden";
}
};
this.get_locations=function(_1b,_1c,_1d,_1e,pg){
if(_1b!=""||_1c!=""||_1d!=""||_1e!=""){
this.city1="";
this.county1="";
this.address1="";
this.x1="";
this.y1="";
this.locations.length=0;
this.pages_cached.length=0;
if(_1e==""){
this.filter_params=this.get_filter_params();
}
}
var _20=new Date();
var _21=Math.floor(_20.getTime()/1000);
if(Math.floor(this.cache_c_time/this.cache_update_period)!=Math.floor(_21/this.cache_update_period)){
this.locations.length=0;
this.pages_cached.length=0;
this.cache_c_time=_21;
}
if(this.pages_cached[pg]){
return this.update_locations_page(pg);
}
if(this.ajax==null){
this.ajax=new ajaxClass(this.showMessage,this.hideMessage);
}
var url=_1+"?action=get_locations&address1="+escape(_1b)+"&county1="+escape(_1c)+"&city1="+escape(_1d)+"&thum_id1="+escape(_1e)+"&x1="+escape(this.x1)+"&y1="+escape(this.y1)+"&pg="+escape(pg)+this.filter_params;
this.ajax.request("GET",url,"","",true,function(_23){
var _24=_23.split("\t");
if(_24.length<3||_24[2]!="end"){
return alert("http error");
}
_24[1]=unescape(_24[1]);
if(_24[0]!=1){
return _8.show_error("locations",_24[1]!=""?_24[1]:"unknown error");
}
_24=_24[1].split("\n");
if(_8.x1==""){
_8.city1=_24.pop();
_8.county1=_24.pop();
_8.address1=_24.pop();
_8.x1=_24.pop();
_8.y1=_24.pop();
}
_8.update_locations(_24,pg);
_8.update_locations_page(pg);
});
};
this.get_filter_params=function(){
var f,obj;
if((obj=document.getElementById("search"))&&obj.style.display.toLowerCase()=="none"){
return "&f_all=1";
}
var _27="";
if(!(f=document.forms.form_1)){
return "";
}
if(f.f_all&&f.f_all.checked){
return "&f_all=1";
}
for(var i=0;i<64;i++){
if(!(obj=f["f"+i])){
continue;
}
if(obj.checked){
_27+="&f"+i+"=1";
}
}
return _27;
};
this.get_dir_params=function(){
var f;
if(!(f=document.forms.form_2)){
return "";
}
if(this.do_correct_time){
return "&mode="+f.mode.value;
}
return "&day="+f.day.value+"&time="+f.time.value+"&mode="+f.mode.value;
};
this.update_locations_page=function(pg){
this.prepare_map(pg);
document.getElementById("locations").innerHTML=this.build_locations_html(pg);
this.hide_panel("directions_link");
this.clear_end_point();
this.clear_dir_map();
this.show_panel("locations_link");
this.show_panel("locations");
this.map_locations();
};
this.update_locations=function(_2b,pg){
var i,n,f;
for(i=0;i<_2b.length;i++){
f=_2b[i].split("\t");
n=f[0];
if(n==""||n==undefined||n<1||n>_4){
break;
}
this.locations[n]=[f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],null,"",null,String.fromCharCode("A".charCodeAt(0)+(n-1)%26),f[9],f[10]];
}
this.pages_cached[pg]=true;
};
this.build_locations_html=function(pg){
var i,_32,_33;
var _34=document.getElementById("location_row").innerHTML;
_34=_34.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
var _35="";
var _36=pg*_3+1;
var end=(pg+1)*_3;
for(i=_36;i<=end;i++){
_32=this.locations[i];
if(!_32){
break;
}
if(i!=_36){
_35+="<div style=\"border-top:1px dashed #afafaf; margin:0; padding:0;\"></div>";
}
_33={n:i,c:_32[11],addr:_32[3],county:_32[4],dist:_32[5],img_url:_2,phone:_32[12],link:_32[13]!=""?"<a href=\""+_32[13]+"\" class=\"hs_a\">visit website</a>":""};
_35+=_34.replace(/\%([_A-Z0-9\-]+)/gi,function(str,p1){
p1=_33[p1];
return p1==undefined?"":p1;
});
}
_35="<div><div class=\"panel3\">"+_35+"</div>";
if(pg>0){
_35+="<a href=\"#\" onClick=\"dr_obj.get_locations('', '', '', '', "+(pg-1)+"); return false;\" class=\"hs_a\">Prev</a>";
}
var _3a=i==_36||i<end||end>=_4?true:false;
if(pg<_5&&!_3a){
_35+=" <a href=\"#\" onClick=\"dr_obj.get_locations('', '', '', '', "+(pg+1)+"); return false;\" class=\"hs_a\">Next</a>";
}
_35+="</div>";
return _35;
};
this.map_init=function(){
if(this.map){
return;
}
this.base_icon=new GIcon(G_DEFAULT_ICON);
this.base_icon.shadow=_2+"/i1.png";
this.base_icon.iconSize=new GSize(20,34);
this.base_icon.shadowSize=new GSize(37,34);
this.base_icon.iconAnchor=new GPoint(9,34);
this.base_icon.infoWindowAnchor=new GPoint(9,2);
var _3b=new GIcon(this.base_icon);
_3b.image=_2+"/i2.png";
this.markerOptions={icon:_3b,zIndexProcess:function(){
return 99999;
}};
_3b=new GIcon(this.base_icon);
_3b.image=_2+"/i3.png";
this.markerOptions2={icon:_3b,zIndexProcess:function(){
return 1;
}};
this.map=new GMap2(document.getElementById("mapContainer"));
this.map.addControl(new GLargeMapControl());
GEvent.clearListeners(this.map,"dblclick");
GEvent.addListener(this.map,"dblclick",function(_3c,_3d){
_8.map_on_dbl_click(_3d);
});
this.map.setCenter(new GLatLng(_7,_6),13);
};
this.map_locations=function(pg){
if(this.current_map=="locations"){
return;
}
this.current_map="locations";
if(!GBrowserIsCompatible()){
return;
}
this.map.clearOverlays();
if(!this.map_bounds){
return;
}
this.map.setCenter(this.map_bounds.getCenter(),this.map.getBoundsZoomLevel(this.map_bounds));
var i;
if(this.map_markers){
for(i=0;i<this.map_markers.length;i++){
this.map.addOverlay(this.map_markers[i]);
}
}
};
this.add_marker=function(x,y,_42,_43){
var _44=new GLatLng(y,x);
var _45=new GMarker(_44,this.markerOptions);
GEvent.addListener(_45,"mouseover",function(){
if(!_8.highlighting_enabled){
return;
}
_45.openInfoWindowHtml(_43);
});
return _45;
};
this.add_marker2=function(x,y,idx,_49){
var _4a=new GIcon(this.base_icon);
_4a.image=_2+"/gm"+_49+".gif";
var _4b=new GMarker(new GLatLng(y,x),{icon:_4a,zIndexProcess:function(){
return idx;
}});
GEvent.addListener(_4b,"mouseover",function(){
_8.on_mouse_over(idx,null);
});
GEvent.addListener(_4b,"infowindowclose",function(){
_8.on_info_window_close(idx);
_4b.infowindow_open=0;
});
GEvent.addListener(_4b,"infowindowopen",function(){
_4b.infowindow_open=1;
});
GEvent.addListener(_4b,"click",function(){
if(!_8.highlighting_enabled){
return;
}
_8.on_mouse_over(idx,null);
});
GEvent.addListener(_4b,"dblclick",function(){
_8.get_location_details(idx);
});
return _4b;
};
this.add_marker3=function(x,y,_4e,_4f,_50){
var _51=new GLatLng(y,x);
var _52;
if(_4f=="Start"){
_52=new GMarker(_51,this.markerOptions);
}else{
if(_4f=="End"){
_52=new GMarker(_51,this.markerOptions2);
}else{
_52=new GMarker(_51);
}
}
GEvent.addListener(_52,"mouseover",function(){
_8.map.openInfoWindowHtml(_51,_50);
});
return _52;
};
this.map_extend_bounds=function(x,y){
var _55=new GLatLng(y,x);
if(!this.map_bounds){
this.map_bounds=new GLatLngBounds(_55,_55);
}else{
this.map_bounds.extend(_55);
}
};
this.dir_map_extend_bounds=function(x,y){
var _58=new GLatLng(y,x);
if(!this.dir_map_bounds){
this.dir_map_bounds=new GLatLngBounds(_58,_58);
}else{
this.dir_map_bounds.extend(_58);
}
};
this.filter_click=function(all){
var obj;
if(all){
for(var i=0;i<64;i++){
if(!(obj=document.getElementById("f"+i))){
continue;
}
if(obj.checked){
obj.checked=false;
}
}
return;
}
if(!(obj=document.getElementById("f_all"))){
return;
}
if(obj.checked){
obj.checked=false;
}
};
this.get_directions_by_idx=function(idx){
var loc=this.locations[idx];
this.address2=loc[3];
this.county2=loc[7];
this.city2=loc[6];
this.x2=loc[1];
this.y2=loc[2];
this.location_id2=loc[0];
this.get_directions(this.address1,this.county1,this.city1,this.x1,this.y1,"","");
};
this.get_directions=function(_5e,_5f,_60,x1,y1,_63,_64){
if(this.x2==""){
return this.show_error("directions","Destination undefined.");
}
if(this.ajax==null){
this.ajax=new ajaxClass(this.showMessage,this.hideMessage);
}
var url=_1+"?action=get_directions&address1="+escape(_5e)+"&county1="+escape(_5f)+"&city1="+escape(_60)+"&x1="+escape(x1)+"&y1="+escape(y1)+"&address2="+escape(this.address2)+"&county2="+escape(this.county2)+"&city2="+escape(this.city2)+"&x2="+escape(this.x2)+"&y2="+escape(this.y2)+"&thum_id1="+escape(_63)+"&thum_id2="+escape(_64)+this.get_dir_params();
this.ajax.request("GET",url,"","",true,function(_66){
var _67=_66.split("\t");
if(_67.length<3||_67[2]!="end"){
return alert("http error");
}
_67[1]=unescape(_67[1]);
if(_67[0]!=1){
return _8.show_error("directions",_67[1]!=""?_67[1]:"unknown error");
}
var _67=_67[1].split("\t");
document.forms.form_2.day.value=_67[0];
document.forms.form_2.time.value=_67[1];
_8.prepare_dir_map(_67[3],_67[4]);
document.getElementById("directions_results").innerHTML="<div><div class=\"panel3\">"+unescape(_67[2])+"</div></div>";
_8.show_panel("directions_link");
_8.show_panel("directions");
_8.do_correct_time=0;
_8.map_directions();
});
};
this.prepare_map=function(pg){
this.map_bounds=null;
this.map_markers=new Array();
var i,loc;
var _6b=pg*_3+1;
var end=(pg+1)*_3;
for(i=0;i<this.locations.length;i++){
if(!(loc=this.locations[i])){
continue;
}
loc[8]=null;
}
this.map_markers.push(this.add_marker(this.x1,this.y1,"","Geocoded Search Location"));
this.map_extend_bounds(this.x1,this.y1);
for(i=_6b;i<=end;i++){
if(!(loc=this.locations[i])){
break;
}
loc[8]=this.add_marker2(loc[1],loc[2],i,loc[11]);
this.map_markers.push(loc[8]);
this.map_extend_bounds(loc[1],loc[2]);
}
this.current_map="";
};
this.prepare_dir_map=function(_6d,_6e){
var i,j,_71,_72,xys,x,y,_76,loc,_78;
this.clear_dir_map();
_71=unescape(_6d).split("\t");
for(i=0;i<_71.length;i++){
_72=_71[i].split("|");
xys=_72[0].split(",");
_76=new Array();
for(j=0;j<xys.length;j+=2){
x=xys[j]/1000000;
y=xys[j+1]/1000000;
_76.push(new GLatLng(y,x));
this.dir_map_extend_bounds(x,y);
}
this.dir_map_polylines.push(new GPolyline(_76,_72[1],_72[2]));
}
_71=unescape(_6e).split("\t");
for(i=0;i<_71.length;i++){
_72=_71[i].split("|");
_78=0;
if(_72[3]=="End"){
for(j=1;j<this.locations.length;j++){
if(!(loc=this.locations[j])){
continue;
}
if(loc[0]!=this.location_id2){
continue;
}
if(!loc[8]||Math.abs(loc[1]-_72[0])>1e-7||Math.abs(loc[2]-_72[1])>1e-7){
break;
}
this.dir_map_markers.push(loc[8]);
_78=1;
break;
}
}
if(!_78){
this.dir_map_markers.push(this.add_marker3(_72[0],_72[1],_72[2],_72[3],unescape(_72[4])));
}
this.dir_map_extend_bounds(_72[0],_72[1]);
}
this.current_map="";
};
this.clear_dir_map=function(){
this.dir_map_bounds=null;
this.dir_map_polylines=new Array();
this.dir_map_markers=new Array();
};
this.map_directions=function(){
if(this.current_map=="directions"){
return;
}
this.current_map="directions";
if(!GBrowserIsCompatible()){
return;
}
this.map.clearOverlays();
if(!this.dir_map_bounds){
return;
}
this.map.setCenter(this.dir_map_bounds.getCenter(),this.map.getBoundsZoomLevel(this.dir_map_bounds));
var i;
if(this.dir_map_polylines){
for(i=0;i<this.dir_map_polylines.length;i++){
this.map.addOverlay(this.dir_map_polylines[i]);
}
}
if(this.dir_map_markers){
for(i=0;i<this.dir_map_markers.length;i++){
this.map.addOverlay(this.dir_map_markers[i]);
}
}
};
this.on_mouse_over=function(idx,div){
if(!this.highlighting_enabled){
return;
}
var loc,_7d,i,_7f;
if(!div){
div=document.getElementById("loc"+idx);
}
var _80="#CDFAA0";
if(div&&div.style.backgroundColor!=_80){
for(i=idx-1;i>=1;i--){
if(!(_7f=document.getElementById("loc"+i))){
break;
}
_7f.style.backgroundColor="#ffffff";
}
for(i=idx+1;i<this.locations.length;i++){
if(!(_7f=document.getElementById("loc"+i))){
break;
}
_7f.style.backgroundColor="#ffffff";
}
div.style.backgroundColor=_80;
}
if((loc=this.locations[idx])&&(_7d=loc[8])&&_7d.infowindow_open!=1){
if(!loc[10]){
var _81=document.getElementById("info_win").innerHTML;
_81=_81.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
var _82={n:idx,c:loc[11],addr:loc[3],county:loc[4],dist:loc[5],phone:loc[12],link:loc[13]!=""?"<a href=\""+loc[13]+"\" class=\"hs_a\">visit website</a>":""};
_81=_81.replace(/\%([_A-Z0-9\-]+)/gi,function(str,p1){
p1=_82[p1];
return p1==undefined?"":p1;
});
var div=document.createElement("DIV");
div.innerHTML=_81;
loc[10]=div;
}
_7d.openInfoWindow(loc[10]);
}
};
this.on_click=function(idx,div){
if(this.highlighting_enabled==0){
this.highlighting_enabled=1;
this.on_mouse_over(idx,div);
}
};
this.on_info_window_close=function(idx){
var div;
if((div=document.getElementById("loc"+idx))){
div.style.backgroundColor="#ffffff";
}
};
this.map_on_dbl_click=function(_89){
this.get_locations(_89.lng()+", "+_89.lat(),"","","",0);
};
this.get_location_details=function(idx){
var loc,_8c;
if(!(loc=this.locations[idx])){
return;
}
if(loc[9]!=""){
return this.show_location_details(idx);
}
if(this.ajax==null){
this.ajax=new ajaxClass(this.showMessage,this.hideMessage);
}
var url=_1+"?action=get_location_details&id="+loc[0];
this.ajax.request("GET",url,"","",true,function(_8e){
var _8f=_8e.split("\t");
if(_8f.length<3||_8f[2]!="end"){
return alert("http error");
}
_8f[1]=unescape(_8f[1]);
if(_8f[0]!=1){
return alert(_8f[1]!=""?_8f[1]:"unknown error");
}
var _8f=_8f[1].split("\t");
if(_8f.length>4){
_8f[1]="<div style=\"width:"+Math.floor(_8f.length/2)*90+"px\">"+_8f[1]+"</div>";
}
for(var i=0;i<_8f.length;i++){
_8f[i]=unescape(_8f[i]);
}
loc[9]=_8.build_tabbed_win(idx,_8f,loc);
_8.show_location_details(idx);
});
};
this.show_location_details=function(idx){
var loc,_93;
if(!(loc=this.locations[idx])||!(_93=loc[8])||loc[9]==""){
return;
}
_93.openInfoWindowHtml(loc[9]);
};
this.build_tabbed_win=function(idx,_95,loc){
var _97="w"+idx+"_"+Math.round(Math.random()*100000000);
var _98=document.getElementById("tab_off").innerHTML.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
var _99=document.getElementById("tab_off_first").innerHTML.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
var _9a=document.getElementById("tab_on").innerHTML.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
var _9b=document.getElementById("tab_space").innerHTML.replace(/^[\r\n\t ]*<!\-\-|\-\->[\r\n\t ]*$/g,"");
var _9c=300-(_95.length/2)*45;
var _9d={w:_9c<10?10:_9c};
_9b=_9b.replace(/\%([_A-Z0-9\-]+)/gi,function(str,p1){
p1=_9d[p1];
return p1==undefined?"":p1;
});
var tab,_a1,_a2,i,j;
var _a5="<div style=\"font-weight:bold;\">"+loc[3]+" - "+loc[5]+"</div>";
_a5+="<div>"+loc[4]+"</div>";
_a5+="<div style=\"padding:0 0 24px 0;\">"+loc[12]+"&nbsp;</div>";
for(j=0;j<_95.length;j+=2){
tab_div_body="";
_a1=_95[j];
_a2=0;
for(i=0;i<_95.length;i+=2){
tab=_95[i]==_a1?_9a:(i==0||_a2?_99:_98);
_9d={win_id:_97,n:i,title:_95[i]};
tab_div_body+=tab.replace(/\%([_A-Z0-9\-]+)/gi,function(str,p1){
p1=_9d[p1];
return p1==undefined?"":p1;
});
_a2=_95[i]==_a1?0:1;
}
tab_div_body+=_9b;
_a5+="<div id=\""+_97+"_"+j+"\" style=\"display:"+(j==0?"block":"none")+";\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>"+tab_div_body+"</tr></table>"+_95[j+1]+"</div>";
}
return _a5;
};
this.activate_tab=function(_a8,n){
var obj,i;
for(i=0;obj=document.getElementById(_a8+"_"+i);i+=2){
if(obj.style.display!="none"){
obj.style.display="none";
}
}
if(obj=document.getElementById(_a8+"_"+n)){
obj.style.display="block";
}
};
};

