<!--
/*
//reset these variables from swNavigationPages to take querystrings into account
var thisPrimaryNav = ''
var thisParentId = ''
var thisPageId = ''
thisPage=document.URL
//figure out what category we are in
thisCatIndex = -1
//arrThisPage = thisPage.split("/")
baseHref = "http://10.3.38.21:8370/"
thisFileName = thisPage.replace(baseHref, "")
baseHref = "http://www.brfc.org/"
thisFileName = thisFileName.replace(baseHref, "")
baseHref = "http://brfc.org/"
thisFileName = thisFileName.replace(baseHref, "")
baseHref = "http://64.78.10.91/"
thisFileName = thisFileName.replace(baseHref, "")

//thisFileName = arrThisPage[arrThisPage.length -1]
thisFileName = thisFileName.toLowerCase()
//alert(thisFileName)
if (thisFileName.indexOf('?') != -1){	//there is a querystring
    arrThisFileName = thisFileName.split("?")
    thisFileName = arrThisFileName[0]
}
//first check main nav's
for (i=0;i<mainNavFileName.length;i++){
    currentFileName = mainNavFileName[i]
    currentFileName = currentFileName.toLowerCase()
    if(thisFileName == currentFileName){
        thisCatIndex = i
        thisPrimaryNav = currentFileName
    }
    //now check sub nav's
    for (j=0;j<subNavFileName[i].length;j++){
        currentFileName = subNavFileName[i][j]
        if (typeof currentFileName != 'undefined'){
	        currentFileName = currentFileName.toLowerCase()
	        if(thisFileName == currentFileName){
				//alert(i + " " + j)
		        thisCatIndex = i	
		        thisPrimaryNav = mainNavFileName[i]
		        thisParentId = subNavParent[i][j]
		        thisPageId = subNavId[i][j]
		        thisPageTitle = subNavTitle[i][j]
	        }
        }
    }
}

//alert(thisCatIndex)
var arrNavTemplate = new Array
var arrNavClass = new Array
var arrNavClassOn = new Array
//var arrDivStyle = new Array

//============================================================================================//
// Create templates for each level of navigation below. The index is the navigation level     //
// i.e. arrNavTemplate[2] is the html template for the 2nd level                              //
//																							  //
// dynamic variables are:																	  //
//			##fileName##	=	url to link to												  //
//			##pageTitle##	=	name to show in navigation									  //
//			##navClass##	=	CSS class to replace										  //
//============================================================================================//



arrNavTemplate[2] =  "  <tr>"
arrNavTemplate[2] +=  "     <td class=\"subnav_link\"><a href=\"##fileName##\" class=\"##navClass##\">##pageTitle##</a></td>"
arrNavTemplate[2] +=  " </tr>"
//arrNavTemplate[2] +=  "             <tr>"
//arrNavTemplate[2] +=  "	                <td width=\"15\" valign=\"top\"><img src=\"images/spacer.gif\" width=\"15\" height=\"1\"></td>"
//arrNavTemplate[2] +=  "                 <td width=\"8\" valign=\"top\" style=\"padding-top:6px;\"><img src=\"images/lnav_arrow.gif\" width=\"8\" height=\"13\">"
//arrNavTemplate[2] +=  "                 <td width=\"7\" valign=\"top\"><img src=\"images/spacer.gif\" width=\"7\" height=\"1\">"
//arrNavTemplate[2] +=  "	                <td width=\"157\" valign=\"top\"  class=\"navitem\" style=\"padding-top:7px;padding-bottom:5px;\"><a class=\"##navClass##\" href=\"##fileName##\">##pageTitle##</a></td>"
//arrNavTemplate[2] +=  "	                <td width=\"10\" bgcolor=\"#CEC6A5\" valign=\"top\"><img src=\"images/spacer.gif\" width=\"10\" height=\"1\"></td>"
//arrNavTemplate[2] +=  "             </tr>"
//arrNavTemplate[2] +=  "         </table>"
//arrNavTemplate[2] +=  "     </td>"
//arrNavTemplate[2] +=  " </tr>"

//styles
arrNavClass[2] = "subnav_link"
arrNavClassOn[2] = "subnav_link_on"

//this is the style for the yellow divider line between 2nd level items
//arrDivStyle[2] = ""



//============================================================================================//
//============================================================================================//
// DO NOT EDIT BELOW THIS LINE UNLESS YOU INTEND ON CHANGING FUNCTIONALITY					  //
//============================================================================================//
//============================================================================================//


//testing variables
//thisCatIndex = 2
//thisFileName = "services-jri-health-services-lev-3-one-4-3.asp"
//end testing variables

pageFound = false
isTopLevelPage = false
navParent = ""
navLevel = 2
navStr = ""
strPagePath = ""
var arrPagePath = new Array


if (typeof thisCatIndex != "undefined"){

	//see if this is a top level landing page (ie About, Services, etc). If so we are only showing the second level
	//for that section. no need to look for 3rd, 4th, etc...
	for(var i=0; i<mainNavFileName.length; i++){
		if (thisFileName == mainNavFileName[i].toLowerCase()){
			isTopLevelPage = true
		}
	}

	if (typeof subNavFileName[thisCatIndex] != "undefined"){
		//get the path of the current page from the parent level
		strPagePath = getPagePath()
		if (strPagePath != ""){
			arrPagePath = strPagePath.split("/")
		}
		
		//get the sub navigation for this top level
		getSubs(navParent, navLevel)
	}
}	
//======================================//
//		write out the navigation		//
//======================================//	
//document.write(navStr)





 
function getSubs(thisParent, level){
	for(var i=0;i<subNavFileName[thisCatIndex].length;i++){
		openToNextLevel = false
		if (subNavInNav[thisCatIndex][i] != "0" && subNavParent[thisCatIndex][i] == thisParent){
			//check to see if the page we are looking at is in the page path
			for (var j=0;j<arrPagePath.length;j++){
				
				
				strPage = subNavFileName[thisCatIndex][i].toLowerCase()
				strPagePath = subNavFileName[thisCatIndex][i].toLowerCase().replace(arrPagePath[j].toLowerCase(), "");

				if (strPage == strPagePath){
					openToNextLevel = false
				}	else {
				    openToNextLevel = true
				}
			}
		
			//get html template for this level and write out navigation HTML
			thisNavString = arrNavTemplate[level]
            
			thisNavString = thisNavString.replace("##pageTitle##", subNavTitle[thisCatIndex][i])
			thisNavString = thisNavString.replace("##fileName##", "/" + subNavFileName[thisCatIndex][i])
			
			if (openToNextLevel) {
				thisNavString = thisNavString.replace("##navClass##", arrNavClassOn[level]) 
				//alert("change");
			} else {
				thisNavString = thisNavString.replace("##navClass##", arrNavClass[level])
			}	
			
			//draw the yellow div line between 2nd levels
			//if(level==2 && i>0){
			//    thisNavString = thisNavString.replace("##divStyle##", arrDivStyle[level]);
			//}
			navStr += thisNavString
			//alert(navStr)
			// if this isn't a top level landing page and this page is at least one level deeper then get children
			if (!isTopLevelPage && openToNextLevel){
				//get next level
				if (level < navLevel){
					getSubs(subNavId[thisCatIndex][i], level+1)
				}	
				
			}	
		}
	}	
	
}

function getPagePath(){
	pageFile = ""
	strPagePath = ""
	for(var i=0;i<subNavFileName[thisCatIndex].length;i++){
		if (thisFileName == subNavFileName[thisCatIndex][i].toLowerCase()){
			pageFile = subNavFileName[thisCatIndex][i]
			strPagePath = pageFile
		}
	}
	safety = 0	//used to stop runaway loop. never more than 10 levels of nav
	while(pageFile != "" && safety < 10){
		pageFile = getParent(pageFile)	
		if (pageFile != ""){
			strPagePath = pageFile + "/" + strPagePath
		}
		safety += 1
	}
	return strPagePath
}

//returns the parent file name of a given navigation file
function getParent(whichPageFile){
	var thisParentId = -1
	strParentFileName = ""
	//get parentId
	for(var i=0;i<subNavFileName[thisCatIndex].length;i++){
		if (whichPageFile.toLowerCase() == subNavFileName[thisCatIndex][i].toLowerCase()){
			thisParentId = subNavParent[thisCatIndex][i]
		}
	}	
	//now get parent
	if (thisParentId != -1){
		for(var i=0;i<subNavFileName[thisCatIndex].length;i++){
			if (thisParentId == subNavId[thisCatIndex][i].toLowerCase()){
				strParentFileName = subNavFileName[thisCatIndex][i]
			}
		}
	}		
	
	return strParentFileName
}

*/


