//  Adapted from ALTTXT V1.2 BY: BRIAN GOSSELIN OF SCRIPTASYLUM.COM -- see http://www.dynamicdrive.com)
//  Introduced code branch for mac IE because changing innerHTML can cause instability there and must be done more reservedly than elsewhere

var center=true;     // CENTERS THE BOX UNER THE MOUSE, OTHERWISE DISPLAYS BOX TO THE RIGHT OF THE MOUSE
var centertext=false; // CENTERS THE TEXT INSIDE THE BOX. YOU CAN'T SIMPLY DO THIS VIA STYLE BECAUSE OF NS4.
                     // OTHERWISE, TEXT IS LEFT-JUSTIFIED. 

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var isMac = navigator.userAgent.toLowerCase().indexOf('mac')!=-1;

var w_y, w_x, infoDiv, boxheight, boxwidth;
var ishover=false;
var isloaded=false;

function getwindowdims(){
w_y=(NS4||NS6||window.opera)? window.innerHeight : (IE5||IE4)? document.body.clientHeight : 0;
w_x=(NS4||NS6||window.opera)? window.innerWidth : (IE5||IE4)? document.body.clientWidth : 0;
}

function getboxwidth(){
if(NS4)boxwidth=(infoDiv.document.width)? infoDiv.document.width : infoDiv.clip.width;
if(IE5||IE4)boxwidth=(infoDiv.style.pixelWidth)? infoDiv.style.pixelWidth : infoDiv.offsetWidth;
if(NS6)boxwidth=(infoDiv.style.width)? parseInt(infoDiv.style.width) : parseInt(infoDiv.offsetWidth);
}

function getboxheight(){
if(NS4)boxheight=(infoDiv.document.height)? infoDiv.document.height : infoDiv.clip.height;
if(IE4||IE5)boxheight=(infoDiv.style.pixelHeight)? infoDiv.style.pixelHeight : infoDiv.offsetHeight;
if(NS6)boxheight=parseInt(infoDiv.offsetHeight);

}

function moveinfoDiv(x,y){
if(NS4)infoDiv.moveTo(x,y);
if(W3C||IE4){
infoDiv.style.left=x+'px';
infoDiv.style.top=y+'px';
}}

function getpagescrolly(){
if(NS4||NS6)return window.pageYOffset;
if(IE5||IE4)return ietruebody().scrollTop;
}

function getpagescrollx(){
if(NS4||NS6)return window.pageXOffset;
if(IE5||IE4)return ietruebody().scrollLeft;
}

function writeindiv(text){
if(NS4){
infoDiv.document.open();
infoDiv.document.write(text);
infoDiv.document.close();
}
if(isMac && (IE4 || IE5))infoDiv.innerHTML=text;
else if (W3C||IE4)infoDiv.innerHTML=text;
}

//**** END UTILITY FUNCTIONS ****//

function writetxt(text){
if(isloaded){
if(text!=0){
ishover=true;
if(NS4)text='<div class="navtext">'+((centertext)?'<center>':'')+text+((centertext)?'</center>':'')+'</div>';
writeindiv(text);
getboxheight();
}else{
if(NS4)infoDiv.visibility="hide";
if(IE4||W3C){
infoDiv.style.visibility="hidden";
}
writeindiv('');
ishover=false;
}}}

function moveobj(evt){
if(isloaded && ishover){
margin=(IE4||IE5)? 1 : 23;
if(NS6)if(document.height+27-window.innerHeight<0)margin=15;
if(NS4)if(document.height-window.innerHeight<0)margin=10;
//mx=(NS4||NS6)? evt.pageX : (IE5||IE4)? event.clientX : 0;
//my=(NS4||NS6)? evt.pageY : (IE5||IE4)? event.clientY : 0;
if (NS4){
mx=evt.pageX
my=evt.pageY
}
else if (NS6){
mx=evt.clientX
my=evt.clientY
}
else if (IE5){
mx=event.clientX
my=event.clientY
}
else if (IE4){
mx=0
my=0
}

if(NS4){
mx-=getpagescrollx();
my-=getpagescrolly();
}
xoff=(center)? mx-boxwidth/2 : mx+5;
yoff=(my+boxheight+30-getpagescrolly()+margin>=w_y)? -15-boxheight: 30;
moveinfoDiv( Math.min(w_x-boxwidth-margin , Math.max(2,xoff))+getpagescrollx() , my+yoff+getpagescrolly());
if(NS4)infoDiv.visibility="show";
if(W3C||IE4)infoDiv.style.visibility="visible";
}}

