var popwidth=800;
var load=' alt=Loading...  ';
var aname='';
var gotbroker=readCookie('gotbroker');
var amoreurl='';
var today = new Date();
var day=pad2(today.getUTCDate());
var yesterday=pad2(today.getUTCDate()-1+(day=='01')*30);
var beginmonth=monthname(1+today.getUTCMonth()-(day==1));
var beginmonth=(1+today.getUTCMonth()-(day==1));
var thismonth=pad2(1+today.getUTCMonth());
var yestermonth=pad2(today.getUTCMonth()+1-(day=='01'));
var thisyear=today.getUTCFullYear();
acountynbr=(typeof(acountynbr)=='undefined'?0:acountynbr);
dadenbr=23;palmbeachnbr=60;browardnbr=16;
photo='';
var recordkeycriterion='';
var arecvector=new Array();
ispopup=(typeof(ispopup)=='undefined'?0:ispopup);
istabulate=(typeof(istabulate)=='undefined'?0:istabulate);
tabwidth=(typeof(tabwidth)=='undefined'?'100%':tabwidth);
if (tabwidth=='10%') dw('<title>tabwidth='+tabwidth+'</title>');
p='<p>';
beston=0;
printable=(typeof(printable)=='undefined'?0:printable);
showminimaps=(typeof(showminimaps)=='undefined'?0:showminimaps);
areatype0=(typeof(areatype)=='undefined')?'':areatype;
tester=(typeof(tester)=='undefined'?'':tester);
var demognamecompound='';
var lastareatype='allworld';
blockopen=0;
vid=(typeof(vid)=='undefined'?'':vid);
iscondex=(vid=='condex.com'||vid=='uscondex.com');
felipa=1;
isArquery=(typeof(isArquery)=='undefined')?0:isArquery;
showPremium=!iscondex;
real_on=(typeof(real_on)=='undefined'?'':real_on);
tfdata='http://tfdata.cs.fiu.edu/';
itfdata='http://tsi.cs.fiu.edu/';
n1='http://n1.cs.fiu.edu/';
n2='http://n2.cs.fiu.edu/';
n3='http://n3.cs.fiu.edu/';
vn4='http://vn4.cs.fiu.edu/';
n1=((typeof(gserver)=='undefined')?n1:((gserver=='')?n1:gserver)).replace(/\/*$/,'/');
n1c=n1+'cgi-bin';
n2c=n2+'cgi-bin';
n3c=n3+'cgi-bin';
vn4c=vn4+'cgi-bin';
vn4c=n1+'cgi-bin';
images=vn4+'images/';
newgif='<img src='+images+'New.gif>';
gnisdispcgi=vn4c+'/gnis'+tester+'.cgi?';
gniscgi=vn4c+'/gnis'+tester+'.cgi?';
h='http://';
sl='/';
hh=''+h;
function ismaph(width_m,height_m,resolution,clat,clong) {
var latdelta=height_m/surface_height_in_meters_of_one_latitude_millidegree_at(0+clat,0+clong)/2/1000;
var longdelta=width_m/surface_width_in_meters_of_one_longitude_millidegree_at(0+clat,0+clong)/2/1000;
ismaphlat(clat-latdelta,clat+latdelta,clong-longdelta,clong+longdelta,width_m/resolution,height_m/resolution);
}
function ismapimg(imgurl,minlat,maxlat,minlong,maxlong,alt) {return alt}
function ismaphlat(minlat,maxlat,minlong,maxlong,width_pix,height_pix) {

var url=vn4c+'/gnis'+tester+'.cgi?vid='+vid+'&srvc='+srvc+'&tfaction='+tfaction+'&minlat='+minlat+'&minlong='+minlong+'&maxlat='+maxlat+'&maxlong='+maxlong+'&pixel_of_max_lat=0&pixel_of_min_lat='+height_pix+'&pixel_of_min_long=0&pixel_of_max_long='+width_pix;
dw('<a border=1 href="'+url+'">');

}
function surface_width_in_meters_of_one_longitude_millidegree_at(latitude,longitude) {
   return DistanceLongLat(longitude - .001, latitude,  longitude, latitude);
}

function surface_height_in_meters_of_one_latitude_millidegree_at(latitude,longitude) {
   return DistanceLongLat(longitude, latitude - .001,  longitude, latitude);
}


function DistanceLongLat(long1, lat1, long2, lat2) {

var REarth = 6.371229*1e6;
var PI = 3.14159;

var long1Radian = long1*PI/180;
var long2Radian = long2*PI/180;
var lat1Radian = lat1*PI/180;
var lat2Radian = lat2*PI/180;

var distance = REarth * Math.acos( 
                      Math.cos(lat1Radian) * Math.cos(lat2Radian) *
Math.cos(long1Radian-long2Radian)
                      + Math.sin(lat1Radian)*Math.sin(lat2Radian) 
                      );
return distance;
}
function displayif(preffix,value,suffix) {
return (mlike(value+'','[^ 0]')?preffix+value+(typeof(suffix)=='undefined'?'':suffix):'')}

function arectab(tabrecord){
arecvector=tabrecord.split(/	/);
}


function cleanse_unit(unit) {
if (mlike(unit,'^sq.*f.*t')) return 'sf';
if (mlike(unit,'^sq.*mi')) return 'smi';
if (mlike(unit,'^sq.*k.*m')) return 'skm';
if (mlike(unit,'^sq.*m')) return 'sm';
if (mlike(unit,'^mi.*')) return 'mi';
if (mlike(unit,'^mm.*')) return 'mm';
if (mlike(unit,'^m.*')) return 'm';
if (mlike(unit,'^f.*')) return 'f';
if (mlike(unit,'^k.*m.*')) return 'm';
if (mlike(unit,'^acr')) return 'a';
return(unit);
}
function elevationdisplay(ft){
return measuredisplay(ft,'ft','Elevation');
}
function measuredisplay(value,unit, prefix){
var displayunit=' '+unit;
var fullunit=unit;
if (unit=='ft') {displayunit="'";fullunit='feet';}
if (unit=='inch') {displayunit='"'; fullunit="inches"}
var explain=(typeof(prefix)=='undefined'?'':prefix+' ')+value+ ' '+fullunit +convert_units(value,unit);
var title=' title= "'+explain+'. Click for Measure Converter." ';
return ' <a '+title+' href="http://allmeasures.com/conversion.asp?Submit=Converter" target="_blank">'+value+displayunit+'</a>';

}

function convert_units(value,unit){

var vals=''+value;
var valn=1*value;
if (mlike(vals,'^ *[0-9]+ *x *[0-9]+ *$')) {
var x=vals.replace(/ *[xX].*/,'');
var y=vals.replace(/^.*[xX] */,'');
return ' ='+(x*y);
}
if (numericG(vals)) {
var u=cleanse_unit(unit);
var f=0.3048;
var mi=1609.3;
var acre=4046.86;
var inch=f/12;
if (u=='mm') return ' ='+ K(valn/inch/1000)+ 'inches';
if (u=='m') return ' ='+ K(valn/f)+ 'ft';
if (u=='f') return ' ='+ K(valn*f)+ 'meters';
if (u=='sf') return ' ='+ K(valn*f*f)+ 'sq.meters'+ (valn>5000?' = '+K(valn*f*f/4047)+' acres':'');
if (u=='smi') return ' ='+ K(valn*mi/1000*mi/1000)+ 'sq.km ='+ K(valn*mi/acre*mi)+ 'acres';
}
return('');
}

function arquery(category,label,arcriteria,poptext,levelOfIframe,levelOfReport) {
var display=(typeof(label)=='undefined'?category:label);
var criteria=(typeof(arcriteria)=='undefined'?'':'&arcriteria=1&'+arcriteria);
var text=(typeof(poptext)=='undefined'?'browse/query '+display:poptext);
var url=vn4c+'/arquery'+tester+'.cgi?category='+category+'&y1='+latitude+'&x1='+longitude+'&vid='+vid+'&srvc='+srvc+'&tfaction='+tfaction+criteria;
pophb(url,display,text);
}

function pointdata_aurl(){return vn4c+'/gnis'+tester+'.cgi?Lat='+alatitude+'&Long='+alongitude+'&vid='+vid+'&srvc='+srvc+'&tfaction='+tfaction;}
function arquery_aurl(category){ var criteria='';return vn4c+'/arquery'+tester+'.cgi?fulldisplay=1&category='+category+'&y1='+alatitude+'&x1='+alongitude+'&vid='+vid+'&tfaction='+basetfaction+criteria}
function arquery_aurlm(category){ var criteria='';return vn4c+'/arquery'+tester+'.cgi?category='+category+'&y1='+alatitude+'&x1='+alongitude+'&vid='+vid+'&tfaction='+basetfaction+criteria}
function arquery_url(category){return vn4c+'/arquery'+tester+'.cgi?category='+category+'&y1='+latitude+'&x1='+longitude+'&vid='+vid+'&tfaction='+basetfaction;}
function arquery_keyurl(category){return vn4c+'/arquery'+tester+'.cgi?fulldisplay=1&category='+category+'&y1='+alatitude+'&x1='+alongitude+'&vid='+vid+'&tfaction='+basetfaction+(recordkeycriterion==''?'':'&arcriteria=1&'+recordkeycriterion);}


var v = new Array();  //argument: fieldnumbers*1000+valueindex, gives shortnaame, unis, fullname, and frequent values
var nbrfields=0;
var fieldnbrs = new Array(); //argument is shortname, computed from v[]
function fieldvalue(fieldnbr,valuenbr) {
var i=100*fieldnbr+valuenbr;
return (typeof(v[i])=='undefined'?'':v[i])};
function fieldnbrof(shortname) {
return (typeof(fieldnbrs[shortname])=='undefined'?'':fieldnbrs[shortname])};

var mins=new Array();
var maxs=new Array();
var totals=new Array();
var counted=new Array();
var actnbrvalues=new Array();
var field_vectors_initialized=0;
function initialize_field_vectors(){
if (field_vectors_initialized) return;
field_vectors_initialized=1;
fieldnbrs['anyfield']=0;
v[0]='Keywords in any fields';
v[-1]='anyfield';
v[-2]='';

if (nbrfields==0) {
var i=0;
while (fieldshortname(i)!='') i++
nbrfields=i-1;}
for (i=1;i<=nbrfields;i++){
mins[i]=0;
maxs[i]=0;
counted[i]=0;
actnbrvalues[i]=0;
totals[i]=0;
fieldnbrs[fieldshortname(i)]=i;
}
}



function nbrvalues(fieldnbr) {
var n=1;
while (fieldvalue(fieldnbr,n)!='') n++;
return n-1}

function fieldvalues(fieldnbr) {
var s=fieldvalue(fieldnbr,1).replace(/:.*/,'');
n=nbrvalues(fieldnbr);
for (i=2;i<=n;i++) s=s+' '+fieldvalue(fieldnbr,i).replace(/:.*/,'');
return s;
}

function fieldvalue_deabbreviate(fieldnbr,value){
for (i=1;i<=nbrvalues(fieldnbr);i++) {
      //dw(fieldnbr);
     var vv=fieldvalue(fieldnbr,i)+':::'; //dw('i='+i+' vv='+vv);
     var v1=vv.replace(/:.*/,'');
     var v2=vv.replace(/^[^:]*:/,'').replace(/:.*/,''); 
     var v3=vv.replace(/^[^:]*:[^:]*:/,'').replace(/:.*/,''); 
     if ((''+value).replace(/^0*/,'')==v1.replace(/^0*/,'')&&v2!='') return v2;
     }
return value}

function fieldvalue_explain(fieldnbr,value){
for (i=1;i<=nbrvalues(fieldnbr);i++) {
      //dw(fieldnbr);
     var vv=fieldvalue(fieldnbr,i)+':::'; //dw('i='+i+' vv='+vv);
     var v1=vv.replace(/:.*/,'');
     var v2=vv.replace(/^[^:]*:/,'').replace(/:.*/,''); 
     var v3=vv.replace(/^[^:]*:[^:]*:/,'').replace(/:.*/,''); 
     if (value==v1&&v2!='') {if (v3!='') return v2+' ('+v3+')'; else return v2}
     }
return value}



function fieldfullname(fieldnbr) {
var  u=fieldvalue(fieldnbr,-2);
return fieldvalue(fieldnbr,0) + (u!=''?' ('+u+')':u )}
function fieldshortname(fieldnbr) {return fieldvalue(fieldnbr,-1)}
function fieldunit(fieldnbr) {return fieldvalue(fieldnbr,-2)}