function stripHTML(strHTML){
    var re = new RegExp;
    re = /<(.|\n)+?>/gi;
    return strHTML.replace(re, "");
    return strHTML
						
}
/*
function getPageTitle(){
    found = false
	
    //first check main navs
    if (typeof mainNavFileName != "undefined"){
		
        for(i=0;i<mainNavFileName.length;i++){
	        if (thisFileName == mainNavFileName[i].toLowerCase()) {
		        found = true
		        return stripHTML(mainNavTitle[i])
	        }
	        if (found){
		        break;
	        }	
        }
    }	
    //if not found, check sub nav's
    if (!found){
        if (typeof subNavFileName != "undefined"){
	        for(i=0;i<mainNavFileName.length;i++){
		        for(j=0;j<subNavFileName[i].length;j++){
										
			        if (thisFileName == subNavFileName[i][j].toLowerCase()) {
				        found = true
				        foundIndex = i
				        return stripHTML(subNavTitle[i][j])
				        break
			        }
					
		        }
		        if (found){
			        break
		        }	
	        }
        }
    }
    //check custom pages
    if (thisFileName == "newsdetail.asp"){
		found = true
		return "News & Events"
    }
    if (thisFileName == "login.asp"){
		found = true
		return "Member Login"
    }
    if (thisFileName == "loginforgot.asp"){
		found = true
		return "Forgot Password"
    }
    if (thisFileName == "loginsignup.asp"){
		found = true
		return "Member Signup"
    }
    if (thisFileName == "about/newsletter-signup-thanks.asp"){
		found = true
		return "Member Signup"
    }
    if (!found){
		return ""
    }
}
*/

	function isEmailValid(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}



