<!-- // Hiding from fogey browsers
// Go to page

function IsIE()
{
	var isIEBrowser = false;
	var browser = navigator.appName;
	if (containsString(browser,"microsoft")) 
	{
		isIEBrowser = true;
	}

	return isIEBrowser; 
}

// set email
function GetEmail()
{
	var email = "";
	
	var a1 = "surfer";
	var a2 = "dudes";
  	var a3 = "@";
	var a4 = "atlantic"
	var a5 = "bodysurfing";
	var a6 = "club";
	var a7 = ".";
	var a8 = "com";	
	
	email = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8;
  	
  	document.write(email);
}

function startSlideShow(pYear,pSlideCount,pStart,pWidth,pHeight)
{
    var strURL = "";
    var strWinDef = "";
    
    // URL:
    strURL += "PhotoSlideShow.aspx";
    strURL += "?year=" + pYear;
    strURL += "&slidecount=" + pSlideCount;    
    strURL += "&start=" + pStart;
    
    // Windows characteristics
    strWinDef += "toolbar=no,";
    strWinDef += "location=no,";
    strWinDef += "status=yes,";
    strWinDef += "menubar=no,"
    strWinDef += "scrollbars=yes,"
    strWinDef += "resizable=yes";
    
    goToPage(strURL,"SlideShow",strWinDef,pWidth,pHeight)    
    
}

function customPrint() {
	
	var strDebug = "";
	var filename = "";		
	
	strDebug += "Entering customPrint() \n";
			    
	// Get image filename
    filename = document.getElementById("imgMain").src;
    strDebug += "imgMain filename: " + filename + "\n";
    
    // Print dialogue
    window.print();
	
	//alert(strDebug);
}

// For showing club T-Shirts
function showImagePhoto(pURL) {
	
	var strDebug = "";	
	var browserTitle = "Atlantic Bodysurfing Club - T-Shirts";	
	
	strDebug += "In showImagePhoto() \n";
	strDebug += "pURL: " + pURL + "\n";
	//alert(strDebug);
	
	formatPopup(browserTitle,pURL);		
}

// For priont slide show photos
function printPhoto() {
	
	var strDebug = "";
	var strURL = "";
	var browserTitle = "Atlantic Bodysurfing Club - Print Photo";
	
	strURL = document.getElementById("imgMain").src;
	strDebug += "In printPhoto() \n";
	strDebug += "strURL: " + strURL + "\n";
	//alert(strDebug);
	
	if (containsString(strURL,"white_back"))
	{
		alert("Select a photo - then click Print.");
	}
	else
	{
		formatPopup(browserTitle,strURL);
	}
}

function formatPopup(pTitle,pURL) {
	
	var strDebug = "";
	var newWindow = "";
	var winContents = "";
	var winDef = "";	
	var strTemp = "";
	var dblQ = "\"";
	
	strDebug += "Entering formatPopup() \n";
	strDebug += "pTitle: " + pTitle + "\n";
	strDebug += "pURL: " + pURL + "\n";	
	//alert(strDebug);
	
	winDef += "toolbar=yes,location=no,status=no,";
	winDef += "menubar=no,scrollbars=yes,resizable=yes,";
	winDef += "width=700,height=520";
	newWindow = window.open('','PrintWin',winDef);
	winContents = newWindow.document;
	
	strTemp = "<html><head><title>" + pTitle + "</title>";  
	winContents.write(strTemp);
	
	// Stylesheet 
	//winContents.write('<link rel="stylesheet" href="js.css">');
	
	winContents.write('</head><body>');
	
	// Page title
	//winContents.write('<div align=center><h3>Page Title</h3></div>');
	
	// Show page
	//winContents.write('<p><a href="alert(self.location.href);">Location</a>.</p>');
	
	// Print link - using browser functionality
	strTemp = "";
	strTemp += "<div align=center>";
	strTemp += "<a href=" + dblQ + "javascript:void(0)" + dblQ;
	strTemp += " onClick=" + dblQ + "window.print();return false;" + dblQ + " >";
	strTemp += "Print";
	strTemp += "</a></div>";
	//winContents.write(strTemp);
			
	// Show photo
	strTemp = "";
	strTemp += "<div align=center>";
	strTemp += "<img border=" + dblQ + "0" + dblQ;
	strTemp += " src=" + dblQ + pURL + dblQ + ">";
	winContents.write(strTemp);
	
	// Print/Close:	
	strTemp = "";
	strTemp += "<br><br>";
	strTemp += "<div align=center>";
	
	// Print message
	strTemp += "<b>Use your browser's Print button to print photo.</b>";
	
	strTemp += "&nbsp;&nbsp;&nbsp;";
	
	// Close button
	strTemp += "<input id=" + dblQ + "btnClose" + dblQ;
	strTemp += " onClick=" + dblQ + "window.close();return false;" + dblQ;
	strTemp += " type=" + dblQ + "button" + dblQ;
	strTemp += " value=" + dblQ + "Close" + dblQ + " >";	
	strTemp += "</div>";
	winContents.write(strTemp);
	
	// Close using link:
	//strTemp = "";
	//strTemp += "<br><div align=center>";
	//strTemp += "<a href=" + dblQ + "javascript:void(0)" + dblQ;
	//strTemp += " onClick=" + dblQ + "window.close();return false;" + dblQ + " >";	
	//strTemp += "<b>Close</b>";
	//strTemp += "</a></div>";
	//winContents.write(strTemp);
		
	winContents.write('</body></html>');
	//winContents.close();
}

