/* the lines causing the error are in the buildnav function.  They are the two addlink functions linking to the new pages
the error reads that a semicolon is expected on line zero */
/* author: Jerry Wood */
/* Creation date: 8/13/01 */

var sectionID, pageID, out, headhtml, navhtml, lastY;
var is=new Is();
var siz="";
var divpad="160px";

function imgLoad(){
	var x, y, xx, yy, aa;
    
    if (document.all){
    	aa=testwidth.width;}
    else {
    	aa=document.getElementById("testwidth").width;}
    
	if (aa<=640){
    	siz="sm"; x=87; y=15; xx=93; yy=23;}
    else if (aa<=800){
    	siz="md"; x=110; y=19; xx=117; yy=29;}
    else {
    	x=145; y=25; xx=155; yy=38;}
   /* declares pageID and sectionID values */
	whowhatmo=new Image(x, y);		setsource(whowhatmo, "NavAboutUsmo");
	whowhat=new Image(x, y);		setsource(whowhat, "NavAboutUs");
	contactusmo=new Image(x, y);		setsource(contactusmo, "NavContactUsmo");
	contactus=new Image(x, y);		setsource(contactus, "NavContactUs");
	relatedmo=new Image(x, y);		setsource(relatedmo, "NavLinksmo");
	related=new Image(x, y);		setsource(related, "NavLinks");
	captablemo=new Image(x, yy);		setsource(captablemo, "NavCaptTablemo");
	captable=new Image(x, yy);		setsource(captable, "NavCaptTable");
	tmpImage=new Image(xx,yy);
   /* <!-- this section is for the Riley Campaign i.e., downloading registration info RVE---> */
    if (sectionID=="calendar"&&pageID!=sectionID){
	    caldetailmo=new Image(x, y);	setsource(caldetailmo, "NavCalDetailmo");
    	caldetail=new Image(x, y);		setsource(caldetail, "NavCalDetail");
	    calhomemo=new Image(x, y);		setsource(calhomemo, "NavCalHomemo");
    	calhome=new Image(x, y);		setsource(calhome, "NavCalHome");}
	else {
		calendarmo=new Image(x, y);		setsource(calendarmo, "NavCalendarmo");
		calendar=new Image(x, y);		setsource(calendar, "NavCalendar");}
        
    if (sectionID=="campaign"&&pageID!=sectionID){
		camemailmo=new Image(xx, y);	setsource(camemailmo, "NavCamEmailmo");
		camemail=new Image(xx, y);		setsource(camemail, "NavCamEmail");
		camhome=new Image(x, yy);		setsource(camhome, "NavCamHome");
		camhomemo=new Image(x, yy);		setsource(camhomemo, "NavCamHomemo");
		caminfomo=new Image(xx, y);		setsource(caminfomo, "NavCamInfomo");
		caminfo=new Image(xx, y);		setsource(caminfo, "NavCamInfo");
		camfaqmo=new Image(xx, y);		setsource(camfaqmo, "NavCamFAQmo");
		camfaq=new Image(xx, y);		setsource(camfaq, "NavCamFAQ");
		camregmo=new Image(xx, y);		setsource(camregmo, "NavCamRegmo");
		camreg=new Image(xx, y);		setsource(camreg, "NavCamReg");}
    else {
		campaignmo=new Image(x, yy);	setsource(campaignmo, "NavCampaignmo"); 
		campaign=new Image(x, yy);		setsource(campaign, "NavCampaign");}
    	
}
/* this function verifies if browser is compatible RVE */
function Is(){
    var agent=navigator.userAgent.toLowerCase();
	var appv=navigator.appVersion;
	
    this.major=parseInt(navigator.appVersion);
    this.minor=parseFloat(appv.substring(appv.indexOf(this.major)+1,4));
    this.ns=((agent.indexOf('mozilla')!=-1)
		&& (agent.indexOf('spoofer')==-1)
		&& (agent.indexOf('compatible')==-1));
    this.ns2=(this.ns && (this.major==3));
    this.ns3=(this.ns && (this.major==3));
    this.ns4b=(this.ns && (this.major==4) 
		&& (this.minor<=3));
    this.ns4=(this.ns && (this.major==4));
    this.ns6=(this.ns && (this.major>=5) && agent.indexOf("netscape6")!=-1);
    this.ie=(agent.indexOf("msie")!=-1);
    this.ie3=(this.ie && (this.major<4));
    this.ie5=(this.ie && (this.major==4) && (agent.indexOf("msie 5.0")!=-1));
    this.ie55=(this.ie && (this.major==4) && (agent.indexOf("msie 5.5")!=-1));
    this.ie4=(this.ie && (this.major==4) && !this.ie5 && !this.ie55);
}

