//Client-side scripting for global objects
//global var
var qts = "'";
var qt = unescape("%22");
var vbCrLf = unescape("%0D%0A");
var tempcolor
var tempcolor2
var temp


//Header Functions

//link talbe
function header_link_table(relURL){
txt = "";
txt = txt + "<table width='100%' border='0' bgcolor='#000066'>" + vbCrLf;
tblrows = 1;
if(Link_Name.length ==15){tblrows = 3;}
  for(J=0; J < tblrows; J++){
  lnStart= J *6;	
  txt = txt + "<tr> " + vbCrLf;
  for(I=lnStart; I < (lnStart +7); I++){ txt = txt + header_Link_format(Link_Name[I],Link_Fine[I],relURL);}
  txt = txt + "</tr> " + vbCrLf;	
  }
txt = txt + "</table>" + vbCrLf;
document.write(txt);	
}

//link format
function header_Link_format(DspText, LinkUrl, relURL){
txtS="";
ckempty=false;
if(DspText=="empty"){ckempty=true;}
if(DspText==""){ckempty=true;}
if(LinkUrl=="empty"){ckempty=true;}
if(LinkUrl==""){ckempty=true;}


if(ckempty){
txtS=txtS+"<td align='center'>";
txtS=txtS+"&nbsp;";
txtS=txtS+"</td>";	
}
else{
txtS=txtS+"<td align='center'>";
txtS=txtS+"<a href='" + relURL + LinkUrl +"' class='Headerlinks' onmouseover='LinkMOver(this);' onmouseout='LinkMOut(this)' target='_parent'>";
txtS=txtS+ DspText + "</a>";	
txtS=txtS+"</td>";
}	
return txtS;	
	
}

function header_format(relURL){
txt = "";
txt = txt + "<table width='100%' border=0 bgcolor='#86A5EE'>" + vbCrLf;
txt = txt + "<tr> " + vbCrLf;
txt = txt + "<td align='center' valign='top' colspan=2>" + vbCrLf;
txt = txt + "<img src='" + relURL + "images/header_left.gif'>" + vbCrLf;
txt = txt + "</td>" + vbCrLf;
txt = txt + "<td align='center' valign=top><div class='HeaderPackText'>" + Pack_Name + "</div>" + vbCrLf;
txt = txt + "<div class='HeaderCityText'>" + Pack_City + "</div></td>" + vbCrLf;
txt = txt + "<td align='center' valign='top' colspan=2>" + vbCrLf;
txt = txt + "<a href='" + relURL + "tiger.htm'><img src='" + relURL + "images/tiger_badge.gif' width=80 border=0></a>" + vbCrLf;
txt = txt + "<a href='" + relURL + "wolf.htm'><img src='" + relURL + "images/wolf.gif' height=80 border=0></a>" + vbCrLf;
txt = txt + "<a href='" + relURL + "bear.htm'><img src='" + relURL + "images/bear3.gif' width=80 border=0></a>" + vbCrLf;
txt = txt + "<a href='" + relURL + "webelos1.htm'><img src='" + relURL + "images/webelo2.gif' width=80 border=0></a>" + vbCrLf;
txt = txt + "<a href='" + relURL + "webelos2.htm'><img src='" + relURL + "images/webelosoval.gif' height=80 border=0></a>" + vbCrLf;
txt = txt + "</td>" + vbCrLf;
txt = txt + "</tr></table>" + vbCrLf;
document.write(txt);
header_link_table(relURL);



}

function footer_format(relURL){
txt = "";
txt = txt + "<table width='100%' border='0'>" + vbCrLf;
txt = txt + "<tr> " + vbCrLf;
txt = txt + "<td align='center' valign='top'>" + vbCrLf;
txt = txt + "<img src='" + relURL + "images/footer_left.jpg' border='0' width=100 alt='Cub Scout'>" + vbCrLf;
txt = txt + "</td>" + vbCrLf;
txt = txt + "<td class='footerText' align='center'><img src='" + relURL + "images/anicubp.gif' height=35><br>";
for(I=0; I < Footer_Line.length; I++){ txt = txt + Footer_Line[I] + "<br>";}
txt = txt + "</td>" + vbCrLf;
txt = txt + "<td width='120' align='center' valign='top'>" + vbCrLf;
txt = txt + "<img src='" + relURL + "images/footer_right.gif' width='100' height='100'>" + vbCrLf;
txt = txt + "</td>" + vbCrLf;
txt = txt + "</tr></table>" + vbCrLf;
document.write(txt);	
	
	
	
}

// Links
function LinkMOver(linkID){
//alert(linkID.id);
tempcolor = linkID.style.color;
linkID.style.color = "red";	
	
}

function LinkMOut(linkID){
linkID.style.color = tempcolor;	
		
	
}

// Calendar Functions