function goToPage(pURL,pWinName,pWinDef,pWinWidth,pWinHeight) {
	
	var strDebug = "";
		
	strDebug += "Entering goToPage() \n";
	strDebug += "pWinName: " + pWinName + "\n";
	strDebug += "pWinDef: " + pWinDef + "\n";
	strDebug += "pWinWidth: " + pWinWidth + "\n";	
	strDebug += "pWinHeight: " + pWinHeight + "\n";
			
	//alert("strDebug: " + strDebug);
	
	var navto = pURL;
		
	// Window name
	var winName = pWinName;
	
	// Window characteristics
	var windef = pWinDef;
	//var windef = "toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1";
	
	openCenteredWindow(navto,winName,windef,pWinWidth,pWinHeight,'true');		
}

// Open centered window 
function openCenteredWindow(theURL,winName,features,myWidth,myHeight,isCenter) {

	if(window.screen)if(isCenter)if(isCenter=="true") {
    	var myLeft = (screen.width-myWidth)/2;
    	var myTop = ((screen.height-myHeight)/2) - 100;
    	features+=(features!='')?',':'';
    	features+=',left='+myLeft+',top='+myTop;
	}
  	  	
  	var centeredWindow = window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
		  	
	centeredWindow.focus();
}

function onLoadActions(pCaller) {

	// Uncheck both
	if (pCaller == "uploadpage")
	{
		if (document.form1.rdoCensusData[0].checked == true) {
			document.form1.rdoCensusData[0].checked = false;
		}

		if (document.form1.rdoCensusData[1].checked == true) {
			document.form1.rdoCensusData[1].checked = false;
		}

		// Hide divs
		hide('divFileBrowse');
		hide('divDownloadFile');
		hide('divUploadStatus');
		hide('divErrors');
	}	
}

function popUpWindow(pFN,pWidth,pHeight) {
	
	var winname = "Download";
	var navto = pFN;
	
	//alert("pStrRTFName: " + pStrRTFName);
	var attrib= 'width= ' + pWidth + ',' + 'height=' + pHeight + ',' + 'toolbar=yes,scrollbars=yes,menubar=yes,resizable=yes,titlebar=no,screenX=75,screenY=75'

	//alert("in popUpWindow()\n" + "going to: " + navto);

	if ( isNotIE() ) {
		window.location.href=pFN;
	}
	else {
		window.open(navto, winname, attrib);
	}
}

function isNotIE()
{
	if (navigator.appName == "Netscape") {
		return true;
	}
	return false;
}

// returns the style object 
function getStyle(pID) {
	if (document.getElementById) {		
		return document.getElementById(pID).style;
	} 
    else if (document.all) {    	
    	return document.all[pID].style;
    } 
    else if (document.layers) {    	
    	return document.layers[pID];
    }
} 

// changes the display property of element 'id' to block 
function show(pID) { 
	var styleObj = getStyle(pID); 
	styleObj.display = 'block';
} 

// changes the display property of element 'id' to none 
function hide(pID) {	
	var styleObj = getStyle(pID); 
	styleObj.display = 'none';	
}

function toggleDiv(pID) {
	
	if (pID == "divFileBrowse") {
		if (isHidden("divFileBrowse")) {
			show("divFileBrowse");			
    	}
    	else {    		
    		hide("divFileBrowse");
    	}
    }
    
}

// check the display property of element 'id'
function isHidden(pID) { 
	var styleObj = getStyle(pID);
	if (styleObj.display == 'none') {
		return true;
	}
	else {		
		return false;
	}	
}

// check the display property of element 'id'
function isShown(pID) { 
	var styleObj = getStyle(pID);
	if (styleObj.display != 'none') {
		return true;
	}
	else {		
		return false;
	}	
}