if(is.ns4){
    doc="document[";
    sty="";
    sufx="].document"
    xpos="e.pageX";
    ypos="e.pageY";} 
else if((is.ie && !is.ie3) || is.ns6){
    doc="document.getElementById(";
    sty=".style";
    sufx=")"
    xpos="event.x";
    ypos="event.y";}	

function msover(IDname){
	if (document.images){
		document.images[IDname].src=eval(IDname+"mo.src");
		if (pageID!="welcome"){
			document.images[pageID].src=eval(pageID+".src");}
    }
}
	
function msout(IDname){
	if (document.images){
		document.images[IDname].src=eval(IDname+".src");
		if (pageID!="welcome"){
			document.images[pageID].src=eval(pageID+"mo.src");}
    }
}
	
function setwidth(){
	document.getElementById("content").width=eval(testwidth.width-146);}
/* this builds the navigational bar for each page RVE */
function buildnav(){
	var flagname="";
    var tpos=30;
    
    if (siz=="sm"){
    	tpos=19;}
    else if (siz=="md"){
    	tpos=24;}
	
	out="<div style='margin: 0px; padding: 0px; position: absolute; top: 0; left: 0; height: 31px; z-index: 11;' background-image: url(images/parchment1.jpg);'>"
		+"<img src='images/pikehead1"+siz+".gif' class='navbg' vspace=0></div>";
	if (pageID=="welcome"){flagname="flagwelcome2"+siz+".gif";}
	if (flagname>""){
		out+="<div style='margin: 0px; padding: 0px; position: absolute; top: "+tpos+"; left: 0px; z-index: 12;' background='images/pike1"+siz+".gif'>"
			+"<img src='images/"+flagname+"' class='navbg' align=absmiddle>"
			+"</div>";
	}
	out+="<div style='margin: 0px; padding: 0px; position: absolute; top: "+tpos+"; left: 0; height: 85%; padding-top: 50px; background-image: url(images/pike1"+siz+".gif); background-repeat: repeat-y; z-index: 10;'>"
	out+="<div style='position: relative; width: 100%; height: 100%;'>";
	addlink("whowhat", "NavAboutUs", "whowhat.html", "navmain", "Who we are and what we do");
/* this is another section for Riley Farm stuff RVE */
	if (sectionID=="campaign"){
		addlink("camhome", "NavCamHome", "campaign_home.html", "navmain", "2001 Campaign at Rileys Farm");
		addlink("caminfo", "NavCamInfo", "campaign_about.html", "navsub", "About the Campaign");
		addlink("camfaq", "NavCamFAQ", "campaign_faq.html", "navsub", "Frequently Asked Questions");
		addlink("camreg", "NavCamReg", "campaign_register.html", "navsub", "Register to Attend");
		addmail("camemail", "NavCamEmail", "campaign2003", "earthlink.net", "navsub", 
			"Contact the Event Coordinators");}
	else {
		addlink("campaign", "NavCampaign", "campaign_home.html", "navmain", "2003 Campaign at Rileys Farm"); }
	
	addlink("contactus", "NavContactUs", "contact.htm", "navmain", "Contact Us");
	if (pageID=="caldetail"){
    	addlink("calhome", "NavCalHome", "calendar_home.html", "navmain", "Return to Calendar");
		addlink("caldetail", "NavCalDetail", "calendar_home.html", "navsub", "Event Details");}
	else {
		addlink("calendar", "NavCalendar", "calendar_home.html", "navmain", "Calendar of Events");}
	addlink("captable", "NavCaptTable", "capttable.html", "navmain", "From The Captains Table");
/*	addlink("gallery_index", "navcamreg", "gallery_index.html", "navmain", "Blackshire\'\s Photo Gallery");
	addlink("bcotshistory", "navcamfaq", "/group_history/bcotshistory_index.html", "navmain", "Blackshire's Group History"); */
	addlink("related", "NavLinks", "links.html", "navmain", "Other Sites Related to Blackshires");
	out+="</div></div>";
	out+="<div style='margin: 0px; padding: 0px; position: absolute; bottom: 0; left: 0; z-index: 13;' background='images/parchment1.jpg'>"
		+"<img src='images/pikeman1"+siz+".gif' class='navbg' vspace=0></div>"
		+"</body>";
	if (is.ns4){
		navhtml=out; out="";}
	else {
		document.getElementById("divnavigate").innerHTML=out;}

	navScroll();
}
/* this puts the BCOTS logo at the top of the page */
function buildhead(){
	out="<img alt='BCOTS' vspace=5 src='images/bcots"+siz+".gif'>";
    
	if (is.ns4){
		headhtml=out; out="";}
	else {
		document.getElementById("header").innerHTML=out; out="";}

	divadjust(document.getElementById("header"));
	divadjust(document.getElementById("content"));
}

