function popDisclaimer() {
	mywindow = window.open ("disclaimer.php","site_terms_of_use","location=1,status=1,scrollbars=1,width=680,height=500");
}

function launchClientArea(membername) {
	var url = "https://www.secureccnet.com/" + membername + "/client_area.php";
	mywindow = window.open (url,"site_terms_of_use","location=1,status=1,scrollbars=1,width=680,height=500");
}


function stopEvent(e) {
	if (!e) e = window.event;
	if (e.stopPropagation) {
		e.stopPropagation();
	} else {
		e.cancelBubble = true;
	}
}

function cancelEvent(e) {
	if (!e) e = window.event;
	if (e.preventDefault) {
		e.preventDefault();
	} else {
		e.returnValue = false;
	}
}
function fixNavLinks() {

	// Sidebar Children
	var navigations = ['sidebar', 'main_navigation_area', 'secondary_navigation_area'];
	var navs = [];
	
	for( var i = navigations.length - 1; i >= 0; i--)
	{
		if( document.getElementById(navigations[i]) )
		{
			navs.push(document.getElementById(navigations[i]));
		}
	}
	
	// Loop through the different navs
	for( var x = navs.length - 1; x >= 0; x--)
	{
		// No reason so have long weird names.
		var sbC = navs[x];
		
		// Find the collection of links. This could be a UL/LI or bunch of divs.
		while( sbC && sbC.childNodes )
		{
			sbC = sbC.firstChild.nodeType == 1 ? sbC.firstChild.childNodes : sbC.childNodes[1].childNodes;
		}

		for( var i = sbC.length - 1; i >= 0; i--)
		{
			if( sbC[i].nodeType == 1 ) {
				var item = sbC[i];

				// Drill down until the link is found. Will quit when the first link is found.
				while( item.firstChild && item.nodeName != "A" ) {
					item = item.firstChild;
				}
				
				item.onmouseup = item.onclick = function(e) {
					cancelEvent(e);
					stopEvent(e);
					var membername = window.location.toString().split(window.location.host)[1].split('/')[1];
					var newURL = "http://www.afsb.net/" + membername + '/' + this.href.split('/').pop();
					location.href = newURL;
					return false;
				}
			}
		}
		
	}
	
	

}
//window.onload = fixNavLinks;