// Pass form name and boolean for showing alert
function CopyToClipboard(elementId,showalert)
{

	var strDebug = "";
	var oElement; 

	strDebug += "elementId: " + elementId + "\n";
	strDebug += "showalert: " + showalert + "\n";

	if (document.all) {
		oElement = document.all[elementId];
	}
	else {
		if (document.getElementById) {
			oElement = document.getElementById(elementId);
		}
	}	

	strDebug += "oElement.value: " + oElement.value + "\n";

	oElement.focus();
	oElement.select();

	CopiedTxt = document.selection.createRange();
	CopiedTxt.execCommand("Copy");

	// Unselect errors text
	document.selection.empty();	

	if (showalert) {
	  alert("All errors have been copied\n" + "to Windows clipboard.");
	}

	//alert("strDebug: " + strDebug);

}

function getElementInfo() {
	var strDebug = "";
	var i = 0;
	var numElements = document.forms[0].elements.length;
	var strName = "";
	var strValue = "";
	var strType = "";
	var strLength = 0;
	var selidx = "";
	var strSelectedValue = "";

	
	for (i = 0; i < numElements; i++) {		
		
		strType = document.forms[0].elements[i].type;
		strName = document.forms[0].elements[i].name;
		
		// skip VIEWSTATE		
		//if (strName.indexOf('VIEWSTATE') == -1) {	
		
		if (strName.indexOf(':HealthPlansGrid:') > 0) {			
			// Get textarea values
			if (strType != "select-one")  {				
				strValue = document.forms[0].elements[i].value;
				if (strValue != "") {
					strLength = strValue.length;
					strDebug += " Value: " + strValue + "\n";
				}
				else {
					strLength = 0;
				}
			}	


			strDebug += "Type: " + strType;
			strDebug += " Name: " + strName;
			//strDebug += " Length: " + strLength + "\n";		

			// Get droplist values
			if (strType == "select-one") {
				selidx = document.forms[0][strName].selectedIndex;
				strSelectedValue = document.forms[0][strName].options[selidx].value;
				strDebug += " Selected value: " + strSelectedValue + "\n";
			}
		}	
	}	

	alert("strDebug:\n" + strDebug);
}

// Pass string to test and string to match
// Ignores case for both parms
function containsString(pStr,pStrToMatch)
{
	var strDebug = "";
	
	// Init to false
	var boolReturn = false;
	
	strDebug += "In containsString(), pStr: " + pStr + "\n";
	strDebug += "In containsString(), pStrToMatch: " + pStrToMatch + "\n";
	
	pStr = pStr.toLowerCase();
	pStrToMatch = pStrToMatch.toLowerCase();
	
	if ( (pStr != "") && (pStr != null) && (pStrToMatch != "") && (pStrToMatch != null) ) 
	{ 
		strDebug += "pStr and pStrToMatch not empty" + "\n";
		if (pStr.indexOf(pStrToMatch) >= 0) 
		{
			strDebug += "pStr.indexOf(pStrToMatch): " + pStr.indexOf(pStrToMatch) + "\n";
			boolReturn = true;
		}
	}
	else
	{
		strDebug += "pStr or pStrToMatch IS empty OR null" + "\n";		
	}	
		
	strDebug += "boolReturn: " + boolReturn + "\n";
	
	//alert(strDebug);
	
	return boolReturn;
}

// Get element ID pass partial name
// ASP.NET creates form elements with names like foo_foo_name
function getElementID(pNameToMatch) {

	var strDebug = "";
	var i = 0;	
	var numElements = document.forms[0].elements.length;
	var strName = "";
	var strID = "";
	var strValue = "";
	var strType = "";	
		
	pNameToMatch = pNameToMatch.toLowerCase();
	strDebug += "In getElementID(), pNameToMatch: " + pNameToMatch + "\n";
	strDebug += "In getElementID(), numElements: " + numElements + "\n";
	
	for (i = 0; i < numElements; i++) {
	
		strType = document.forms[0].elements[i].type;
		strName = document.forms[0].elements[i].name;		
		strDebug += "strName: " + strName + "\n";
		strDebug += "strType: " + strType + "\n";		
		
		//strDebug += "strBaseName: " + strBaseName + "\n";
		//strDebug += "pBaseNameToMatch: " + pBaseNameToMatch + "\n";
		
		if ( containsString(strName,pNameToMatch) )
		{
			strID = strName;						
		}		
		
	} // end for	
	
	strDebug += "Returning element ID: " + strID + "\n";		
	
	// For testing:
	alert(strDebug);
	
	return strID;
	
} // end getElementID()