function addlink (linkID, srcImage, hrefLink, imgclass, winStat){
	if (linkID==pageID){
		srcImage="images/"+srcImage+"mo"+siz+".gif";}
	else {
		srcImage="images/"+srcImage+siz+".gif";
		out+="<a href='"+hrefLink+"' id='"+linkID+"' onmouseover=\"msover('"+linkID
			+"'); window.status='"+winStat+"'; return true;\" onmouseout=\"msout('"+linkID
			+"'); window.status=''; return true;\">";
	}
	out+="<img name='"+linkID+"' src='"+srcImage+"' class='"+imgclass+"' border=0>";
	if (linkID!=pageID){
		out+="</a>";}
	out+="<br>";
}
	
function addmail (linkID, srcImage, uname, ispname, imgclass, winStat){
	srcImage="images/"+srcImage+siz+".gif";
	out+="<a id='"+linkID+"' onmouseover=\"msover('"+linkID+"'); window.status='"
		+winStat+"'; return true;\" onmouseout=\"msout('"+linkID+"'); window.status=''; return true;\""
		+" onclick=\"mailit('"+uname+"', '"+ispname+"')\"><img name='"+linkID+"' src='"+srcImage
		+"' class='"+imgclass+"'></a></br>";
}

function mailit(uname, ispname){
	document.URL='mailto:'+uname+'@'+ispname;}

function divadjust(divname){
    if (siz=="sm"){
       	divpad="96px";}
    else if (siz=="md"){
       	divpad="123px";}
    else {
    	divpad="160px";}
        
    divname.style.paddingLeft=divpad;
    
	if (is.ns6){
		var divWidth;
        
		divWidth=window.innerWidth-(parseInt(divpad, 10)+18);
		divname.style.width=divWidth;
	}
}

function navScroll(){
	var curY, newY, moveBy, nextCheck, xPos;
	nextCheck=800; moveBy=0;
	
	if (is.ie&&!is.ie3){
		curY=parseInt(divnavigate.style.top, 10);
		newY=document.body.scrollTop;}
	else if (is.ns4){
		curY=document["divnavigate"].top;
		newY=top.pageYOffset;}
	else if (is.ns6){
		curY=parseInt(document.getElementById("divnavigate").style.top);
		newY=window.pageYOffset;}
/*	else if (is.op5){
		curY=divnavigate.style.top;
		newY=top.pageYOffset;} */
	else {return true;}

	if (!curY){curY=0;}
		
	if (curY!=newY&&newY==lastY){
		moveBy=Math.ceil(Math.abs(newY-curY)/20);
		nextCheck=10;
		
		if (curY>newY){moveBy=-moveBy;}
		
		if (is.ie&&!is.ie3){
			xPos=curY+moveBy;
			divnavigate.style.top=xPos;}
		else if (is.ns4){
			document["divnavigate"].top+=moveBy;}
		else if (is.ns6){
			document.getElementById("divnavigate").style.top=(curY+moveBy);
			nextCheck=5;}
/*		else if (is.op5){
			divnavigate.style.top+=moveBy;}*/

		if (document.getElementById("divreport")){
			document.getElementById("divreport").innerHTML = "curY=" + curY + "/newY=" + newY + "/moveby=" + moveBy + "/xPos=" + xPos + "/top=" + document.getElementById("divnavigate").style.top;
		}
	}
	
	lastY=newY;
	setTimeout("navScroll()", nextCheck);
}

function setsource(imgName, imgSrc){
	imgName.src='images/'+imgSrc+siz+'.gif';
}

function sizadjust(){
	var newsiz, wd;
    
    if (is.ns6){
    	document.getElementById("content").style.width="100%";
        document.getElementById("header").style.width="100%";
        divadjust(document.getElementById("content"));
        divadjust(document.getElementById("header"));
    }
    
    if (document.all){
    	wd=testwidth.width;}
    else {
    	wd=document.getElementById("testwidth").width;}
        
    if (wd<=640){
    	newsiz="sm";}
    else if (wd<=800){
    	newsiz="md";}
    else {
    	newsiz="";}
        
    if (siz!=newsiz){history.go(0);}
}