function calload(){

posx=200;
posy=250;
var wzStyleSheet;

wzStyleSheet= document.styleSheets[0];	
if(!wzStyleSheet.cssRules){
    wzStyleSheet.cssRules = wzStyleSheet.rules;	
    }
tempcolor2 = wzStyleSheet.cssRules[11].style.color



var todaydate = new Date();
MNum = todaydate.getMonth() +1;

selmonth(MNum);
	
}
function selmonth(MSel){
var monthsel

for(I=1;I<13;I++){
	monthsel = document.getElementById("MS"+I);	
	monthsel.style.color = tempcolor2;	
	monthsel.style.cursor = poniter;
	}	
monthsel = document.getElementById("MS"+MSel);	
monthsel.style.color = "#FF0000";	
showmonth(MSel);	
	
}

function showmonth(MSet){
var monthlayer
var wzStyleSheet;
var wzStyleObject1;
var wzStyleObject2;
var wzTblObject;


	
wzStyleSheet= document.styleSheets[0];	
if(!wzStyleSheet.cssRules){
    wzStyleSheet.cssRules = wzStyleSheet.rules;	
    }
wzStyleObject1 = wzStyleSheet.cssRules[9].style
wzStyleObject2 = wzStyleSheet.cssRules[10].style

wzTblObject = document.getElementById("MT"+MSet);
for(I=0; I < wzTblObject.rows.length;I++){
wzTblObject.rows[I].cells[0].style.fontSize = wzStyleObject1.fontSize;
wzTblObject.rows[I].cells[0].style.fontFamily = wzStyleObject1.fontFamliy;
wzTblObject.rows[I].cells[0].style.fontStyle = wzStyleObject1.fontStyle;
wzTblObject.rows[I].cells[0].style.color = wzStyleObject1.color;
wzTblObject.rows[I].cells[1].style.fontSize = wzStyleObject1.fontSize;
wzTblObject.rows[I].cells[1].style.fontFamily = wzStyleObject1.fontFamliy;
wzTblObject.rows[I].cells[1].style.fontStyle = wzStyleObject1.fontStyle;
wzTblObject.rows[I].cells[1].style.color = wzStyleObject1.color;
wzTblObject.rows[I].cells[2].style.fontSize = wzStyleObject2.fontSize;
wzTblObject.rows[I].cells[2].style.fontFamily = wzStyleObject2.fontFamliy;
wzTblObject.rows[I].cells[2].style.fontStyle = wzStyleObject2.fontStyle;
wzTblObject.rows[I].cells[2].style.color = wzStyleObject2.color;
	}

for(I=1;I<13;I++){
	monthlayer = document.getElementById("M"+I);
	monthlayer.style.visibility ="hidden";
	
	}	
monthlayer = document.getElementById("M"+MSet);
monthlayer.style.position = "absolute";
monthlayer.style.width = 500;
monthlayer.style.top = posy;
monthlayer.style.left = posx;
monthlayer.style.visibility ="visible";	
}


//Scraop Book Functions
function sbload(){
var tlayer
tlayer = document.getElementById("SBD");
tlayer.style.visibility="hidden";
tlayer = document.getElementById("LNN");
tlayer.style.visibility="hidden";
	
var wzStyleSheet;

wzStyleSheet= document.styleSheets[0];	
if(!wzStyleSheet.cssRules){
    wzStyleSheet.cssRules = wzStyleSheet.rules;	
    }
tempcolor2 = wzStyleSheet.cssRules[15].style.color

//read data

var wzTblObject
wzTblObject = document.getElementById("SBTD");
NumRow = wzTblObject.rows.length;
temp = 0;
txt = "<table width='75%' border='0'> <tr><td align='left' class='sbLeftHeader'>Select Picture</td></tr><tr><td>" + vbCrLf;
txt = txt + "<table width='100%' border='0'>" + vbCrLf;
	for(I=1;I<NumRow;I++){
	if(!wzTblObject.rows[I].cells[0].firstChild.nodeValue==""){
	txt = txt + "<tr><td id='SBS" + I + "' class='sbLeftName' align='left' onclick=" + qt + "selSBP(" + I + ",'";
	txt = txt + wzTblObject.rows[I].cells[0].firstChild.nodeValue +"','" + wzTblObject.rows[I].cells[2].firstChild.nodeValue + "'";
	txt = txt + ");" + qt + ">";
	txt = txt +  wzTblObject.rows[I].cells[1].firstChild.nodeValue
	txt = txt + "</td></tr>" + vbCrLf;	
	temp=temp+1;	
	
	
	
	}
	}	
	
	
txt=txt + "</table>"+ vbCrLf;	
txt=txt + "</td></tr></table>"+ vbCrLf;

//alert(txt);
tlayer.innerHTML= txt;
tlayer.style.visibility="visible";
selSBP(1,wzTblObject.rows[1].cells[0].firstChild.nodeValue,wzTblObject.rows[1].cells[2].firstChild.nodeValue);
	
}