if(NS4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;
window.onload=function(){
  infoDiv=(NS4)? document.layers['infoDiv'] : (IE4)? document.all['infoDiv'] : (W3C)? document.getElementById('infoDiv') : null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  isloaded=true;
  if((W3C || IE4) && centertext)infoDiv.style.textAlign="center";
  if(W3C)infoDiv.style.padding='4px';
  }
window.onresize=getwindowdims;

routeText=[];
routeText[0]=["Seattle, WA - Aug. 17th - 20th",
							"Tues. Aug. 17","",
							"7:30pm","Fundraiser at the crocodile.",
							"<br>Fri. Aug. 20","",
							"MEET-UP 7pm-8pm:","Departure, Linda's Tavern",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;707 East Pine St.&nbsp; Graffiti workshop & more"];

routeText[1]=["Lawrence, KS &amp; Kansas City, MO - Aug. 22nd",	
							"MEET UP, 10am in Lawrence, KS:","Breakfast.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Steve and Harriet's, 1509 Crescent Road",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(in Lawrence, KS)",
							"MEET UP at 1pm:","ACORN office, 3931 Main St.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kansas City, MO",
							"1—6pm:","Voter registration with ACT/ACORN",
							"MEET UP, 7-9:30pm:","Californos Restaurant",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4124 Pennsylvania (in Westport, KC, MO)"];

routeText[14]=["Columbia, MO - Aug. 23rd",
							"MEET UP at 10am:","U. of Missouri.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at the Student Union",
							"10am-11:30am:","Register at U. of Missouri."];
							
routeText[2]=["St. Louis, MO - Aug. 23rd",
							"MEET UP at 1pm:","Missouri ProVote office.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5585 Pershing, Suite 150, St. Louis, MO",
							"1:30-7pm:","Registration with Missouri ProVote.",
							"MEET-UP at 7pm:","Dinner at MoKaBe's",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3606 Arsenal Street, St. Louis, MO"];

routeText[3]=["Oxford, OH &amp; Cincinnati, OH - Aug. 24th",
							"Split into 2 teams:","Oxford &amp; Cincinnati",
							"Oxford Team:","",
							"MEET UP at 1pm:","Miami University at Oxford,",
							"","&nbsp;&nbsp;&nbsp;&nbsp;at the Phi Delt Gate, at Campus Ave &amp; High St.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;Registration, 1st day of classes",
							"Cincinnati Team:","",
							"MEET-UP at 1:30pm:","The ACT office",
							"","&nbsp;&nbsp;&nbsp;&nbsp;2330 Victory Parkway Suite 100",
							"2pm-6:30pm:","Registration/outreach with ACT."];

routeText[4]=["Columbus, OH - Aug. 25th",
							"MEET-UP at 1pm:","The ACORN office",
							"","&nbsp;&nbsp;&nbsp;&nbsp;1116 North High",
							"2pm-7pm:","Registration/outreach with ACORN."];

routeText[5]=["Pittsburgh, PA - Aug. 26th, 27th",
							"Aug. 26th","",
							"MEET UP 5-8pm:","Potluck BBQ.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at Sycamore Grove in Highland Park.",
							"8-12pm:","Registration with Pittsburgh VIE.",
							"12-2am:","Join us; celebrate at The Upstage.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3609 Forbes Ave (in Oakland).",
							"<br>Aug. 27th","",
							"MEET UP 11am-noon:","Tazza d'Oro.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1125 N Highland Ave)", 
							"Noon-6pm:","Registration with Pittsburgh VIE."];

routeText[6]=["Philadelphia, PA - Aug. 28th, 29th",
							"Aug. 28th","",
							"MEET UP, 3pm to 7pm:","Clark Park.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;South 43rd Street at Chester Ave.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clark Park World Music Festival.",
							"MEET UP 10pm:","RV parked at Shampoo Bar.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(at Willow and 8th Street)",
							"<br>Aug. 29th","",
							"MEET UP at noon","ACORN office:",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;846 North Broad Street",
							"Noon-6pm:","Registering voters in Philly suburbs."];

routeText[7]=["New York, NY - Aug. 30th - Sept. 2nd",
							"Wed, Sep. 1st","",
							"DV Training Workshops","1-2pm &amp; 2:30-3:30pm.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at Siberia (21+ only) 40th St. @9th Ave.",
							
							"Thurs, Sep. 2nd","",
							"DV Training Workshops","1-2pm &amp; 2:30-3:30pm.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at Siberia (21+ only) 40th St. @9th Ave."];

routeText[8]=["Raleigh, NC - Sunday Sept. 5th",
							"MEET UP, 11am","Raleigh ACT office.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11:00am-1pm, UNC Chapel Hill.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4pm to 7pm, canvasing in Raleigh."];

routeText[9]=["Jacksonville, FL - Sept. 7th",
							"Due to Hurricane","DV spent Tuesday.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in Jacksonville doing disaster relief work."];

routeText[10]=["Tampa, FL - Tuesday Sept. 7th",
							"Cancelled due to floods","DV will spend Tuesday.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in Jacksonville doing disaster relief work."]; 

routeText[11]=["Sarasota, FL - Wednesday Sept. 8th",
							"MEET-UP at 11am:","New College campus, Sarasota.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11am-6pm, registration in neighborhoods."]; 

routeText[12]=["Orlando, FL - Sept. 9th, 10th, 12th",
							"Thursday Sep. 9th","",
							"MEET-UP at noon:","ACORN office.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;132 E. Colonial Dr. Suite 214.",
							"Friday Sep. 10th","",
							"MEET-UP at noon:","ACORN office.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;132 E. Colonial Dr. Suite 214",
							"Saturday Sep. 11th","",
							"MEET-UP at 9am:","ACORN office parking lot.",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Behind 132 E. Colonial Dr. Suite 214.",
							"Sunday Sep. 12th","",
							"MEET-UP at noon:","Parking lot at intersection of",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Colonial Dr. and Tampa Ave., NE corner."]; 

routeText[13]=["Miami, FL, Saturday Sept. 11th",
							"Miami stop cancelled due to hurricane","",
							"","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DV is spending Saturday in Orlando instead"];

function showRouteInfo( t ) {
	var ret;
	if (isMac && (IE4 || IE5)){
		ret=t[0];
		for (i=1; i<t.length-1; i+=2 )
			ret += "<br>" + t[i] + " " + t[i+1];
	}
	else{
		ret="<h1><strong>" + t[0] + "</strong></h1><p>";
		if ( t.length >= 3 )
			ret += "<strong>" + t[1] + "</strong> " + t[2];
		
		for (i=3; i<t.length-1; i+=2 )
			ret += "<br><strong>" + t[i] + "</strong> " + t[i+1];
		ret += "</p>";
	}
	writetxt( ret );
}
function hideRouteInfo(){
	writetxt(0);
}

function oldshowRouteInfo( t ) {
	var ret;
	if (t.length != 2) alert("not right num args: got " +  t.length);
	if (isMac && (IE4 || IE5)){
		ret=t[0] + "<br>" + t[1];
	}
	else{
		ret="<h1><strong>" + t[0] + "</strong></h1><p>" + t[1] + "</p>";
	}
	writetxt( ret );
}