n157o='n150.cs.fiu.edu';
n157='http://'+n157o+'/';
n157e=hh+n157o+sl;
miniaddress=(typeof(miniaddress)=='undefined')?'':miniaddress;
addressplus=(typeof(addressplus)=='undefined')?'':addressplus;
stree=(typeof(stree)=='undefined')?'stree.cs.fiu.edu:8080':stree;
strip=n157e+'wde-fmt/Executor?'
longitude=(typeof(longitude)=='undefined'?'':longitude);
latitude=(typeof(latitude)=='undefined'?'':latitude);
place_name=(typeof(place_name)=='undefined'?'':place_name);
fires=n1c+'/fire.cgi?x1='+longitude+'&y1='+latitude;
arcoord='&x1='+longitude+'&y1='+latitude+'&';
stripend=arcoord+'numfind=100&F=SHTML&SName=';
real=strip+stripend+'REA_STAT';
schoolref='http://n150.cs.fiu.edu/geodata/schl.iq2?Query=GetSchoolsByPoint&x1='+longitude+'&y1='+latitude+'&format=html'
hotels=strip+stripend+'HOT_STAT&filter=sql&Where=supplier%3c%3e%27TRWB%27+and+supplier%3c%3e%27AMDS%27';
aerial0=vn4c+'/tfdispense.cgi?long='+longitude+'&lat='+latitude+'&';
aerial=aerial0+'width=2000&height=1600';
q="'";
title=searchstring+' '+cityorkountryname+' - Data on the Point You Clicked';
floodzoominhref='http://www.hazardmaps.gov/atlas.php?ex%5Bminx%5D='+longitude+'&ex%5Bmaxx%5D=&ex%5Bminy%5D='+latitude+'&ex%5Bmaxy%5D=&command=panW&currentView=1&zoomLevel=9&mapImageSrc=images%2Farcims%2Fmmi_image_PEISIN21801176395.png&selState=--&selCounty=0&selCongress=--&txtZipCode=&radioCmd=zoomInPoint&selView=1&viewType=normal&layerSet%5B46%5D%5Bvisible%5D=1&layerSet%5B46%5D%5Bin%5D=1&layerSet%5B81%5D%5Bvisible%5D=1&layerSet%5B81%5D%5Bin%5D=1&layerSet%5B8%5D%5Bvisible%5D=1&layerSet%5B8%5D%5Bin%5D=1&layerSet%5B5%5D%5Bvisible%5D=1&layerSet%5B5%5D%5Bin%5D=1&layerSet%5B6%5D%5Bvisible%5D=1&layerSet%5B6%5D%5Bin%5D=1&layerSet%5B7%5D%5Bvisible%5D=1&layerSet%5B7%5D%5Bin%5D=1&layerSet%5B1%5D%5Bvisible%5D=1&layerSet%5B1%5D%5Bin%5D=1&layerSet%5B2%5D%5Bvisible%5D=1&layerSet%5B2%5D%5Bin%5D=1&layerSet%5B3%5D%5Bvisible%5D=1&layerSet%5B3%5D%5Bin%5D=1&layerSet%5B12%5D%5Bvisible%5D=1&layerSet%5B12%5D%5Bin%5D=1';
floodzoomouthref='http://www.hazardmaps.gov/atlas.php?ex%5Bminx%5D='+longitude+'&ex%5Bmaxx%5D='+longitude+'&ex%5Bminy%5D='+latitude+'&ex%5Bmaxy%5D='+latitude+'&command=zoomTo8&currentView=1&zoomLevel=9&mapImageSrc=images%2Farcims%2Fmmi_image_PEISIN21801176389.png&selState=--&selCounty=0&selCongress=--&txtZipCode=&radioCmd=zoomInPoint&selView=1&viewType=normal&layerSet%5B46%5D%5Bvisible%5D=1&layerSet%5B46%5D%5Bin%5D=1&layerSet%5B81%5D%5Bvisible%5D=1&layerSet%5B81%5D%5Bin%5D=1&layerSet%5B8%5D%5Bvisible%5D=1&layerSet%5B8%5D%5Bin%5D=1&layerSet%5B5%5D%5Bvisible%5D=1&layerSet%5B5%5D%5Bin%5D=1&layerSet%5B6%5D%5Bvisible%5D=1&layerSet%5B6%5D%5Bin%5D=1&layerSet%5B7%5D%5Bvisible%5D=1&layerSet%5B7%5D%5Bin%5D=1&layerSet%5B1%5D%5Bvisible%5D=1&layerSet%5B1%5D%5Bin%5D=1&layerSet%5B2%5D%5Bvisible%5D=1&layerSet%5B2%5D%5Bin%5D=1&layerSet%5B3%5D%5Bvisible%5D=1&layerSet%5B3%5D%5Bin%5D=1&layerSet%5B12%5D%5Bvisible%5D=1&layerSet%5B12%5D%5Bin%5D=1';
hr='http://n1.cs.fiu.edu/cgi-bin/d.cgi?tigermaps=&gnis0=&searchstring='+searchstringplus+'&lat='+latitude+'&long='+longitude+'&bigmap=1';
href='<a href='+hr+' target=_top>';
var N='north';
var E='east';
var S='south';
var W='west';
var NW='north-west';
var NE='north-east';
var SW='south-west';
var SE='south-east';
var distcnbr=0;
srvc=(typeof(srvc)=='undefined'?'':srvc);
tfaction=(typeof(tfaction)=='undefined'?'':tfaction);
var onlycount=(mlike(tfaction,'^count')) ;
if (tfaction=='') tfaction=getparam('tfaction');
basetfaction=(mlike(tfaction,'rambbroker')?tfaction.replace(/.*rambbroker/,'rambbroker'):'');
if (srvc=='') srvc=getparam('srvc');
function mkicon(s) {
return '<font face=Courier>'+s+'</font>';
}
function distc(meters,direction,label) {
  var olabel=(label=='undefined'?'':label);
  var red=(olabel.indexOf('color=red')>0);
  olabel=olabel.replace(/\<[^>]*\>/g,'');
  var olabelnet=olabel.replace(/.*:/,'').replace(/.nbsp;*/g,' ').replace(/^ */,'');
  var olabel_=olabel.replace(/.nbsp;*/g,' ').replace(/^  */,'').replace(/[^$a-zA-Z0-9,.\/:-]/g,'+');
  var olabelnet_=olabelnet.replace(/[^a-zA-Z0-9,.\/:-]/g,'+');
  var objectref=(olabel==''?'':' (<a href=.>'+olabelnet+'</a>)');
  var objectcat=(typeof(aicon)=='undefined'?'':aicon);
  if (typeof(ocat)!='undefined') if (ocat!='') objectcat=ocat;
  objectcat=(objectcat==''?'object':objectcat);
var objectcref='the '+objectcat+objectref;
var flyurl='http://terrafly.fiu.edu/launch.asp?Lat='+alatitude+'&Long='+alongitude;
if (typeof(appletform)!='undefined') flyurl=appletform.replace(/aplatitude/g,alatitude).replace(/aplongitude/g,alongitude).replace(/applace/g,(olabel_==''?'+':olabel_).replace(/.*:./,'').replace(/[^a-zA-Z0-9.\/$-]/g,'%20'));

var flyicon='&phi;';
flyicon=mkicon('f');
var panurl=gniscgi+'TopPlaces=5&Lat='+alatitude+'&Long='+alongitude+'&vid='+vid+'&tfaction='+tfaction+'&place_name='+olabelnet_+'#TerraPan';
var searchurl='http://recommend.org/omnisearch.htm#sitetype=omni&zipcode='+zipcode+'&cityname='+citynameplus+'&statecode='+statecode+'&vid='+vid+'&searchstring='+olabelnet_;
var panicon='&pi;';
panicon=mkicon('p');
allfieldsicon=mkicon('a');
folioicon='parcels';
blockicon='block';
bgicon='vicinity';
var moreicon='&mu;';
moreicon=mkicon('l');
var searchicon=mkicon('i');
var mapicon='&epsilon;';
mapicon=mkicon('e');
directionsicon=mkicon('d');
  distcnbr++;
  if (direction.length<4)
    direction=direction.replace('N','north').replace('S','south').replace('W','west').replace('E','east').replace('thw','th-w').replace('the','th-e');
  var precision_meters=0;
  var alongitude_string=(''+alongitude)+''+'0000001s';
  //tempoff var alongitude_string=(''+alongitude).replace(/0*$/,'');
  //if  (mlike(''+alatitude,'\.107')) precision_meters=100*alongitude_string.substr(alongitude_string.length-4,4);
  //was in prod till 2007-525: if  (mlike(''+alatitude,'\.107')) precision_meters=500*alongitude_string.replace(/.*\./,'').substr(4,3);
  //if  (mlike(''+alatitude,'[.]...107')) precision_meters=500*alongitude_string.replace(/.*[.]/,'').substr(4,3);
  if  (mlike(''+alatitude,'[.]...107')) precision_meters=50*alongitude_string.replace(/.*[.]/,'').substr(3,4);
 // dw(alongitude_string.replace(/.*[.]/,'').substr(4,3));dw();
  var approximately=(precision_meters>0?' very approximately ':'');
  var ft=Math.round(meters/0.3);
  var miles=Math.round(meters/160.9)/10; amiles=miles;
  var km=Math.round(meters/100)/10;
  var valarrow='<img border=0 src='+images+direction+'.gif>';
  var valdist=(meters>5000?km+'km':meters+'m');
    if (precision_meters>0) valdist=km+'&plusmn;'+(precision_meters/1000).toPrecision(2)+' km';
  //  valdist=''+alatitude+'='+alongitude+'='+precision_meters;
  var from=(place_name==''?' from the starting point':' from '+place_name)+'.';
  if (USA) {valdist=(ft>5000?miles+'mi':ft+q);

    //if (precision_meters>0) valdist=miles+'&plusmn;'+Math.round(precision_meters/1600).toPrecision(2)+' miles';
    if (precision_meters>0) valdist=miles+'&plusmn;'+(Math.round(precision_meters/16).toPrecision(2))/100+' miles';
}
  var val=valarrow+valdist;  if (ft==0) val=valdist;

  if (ft==0) {val='<img src='+images+'startpoint.gif>';valarrow=val};
  if (typeof(alatitude)!='undefined') {if (alatitude!=0) {
var tp='http://books-maps.com/gnisterrapan521.html#set?lat='+alatitude+'&lon='+alongitude+'&res=';
var img1=' <img src=http://tsi.cs.fiu.edu/qHaMz'+alongitude+'qALz'+alatitude+'>';
var img='<iframe src='+tp+'1 width=700 scrolling=no framespacing=0 marginwidth=0 marginheight=0 height=500 border=0></iframe> <iframe src='+tp+'8 width=700 scrolling=no framespacing=0 marginwidth=0 marginheight=0 height=500 border=0></iframe>';
img='<iframe src='+tp+'1 width=670 scrolling=no framespacing=0 marginwidth=0 marginheight=0 height=500 border=0></iframe>';
var panminitext='<b>Pan</b> aerial imagery at '+objectcref;
if (!isIE55) pantext=panminitext+img1; 
else pantext='<b>Pan</b> aerial imagery at '+objectcref+' (or graphically adjust location)'+img;
pantext='<b>Pan</b> aerial imagery at '+objectcref+' (or graphically adjust location)'+img1;
var flytext='open TerraFly<b>flight</b> windows at '+objectcref;
var searchtext='<b>Internet omni-search</b>: the Web, dictionaries, encyclopaedias, online databases for '+objectcref;
var mapurl='http://maps.google.com/maps?q='+citynameplus+'&ll='+alatitude+'%2C'+alongitude;
var mapsource='Google';
var mapminitext='<b>External Map</b>ping Service ('+mapsource+') at '+objectcref;
var maptext=mapminitext+'<iframe src='+mapurl+' width=800 scrolling=no framespacing=0 marginwidth=0 marginheight=0 height=660 border=0></iframe>';
var allfieldsminitext='<b>All fields</b> of '+atitle;
var moretext='<b>List</b> all '+atitle+' with details and distances to '+objectcref+'.  <b>Easy Geo-Query</b>';
var aerial='<img src=http://tsi.cs.fiu.edu/qB1Fz'+alongitude+'qALz'+alatitude+'>';
var foliotext='county records';
var blocktext='demographics of this block and nearby';
var bgtext='demographics of this neighborhood and nearby';
var allfieldsurl=arquery_aurl(p1);
var allfieldstext=allfieldsminitext;
var amoreurlt=n1c+'/arquery'+tester+'.cgi?category='+p1+'&x1='+alongitude+'&y1='+alatitude+'&tfaction='+tfaction+'&vid='+vid+'&place_name='+olabel.replace(/[^a-zA-Z0-9]/g,'+');
var foliourl=arquery_aurlm(kountrycode=='US_FL'?'flproperties-09':'firstamerican_points');
var blockurl=arquery_aurlm('pblock');
var bgurl=arquery_aurlm('pbg');
var detailref=(isArquery==1)?'<img src='+images+'details.gif width=32 height=32><font color=blue><b>'+alabel+'</b></font>':'the '+objectcat+' '+objectref;
poph(gniscgi+'Lat='+alatitude+'&Long='+alongitude+'&vid='+vid+'&tfaction='+tfaction+'&place_name='+olabel_,'<b><i>'+val+'</i></b>',distcnbr+'. This place is '+approximately+ft+' feet (by air) ='+meters+' meters, ='+miles+' miles, =<b>'+km+' kilometers</b> '+direction+from+'<p>Click on '+valarrow+' to go to recenter report on this point or<p>click on '+detailref+' for more <b>details</b> about this '+objectcat+' or<p>mouse-over other buttons for more options');
 flyiconhelp='';
searchiconhelp=p+searchicon+' -- '+searchtext+'.'; 
paniconhelp=p+panicon+' -- '+panminitext+'.'; mapiconhelp=p+mapicon+' -- '+mapminitext+'.';moreiconhelp=p+moreicon+' -- '+moretext+'.';
allfieldshelp=p+allfieldsicon+' -- '+allfieldsminitext+'.';
paniconminihelp=p+panicon+' -- <b>pan</b> aerial imagery overlaid with maps (or graphically adjust location).';
if (azipcode.length>5) azipcode=azipcode.substr(0,5);
aaddress=aaddress.replace(/#.*/,'');
var directionsadr=miniaddress+' to '+aaddress+','+azipcode;
var directionsaddressplus=directionsadr.replace(/ /g,'+');
var directionurl='http://maps.google.com/maps?q='+directionsaddressplus;
var directions=' <b><i>Driving</i> distance</b>: <br><iframe width=800 height=500 src='+directionurl+'></iframe>'; 
if (USA) { flyiconhelp='<p>'+flyicon+' -- '+flytext+'.';}
if (!onlycount&&!printable) {
dw('<small>');
if (felipa) {

if (felipa_pulldown_on) {
dw('</small>')
submenu='';
if (USA) {
}
submenub(mapurl,mapicon,maptext);
submenub(amoreurlt,moreicon,moretext); 
submenub(searchurl,searchicon,searchtext); 
submenub(allfieldsurl,allfieldsicon,allfieldstext); 
if (USA) {pointbuttong('censusmap','population.gif','demographics');}
if (ft>300) if (address!=''&&aaddress!=''&&azipcode!='') {pointbutton(directionurl,'car.gif',directions);}
if (USA) {

if (meters>150) {
line_speed=40;
line_seconds=25;
line_px=line_speed*line_seconds;
line_resolution=(meters/line_px);
if (line_resolution<0.3) line_resolution=0.3;

pointbutton('http://maps.cs.fiu.edu/pilot/pilot.htm?autopilot=straightline&startlat='+latitude+'&startlong='+longitude+'&endlat='+alatitude+'&endlong='+alongitude+'&speed='+line_speed+'&res='+line_resolution,'airport.gif','TerraFlight from the starting point to this point');
}
pointbutton('http://maps.cs.fiu.edu/pilot/pilot.htm?autopilot=spiral&startlat='+alatitude+'&startlong='+alongitude+'&radius=500&res=1.2','heliport.gif','TerraFlight spiraling around this point');


}
if (!istabulate) felipa_pulldown();
}
else {
if (USA) {dw(); popht('terrafly',flyurl,flyicon,flytext);}
dw();pophb(mapurl,mapicon,maptext);
dw(); pophb(amoreurlt,moreicon,moretext); 
dw(); pophb(searchurl,searchicon,searchtext); 
dw(); pophb(panurl,panicon,pantext); 
dw(); pophb(allfieldsurl,allfieldsicon,allfieldstext,iframe_arquery(allfieldsurl)); 
if (ft>300) if (address!=''&&aaddress!=''&&azipcode!='') {dw();pophb(directionurl,directionsicon,directions);}  }
}
if (isArquery&&typeof(p1)!='undefined') {
submenu_section();
if (preal) submenu_arquery('ramb','client&nbsp;view');
if (p1=='ramb'||p1=='callreal') {submenu_arquery('allreal','Pro&nbsp;view','status=A');}
var br='<br>'
var indent=br+'&nbsp;';
if (p1=='emergencycalls') {

submenu_arquery('ptrim','Rain','','precipitation last 24h');
submenu_arquery('rtgauges','Water gage','','flow and level at USGS water gages');
}
if (preal||p1=='emergencycalls')  submenuOrBr(foliourl,folioicon,foliotext,iframe_arquery(foliourl));
if (p1=='pbg'||p1=='ptract'||preal||mlike(p1,'flproperties')||p1=='nfolio') {submenuOrBr(blockurl,blockicon,'demographics at the BLOCK level',iframe_arquery(blockurl))};
if (p1=='pblock'||p1=='ptract'||p1=='pzipcode'||p1=='pincorp'||mlike(p1,'flproperties')) {submenuOrBr(bgurl,bgicon,'demographics at the NEIGHBORHOOD (Census Block Group) level',iframe_arquery(bgurl))};
if (p1=='bcndx') {submenu_arquery('cndx','units','','condo units offered nearby');}
submenu_arquery('iypages','Business','','Yellow Pages');
if (p1=='cndx') {submenu_arquery('bcndx','buildings','','featured condominum buildings nearby');}
if (preal||mlike(p1,'flproperties')&&(flcounty==dadenbr||flcounty==browardnbr||flcounty==palmbeachnbr)) {
submenuOrBr(pointdata_aurl().replace(/tfaction=/,'&printable=1&tfaction=aerial'),'aerial','printable aerial photographs & property lines',aerial);
var folionbr=folio.replace(/-/g,'');var basefolio=folionbr;
var taxurl='http://gisims2.co.miami-dade.fl.us/MyHome/propmap.asp?app=propmap&bytool=FOLIO&cmd=FINDFOLIO&tool=SELECT&searchtool=FOLIO&mapURL=&selX=&selY=&scale=155&ownerl=&ownerf=&stnum=&stdir=&stname=&sttype=&stunit=&stzip=&reffolio=&startnum=0&sOrthophoto=YES&folio='+folionbr;
if (acountynbr==browardnbr) taxurl='http://www.bcpa.net/RecInfo.asp?URL_Folio='+folionbr;
if (acountynbr==palmbeachnbr) taxurl='http://www.co.palm-beach.fl.us/papa/aspx/web/detail_info.aspx?p_entity='+folionbr;
var taxpopurl=taxurl;
if (acountynbr==dadenbr) taxpopurl='http://gisims2.co.miami-dade.fl.us/myhome/proptext_print.asp?folio='+ folionbr;
basefolio=sub("....$","0000",basefolio);
pointbutton(taxurl,'bmaps.gif','Current County Property Appraiser record for this property',taxurl);
if ((preal||mlike(p1,"flproperties"))&&flcounty==dadenbr) submenuOrBr("http://"+server +"/cgi-bin/arquery"+tester+".cgi?category=deeds_props&y1="+alatitude+"&x1="+alongitude+"&vid="+vid+"&tfaction=tabview&arcriteria=1&Folio_Number="+folionbr,"Deeds","Property documents recorded with County Clerk");
if (preal||mlike(p1,'flproperties')&&(flcounty==dadenbr||flcounty==browardnbr||flcounty==palmbeachnbr)&&(vid=='ramb'||vid=='mreal')) {
submenu_section('Comparables');
if (acountynbr==dadenbr&&(vid=='mreal')) submenuOrBr("http://n1.cs.fiu.edu/cgi-bin/condorep"+tester+".cgi?Lat="+alatitude+"&Long="+alongitude+"&vid="+vid+"&folio="+basefolio,"per-tax","Run a value comparison report for the subdivision (sale price per sq. foot of adjusted area) and show owners (analysis of records of the County Appraiser office)"); 
if (preal) {
report_name="place_name=Comparables+adjustment+to+county+valuation+of+$"+county_value+"+via+MLS+CS+analysis+of+ratio+of+Recent+Sales+to+County+Valuation&";
submenuOrBr("http://"+server +"/cgi-bin/arquery"+tester+".cgi?"+report_name+"category=allreal&y1="+alatitude+"&x1="+alongitude+"&vid="+vid+"&tfaction=tabvieweval_County_Valuation"+county_value+"&arcriteria=1&status=CS&closing_date%3E=2009-08-01&property_type="+listing_type,"per-MLS-CS-assessed","Run a value comparison report (adjustment to the county-appraized so-called just-value) based on recent  closed sales"); 
report_name="place_name=Comparables+adjustment+to+county+valuation+of+$"+county_value+"+via+Coutnty+Records+analysis+of+ratio+of+Recent+Sales+to+County+Valuation&";
submenuOrBr("http://"+server +"/cgi-bin/arquery"+tester+".cgi?"+report_name+"category=deeds_props&y1="+alatitude+"&x1="+alongitude+"&vid="+vid+"&tfaction=tabvieweval_County_Valuation"+county_value+"&arcriteria=1&Recording_Date%3E=20090801&Computed_Sale_Price%3E=20000&TOTLAREA%3E="+area/2+"&TOTLAREA%3C="+area*2,"per-Deeds+Tax","Run a value comparison report (adjustment to the county-appraized so-called just-value) based on recent recorded sales"); 
report_name="place_name=Comparables+valuation+of+"+area+"sq.ft.+via+MLS+CS+analysis&";
submenuOrBr("http://"+server +"/cgi-bin/arquery"+tester+".cgi?"+report_name+"category=allreal&y1="+alatitude+"&x1="+alongitude+"&vid="+vid+"&tfaction=tabviewevalsqft"+area+"&arcriteria=1&status=CS&closing_date%3E=2009-08-01&property_type="+listing_type,"per-MLS-CS-sq.ft","Run a value comparison report (sale price per sq.ft of living area) based on recent  closed sales"); 
report_name="place_name=Comparables+valuation+of+"+area+"sq.ft.+via+County+Records+analysis&";
submenuOrBr("http://"+server +"/cgi-bin/arquery"+tester+".cgi?"+report_name+"category=deeds_props&y1="+alatitude+"&x1="+alongitude+"&vid="+vid+"&tfaction=tabviewevalsqft"+area+"&arcriteria=1&Recording_Date%3E=20090801&Computed_Sale_Price%3E=20000&TOTLAREA%3E="+area/2+"&TOTLAREA%3C="+area*2,"per-Deeds-sqft","Run a value comparison report (sale price per sq.ft. of living area) based on recent recorded sales"); 
}}
submenu_section();
}
if (creal) {
submenu_arquery('gnis2009','Places','','Public places nearby');
submenu_section('People');submenuOrBr(blockurl,blockicon,blocktext,iframe_arquery(blockurl));submenuOrBr(bgurl,bgicon,bgtext,iframe_arquery(bgurl));
submenu_section();
};
if (creal) {submenu_section('Schools'); submenu_arquery('public_schools','public','','public schools'); submenu_arquery('private_schools','private','','private schools');submenu_section() }
}
if (felipa_pulldown_on&&istabulate&&!printable) felipa_pulldown();
if (!printable) pointbuttona(arquery_keyurl(p1),'details16x16.gif','');
   if (isArquery&&!printable) pointbutton(pointdata_aurl().replace(/.tfaction=[^&]*/g,''),'more1grey.gif','PointData: Summary from all the datasets and maps at this location');
}
var redmsg=(red)?('<p><font color=red>Red color ('+olabelnet+ ')</font>'+' means you have clicked approximately on the '+objectcat+'.'):'';
var arqueryhelp=(isArquery?'<hr><b>Refine this Query:</b> Mouse over any blue word in any column on right or any symbol (&ge;, &le;) to see instructions on how you can refine this query. Once you click on any such word or symbol you will see more options of defining search criteria for that field.':'');
   var arrowmsg=(ft==0?valarrow+' symbolizes that the current page is '+approximately+'centered on this '+objectcat+'.':'Arrow '+valarrow+' shows direction ('+direction+') and distance to the '+objectcat+''+objectref+'<p>Click on the arrow '+valarrow+' to go to recenter report on this '+objectcat+''+objectref+'.');
var pulldown_help=felipa_pulldown_on?'<hr>Pull down <img src='+images+'pulldown.gif> for  a menu of actions on this '+ocat+':':'';
   //if (distcnbr==1&&!isArquery&&!printable)  popq('',arrowmsg+'<p>Click '+detailref+' for detailed information about the '+objectcat+'.'+redmsg+(felipa?pulldown_help+flyiconhelp+mapiconhelp+moreiconhelp+searchiconhelp+paniconminihelp+allfieldshelp:''));
   if (distcnbr==1&&!isArquery&&!printable)  popq('',arrowmsg+'<p>Click '+detailref+' for detailed information about the '+objectcat+'.'+redmsg+pulldown_help);
   //if (distcnbr==1&&isArquery&&!printable)  popq('','<b>Details:</b> Click '+detailref+' for detailed information about the '+objectcat+'.<hr><b>Location data:</b><p>'+arrowmsg+(felipa?flyiconhelp+mapiconhelp+moreiconhelp+searchiconhelp+paniconminihelp+allfieldshelp:'')+arqueryhelp);
   if (distcnbr==1&&isArquery&&!printable)  popq('','<b>Details:</b> Click '+detailref+' for detailed information about the '+objectcat+'.<hr><b>Location data:</b><p>'+arrowmsg+pulldown_help+arqueryhelp);
    }
    else {
      if (distcnbr==1) if (!printable) popq(val,'This place is '+approximately+ft+' feet ='+meters+' meters, ='+miles+' miles, =<b>'+km+' kilometers</b> '+direction+from);
      else popbi(val,distcnbr+'. This place is '+approximately+ft+' feet ='+meters+' meters, ='+miles+' miles, =<b>'+km+' kilometers</b> '+direction+from);
    }
  }
}


wh='iht=359&iwd=422';
wh0='iht=359&iwd=422';



function micro(mapurl) {
  return '';
}

function nano(mapurl) {
  return '<iframe src="'+mapurl+'" border=0 width=1 height=1></iframe>';
}

function tigerref(wealth,label,legend) {dw();
  //poph_static(hr,label,'Click for detailed map album or <b>HOLD MOUSE</b> for a small '+label+' map<br><img src='+wealth+load+'>'+(legend=='undefined'?'':legend),777);
  pophb(hr,label,'Click for detailed map album or <b>HOLD MOUSE</b> for a small '+label+' map<br><img src='+wealth+load+'>'+(legend=='undefined'?'':legend),777);
  dw('&nbsp;');
}
function tigershow(wealth,label,legend) {dw();
hr='http://n1.cs.fiu.edu/cgi-bin/d.cgi?tigermaps=&gnis0=&searchstring='+searchstringplus+'&lat='+latitude+'&long='+longitude+'&bigmap=1';
  dw('<table><tr><td>');
  pophb(hr,'<img src='+wealth+'>','Click for a larger demographic map');
dw('</td></tr><tr><td>');
  dw((legend=='undefined'?'':legend)+'</td></tr></table>')
  dw('&nbsp;');
}
function tigersshow(){
return;
if (typeof(wealth!='undefined')) {dw('<table  border=0><tr><td>Median Family Income in 2000:');
dw('</td></tr><tr><td>');
    tigershow(wealth,'Wealth','<img src='+images+'tigerlegend.gif>');
dw('</td></tr><tr><td>');
dw('</td></tr><tr><td>Population density in 2000:');
dw('</td></tr><tr><td>');
    tigershow(density,'Density','<img src='+images+'tigerlegend.popdensity.gif>');
dw('</td></tr></table>');
}
}

function weather(){
dw('<p><b>Weather:</b><br>');
 //   dw('<table align=right><tr><td>');
    weathericon='http://oper.dblive.com/zml/products?ext=jpg&h=116&w=144&lang=us&act_p=image&user=terrafly&pass=trfg$us&client=terrafly&retrieve=yes&object=clickweather&package=239&act=forecast&tf=1&lat='+latitude+'&lon='+longitude;
    weatherlink='http://www.clickweather.com/zml/clickweather?user=terrafly&long_point='+longitude+'&lat_point='+latitude+'&act=forecast';
    weatherpop='http://www.clickweather.com/zml/pforecast?lat='+latitude+'&lon='+longitude;
  pophb(weatherlink, '<img src="'+weathericon+'" alt=""  border=0>','Click for weather forecast');
  if (typeof(zipcode)!='undefined') if (zipcode!='') {
dw();
var ws='http://www.wunderground.com/cgi-bin/satblast/satBlast?lat='+latitude+'&lon='+longitude+'&width=640&height=450&zoom=2&SatType=VIS&Map.x=328&Map.y=193';
pophb(ws,'<img src="http://banners.wunderground.com/banner/ban/wxBanner?bannertype=sunandmoon150_both&zip='+zipcode+'" border=0 alt="" height=50 width=150>','Click for Weather Satellite');
dw();
var ww='http://www.wunderground.com/cgi-bin/findweather/getForecast?query='+zipcode;
pophb(ww,'<img src="http://banners.wunderground.com/banner/ban/wxBanner?bannertype=miniStates&zip='+zipcode+'" border=0 alt="" height=100 width=150>',statename+ ' flag with curent weather. Click for forecast from WeatherUnderground');
dw('<p>');
var yw='http://weather.yahoo.com/search/weather2?p='+zipcode;
pophb(yw,'Yahoo','Click for weather forecast');dw();
var ww='http://www.weather.com/weather/local/'+zipcode+'?lswe='+zipcode+'&lwsa=WeatherLocalUndeclared'
pophb(ww,'Weather.com','Click for weather forecast');dw();
var ww='http://www.srh.noaa.gov/zipcity.php?inputstring='+zipcode;
pophb(ww,'NOAA',popframe(ww,670,670));dw();
dw('<br>')

  }

}
function weatherbutton(){
if (zipcode>0) {
var sticker='<img src="http://banners.wunderground.com/banner/ban/wxBanner?bannertype=smalltemptr&zip='+zipcode+'" border=0 alt="" height=28 width=53 align=top class="bttn">';
var weatherlink='http://www.wunderground.com/cgi-bin/findweather/getForecast?query='+zipcode;
var weatherpop=popframe('http://www.srh.noaa.gov/zipcity.php?inputstring='+zipcode,670,670);
pophb(weatherlink,sticker,weatherpop);

}
}

function mapbar() {
  predemog();
  dw('<TABLE bgcolor="#EFEFDE" width="'+tabwidth+'" border=0 cellspacing=0><TR><td>');
  tiger='http://tiger.census.gov/cgi-bin/mapper/map.gif?lat='+latitude+'&lon='+longitude+'&mlat='+latitude+'&mlon='+longitude+'&msym=cynpin&mlabel=&murl=&conf=mapnew.con&'+wh+'&';
  tiger0='http://tiger.census.gov/cgi-bin/mapper/map.gif?lat='+latitude+'&lon='+longitude+'&mlat='+latitude+'&mlon='+longitude+'&msym=cynpin&mlabel=&murl=&conf=mapnew.con&'+wh0+'&';
  wealth=tiger0+'ht=0.120&wid=0.120&on=CITIES&on=majroads&on=miscell&on=places&on=interstate&on=statehwy&on=states&on=ushwy&on=water&tlevel=censusb&tvar=income&tmeth=i';
  density=tiger+'ht=0.480&wid=0.480&on=CITIES&on=majroads&on=miscell&on=places&on=interstate&on=statehwy&on=states&on=ushwy&on=water&tlevel=tracts&tvar=density&tmeth=q';
  zoomin=tiger+'wid=0.015&ht=0.015&on=CITIES&on=majroads&on=miscell&on=places&on=streets&on=interstate&on=statehwy&on=states&on=ushwy&on=water&tlevel=-&tvar=-&tmeth=i';
  statemap=tiger+'ht=8.640&wid=8.640&on=CITIES&on=miscell&on=places&on=interstate&on=states&on=ushwy&on=water&tlevel=-&tvar=-&tmeth=i';
  regional=tiger+'ht=2.160&wid=2.160&on=CITIES&on=counties&on=miscell&on=interstate&on=statehwy&on=states&on=ushwy&on=water&tlevel=-&tvar=-&tmeth=i';
if (!mlike(vid,'condex')&&!ispopup) {
  dw('Physical Maps: ');
for (maplevel=1;maplevel<7;maplevel++) {
dw();pophb('http://www.expedia.com/pub/agent.dll?qscr=mrdt&ID=3XNsF.&CenP='+latitude+','+longitude+'&Lang=WLD0409&Alti='+maplevel+'00&Size=1200,800&Offs=0,0&MapS=0&Pins=|21bb|',maplevel,'Expedia Physical Map at Altitude='+maplevel+'00');
};

dw(' Map Servers: ');
pophb('http://www.mapquest.com/maps/map.adp?latlongtype=decimal&zoom=5&latitude='+latitude+'&longitude='+longitude,'MapQuest','MapQuest map'); 
dw();pophb('http://maps.google.com/maps?q='+citynameplus+'&ll='+latitude+'%2C'+longitude,'Google','Google map');
dw();pophb('http://local.live.com/default.aspx?v=2&cp='+latitude+'~'+longitude+'&style=h&lvl=17','Windows Local','Windows Live Local (former Microsoft Virtual Earth)');
  if (USA) {
dw();pophb(gniscgi+'Lat='+latitude+'&Long='+longitude+'&tfaction=dispense&place_name='+statename+'&areatype=state#State+Maps',statecode+' Maps','Printable PDF maps of '+statename);
}
}
  if (USA) {
if (1==2) {
dw('<br>');
    dw(' US Census Maps: '); 
    tigerref(zoomin,'ZoomIn','');
    tigerref(wealth,'Wealth','<img src='+images+'tigerlegend.gif>');
    tigerref(density,'Density','<img src='+images+'tigerlegend.popdensity.gif>');
    tigerref(regional,'Region','');
    tigerref(statemap,'State','');
    dw('<br>Environmental Maps: ');
    //dw(' FEMA: ');     pophb(floodzoomouthref,micro(statemap)+'Flood Zones, Hazards ','Click this link to explore FEMA Flood Zones and Hazards Map.',300);dw();
    dw(' EPA: ');
    waste='http://oaspub.epa.gov/enviro/ef_home3.html?p_zipcode='+zipcode+'&p_type=zip&x=25&y=4'
    pophb(waste,'Waste','map of toxic releases into air and water discharge in Zipcode '+zipcode);dw();
    waterair='http://134.67.99.77/aspscripts2/myWindow.asp?xl='+(longitude-.03)+'&yb='+(latitude-.03)+'&xr='+(longitude-0+.03)+'&yt='+(latitude-0+.03);pophb(waterair,'Water&Air','interactive map and EPA reports from air and water monitoring stations (if the EPA server is up:-))');dw();
    toxic='http://oaspub.epa.gov/wme/i3_ef_link.query_links?db_type=ENVIROFACTS&ul_lr='+(longitude-.03)+','+(latitude-.03)+','+(longitude-0+.03)+','+(latitude-0+.03);pophb(toxic,'Polluters?','list and details of facilities regulated by EPA');dw();
}
    if (1==2) {
dw('<br>TerraFly Reports: ');
    poph(demog,'Demographics','<table><tr><td>demographics of all areas containing the current location.</td></tr></table>');dw();
    if (real_on==1) poph(real,'Homes 4Sale','<table><tr><td>homes listed for sale near the current location.<br>'+popframe(real,800,1000)+'</td><td>'+'</td></tr></table>',800);dw();
    if (typeof(zipcode)!='undefined') { lifequality='http://n150.cs.fiu.edu/geodata/bstp.iq2?Query=GetAreaDetails&format=html&aid=Z'+zipcode;poph(lifequality,'Life Quality','<table><tr><td>see Quality of Life Report for zip code '+zipcode+'<br>'+popframe(lifequality,450,600)+'</td><td>'+'</td></tr></table>',800);dw(); }
    poph(hotels,'Hotels','<table><tr><td>report on hotels near this location; click on hotel name to check availability/prices and reserve.<br>'+popframe(hotels,800,1000)+'</td><td>'+'</td></tr></table>',800);dw();
    poph(schoolref,'Schools','<table><tr><td>a report on nearby schools.<br>'+popframe(schoolref)+'</td><td>'+'</td></tr></table>',800);dw();
    //pophb(weatherlink, 'Weather','Weather forecast'+popframe(weatherpop));dw();
}
  }

if (!mlike(vid,'condex')&&!ispopup) {
  dw('<br>Fees: ')
  aerialpop='http://dispense.cs.fiu.edu/tf001.asp?long='+longitude+'&lat='+latitude+'&width=1500&height=1500';
  if (tfpopupvip==1) {
    poph(aerial,'Aerials','Click for photo-prints and downloadables of aerial photos, TerraAtlas, topo-maps, etc. You will be able to adjust size.',800);
    dw();
  }
  else {
    poph(aerial,redden('Aerials'),'Click for photo-prints and downloadables of aerial photos  etc. You will be able to adjust size.',800);dw();
    poph(aerial0+'width=3000&height=2400&tab=prints&preclick=','Prints','Click for photo-prints of aerial photos, topo-maps, etc. Changeable recommended size is 20x16 inch',800);dw();
    poph(aerial0+'width=2000&height=2600&area=incorp&tab=atlas&preclick=5','TerraAtlas','Click for downloadable pdf Atlas of imagery with street overlays.',800);dw();
    poph(aerial+'&preclick=','Topo-maps','Click for photo-prints and downloadables of  topo-maps, etc. ',800);dw();
    poph(aerial+'&tab=poster&preclick=','Posters','Click for Art-photo posters of satellite views of nearby locations',800);dw();
    poph(aerial0+'width=800&height=600','Mini-aerials','Downloadables of 800x600 aerial photos  etc. You will be able to adjust size.',800);dw();
    poph(aerial0+'width=1500&height=900&tab=print&preclick=','Photo-cards','Postcard-sized glossy photo-prints of aerials etc.',800);dw();
    poph(aerial0+'area=zip&tab=report&preclick=2','Reports','Premium (fees) reports about this area, e.g. 8000-field demographic report comparing all block groups within this zipcode',800);dw();
    poph(gnisdispcgi+'Lat='+latitude+'&Long='+longitude+'&tfaction=dispense','Choose size','Choose the size of downloadables and prints. You may also adjust location/address.',800);dw();
  }
}
  dw('</td></TR></TABLE>')
}

temppopwidth=350;

function environmaps(){

    dw('<p><b>Maps</b>: ');
    //dw(' FEMA: ');pophb(floodzoomouthref,micro(statemap)+'Flood Zones, Hazards ','Click this link to explore FEMA Flood Zones and Hazards Map.',300);dw();
    dw(' EPA: ');
    waste='http://oaspub.epa.gov/enviro/ef_home3.html?p_zipcode='+zipcode+'&p_type=zip&x=25&y=4'
    pophb(waste,'Waste','map of toxic releases into air and water discharge in Zipcode '+zipcode);dw();
    waterair='http://134.67.99.109/wme/myWindow.asp?myWindow.asp?RequestTimeout=300&xl='+(longitude-.06)+'&yb='+(latitude-.06)+'&xr='+(longitude-0+.06)+'&yt='+(latitude-0+.06);pophb(waterair,'Water&Air','interactive map and EPA reports from air and water monitoring stations (if the EPA server is up:-))');dw();
    toxic='http://oaspub.epa.gov/wme/i3_ef_link.query_links?db_type=ENVIROFACTS&ul_lr='+(longitude-.03)+','+(latitude-.03)+','+(longitude-0+.03)+','+(latitude-0+.03);pophb(toxic,'Polluters?','list and details of facilities regulated by EPA');dw();
}
function predemog() {
  zipres=(typeof(zipres)=='undefined')?16:zipres;
  aerialres=(typeof(aerialres)=='undefined')?8:aerialres;
  zipmap=('qTFZP'+zipres+'z'+longitude+'qALz'+latitude);
  bgmap=('qTFBG'+aerialres+'z'+longitude+'qALz'+latitude);
  bgmapq=(bgmap+'Mzp'+zipmap).replace(/q/g,'q17');
  if (typeof(place_name)=='undefined') place_name=''
  demog=gniscgi+'Lat='+latitude+'&Long='+longitude+'&areatype=bg&place_name='+(place_name==''?'This Neighborhood':'Neighborhood+of+'+place_name.replace(/ /g,'+'))+'&vid='+vid+'#Demographics';
}

function midmaps() {
  predemog();
  mapbar();
 // if (!mlike(vid,'condex')) mapbar();
  //dw('<table width="100%"> <tr> <td align=left width=376>');
  dw('<table align="center"> <tr> <td align=left width=376>');
  if (showminimaps==1) dw('<img src='+itfdata+'qTFST4z'+longitude+'qALz'+latitude+' alt="TerraFly aerial map, 4 meters/pixels"><br>Aerial 1-mile wide<hr>');
  dw('</td><td align="right">')
  if (showminimaps==1) dw('<img src='+itfdata+zipmap+' alt="TerraFly Zipcode Map, '+zipres+' meters/pixel"><br>Zipcode '+zipcode+' (map width = '+zipres/4+' miles)<hr>');
  dw('</td></tr></table>');
  dw('<table width="'+tabwidth+'"> <tr>');
  if (showminimaps==1) {
  }
  dw('<td valign=top align=right>');
  dw('</td></tr></table>');
}
function demogmaps() {
  var dzipmap=('qTFZP'+zipres+'z'+longitude+'qALz'+latitude);
  var dbgmap=('qTFBG'+aerialres+'z'+longitude+'qALz'+latitude);
  //predemog();
  //mapbar();
 // if (!mlike(vid,'condex')) mapbar();
  //dw('<table width="'+tabwidth+'"> <tr> <td align=left width=376>');
  if (showminimaps) {dw('<img src='+itfdata+'qTFST4Bz'+longitude+'qALz'+latitude+' alt="TerraFly aerial map, 4 meters/pixels"><br>Aerial 1-mile wide with population count per block<hr>');
 dw('<img src='+itfdata+dbgmap+' alt="TerraFly map of U.S. Census 2000 Block Groups, '+aerialres+' meters/pixel"><br>Neighborhoods (US Census 2000 Block Groups) with aggregate annual income<b>/<\/b>population count (map width = '+aerialres/4+' miles)<hr>');
  dw('<img src='+itfdata+dzipmap+' alt="TerraFly Zipcode Map, '+zipres+' meters/pixel"><br>Zipcode '+zipcode+' (map width = '+zipres/4+' miles)<hr>');
}
}

function red() {
  dw('<font color=red>');
}

function hspace(){dw(' &nbsp;&nbsp; ')}
function tfpophelp(noresolution) {
hspace();
  flyhelp='http://terrafly.com/how_to_fly.html';
  dataqualityhelp=vn4c+'/gnis.cgi?ispopup=1&lat='+latitude+'&long='+longitude+'&vid='+vid+'&tfaction=dataqualityhelp';
  moregif='<img src='+images+'closeup.gif border=0 width=11 height=11>';
  flyhelppop='<b>To fly</b> (or to change direction), click on the image near an edge. To zoom, click on the Zoomin-Zoomout bar above the image. Click '+moregif+'for more help.';
hspace();
  popbi(redden('Data quality.'),popframe(dataqualityhelp));
  poph(dataqualityhelp,moregif,popframe(dataqualityhelp));
hspace();
hspace();
  popbi(redden('Downloading.'),'<b>To download</b> or order imagery or data or to <b>get prints</b>: <p>Method 1: in Terra<b>Flight</b> open the Download tab, press <b>MARK</b> (in the bar above the imagery window), drag the mouse over the imagery to create a red rectangle, then press <b><img src='+images+'dispense.gif></b>.  <i>To download a very large image: zoom-out, <b>MARK</b> a rectangle, press <b><img src='+images+'dispense.gif></b>, and you will get a menu of all resolutions and imagery available for the area you marked.</i><p>Method 2: in this PointData page in the table of regions below click on any <em><b>sq.miles</b></em> to get an appropriate region');
  poph(aerial,moregif,'Click for a menu of aerial products for this point');
}
function tfpophelpshort() {
  var valarrow='<img border=0 src='+images+'north-east.gif>';movehelp='<p>To <b>move</b>/recenter this page, click on the aerial <b>map</b> or enter an <b>address</b> or coordinates or click on any arrow '+valarrow+'.';
var  flyhelp='http://terrafly.com/how_to_fly.html';
var   helpgif='<img src='+images+'bluequestion.gif border=0 width=16 height=16>';
var          moregif='<img src='+images+'closeup.gif border=0 width=11 height=11>';
var  flyhelppop='<b>To fly</b> (or to change direction), click on the image near an edge. To zoom, click on the Zoomin-Zoomout bar above the image. Click '+moregif+'for more help.';
var pointdatahelp='In Terra<b>Flight</b>, for <b>information about a point</b> in the image, doubleclick on that point.<p><b>This PointData</b> page contains information about the object you clicked on, objects nearby, data about the area, and various maps.  <p>To see medium level details about any data item, place and <b>HOLD MOUSE</b> over any icon, link, or tab.  For more details click on the item.';
  //poph(aerial,helpgif,'Click for a menu of aerial products for this point');
  popq('',pointdatahelp+movehelp,600);
  //poph(aerial,downloadbutton,popframe(dataqualityhelp));
  //poph(dataqualityhelp,moregif,popframe(dataqualityhelp));
  //poph(aerial,downloadbutton,'Click for a menu of aerial products for this point.<p>'+downloadhelp);
}
function downloadbutton() {
var  dataqualityhelp=vn4c+'/gnis.cgi?ispopup=1&lat='+latitude+'&long='+longitude+'&vid='+vid+'&tfaction=dataqualityhelp';
var   downloadbutton='<img src='+images+'download.gif border=0 width=75 height=20>';
var downloadhelp='<b>To download</b> or order imagery or data or to <b>get prints</b>: <p>Method 1: in Terra<b>Flight</b> open the Download tab, press <b>MARK</b> (in the bar above the imagery window), drag the mouse over the imagery to create a red rectangle, then press <b><img src='+images+'dispense.gif></b>.  <i>To download a very large image: zoom-out, <b>MARK</b> a rectangle, press <b><img src='+images+'dispense.gif></b>, and you will get a menu of all resolutions and imagery available for the area you marked.</i><p>Method 2: in this PointData page in the table of regions below click on any <em><b>sq.miles</b></em> to get an appropriate region';
  poph(aerial,downloadbutton,'Click for a menu of aerial products for this point.<p>'+downloadhelp+popframe(dataqualityhelp));
}
function tfpophelpobsolete() {
  dw('<table width="'+tabwidth+'"><tr><td align=left width="25%">');
  flyhelp='http://terrafly.com/how_to_fly.html';
  dataqualityhelp=vn4c+'/gnis.cgi?lat='+latitude+'&long='+longitude+'&vid='+vid+'&tfaction=dataqualityhelp';
  moregif='<img src='+images+'closeup.gif border=0 width=11 height=11>';
  flyhelppop='<b>To fly</b> (or to change direction), click on the image near an edge. To zoom, click on the Zoomin-Zoomout bar above the image. Click '+moregif+'for more help.';
  popbi(redden('HELP on flying'),flyhelppop);
  poph(flyhelp,moregif,flyhelppop);
  dw('</td><td align=center width="25%">');
  popbi(redden('HELP on data quality'),popframe(dataqualityhelp));
  poph(dataqualityhelp,moregif,popframe(dataqualityhelp));
  dw('</td><td align=center width="25%">');
  popbi(redden('HELP on Point Data'),'For <b>information about a point</b> in the image, click on the point.<p> This PointData page contains information about the object you clicked on, objects nearby, data about the area, and various maps.  To see medium level details about any data item, place and <b>HOLD MOUSE</b> over any icon, link, or tab.  For more details click on the item.');
  dw('</td><td align=right width="25%">');
  popbi(redden('HELP on Downloading'),'<b>To download</b> or order imagery or data or to <b>get prints</b>: <p>Method 1: press <b><img src='+images+'mark.gif></b> (in the bar above the imagery window), drag the mouse over the imagery to create a red rectangle, then press <b><img src='+images+'dispense.gif></b>.  <i>To download a very large image: zoom-out, <b><img src='+images+'mark.gif></b> a rectangle, press <b><img src='+images+'dispense.gif></b>, and you will get a menu of all resolutions and imagery available for the area you marked.</i><p>Method 2: click in this page on any <font color=red>red sq.miles</font> to get an appropriate region');
  poph(aerial,moregif,'Click for a menu of aerial products for this point');
  dw('</td></tr></table>');
}

atest=0;
dispenser=(typeof(dispenser)=='undefined')?'':dispenser
b=' ';

function aconcat(d,x1,x2,x3,x4,x5) {
  return ((typeof(x1)=='undefined')?'':x1)+d+((typeof(x2)=='undefined')?'':x2)+d+((typeof(x3)=='undefined')?'':x3)+d+((typeof(x4)=='undefined')?'':x4)+d+((typeof(x5)=='undefined')?'':x5);
}

function astart() {
set_category();
apopup0='';
alabel0='';
all_set=0;
extraother='';
isArquery=(typeof(isArquery)=='undefined')?0:isArquery;
felipa_pulldown_on=1;
if (!isArquery&&p1!='census') dw('<table width="'+tabwidth+'" border=0><tr><td>');
  amoreurl='';
  aurl='';
  photoshown='';
  photoshow='';
  atitle=p1;
  strippref='';
  aicon='';
isdemog=0;
extras='';
ocat=''; //object category in singular, if other than aicon
  amoreurln=vn4c+'/arquery'+tester+'.cgi?category='+p1+'&x1='+longitude+'&y1='+latitude+'&tfaction='+tfaction+'&vid='+vid+'&place_name='+place_name.replace(/[^a-zA-Z0-9]/g,'+');
  if (p1=="havanastreets") {atitle='Havana Streets'; }
  if (p1=="obfs") {atitle='Observation Biological Field Stations'; aicon='obfs';ocat='station'}
  if (p1=="rtstream") {atitle='River Gauges'; aicon='rtstream';ocat='gauge'}
  if (p1=="rtgauges") {atitle='Stream Gauges'; aicon='rtstream';ocat='gauge'}
  if (p1=="hist_rtgaugaes") {atitle='History of Stream Gauges'; aicon='rtstream';ocat='gauge';
extrasparam='arcriteria=1&TIME%3E';
extras=extraref('all','')+extraref('recent',thisyear+'-'+yestermonth+'-'+yesterday);}
  if (p1=="deeds_props") {atitle='Deeds and County-recorded Documents'; aicon='bmaps';ocat='deed';

extrasparam='arcriteria=1&Document_Type_Description=DEED&Recording_Date%3E';
yesteryear=thisyear-1;
extras=extraref('all','')+extraref(thisyear,''+thisyear+'0101')+extraref(thismonth+'/'+thisyear,''+thisyear+thismonth+'01')+extraref(yesteryear+'-'+thisyear,''+yesteryear+'0101');
}
  if (p1=="ownership") {atitle='Property Records'; aicon='bmaps';ocat='property'}
  if (p1=="firstamerican_points") {atitle='Property Records (Nationwide)'; aicon='bmaps';ocat='property'}
  if (mlike(p1,"flproperties")) {
atitle='Parcels - Ownership Records'; aicon='bmaps';ocat='property';
amoreurln=arquery_url('flproperties-09');
extrasparam='arcriteria=1&'+(p1=='flproperties'?'HEX_VAL1':'EXMPT01')+'%3E';

extras=extraref('all','')+extraref('homesteaded','25000');
}
  if (p1=="nfolio") {atitle='County property records'; aicon='bmaps';ocat='property'}
  if (p1=="folio") {atitle='Property records'; aicon='bmaps';}
  else if (p1=="hotels") {atitle='Hotels';strippref='';aicon='hoteltr'; ocat='hotel';
extrasparam='stars%3E';
extraother='&stars%3C=0.5';
var him='<img alt=rating src='+images+'hotel'; var hg='.gif> ';
extras=extraref('all','')+extraref(him+5+hg+'5 stars','5')+extraref(him+4+hg+'4+','4')+extraref(him+3.5+hg+'3.5+','3.5')+extraref(him+3+hg+'3+','3')+extraref(him+2+hg+'2+','2')+extraref(him+1+hg+'1+','1')+extrarefmany(him+'tr'+hg+'other','');
}
  else if (p1.search('nno_')>0) {atitle='Annotations';aicon='other_solid'; ocat='annotated location'}
  else if (p1=="street") {atitle='Streets nearby (house number is approximate)';aicon='';ocat='street';
amoreurln=arquery_url('austreets');}
  else if (p1=="dining") {atitle='Food';aicon='restaurant';}
  else if (p1=="auintersections") {atitle='Intersections';}
  else if (p1=="austreets") {atitle='Street Segments'}
  else if (mlike(p1,'Street_Segment')) {atitle='Segments of '+p1.replace(/.*_/,'').replace(/MajHwys/,'Major Highways').replace(/SecHwys/,'Secondary Highways')+' with NavTeq Data'}
  else if (p1=="restaurant"||p1=="nv_restrnts") {atitle='Restaurants';aicon='restaurant';
extrasparam='anyfield';
extras=extraref('all','')+extraref('Italian','italian')+extraref('Chinese','chinese')+extraref('Japanese','japanese')+extraref('Thai','thai')+extraref('Mexican','mexican')+extraref('other American North&South','american+food')+extraref('Middle Eastern','middle eastern')+extraref('vegetarian','vegetarian')+extraref('fast food','fast+food')+extraref('sandwiches','sandwich');
}
 else if (mlike(p1,'nv_')) {
if (p1=='nv_autosvc') atitle='Auto Service';
if (p1=='nv_business') atitle='Larger Corporations';
if (p1=='nv_commsvc') atitle='Community Service';
if (p1=='nv_eduinsts') atitle='Education';;
if (p1=='nv_entertn') atitle='Entertainment';
if (p1=='nv_fininsts') atitle='Banks';
if (p1=='nv_hamlet') atitle='Hamplets';;
if (p1=='nv_hospital') atitle='Hospitals';
if (p1=='nv_namedplc') atitle='Places';;
if (p1=='nv_parking') atitle='Parking';
if (p1=='nv_parkrec') atitle='Parks and Recreation';
if (p1=='nv_restrnts') atitle='Restaurants';;
if (p1=='nv_shopping') atitle='Shopping';
if (p1=='nv_transhubs') atitle='Transportation';
if (p1=='nv_travdest') atitle='Travel Destinations';



}
  else if (preal) {atitle='MLS Real Estate Professional';aicon='realestate';
ocat='property';
extrasparam='arcriteria=1&status=A&list_price%3C=2000000&property_type';
extras=extraref('All','')+extraref('RE1/Houses','RE1')+extraref('RE2/Condos','RE2')+extraref('Rental','RNT')+extraref('Commercial','COM')+extraref('Business','BUS')+extraref('Res. land','RLD')+extraref('Commercial land','CLD')+extraref('Res. income','RIN')+'<br>';
extrasparam='arcriteria=1&list_price%3C=2000000&status';
extras=extras+extraref('Any status','').replace(/,/,'')+extraref('Active','A');
extrasparam='arcriteria=1&list_price%3E=30000&closing_date%3E=2008-02-01&status';
extras=extras+extraref('Closed','CS');
extrasparam='arcriteria=1&status=A&list_price%3C=2000000&number_of_beds';
extras=extras+extraref('1 bedroom','1')+extraref('2','2')+extraref('3','3');
extrasparam='arcriteria=1&status=A&list_price%3C=2000000&number_of_beds%3E';
extras=extras+extraref('1+','1')+extraref('2+','2')+extraref('3+','3')+extraref('4+','4')+extraref('5+','5');
extrasparam='arcriteria=1&status=A&list_price%3C=5000000&price_vs_market%3E=0.2&price_vs_market%3C=1.7&special_information';
extras=extras+extraref('Foreclosure','FORECLOSE');
extrasparam='arcriteria=1&status=A&list_price%3C=5000000&price_vs_market%3E=0.15&price_vs_market%3C';
extras=extras+extraref(newgif+'<b title=Probably-undervalued>Undervalued?</b>','0.95')+extraref(newgif+'<b title=Probably-very-undervalued>Steals?</b>','0.8');
extrasparam='arcriteria=1&status=A&list_price%3C=5000000&Short_Sale';
extras=extras+extraref(newgif+'Short Sale','Y');
extrasparam='arcriteria=1&status=A&list_price%3C=5000000&REO';
extras=extras+extraref(newgif+'REO','Y');
userid=tfuser();
if (userid!='') {extrasparam='arcriteria=1&status=A&list_agent_public_id';
extras=extras+extraref(newgif+'My Listings',userid)}
}
  else if (p1=="wikix") {atitle='Wikipedia'}
  else if (p1=="nypages") {atitle='Business Directory';aicon='business';

extrasparam='arcriteria=1&siccode';
extras=extraref('all','')+extraref('food','food')+extraref('faith','religious');
extrasparam='arcriteria=1&sales%3E';
extras+=extraref('lucrative','500000');
extrasparam='arcriteria=1&numofemp%3E';
extras+=extraref('large','10');



}
else if (p1=="emergencycalls") {atitle="Emergency Calls Test System";
extrasparam='arcriteria=1&Call_type';
extras=extraref('all','')
extras=extras+extraref('SMS','SMS');
extras=extras+extraref('MMS','MMS');
extras=extras+extraref('Voice','Voice');
extras=extras+extraref('Cell','Cell');
extras=extras+extraref('Land','Land');
extrasparam='arcriteria=1&Test_type';
extras=extras+extraref('Actual-Human','Human');
extras=extras+extraref('Simulated','Simulated');
}
  else if (p1=="crime_dade") {atitle='Crimes and Incidents Reported by Miami-Dade County and Municipal Police Departments'}
  else if (p1=="physicians") {atitle='Physicians';aicon='medical';
extrasparam='arcriteria=1&PPSC';
extras=extraref('all','')
extrasparam='arcriteria=1&PHYSICIAN_CREDENTIALS|';
extras=extras+extraref('MD','MD');
extras=extras+extraref('Dentist','DDS+DDM');
extrasparam='arcriteria=1&PPSC|';
extras=extras+extraref('General','01');
extras=extras+extraref('Family','08');
extras=extras+extraref('Internal','11');
extras=extras+extraref('Orthopedic','20');
extras=extras+extraref('Optometry','41');


}
  else if (p1=="iypages") {atitle='Business Directory 2009';aicon='business';

extrasparam='arcriteria=1&sic';
extras=extraref('all','')
extrasparam='arcriteria=1&sic|';
extras=extras+extraref('physicians','doctor+doctors+physician+physicians');
extras=extras+extraref('dentists','dentist+dentists+dental');
extras=extras+extraref('restaurants','restaurants+restaurant+eating');
extras=extras+extraref('grocery','grocery+groceries')+extraref('stores','store+stores');extraref('faith','religious+synagogues+churches');
extrasparam='arcriteria=1&anyfield|';
extras=extras+extraref('condo','condominium+condominiums');
extrasparam='arcriteria=1&sales%3E';
extras+=extraref('lucrative','500000');
extrasparam='arcriteria=1&numofemp%3E';
extras+=extraref('large','10');



}
  else if (mlike(p1,'_UNION')) {atitle='Unified Dataset of Major Points'; }
  else if (p1=="canada_ypages") {atitle='Yellow Pages';aicon='business';}
  else if (p1=="ypages") {atitle='Yellow Pages';aicon='business';
extrasparam='anyfield';
extras=extraref('all','')+extraref('stores','shopping')+extraref('food','food+and+dining')+extraref('government',':government')+extraref('gas','gas+stations')+extraref('physicians','doctors')+extraref('dentists','clinics:dentistry')+extraref('hair','salons')+extraref('galleries',':galleries')
}
    else if (p1=="bcndx") {atitle='Featured Condominium Buildings'; aicon='re2';
ocat='building';
extrasparam='arcriteria=1&preconstruction'; extras=extraref('all','')+extraref('preconstruction','true')+extraref('occupied','false');}
    else if (p1=="cndx") {atitle='Condos on Market'; aicon='re2';
ocat='condo';
extrasparam='arcriteria=1&sale_price%3C=2000000&number_of_beds';
extras=extraref('all','')+extraref('1 bedroom','1')+extraref('2','2')+extraref('3','3');
extrasparam='arcriteria=1&sale_price%3C=2000000&number_of_beds%3E';
extras=extras+extraref('1+','1')+extraref('2+','2')+extraref('3+','3')+extraref('4+','4')+extraref('5+','5');

}
  else if (p1=="real") { atitle='Homes offered'; aicon='realestate';
extrasparam='arcriteria=1&property_type_code'; extras=extraref('all','')+extraref('houses',1)+extraref('condos',2);
ocat='property';

    if (vid=="ramb") atitle='MLS Residential Listings (multi-source)';
  }
  else if (p1=="ramb"||p1=="fproperties"||p1=="callreal") { atitle='Real estate offered in MLS'; aicon='realestate';
if (mlike(tfaction,'rambbroker;')){var identity=tfaction.replace(/.*rambbroker;/,'').replace(/^[^;]*;/,'').replace(/[;+]/g,' '); atitle=identity}
    if (p1=="fproperties") atitle='Featured Real Estate';
ocat='property';

extrasparam='arcriteria=1&price%3C=2000000&bedroom';
extras=extraref('all','')+extraref('1 bedroom','1')+extraref('2','2')+extraref('3','3');
extrasparam='arcriteria=1&price%3C=2000000&bedroom%3E';
extras=extras+extraref('1+','1')+extraref('2+','2')+extraref('3+','3')+extraref('4+','4')+extraref('5+','5');

if (p1=="callreal") {
extrasparam='arcriteria=1&list_price%3C=2000000&property_type';
extras=extraref('All','')+extraref('Houses','RE1')+extraref('Condos','RE2')+extraref('Rental','RNT');
extrasparam='arcriteria=1&list_price%3C=2000000&number_of_beds';
extras=extras+extraref('1 bedroom','1')+extraref('2','2')+extraref('3','3');
extrasparam='arcriteria=1&list_price%3C=2000000&number_of_beds%3E';
extras=extras+extraref('1+','1')+extraref('2+','2')+extraref('3+','3')+extraref('4+','4')+extraref('5+','5');
extrasparam='arcriteria=1&list_price%3C=5000000&Short_Sale';
extras=extras+extraref(newgif+'Short Sale','Y');
extrasparam='arcriteria=1&status=A&list_price%3C=5000000&REO';
extras=extras+extraref(newgif+'Foreclosed','Y');


}
  }
  else if (p1=="fires") {atitle='Fires'; aicon='fire'; ocat='fire location'}
  else if (p1=="nraws") {atitle='Weather Stations';aicon='weather';ocat='station'}
  else if (p1=="raws") {atitle='Weather Stations';aicon='weather';ocat='station'}
  else if (p1=="town") {atitle='Towns and Incorporated Areas';aicon='city';}
  else if (p1=="ikonos") {atitle='Ikonos Satellite Images';aicon='';ocat='image'; extrasparam='arcriteria=1&mcca_full%3C'; extras=extraref('all','')+extraref('clear','10');}
  else if (p1=="geoeye") {atitle='GeoEye Satellite Images';aicon='';ocat='image'; extrasparam='arcriteria=1&mcca_full%3C'; extras=extraref('all','')+extraref('clear','10');}
  else if (p1=="medical_dade") {atitle='Medical Examiner Records';aicon='other';}
  else if (p1=="wtown3") {atitle='Towns';aicon='city';}
  else if (p1=="wcity") {
    atitle='Hub Cities';
    aicon='hubcity';ocat='city';
    aurl='http://books-maps.com/'+kountrycode;
  }
  else if (p1=='gnis'||p1=='newgnis'||p1=='gnis2009') {ocat='place';
    atitle='Places';
extrasparam='placetype';
extraother='&placetype!=museum';
if (USA&&p1=='gnis') extras=extraref('all','')+extraref('communities','community')+extraref('parks','park')+extraref('public buildings','building')+extraref('locales','locale')+extraref('worship','faith')+extraref('heliports','heliport')+extraref('hospitals','hospital')+extraref('streams','stream')+extraref('lakes','lake')+extraref('bridges','bridge')+extrarefmany('museums','anyfield=museum')+extraref('towers','tower')+extraref('islands','island')+extrarefmany('','');
if (USA&&(p1=='gnis2009'||p1=='newgnis')) extras=extraref('all','')+extraref('communities','populated')+extraref('parks','park')+extraref('public buildings','building')+extraref('locales','locale')+extraref('worship','church')+extrarefmany('heliports','anyfield=heliport')+extraref('hospitals','hospital')+extraref('streams','stream')+extraref('lakes','lake')+extraref('bridges','bridge')+extrarefmany('museums','anyfield=museum')+extraref('towers','tower')+extraref('islands','island')+extrarefmany('','');
    aicon='other';
  }
  else if (p1=="geoimages") {atitle='High-res Photo Library'; aicon='';

extrasparam='arcriteria=1&visualvalue%3E'; extras=extraref('all','')+extraref('nice',4)+extraref('best',5);
}
  else if (p1=="airport") {atitle='Airports (ICAO code, Name, Elevation)'; aicon='airport';

extrasparam='arcriteria=1&name'; extras=extraref('all','')+extraref('international','INTL');
}
  //else if (p1=="school") {atitle='Schools'; aicon='school';amoreurl=schoolref}
  else if (p1=="ngagns") {atitle=(USA?'Offshore':'Places'); aicon='otherblue'; 
ocat='place';
extrasparam='arcriteria=1&FC'; extras=extraref('all','')+extraref('community','P')+extraref('water','H')+extraref('height','T')+extraref('undersea','U');}
  else if (p1=="public_schools") {atitle='Public Schools'; aicon='school';

extrasparam='arcriteria=1&sch_level_code'; extras=extraref('all','')+extrav('Primary')+extrav('Middle')+extrav('High');
}
  else if (p1=="gnsw") {atitle='Places/NGA'; aicon='otherblue'; 
ocat='place';
extrasparam='arcriteria=1&FT'; extras=extraref('all','')+extraref('community','P')+extraref('water','H')+extraref('height','T')+extraref('undersea','U');}
  else if (p1=="public_schools") {atitle='Public Schools'; aicon='school';

extrasparam='arcriteria=1&sch_level_code'; extras=extraref('all','')+extrav('Primary')+extrav('Middle')+extrav('High');
}
  else if (p1=="private_schools") {atitle='Private Schools'; aicon='school';
extrasparam='arcriteria=1&orient'; extras=extraref('all','')+extrav('Baptist')+extrav('Catholic')+extrav('Evangelical')+extrav('Jewish')+extrav('Lutheran')+extrav('Nonsectarian');
}
  else if (p1=="school") {atitle='Schools'; aicon='school'
extrasparam='arcriteria=1&type'; extras=extraref('all','')+extraref('public','Public')+extraref('private','Private');
extrasparam='arcriteria=1&institution_name'; extras+=extraref('high','high');
extrasparam='arcriteria=1&total_students%3E'; extras+=extraref('big','1000');


}
  //else if (p1=="college") {atitle='Colleges'; aicon='school'}
  else if (p1=="college") {atitle='Colleges'; aicon='college';
extrasparam='arcriteria=1&type_of_college'; extras=extraref('all','')+extraref('public','Public')+extraref('private','Private');
extrasparam='arcriteria=1&anyfield'; extras+=extraref('4-year','4-year');

}
  else if (p1=="photos") {atitle='Architecture Photography'; aicon='';ocat='building'}
else if (p1=="ptrim") {atitle='Rainfall Yesterday</b> (NASA Goddard TRMM, mean over .25x.25 degree cell)';
ocat='cell';
extrasparam='arcriteria=1&daily%3E'; extras=extraref('all','')+extraref('wet','0.01')+extraref('soaked','15');
}
  else if (p1=="posters") {atitle='Posters';
ocat='image';
extrasparam='city%3E'; extras=extraref('all','')+extraref('urban','a');
}
  else if (p1=="blocks") {atitle='Census Blocks'; ocat='Census block'}
  else if (p1=="dos") {atitle='Department of State Markers'; ocat='marker'}
else  if (p1=='pblock'||p1=='pbg'||p1=='ptract'||p1=='pzipcode'||p1=='pmetro'||p1=='pcongress'||p1=='pincorp'||p1=='pcounty'||p1=='psubcounty') {



extrasparam='arcriteria=1&sf1P013001%3E';
extras=extraref('all','');
extras+=extraref('adult',60);
extrasparam='arcriteria=1&sf1P013001%3C';
extras+=extraref('young',30);
if (p1!='pblock') {
extrasparam='arcriteria=1&sf1P017001%3E';
extras+=extraref('kids',3);
extrasparam='arcriteria=1&sf3H024001%3E';
extras+=extraref('spacious',4);
extrasparam='arcriteria=1&sf3P053001%3E';
extras+=extraref('wealthy',60000);
}
atype=p1.substr(1,30);
longertype=atype;
if (atype=='metro') longertype='Metropolitan Area';
if (atype=='congress') longertype='Congressional District';
if (atype=='zipcode') {longertype='Zip Code'}
longertypes=longertype+'s';
if (atype=='tract') longertype='Greater Neighborhood (Census Tract)';
if (atype=='tract') longertypes='Greater Neighborhoods (Census Tracts)';
if (atype=='bg') longertype='Neighborhood (Census Block Group)';
if (atype=='bg') longertypes='Neighborhoods (Census Block Groups)';
if (atype=='county') longertype='County';
if (atype=='county') longertypes='Counties';
if (atype=='incorp') {longertype='Town'; longertypes='Towns and Incorporated Areas'}
if (atype=='block') longertype='Census Block';
if (atype=='block') longertypes='Blocks (per U.S. Census)';
ocat=longertype;
atitle=longertypes;
isdemog=1;
}
  else if (p1=="census") {
    predemog();
    //atitle='Areas containing the current object </b>(click <i>'+redden('sq. mileage')+'</i> for aerials, prints, atlases; click <i>population</i> for demographics</i>)';
    atitle='Areas containing the current object </b>(click "<b>GO</b>" to download aerials, atlases and reports or to order prints)';
if (!showPremium) atitle='Areas';
    aicon='';
  }
  if (amoreurl=='') {
    if (strippref=='') amoreurl=amoreurln;
    else amoreurl=n157e+'wde-fmt/Executor?SName='+strippref+'STAT&F=SHTML&META=off&numfind=100&y1='+latitude+'&x1='+longitude;
  }
  if (aurl=='') aurl=amoreurl;
  //if (aurl=='') aurl=arquery_keyurl(p1);
  distcnbr=0;
  if (beston==0) dw('<a name="'+p1+'"></a>');
  if (isArquery) dw('<h2 class=titlepageGQ><b>'+atitle+'</b></h2>'+((extras==''||ispopup)?'':'<p><center>'+extras.replace(/^, /,'')+'</center><p>'));
  else dw('<p><b>'+(aicon!=''?'<img src='+images+aicon+'.gif border=0> ':'')+atitle+((extras==''||ispopup)?'':' ('+extras.replace(/^, /,'')+')')+':</b> ');
  if (p1=="census") startdemographics();
}

function extrav(label){return extraref(label,label)}

function extraref(label,typevalue){
if (label=='all') all_set=1;
extraother=extraother+'&'+extrasparam.replace(/%.*/,'')+'!='+typevalue; return ', <a href='+amoreurln+(typevalue==''?'':'&extraref=1&'+extrasparam+'='+typevalue)+'>'+label+'</a>'}

function extrarefor(label,typevalue){
extraother=extraother+('|'+typevalue).replace(/\|/g,'&'+extrasparam+'!=');
return ', <a href='+amoreurln+'&extraref=1'+('|'+typevalue).replace(/\|/g,'&'+extrasparam+'|=')+'>'+label+'</a>'}


function extrarefmany(label,expression){return ', <a href='+amoreurln+'&extraref=1&'+(expression==''?extraother:expression)+'>'+(label==''?'other':label)+'</a>'}

function arec0(plat,plong,pdist,pcomp,poff,pname) {
  //dw(aurl);

  photo='';
  zip_code=zipcode;
  aaddress='';
  azipcode=zipcode;
  alatitude=plat;
  alongitude=plong;
  distance=pdist;
  adistance=distance;
  compass_direction=pcomp;
  offset=poff;
  aname='';
  if (typeof(pname)!='undefined') aname=pname;
  alabel=aname;
  asublabel='';
set_category();
  aurl=arquery_keyurl(p1);
}
function set_category(){
p1=(typeof(p1)=='undefined'?0:p1);
preal=(mlike(p1,'allreal')&&(p1!='callreal')); //preal = professional realtor interface
creal=(mlike(p1,'allreal')||p1=='ramb'||p1=='emergencycalls'); //creal = professional or consumer realtor interface
}

function arec(fullrecord) {
var f=new Array();
var f=('	'+fullrecord).split('	');
var f1=f[1];
var f2=f[2];
var f3=f[3];
var f4=f[4];
var f5=f[5];
var f6=f[6];
var f7=f[7];
var f8=f[8];
var f9=f[9];
var f10=f[10];
var f11=f[11];
var f12=f[12];
var f13=f[13];
var f14=f[14];
var f15=f[15];
var f16=f[16];
var f17=f[17];
var f18=f[18];
var f19=f[19];
var f20=f[20];
var f22=f[11];
var f22=f[22];
var f23=f[23];
var f24=f[24];
var f25=f[25];
var f26=f[26];
var f27=f[27];
var f28=f[28];
var f29=f[29];

  var _staticLayer = false;
set_category();
  apoptext='';
  //if (alabel=='') alabel=f1;
  if (alabel=='') alabel=f1;
  extralabel='';
  apopurl=arquery_keyurl(p1);
  //aurl=amoreurl;
  photo='';
  aall=aconcat(' ',f1,f2,f3,f4,f5);
  apoptext=aall;
  apoptext=popframe(apopurl);
  acounter=(typeof(acounter)=='undefined')?0:acounter;
  acounter++; 
isArquery=(typeof(isArquery)=='undefined')?0:isArquery;
  if (acounter==1&&isArquery!=1) astart();

  if (atest) dw('aall='+aall);
  if (p1=="wikix") aurl=f2;
  if (p1=="wtown3") {apoptext=f1+', '+f3; aurl=gniscgi+'Lat='+alatitude+'&Long='+alongitude+'&tfaction='+tfaction+'&place_name='+alabel.replace(/ /g,'+');


}
if (p1=="physicians") asublabel=f2+' '+f5;
  if (p1=="ikonos") {
var jpgurl='http://archive.spaceimaging.com/'+f[13]+'/'+f[14];
aurl='/cgi-bin/tfdispense.cgi?lat='+alatitude+'&long='+alongitude+'&tab=ikonos&label=Ikonos+Scene';
apoptext='Ikonos Scene on '+aname+'. Click to price/dispense. Resampled preview:<br><img src='+jpgurl+'>';
scenedate=f1.replace(/ *on /,'');
cloudpct=f3;
alabel=aname;

asublabel=cloudpct+'% cloudy';
}
  if (p1=="geoeye") {
var jpgurl=f[28];
aurl='/cgi-bin/tfdispense.cgi?lat='+alatitude+'&long='+alongitude+'&tab=ikonos&label=Satellite+Scenes';
scenedate=f1.replace(/ *on /,'');
aname=hyphenate_date(scenedate);
cloudpct=f3;
alabel=aname;

asublabel=cloudpct+'% cloudy';
community=f[29];
apoptext=f[21]+' Satellite Scene on '+aname+'. Click to price/dispense. Resampled preview:<br><img src='+jpgurl+'>';
}
if (p1=="wikix") {photo=f5.replace(/http[^ ]*png/g,'')}
  if (p1=="bcndx") { aname=f4; alabel=aname; photo=f[28]; apoptext=atitle+': '+alabel;
aurl='http://miamiherald.uscondex.com/buildingview.asp?TrackFrom=TerraFly&PropertyId='+f1;
}
  if (p1=="obfs") { aname=f7; alabel=aname; apoptext=atitle+': '+alabel;}
  if (p1=="street") { aname=f1; alabel=aname; apoptext="Approximate nearest address in street block. Click for demograpic street block data";aurl=vn4c+'/arquery.cgi?category=pblock&y1='+alatitude+'&x1='+alongitude}
  if (p1=="atlasgnis") { aname=f1; alabel=aname; apoptext="Web site";aurl=f5}
  if (p1=="rtstream") { aname=f6; alabel=aname; apoptext="Click for real time reading";aurl=f[14]}
  if (p1=="rtgauges") { aname=f6; alabel=aname; 
aurl=f[16];
asublabel=measuredisplay(f[11],'ft','The water stage at '+aname+' is'); apopurl=aurl;
apoptext='Click for real time reading from  '+aname+popframe(aurl);

};
  if (p1=="rtgauges") { aname=f6; alabel=aname; 
aurl=f[16];
asublabel=measuredisplay(f[11],'ft','The water stage at '+aname+' is'); apopurl=aurl;
apoptext='Click for real time reading from  '+aname+popframe(aurl);

};
  if (p1=="hist_rtgaugaes") { aname=f6; alabel=aname; 
aurl='http://waterdata.usgs.gov/nwis/uv?'+f5;
asublabel=measuredisplay(f[11],'ft','The water stage at '+aname+' is'); 
apopurl=aurl;
apoptext='Click for real time reading from  '+aname+popframe(aurl);

};
  if (p1=="college") {collegeid=f1;college_address=f2;college_city=f3;college_state=f4; college_zip_code=f5; aname=f6; college_type=f7; aaddress=college_address; azipcode=college_zip_code;
aurl=f8.replace(/.*=/,'http://nces.ed.gov/globallocator/col_info_popup.asp?ID=') ; }
  if (p1=='gnis'||p1=='newgnis'||p1=='gnis2009'){aname=f1;type=f2}
  if (p1=="photos"){aname=f1; photo=f2;apoptext=aname }
  if (p1=="hotels"){aname=f1; hotel_chain=f2; reserve=f3; info=f4; stars=f5; street_address=f6; city=f7; state=f8; country=f9; 

zip_code=f[10]; phone=f[11]; photo=f[12]; pid=f[13]; hotel_facilities=f[16]; policy=f[17]; daily_rate_min=f[18]; daily_rate_max=f[19]; currency=f[20]; supplier=f[21];  
aaddress=street_address; azipcode=zip_code;


}
  if (p1=='real') {
aurl=f[22];
    property_type=f1;
    price=f2; area=f3;
    bedroom=unblank(f4); bathroom=unblank(f5); photo=f6;
    property_features=f7; community_features=f8;
    year_built=f9; 
street_address=f[10]; unit=f[11];
aaddress=street_address;

    community=f[12]; county=f[13]; city=f[14]; state=f[15];
    zip_code=f[16]; property_id=f[17]; contact=f[18];
azipcode=zip_code;
    phone=f[19]; fax=f[20]; email=f[21]; info=f[22];
    supplier=f[23]; listing_type=f[26]; lot_size=f[27];
    description=f[28]; property_view=f[29]; virtual_tour=f[30];
    property_type_code=f[31]; placetype=f[32]; object_id=f[33];
    if (zipcode==32804) {
      aurl=info;
      amoreurl='http://www.realtor.com/FindHome/HomeListings.asp?frm=byzip&st=&typ=1&typ=2&typ=3&typ=4&typ=5&typ=6&poe=realtor&mnbed=0&mnbath=0&mnprice=0&mxprice=99999999&js=off&pgnum=1&lnksrc=&fid=so&mnsqft=&mls=xmls&optInCheckbox=yes&zp=32804';
    }
  }
if (p1=='cndx') {
photo=f[33]; area=f[23];year_built=f[26];
lot_size='';
virtual_tour='';
street_address=f7;
aaddress=street_address;
unit=f6;
property_type='';
property_features='';
community_features='';
supplier='';
listing_type='';
price=f[40]; bedroom=unblank(f[21]); bathroom=unblank(f[22]);community=f4;
if (price=='') price=f[17]+'/month'}

  if (p1=='ramb'||p1=='fproperties') {
photo=f1
    property_type=f1;
    price=f2; area=f3;
    bedroom=unblank(f4); bathroom=(unblank(f5)/1)+(unblank(f6)/2); photo=f7;
    property_features=''; community_features='';
    year_built=f9; street_address=f[10]; unit=f11;
aaddress=street_address;
azipcode=f16;
    community=f12; county=''; city=f14; state='';
lot_size=f23; virtual_tour='';listing_type=f1;
supplier='';
}
  if (p1=='blocks') aurl=gniscgi+'Lat='+alatitude+'&Long='+alongitude+'&aid='+f1+'&vid='+vid+'&areatype=block&place_name=Census+Block+'+f1+'+'+alabel.replace(/ /g,'+');
if (isdemog) {
longername=f1;
if (p1=="pblock"||p1=="pbg"||p1=="ptract") longername=longertype+' '+f2 +' centered at '+f1;
if (p1=='pzipcode') longername='Zipcode '+f2.substr(1,30);
aurl=gniscgi+'Lat='+alatitude+'&Long='+alongitude+'&aid='+f2+'&vid='+vid+'&areatype='+atype+'&place_name=+'+longername.replace(/ /g,'+');
aname=f1;
if (atype=='tract'||atype=='block'||atype=='bg') aname='@'+f1;
alabel=aname; asublabel=K(f5)+' people'+(p1!='pblock'?' $'+K(f12):'')+' '+measuredisplay(K(f3),'sq.mi.','The area of '+aname+' is');
apoptext='Click for detailed reports on '+longername+ '; US Census 2000: population '+K(f5)+ (p1!='pblock'?', Median Household Income: $'+K(f12):'');
}
  if (p1=="fires") {
    instrument=f1; date=f2; time=f3;
    temperature1=f4; temperature2=f5; temperature3=f6; ecosystem=f7; landcover=f8; flag=f9; mask=f10; conf=f11;
  }
  if (p1=="wcity") {
    acitycode=f1; aname=f2; astatecode=f3; acountrycode=f4; astate=f5; acountry=f6;  alabel=aname;
asublabel=astatecode;
    akountrycode=((acountrycode=='US')?'US_'+astatecode:acountrycode); aurl='http://books-maps.com/'+akountrycode;
    apoptext=aname+' ('+acitycode+'), '+astate+' '+(acountrycode=='US'?'':acountry);
  }
  if (p1=="raws"){aname=f1;  }
  if (p1=="nraws"){aname=f1;  }
  if (p1=="airport"){aname=f2; elevation=f3; acode=f1; aurl='http://www.fallingrain.com/icao/'+acode+'.html';  alabel=acode+' '+aname; asublabel=elevationdisplay(elevation);  apoptext='ICAO code: '+acode+ ', Name: '+ aname+', Elevation: '+elevation +' feet '+convert_units(elevation,'ft') }
  if (atitle=="Annotations"){aname=f1; alabel=f1; apoptext='Annotation of this point made by a member of this user group'}
  if (p1=="school"){aname=f2; aaddress=f3; ownership=f6; level=f7; sccode=f9; 
}
  if (p1=="dining"){aname=f2; type=f3; aaddress=f4; city=f5; azipcode=f7; phone=f8; }
  if (mlike(p1,'nv_')) {aname=f4; 
if (!mlike(aname,'[a-zA-Z]')) aname=f5;
alabel=aname

}
  if (p1=="restaurant"||p1=="nv_restrnts"){aname=f4; type=f19; aaddress=f7+' '+f8; city=''; zip_code=zipcode; phone=f12;
asublabel=type.replace(/^OTHER$/,'').replace(/ FOOD/,'')+' '+aaddress+' '+phone;
azipcode=zip_code;
alabel=aname;
apoptext=type+' Restaurant '+aname+' at '+aaddress;
 }
  if (p1=="canada_ypages"){aname=f2;  type=''; aaddress=f3; city=f4; azipcode=f6; phone=f7; }
  if (p1=="nypages"){aname=f2;  type=f23; aaddress=f25; city=f10; azipcode=f3; phone=f8; }
  if (p1=="iypages"){aname=f2;  type=f26; aaddress=f4; city=f4; azipcode=f6; phone=f7; }
  if (p1=="ypages"){aname=f2; type=f3; aaddress=f4; city=f5; azipcode=f7; phone=f8}

  if (p1=='nraws') {
    //_staticLayer=true;
    alabel=aname.replace('zz_','').replace(statecode+'_','').replace(/_/g,' ');
    //aurl='http://raws.boi.noaa.gov/obs/'+aname+'.txt';
    //aurl=f3.replace(/boi/,'wrh');
    aurl=f3;
    apoptext='Click for detailed report from automatic weather station '+aname+popframe(aurl);
  }
  if (p1=="geoimages") {alabel=f1;apoptext=f1;photo=f3}
  if (p1=='fires') {
    alabel=date;
    apoptext=aall;
  }
  if (p1=='real'||p1=='ramb'||p1=='fproperties'||p1=='cndx') {
    if (numericG(price)) priceK=K(price);
    else priceK=price;
    sqft=area+'sq.ft.'; if (area==''||area=='0') sqft='';
    built='built in '+year_built; if (year_built=='') built='';
    lot='on '+lot_size+' sq.ft. lot'; if (lot_size=='') lot='';
    tour='<a href='+virtual_tour+'>Virtual Tour</a>'; if (virtual_tour=='') tour='';
if (bathroom<'1') bathroom='';
    apoptext='$'+ priceK +displayif(b,bedroom,' bedroom')+ displayif(b,bathroom,' bathroom')+displayif(b,sqft)+b+street_address+b+unit+b+property_type+b+built+displayif(' in ', community)+b+property_features+b+community_features+b+displayif('/',supplier);

    if (zipcode==32804) apoptext='Click for full details about this home for sale at Realtor.com';
    alabel='$'+priceK+b+bedroom+'/'+bathroom;
asublabel=sqft+b+street_address;
  }

if (p1=='posters') {photo=f10;aurl='http://vn4.cs.fiu.edu/cgi-bin/tfdispense.cgi?long='+alongitude+'&lat='+alatitude+'&width=10000&height=10000&tab=poster&preclick='

}

  if (p1=='callreal'||preal||p1=='re2'||p1=='re2_RAMB'||p1=="re1"||p1=="re1_RAMB") {
photo=f1;
acounty=f[46];
if (acounty=='DADE') acountynbr=dadenbr;
if (acounty=='BROWARD') acountynbr=browardnbr;
flcounty=acountynbr;
folio=f[61];
price=f[76];
area=f[121];
virtual_tour='';
lot_size='';
bedroom=1*unblank(f2);
fbathroom=unblank(f3);
hbathroom=unblank(f4);
year_built='';
street_address=f[38];
aaddress=street_address;
unit='';
community=f[42];
property_type='property';
  if (p1=="re2"||p1=="re2_RAMB") property_type='condo';
  if (p1=="re1"||p1=="re1_RAMB") {
street_address=f[36];
aaddress=street_address;
fbathroom=unblank(f5);
hbathroom=unblank(f7);
property_type='house';
}
bathroom=fbathroom/1+(hbathroom/2);
property_features='';
community_features='';
listing_type=f[109];
county_value=f[510];
supplier='';
    priceK=K(price);
    sqft=area+'sq.ft.'; if (area=='') sqft='';
    built='built in '+year_built; if (year_built=='') built='';
    lot='on '+lot_size+' sq.ft. lot'; if (lot_size=='') lot='';
    tour='<a href='+virtual_tour+'>Virtual Tour</a>'; if (virtual_tour=='') tour='';
    //apoptext='Click to display: $'+ priceK +b+ bedroom +' bedroom '+ bathroom +' bathroom '+b+sqft+b+street_address+b+unit+b+property_type+b+built+b+'in '+ community+b+property_features+b+community_features+b+listing_type+'/'+supplier;
    apoptext='Click to display: $'+ priceK +displayif(b,bedroom,' bedroom')+ displayif(b,bathroom,' bathroom')+b+sqft+b+street_address+b+unit+b+property_type+b+built+b+displayif('in ',community)+b+property_features+b+community_features+b+listing_type+displayif('/',supplier);

    if (zipcode==32804) apoptext='Click for full details about this home for sale at Realtor.com';
    if (bedroom*1>=1) alabel='$'+priceK+b+bedroom+'/'+bathroom;
    else alabel='$'+priceK+b+street_address;
  }

  smartkeyword='service';
  if (p1=='canada_ypages'||p1=='iypages'||p1=='nypages'||p1=='ypages'||p1=='dining'||p1=='restaurants') {
    apoptext=aname+', '+type+' at '+aaddress+'. Click for more details';
    alabel=aname; asublabel=aaddress+' '+phone;
    //if (0<type.search('Dining')) {alabel=aname;smartkeyword='restaurants'}
    if (p1=='dining'||p1=='restaurants') {
smartkeyword='restaurants'}

    asearchstring=aname.replace(/ /g,'+').replace(/.*: */,'');
    //aurl='http://service.bfast.com/bfast/click?siteid=35724832&bfpage=banner1_new&bfmid=27359743&czac='+zip_code+'&t=0&s=0&p=1&v=2&q='+asearchstring;
    aurl='http://google.com/maps?near='+azipcode+'&q='+asearchstring;
if (p1=='nypages') {alink=f13;
if (mlike(alink,'http')) aurl=alink;
b=' ';
asublabel+=acom(f9);
asublabel+=acom(f7,'fax: '); //b+(f7>' '?'fax '+f7:'');
asublabel+=acom(f5)+acom(f16)+acom(f21)+acom(K(f22),' sales: $');
asublabel+=acom(f20,'',' employees')+acom(f23,'SIC: ');
apoptext=alabel+b+asublabel+b+alink;
}
if (p1=='iypages') {alink=f16;
if (mlike(alink,'http')) aurl=alink;
else if (mlike(alink,'www|[.]com')) aurl='http://'+alink;
b=' ';
asublabel+=acom(f9);
asublabel+=acom(f8,'fax: '); //b+(f7>' '?'fax '+f7:'');
asublabel+=acom(f17)+acom(f18)+acom(f22)+acom(K(f25),' sales: $');
asublabel+=acom(f24,'',' employees')+acom(f26.replace(/^[0-9-]*/,''),'SIC: ');
apoptext=alabel+b+asublabel+b+alink;
}
amoreurl=amoreurln.replace(/dining/,"restaurants");
  }
  if (p1=='school') {
    asearchstring=aname.replace(/ /g,'+');
    apoptext='Click for data and ratings of this school, '+aname+ ' '+ownership+' '+level+' at '+aaddress;
    alabel=aname;
    aurl='http://n150.cs.fiu.edu/geodata/schl.iq2?Query=GetSchoolDetails&format=html&obj_code='+sccode;
  }
  if (p1=='college') {
    asearchstring=aname.replace(/ /g,'+');
    apoptext=aname+ ' ('+college_type+') at '+college_address+' '+college_city+' '+college_state+' '+college_zip_code;
    alabel=aname;
  }
if (p1=='ptrim') {
alabel=aname+'mm';
var sl="/";
var begin_date=thisyear+sl+thismonth+sl+'01';
var bdate=thisyear+thismonth+'0100';
var end_date=thisyear+sl+thismonth+sl+day;
var edate=thisyear+thismonth+day+'23';
aurl='http://disc2.nascom.nasa.gov/daac-bin/Giovanni/tovas/Giovanni_cgi.pl?west='+(alongitude-3)+'&north='+(alatitude-(-3))+'&east='+(alongitude-(-3))+'&south='+(alatitude-3)+'&data=Accumulated+Rainfall&cbar=cdyn&plot_type=Area+Plot&byr='+thisyear+'&bmo='+beginmonth+'&bdy=1&b_hour=00Z&eyr='+thisyear+'&emo='+thismonth+'&edy='+day+'&e_hour=23Z&begin_date='+begin_date+'&end_date='+end_date+'&prod_id=3B42RT&params=0%7C3B42RT&action=Generate+Plot&global_cfg=tovas.global.cfg.pl&instance_id=realtime';
aimg='http://disc2.nascom.nasa.gov/daac-bin/Giovanni/tovas/monthly_analysis_gds.pl?south='+(alatitude-1)+'&north='+(alatitude-(-1))+'&west='+(alongitude-1)+'&east='+(alongitude-(-1))+'&action=Generate+Plot&cbar=cdyn&cmin=-9999&cmax=-9999&bdate='+bdate+'&edate='+edate+'&global_cfg=tovas.global.cfg.pl&instance_id=realtime&prod_id=3B42RT&unit=NO_CHANGE&params=0|3B42RT&param=0&pid=3B42RT&plot_type=Area+Plot';
apoptext='a NASA plot of month-to-date rainfall in the region <img src='+aimg+'>';
asublabel=measuredisplay(K(aname/25.4),'inch');
}
  if (p1=='hotels') {
    strippref='H_';
    range='';
    if (1*daily_rate_min>0) {
      range=' $'+K(daily_rate_min);
      if (1*daily_rate_max>5+1*daily_rate_min) range=range+'-'+K(daily_rate_max);
      range=range+b;
    }
    aurl=reserve;
    if (aurl.indexOf('/')<2) aurl='http://hotels-shopper.com'+ aurl;
    stariconlong='';
    if (stars>=2) stariconlong='<img border=0 src='+images+(stars+'.0i').substr(0,3)+'.stars.gif alt='+stars+'+stars>';
    starsshort=Math.round(stars-.5); if (stars==3.5) starsshort=3.5;
    stariconshort='';
    if (starsshort>=1) stariconshort='<img border=0 src='+images+'hotel'+starsshort+'.gif alt='+stars+'stars>';
    else stariconshort='<img border=0 src='+images+'hoteltr.gif alt=unrated>';

    if (typeof(policy)!='ubdefined') if (policy.Length>1) policy=' <i>Policy:</i> '+policy;
    alabel=stariconshort+aname; asublabel=range ;
    apoptext='Click to reserve via '+supplier+' hotel '+ aname+ stariconlong+ range+ ' at '+ street_address+b+ city+b+zip_code+'. '+ hotel_facilities +  policy ;
  }
if (mlike(p1,'flproperties')) {
aname=f[74]+' - '+f[88]; folio=f2; acountynbr=f1; flcounty=f1;
recordkeycriterion='PARCELNO='+folio;
aurl=arquery_keyurl(p1);
apopurl=iframeable_url(aurl);
asublabel='';
if (mlike(aname,'REFERENCE ONLY')) aname=f[88];
if (p1=='flproperties') aname=f[39];
else asublabel=f[99];
alabel=aname;
apoptext='county valuation: $'+K(f11)+popframe(apopurl);
}


if (p1=='ownership') {adr=f12; aname=adr; alabel=adr}
  if (p1=='folio'||p1=='nfolio') {
    _staticLayer=false;
    area=f1; perimeter=f2; prop_=f3; prop_id=f4; 
    ttrrss=f5; folion=f6; pid=f7; subunit=f8; hnmax=f9;
    condoflg=f10; mod_date=f11; h_num=f12; h_num2=f13; 
    pre_dir=f14; st_aname=f15; st_type=f16; st_type2=f17;
    suf_dir=f18; azipcode=f19;
owner='';
  
    housenbr=h_num; if (housenbr==0 || housenbr=='') housenbr=hnmax;
    folionbr=folion;
    adr= housenbr +b+ h_num2 +b+ pre_dir +b+ st_aname +b+ st_type +b+ st_type2 +b+ suf_dir ;
    adr=adr.replace(/^ */,'').replace(/   */,' ').replace(/ *$/,'');
    area=parseInt(area);
  if (p1=='nfolio') {
folionbr=f3;
owner=f2;
adr=f4;
aaddress=f4;
azipcode=f6;
}
    if (adr.search('[a-zA-Z]')<0) {adr='lot'; aaddress=''}
    if (owner=='REF ONLY') owner='Condominium';
    if (owner=='REFERENCE ONLY') owner='Condominium';
    if (area>0) area='Property lot net area: '+area+' sq.ft. ';
    else area='';
    perimeter=parseInt(perimeter);
    if (perimeter>0) perimeter='Property lot perimeter: '+perimeter+' ft. ';
    else perimeter='';
    comment=aall;
    alabel=owner+' '+adr;
 //tempoff2006.09.13   
if (owner=='Condominium') extralabel=' (<a target=_blank href="http://n1.cs.fiu.edu/cgi-bin/condorep'+tester+'.cgi?Lat='+alatitude+'&Long='+alongitude+'&vid='+vid+'&folio='+folionbr+'" title="Compare condo units">Units</a>)';
    //if (vid=='ramb') {
      aurl='http://gisims2.co.miami-dade.fl.us/MyHome/propmap.asp?app=propmap&bytool=FOLIO&cmd=FINDFOLIO&tool=SELECT&searchtool=FOLIO&mapURL=&selX=&selY=&scale=155&ownerl=&ownerf=&stnum=&stdir=&stname=&sttype=&stunit=&stzip=&reffolio=&startnum=0&sOrthophoto=YES&folio='+folionbr;
      //apoptext=area+perimeter+(isIE55?'Please <b>HOLD Mouse</b>  or Click to  browse property record (please wait, we are redirecting to the County and it may take their system up to one minute to get the property data) ':' property record and aerial photo');
      apoptext=owner+' '+adr+' '+(isIE55?'Please <b>HOLD Mouse</b>  or Click to  browse property record (please wait, we are redirecting to the County and it may take their system up to one minute to get the property data) ':' property record and aerial photo');
    //}
    //else {
      //aurl='http://n150.cs.fiu.edu/geodata/folios.iq2?Query=GetFolioDetails&format=html&folio_code='+folionbr;
      //apoptext=area+perimeter+(isIE55?'Please <b>HOLD Mouse</b>  or Click to  browse property record ':' property record');
    //}
    apopurl='http://gisims2.co.miami-dade.fl.us/myhome/proptext_print.asp?folio='+folionbr;
  }
  if (mlike(p1,'_UNION')) { aurl=arquery_keyurl(f5.replace(/[.]asc/,''))}

  if (p1=='gnis'||p1=='newgnis'||p1=='gnis2009') {
    strippref='GNIS_';
    icon='';
    type=type.replace(/Populated Place/g,'city');
    type=type.replace(/ppl/g,'city');
    type=type.replace(/Park/g,'park');
    type=type.replace(/Church/g,'church');
    type=type.replace(/faith/g,'church');
    type=type.replace(/community/g,'city');
    type=type.replace(/Hospital/g,'hospital');
    type=type.replace(/Airport/g,'airport');
    if (type=='airport')
      if (aname.indexOf('irport')<0) type='';
    if (aname.indexOf('eliport')>=0) type='heliport';
    type=type.replace(/Beach/g,'beach');
    type=type.replace(/School/g,'school');
    //if (mkike(aname,'heliport')) type='heliport';
    
    if (type=='airport' || type=='heliport' || type=='church' || type=='park' || type=='school' || type=='hospital' || type=='beach' || type=='city') icon='<img  src='+images+type+'.gif border=0>&nbsp;';
    else if (type!='') icon='<img src='+images+'other.gif border=0>&nbsp;';
    type=type.replace(/city/g,'community');
if (type!='') ocat=type;
    
    type_=type.replace(/ /g,'+');
    aname_=aname.replace(/[^a-zA-Z0-9-]/g,"+");
    asearchstring=aname.replace(/ /g,'+');
    params='zipcode='+azipcode+'&cityname='+citynameplus+'&country='+kountrycode+'&latitude='+latitude+'&longitude='+longitude+'&vid='+vid;
    //aurl=vn4c+'/d.cgi?stp=travel&'+params+'&omnisearch='+asearchstring;
    aurl='http://terrafly.com/omnisearch.html#?'+params+'&searchstring='+asearchstring;
    alabel=icon+aname;
    apoptext='search the Web, '+cityname+' Directories, Encyclopaedias, etc., for '+  type +b+'<b>'+ aname+'</b>' +b;
  }
  if (p1=="newgnis"||p1=="gnis2009"){elevation=1*f5;  elevation_ft=K(Math.round(elevation/0.3048)); asublabel=elevationdisplay(elevation_ft); apoptext+='<br>Elevation at ground: '+elevation_ft +' feet = '+elevation+' meters.<br>'+f3+'<br>'+f4+popframe('http://google.com/search?q=%22'+asearchstring+'%22+'+zipcode) }

  distance=parseInt((typeof(distance)=='undefined')?'10000':distance+' ');
  if (acounter==1 && distance<radius) alabel='<font color=red>'+ alabel+ '</font>'
  photopop='';photos='';photospop='';
if (typeof(photo)=='undefined') photo='';
  if (photo.search(/https*:/)>=0) {
    photo=photo.replace(/[<>"]/g,' ').replace(/src=/g,' ');
    photo=photo.replace(/ [^h ][^ ]*/g,' ').replace(/^ */,'').replace(/  *$/,'').replace(/, *http.*/,'');
    //photo=photo.replace('"* .*','');
    //photo=photo.replace('.*http:','http:');
    photos=photo.replace(/  */g,'> <img align=top border=0 src=');
    photopop='<table><tr><td><img border=0 src='+photos+' alt=unavailable></td></tr></table>';
  }

  if (acounter==1&&(isArquery!=1)) {
    dw('<blockquote>');
    blockopen=1;
  }

  if (p1=='real') {
    strippref='REA_';
    strippref='';
      photopop=photopop.replace(/small/,'large');
    if (typeof(virtual_tour)!='undefined') if (virtual_tour.indexOf('http')>=0) {
      iconurl=virtual_tour;
      iconpop='Click for <b>virtual tour</b> '+photopop;
      poph(iconurl,'<img border=0 src='+images+'vr.gif>',iconpop);
    }
  }

  if (p1=="census") {
    if (areatype0!=lastareatype) demogrecord(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19);
  }
  else {

if (isArquery==1) {
if (onlycount) dw(' '+(1+distcnbr)+':&nbsp;');
else dw('<table border="0" valign=top align=left width="90%" cellspacing=0 cellpadding=0 rules="none" rule="none"><tr><td border=0 valign=top>');}
else dw('<table border="0"  cellspacing=0 cellpadding=0 rules="none" rule="none"><tr><td border=0 valign=top>');
    //var apopupurl=aurl.replace(/category=/,'popup=1&category=');
    apopurl=aurl;
    //apopup=apoptext+popframe(apopupurl);
    if (atest) dw('aall='+aall +'acounter='+acounter+' apopup='+apopup);
    //if (apopurl!='') apopup=apoptext+popframe(apopurl);
    apopup='';
    apopup=apoptext+ photopop ;
    if (acounter==1 && distance<radius) dw('<font color=red>');
    if (compass_direction.search(/^[a-zA-Z]/)>=0 &&beston==0) {
if (!onlycount) dw('');
else dw(' &nbsp;  ');
if (isArquery&&!onlycount) dw((1+distcnbr)+': ');;
      distc(distance,compass_direction,atitle+': '+alabel);
      dw('&nbsp;');
    }
   //if (isArquery==1) {if (aurl==amoreurl) alabel=''; else alabel='<img src="/images/details.gif" alt="" width=32 height=32>';
   if (!isArquery) dw('</td><td align=left>');
   if (isArquery==1&&!onlycount) {
dw('</td><td valign="top" align="right" rules="none" rule="none">');
magnifier='<img src='+images+'magnifier14x13.gif>';
if (aurl=='') aurl=amoreurl;
if (p1!='real'&&p1!='re1'&&p1!='re2'&&p1!='ramb'&&p1!='callreal'&&p1!='fproperties'&&!preal&&p1!='cndx') {if (aurl==amoreurl||printable) alabel=''; else alabel='<img src="'+images+'details.gif" alt="" width=32 height=32>';}
else alabel=' <b>'+alabel+magnifier+'</b>';
};
    if (_staticLayer)
      poph_static (aurl,alabel,apopup);
    else
      {if (beston) poph(aurl,alabel,apopup,popwidth); else pophb(aurl,alabel,apopup,popwidth);}
if (asublabel!=''&&!isArquery) dw(' '+asublabel);
 dw(extralabel);
if (isArquery==1&&!onlycount) dw('</td></tr></table>');
if (!isArquery) dw('</td></tr></table>');
    if (acounter==1 && distance<radius) dw('</font>');
    if ((!isArquery)&&photoshown==''&&photopop!=''&&(p1!='ramb'||p1!='callreal'||mlike(photo,'^http[^ ]*_101')))  {
      photoshown=1;
photopop0=photopop;
photo0=photo;
apoptext0=apoptext;
aurl0=aurl;
alabel0=alabel;
apopup0=apopup;
    }
  }
}

function alast() {
recordkeycriterion='';
  if (p1=="census") enddemographics();
  else {
    if (acounter>0&&amoreurl!=''&&!all_set) {dw(' &nbsp;&nbsp; ');poph(amoreurl,'<img align=top src='+images+'more1.gif border=0>','more nearby '+atitle+' records');}
    if (blockopen==1) {
      dw('</blockquote>');
      blockopen=0;
    }
    if ((!isArquery)&&photoshown&&photopop0!='') {
      dw('</td><td align=right>');
dw('<table align=right><tr><td>');
     pophb(aurl0,'<img border=0 onerror="rplcErrImg(this);" src='+photo0+' >',apoptext0);
    // if (isIE) pophb(aurl0,'<img border=0 onerror="rplcErrImg(this);" src='+photo0+' >',apoptext0);
    // else pophb(aurl0,'<img border=0  src='+photo0+' >',apoptext0);
dw('</td></tr><tr><td>');
      pophb(aurl0,alabel0,apopup0);
dw('</td></tr></table>')
    }
if (!isArquery&&p1!='census') dw('</td></tr></table>');
  }
}

function startdemographics(f1,f2,f3,f4,f5,f6,f7) {
  var td1='<td align=center >';
  var td1='<td align=center bgcolor="#D4E3F1">';
  var td1='<td align=center bgcolor="#F2E5C5">';
  var td='</td>'+td1;
  //dw('<table border=1 width="100%" cellspacing="0" cellpadding="0" align=center><tr><td>');
  //dw('<p><table><tr>'+td1+'nested areas'+td+'population'+td+'sq. miles'+td+'homes'+td+'water</td></tr>');
  dw('<table border=0 width="'+tabwidth+'" cellspacing="0" cellpadding="0" align=center><tr>'+td1+'Nested Areas'+td+'Population'+td+'Sq. Miles'+td+'Homes'+td+'Water'+(showPremium?td+'Premium':'')+'</td></tr>');
}

function demogrecord(id,aname,population,housingunits,sqmeters,watersqmeters,areatype,distance,compass_direction,offset,bbox,llong,rlong,llat,ulat,widthm,heightm,ilat,ilong) {
  lastareatype=areatype;areaw=widthm;areah=heightm;
  var td='</td><td align=right>';
  var sqm=1609*1609;
  var demogurl='http://n150.cs.fiu.edu/geodata/sf1.iq2?Query=GetAreaDetails&Format=html&aid='+id;
  var demogname=aname.replace(' CCD',' division').replace(' CDP',' place').replace(/  *$/,'');
  demognamecompound=aname.replace(/  *$/,'')+'; '+demognamecompound;
  var longername=demogname+', '+kountryname;
  if (areatype=='state') longername=kountryname;
  if (areatype=="bg"||areatype=='tract') {
    longername=longername+' '+zipcode;
    longername=longername.replace('Block Group','Neighborhood (Census Block Group)');
    longername=longername.replace('Census Tract','Greater Neighborhood (Census Tract)');
  }
  if (areatype=='zip') longername=kountryname+' '+demogname.replace(/^.* /,'');
  var aerial00=vn4c+'/tfdispense.cgi?long='+ilong+'&lat='+ilat+'&';
  var areaurl=aerial00+'&area='+areatype+'&label='+demogname.replace(/ /g,'+');
  var downloadable=(sqmeters/sqm<400000);
  var smaller=(areatype=='bg')?'':' and smaller areas within '+demogname;
  var aerialstext='click for menu of dowloadable imagery, data, TerraAtlases, and prints covering the entire area of '+demogname;
  if (dispenser==''||downloadable) {
    dw('<tr><td>');
    areacgi=gnisdispcgi+'Lat='+ilat+'&Long='+ilong+'&tfaction=dispense&vid='+vid+'&areatype='+areatype+'&aid='+id+'&place_name='+longername.replace(/[^a-zA-Z0-9.()-]/g,'+')+'&awidth='+widthm+'&aheight='+heightm;
    areademog=areacgi+'#Demographics';

    if (areatype0==areatype) dw('<b>');
    //if (dispenser==''||!downloadable) {
      poph(areacgi,demogname,'click for more data on '+demogname);
    //}
    //else poph(areaurl,redden(demogname),aerialstext);
    dw(td)
    poph(areademog,K(population),'Click for a complete housing/demographic report from 2000 US Census, comparing nested areas: '+demognamecompound);

    dw(td);
    if (downloadable) poph(areaurl,redden(K(sqmeters/sqm)),aerialstext);
    else dw(K(sqmeters/sqm));
    dw(td);
    poph(demogurl,K(housingunits),'Click for a detailed demographic report on '+demogname+' as one long printable document');
    dw(td);

    waterpercent=percent(1*watersqmeters/(1+1*sqmeters));
    poph(areaurl+'&tab=report&preclick=',waterpercent,waterpercent+ ' ('+K(watersqmeters/1609/1609)+' sq. miles) of the area of '+demogname+' is water. <p>Click for a menu of premium (fees) reports (demographic, life quality, etc.) on '+demogname+smaller);
    if (showPremium) {dw(td);    poph(areaurl,'<img src="'+images+'green_go_button.gif">',aerialstext);}
    dw('</td></tr>');
  }
}

function enddemographics() {
  dw('</table>');
  //dw('</td></tr></table>');
}

function redden(s) {
  //return '<font color=red>'+s+'</font>';
  return '<b>'+s+'</b>';
}

posterstring=' AMS 4010 ATL 4000 AUS 4003 AVX 6001 BNA 4705 BOS 4100 BUD 4110 BWI 4101 CHI 4201 CLE 4208 CLT 4211 CMH 4209 CVG 4206 DEN 4303 DFW 4300 DTT 4302 FLR 4950 FRA 4311 HKG 4405 HNL 4400 HOU 4402 IAG 4708 IND 4404 IND 4408 IST 4409 JAX 4411 JRS 4410 LAS 4506 LAX 4502 LON 4949 LON 4951 MAD 4610 MEM 4603 MIA 4504 MKC 4421 MOW 4620 MSP 4606 MSY 4704 MUC 4650 MWC 4508 NYC 4703 OFP 4817 ORL 4710 PDX 4740 PHL 4721 PHL 4725 PHL 4726 PHL 4727 PHX 4722 PIT 4720 PIT 4728 PRG 4760 ROM 4953 SAN 4801 SAN 4808 SAT 4810 SEA 4805 SFO 4802 SFO 4803 SFO 4804 STL 4806 STL 4807 STO 4818 SYD 4815 SYD 4816 TPA 4821 TYO 4820 VCE 4954 WAS 4900 YMQ 4618 YTO 4830 YVR 4955 ZSP 4800'
function cityposter() {
  var indx=posterstring.indexOf((typeof(citycode)!='undefined'?citycode:999999));
  if (indx>0) {
    var posternbr=posterstring.substr(indx+4,4);
    dw('<center><a href=http://terrafly.cs.fiu.edu/aerial_posters/template.asp?item='+posternbr+' target=_blank><img border=0 src=http://www.spaceshots.com/images/full/sspn'+posternbr+'.jpg alt="'+cityname+' poster"></a></center>');
  }
}

function xhref(urlsuffix,text,title) {
  demogboxurlpref='http://ts.cs.fiu.edu/qsf'+(sf3=='sf3'?3:1)+'z';
  //dw('<a href="'+demogboxurlpref+urlsuffix+'" title="'+title+'" target=_blank>'+text+'</a>');
  pophb(demogboxurlpref+urlsuffix,text,title);
}

function xhrefd(demographictab,text) {
  dw('<li>');
  amp='qAz';
  taba='tab='+demographictab+amp;
  xhref(taba+demogboxurlsufmini,text,'report for this zone only');dw('&nbsp;&nbsp;&nbsp;');
  xhref(taba+demogboxurlsuf,'+','compare this and major encompassing zones');
  dw('&nbsp;&nbsp;&nbsp;');
  xhref(taba+demogboxurlsufbig,'++','compare this zone, adjacent zones, and all encompassing zones');
  dw('&nbsp;&nbsp;&nbsp;');
  //pophb('http://recommend.org/omnisearch.htm#sitetype=omni&zipcode='+zipcode+'&cityname='+citynameplus+'&statecode='+statecode+'&vid='+vid+'&searchstring='+text.replace(/[^a-zA-Z0-9]/g,'+'),'<img src="http://recommend.org/images/srch_button.gif" border=0>','search the Web and reference sources for <i>'+text+'</i> locally and generally');
  pophb('http://recommend.org/omnisearch.htm#sitetype=omni&zipcode='+zipcode+'&cityname='+citynameplus+'&statecode='+statecode+'&vid='+vid+'&searchstring='+text.replace(/[^a-zA-Z0-9]/g,'+'),'s','search the Web and reference sources for <i>'+text+'</i> locally and generally');
  dw('</li>');
}
function unblank(s) {return s.replace(/ /g,'')}
function pad2(nbr) {return (nbr<10?'0':'')+nbr}


function hminisg(){
var hmini='<table cellspacing=0 cellpadding=0 border=1 >'+'<tr><td bgcolor="#D4E3F1" align="center" >Check hotel rates for: <form action="http://vn4.cs.fiu.edu/cgi-bin/d.cgi" name=nnn method=GET target=_blank> <input name=citycode value="'+citycode+'" type=hidden>';
hmini+='<input name=latitude value="'+latitude+'" type=hidden>';
hmini+='<input name=longitude value="'+longitude+'" type=hidden>';
hmini+='<input name=category value="'+category+'" type=hidden> <input name=country value="'+kountrycode+'" type=hidden> <input name=cityname value="'+citynameplus+'" type=hidden> <input name=clang value="EN" type=hidden> <select name=Month size=1>'
hmini+=selectmonths()+'</select><select name=Day size=1>';
hmini+=selectstrngs('1,1st;2,2nd;3,3rd')+selectnbrs(20,'th',4)+selectstrngs('21,21st;22,22nd;23,23rd')+selectnbrs(30,'th',24)+selectstrngs('31,31st')+'</select><select name=Nights>';
hmini+=selectstrngs('1,1 night')+selectnbrs(40,' nights',2);
hmini+='</select>'
hmini+='<select name=adults size=1>';
hmini+=selectstrngs('1,1 adult;2,2 adults;3,3 adults;4,4 adults')+'</select>';
hmini+='<select name=children size=1>'+selectnbrs(4,' children',0)+'</select>';
hmini+='<input type=image src="'+images+'green_go_button.gif" class="bttn" alt="" border=0 name=submit target=_blank></form> </td></tr></table>';
poptxt='<small>Find availability and rates in hotels near the current location</small>';
popbi(hmini,poptxt);}
function acom(value, prefix, suffix){//add with comma and blank
return (mlike(value,'[^$K0 ]')?', '+(typeof(prefix)=='undefined'?'':prefix)+value+(typeof(suffix)=='undefined'?'':suffix):'');
}
function submenuOrBr(url,icon,text,bigpopup){
var bigpop=(typeof(bigpopup)=='undefined'?'':'<br>'+bigpopup);
if (istabulate) submenub(url,(submenu_section_title==''?'':submenu_section_title+': ')+'<b>'+icon+'</b>',text)
else {dw('<small><br>');if (submenu_section_title!='')dw('&nbsp;&nbsp;');pophb(url,icon,text+bigpop,popwidth);dw('</small>')}}


function iframe_arquery(url) {
return (typeof(url)!='undefined'?'<iframe scrolling=no width='+popwidth+' height=600 src='+iframeable_url(url)+'>':''); }
function iframeable_url(url){return url.replace(/1.cgi/,'.cgi').replace(/tester=1./,'').replace(/[?]/,'?printable=1&ispopup=9&'); }
function pointbuttong(tfaction,icon_gif,text){
var url='http://vn4.cs.fiu.edu/cgi-bin/gnis.cgi?Lat='+alatitude+'&Long='+alongitude+'&tfaction='+tfaction;
pointbutton(url,icon_gif,(typeof(text)=='undefined')?'':text,url+'&ispopup=9')}
function pointbuttona(url,icon_gif,text){ pointbutton(url,icon_gif,text,iframeable_url(url))}
function pointbutton(url,icon_gif,text,iframe_url){
var icon=(mlike(icon_gif,'[.]')?'<img src="'+images+'/'+icon_gif+'" border=0 alt="">':icon_gif);
var bigpop=text+(typeof(iframe_url)!='undefined'?'<iframe width='+popwidth+' height=600 scrollng=no src='+iframe_url+'>':'');
if (isArquery) {dw(' ');pophb(url,icon,bigpop)}
else submenub(url,'<img src='+images+icon_gif+'>',text)

}


function submenu_section(title) {
var tit=(typeof(title)=='undefined'?'':title);
submenu_section_title=tit;
if (!istabulate&&tit!='') dw('<br>'+tit+': ')}
function submenu_arquery(category,label,arcriteria,poptext,levelOfIframe,levelOfReport) {
var display=(typeof(label)=='undefined'?category:label);
var criteria=(typeof(arcriteria)=='undefined'?'':'&arcriteria=1&'+arcriteria);
var text=(typeof(poptext)=='undefined'?'browse/query '+display:poptext);
var url=vn4c+'/arquery.cgi?'+gotbroker+'&category='+category+'&y1='+alatitude+'&x1='+alongitude+'&vid='+vid+'&srvc='+srvc+'&'+criteria;
url=url.replace('?&','?');
submenuOrBr(url,display,text,iframe_arquery(url));
}
function hyphenate_date(d){
if (mlike(d,"[^0-9]")) return d
return d.substr(0,4)+'-'+d.substr(4,2)+'-'+d.substr(6,2)}