function selSBP(sbNum,sbPic,sbText){
for(I=1;I<=temp;I++){
LeftNN = document.getElementById("SBS" + I);	
LeftNN.style.color = tempcolor2;
LeftNN.style.cursor = poniter;	
	}	
LeftNN = document.getElementById("SBS" + sbNum);	
LeftNN.style.color = "#FF0000";

DspImage = document.getElementById("SBP");	
DspImage.style.visibility ="hidden";	
txt = "<table width='90%' border='0'>" + vbCrLf;
txt = txt + "<tr><td align='center'><img src='images/" + sbPic + "'></td></tr>" +vbCrLf;
txt = txt + "<tr><td class='sbCaption' align='center'>" + sbText + "</td></tr>" +vbCrLf;
txt = txt + "</table>" + vbCrLf;	
DspImage.innerHTML = txt;
DspImage.style.position = "absolute";
DspImage.style.width = 500;
DspImage.style.top = 200;
DspImage.style.left = 200;
DspImage.style.visibility ="visible";	


}



// Browser Detector
function BrowserDetectLite() {
	var ua = navigator.userAgent.toLowerCase(); 

	// browser name
	this.isGecko     = (ua.indexOf('gecko') != -1);
	this.isMozilla   = (this.isGecko && ua.indexOf("gecko/") + 14 == ua.length);
	this.isNS        = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
	this.isIE        = ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) ); 
	this.isOpera     = (ua.indexOf("opera") != -1); 
	this.isKonqueror = (ua.indexOf("konqueror") != -1); 
	this.isIcab      = (ua.indexOf("icab") != -1); 
	this.isAol       = (ua.indexOf("aol") != -1); 
	this.isWebtv     = (ua.indexOf("webtv") != -1); 
	
	// spoofing and compatible browsers
	this.isIECompatible = ( (ua.indexOf("msie") != -1) && !this.isIE);
	this.isNSCompatible = ( (ua.indexOf("mozilla") != -1) && !this.isNS && !this.isMozilla);
	
	// browser version
	this.versionMinor = parseFloat(navigator.appVersion); 
	
	// correct version number
	if (this.isNS && this.isGecko) {
		this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
	}
	else if (this.isIE && this.versionMinor >= 4) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	}
	else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isOpera) {
		if (ua.indexOf('opera/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
		}
		else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
		}
	}
	else if (this.isKonqueror) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
	}
	else if (this.isIcab) {
		if (ua.indexOf('icab/') != -1) {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
		}
		else {
			this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
		}
	}
	else if (this.isWebtv) {
		this.versionMinor = parseFloat( ua.substring( ua.indexOf('webtv/') + 6 ) );
	}
	
	this.versionMajor = parseInt(this.versionMinor); 
	this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
	
	// dom support
   this.isDOM1 = (document.getElementById);
	this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

	// platform
	this.isWin   = (ua.indexOf('win') != -1);
	this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
	this.isMac   = (ua.indexOf('mac') != -1);
	this.isUnix  = (ua.indexOf('unix') != -1 || ua.indexOf('linux') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
	
	// specific browser shortcuts
	this.isNS4x = (this.isNS && this.versionMajor == 4);
	this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
	this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
	this.isNS4up = (this.isNS && this.versionMinor >= 4);
	this.isNS6x = (this.isNS && this.versionMajor == 6);
	this.isNS6up = (this.isNS && this.versionMajor >= 6);
	this.isNS7x = (this.isNS && this.versionMajor == 7);
	this.isNS7up = (this.isNS && this.versionMajor >= 7);
	
	this.isIE4x = (this.isIE && this.versionMajor == 4);
	this.isIE4up = (this.isIE && this.versionMajor >= 4);
	this.isIE5x = (this.isIE && this.versionMajor == 5);
	this.isIE55 = (this.isIE && this.versionMinor == 5.5);
	this.isIE5up = (this.isIE && this.versionMajor >= 5);
	this.isIE6x = (this.isIE && this.versionMajor == 6);
	this.isIE6up = (this.isIE && this.versionMajor >= 6);
	
	this.isIE4xMac = (this.isIE4x && this.isMac);
}
var browser = new BrowserDetectLite();
var poniter = "pointer";
if(browser.isIE){
	var poniter = "hand";
}

function emailTo(Position) {

	output = '<a href="' + 'mail' + 'to:' + Position + '@' + 'pack469.' + 'org">';

	output += '<img src="images/mail.gif" alt="Mail" border="0" width="25" height="16">';

	output += Position + '@' + 'pack469.' + 'org </a>';

	return output;

	}

	

function volunteerNow(Position) {

	output = '<a href="' + 'mail' + 'to:' + 'chairman' + '@' + 'pack469.' + 'org';

	output += '?Subject=Volunteer for ' + Position + '">';

	output += '<img border="1" src="images/volunteernow.gif" align="bottom" alt="(Volunteer Now)" width="140" height="16">';

	output += '</a>';

	return output;

	}

// End hiding script from old browsers -->