//
function changeMain(pFN,pImgMainClientID,pPhraseMainClientID) {
    
    var strDebug = "";
    var strCaption = "";
    var elementID = "";
    
    //clearDebug("divDebug");
    
    strDebug += "In changeMain(), pFN: " + pFN + "\n";
    strDebug += "In changeMain(), pImgMainClientID: " + pImgMainClientID + "\n";
    strDebug += "In changeMain(), pPhraseMainClientID: " + pPhraseMainClientID + "\n";
    
    //getElementID("imgMain");
    
    // Get image
    document.getElementById(pImgMainClientID).src = pFN;
    
    // Get caption
    strCaption = getCaption(pFN);
    strDebug += "In changeMain(), strCaption: " + strCaption + "\n";
    
    elementID = document.getElementById(pPhraseMainClientID);
    elementID.innerHTML = strCaption; 
       
    //alert(strDebug);
    //addDebug("divDebug", strDebug);
   
}

function getCaption(pFN) {	
	
	var jsArray1 = "";
	var jsArray2 = "";
	var strDebug = "";
	var strCaption = "";
	var slideNum = "";
	var lastPart = "";
	
	jsArray1 = pFN.split("/");
		
	//myArray.length
	
	strDebug += "In getCaption(), pFN: " + pFN + "\n";
	strDebug += "In getCaption(), jsArray1[0]: " + jsArray1[0] + "\n";
	strDebug += "In getCaption(), jsArray1[1]: " + jsArray1[1] + "\n";
	
	lastPart = jsArray1[jsArray1.length-1];
	strDebug += "In getCaption(), lastPart: " + lastPart + "\n";
	
	jsArray2 = lastPart.split(".");
	slideNum = jsArray2[0];
	strDebug += "In getCaption(), slideNum: " + slideNum + "\n";
	
	if (slideNum == "white_back") {
	    strCaption = "Place mouse pointer over slide to view full size photo.";
	}
	else {
	    strCaption = getPhrase(slideNum);    
	}
		
	strDebug += "In getCaption(), strCaption: " + strCaption + "\n";
	
	//alert(strDebug);
	//addDebug("divDebug", strDebug);
	
	return strCaption;
	
} // end function

// for debugging
function addDebug(strElementID,strDebug)
{
	var str = "";
	
	if (strDebug != "")
	{
		str = strDebug.replace(/\n/g,"<br>");
		document.getElementById(strElementID).innerHTML += str;
	}	
}

// for debugging
function clearDebug(strElementID)
{
    document.getElementById(strElementID).innerHTML = "";
}

// **************************************************************************
// DD Tab Menu- Last updated April 27th, 07: http://www.dynamicdrive.com
// Only 1 configuration variable below
// **************************************************************************

var ddtabmenu={
	disabletablinks: false, ////Disable hyperlinks in 1st level tabs with sub contents (true or false)?
	currentpageurl: window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, ""), //get current page url (minus hostname, ie: http://www.dynamicdrive.com/)

definemenu:function(tabid, dselected){
	this[tabid+"-menuitems"]=null
	this.addEvent(window, function(){ddtabmenu.init(tabid, dselected)}, "load")
},

showsubmenu:function(tabid, targetitem){
	var menuitems=this[tabid+"-menuitems"]
 for (i=0; i<menuitems.length; i++){
		menuitems[i].className=""
		if (typeof menuitems[i].hasSubContent!="undefined")
			document.getElementById(menuitems[i].getAttribute("rel")).style.display="none"
	}
	targetitem.className="current"
	if (typeof targetitem.hasSubContent!="undefined")
		document.getElementById(targetitem.getAttribute("rel")).style.display="block"
},

isSelected:function(menuurl){
	var menuurl=menuurl.replace("http://"+menuurl.hostname, "").replace(/^\//, "")
	return (ddtabmenu.currentpageurl==menuurl)
},

addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
},

init:function(tabid, dselected){
	var menuitems=document.getElementById(tabid).getElementsByTagName("a")
	this[tabid+"-menuitems"]=menuitems
	for (var x=0; x<menuitems.length; x++){
		if (menuitems[x].getAttribute("rel")){
			this[tabid+"-menuitems"][x].hasSubContent=true
			if (ddtabmenu.disabletablinks)
				menuitems[x].onclick=function(){return false}
		}
		else //for items without a submenu, add onMouseout effect
			menuitems[x].onmouseout=function(){this.className=""}
		menuitems[x].onmouseover=function(){ddtabmenu.showsubmenu(tabid, this)}
		if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[x].href)){
			ddtabmenu.showsubmenu(tabid, menuitems[x])
			var setalready=true
		}
		else if (parseInt(dselected)==x)
			ddtabmenu.showsubmenu(tabid, menuitems[x])
	}
}
}

// Done hiding -->