function swapImage(img, state){
	thisSrc = img.src
	
	if(thisSrc.indexOf("Over") > 0){	//on, turn off
		thisSrc = thisSrc.replace("Over.gif", ".gif")
		img.src = thisSrc
	}	else {	//turn on
		thisSrc = thisSrc.replace(".gif", "Over.gif")
		img.src = thisSrc
	}
	

}

//for use with any ajax calls													
var request = false;
var requestPrivate = false
try {
	request = new XMLHttpRequest();
} catch (trymicrosoft) {
	try {
	request = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (othermicrosoft) {
	try {
		request = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (failed) {
		request = false;
	}  
	}
}

function sendPageToFriend(){
	url = "/modules/sendToFriend.asp?url=" + encodeURIComponent(location.href)
	GB_show('Send Page To a Friend', url, 400, 500);
}

function postToDelicious(){
	window.open('http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=700,height=400')
}

function postToDigg(){
	
	//get description from meta tag description
	el = document.getElementsByTagName("meta")
	strBodyText = ""
	for (i=0; i<el.length; i++){
		
		thisName = el[i].name
		if (thisName != "")
			thisName = thisName.toLowerCase()
		if (thisName == "description")	{
			strBodyText = el[i].content
		}
	}
	url = "http://digg.com/submit?phase=2&url=" + encodeURIComponent(location.href) + "&referrer=digg&title=" + encodeURIComponent(document.title) + "&topic=health&bodytext=" + encodeURIComponent(strBodyText)
	
	window.open (url, 'digg', 'width=700,height=400, resizable=yes')
}

function postToFaceBook(){
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title),'sharer','toolbar=no,width=642,height=436')
}

function postToStumbleUpon(){
	url = "http://www.stumbleupon.com/submit?url=" + encodeURIComponent(location.href) + "&title=" + encodeURIComponent(document.title)
	window.open (url, 'stumbleUpon', 'width=700,height=400, resizable=yes')
}

//-->	
