
$(document).ready(function(){
	if(typeof nodePath != 'undefined') {
		var elm = document.getElementById(nodePath);	
	
		if(elm !=null){
			var theNode = jQuery(elm);
			var theLevel= theNode.get(0).className.substring(1,2);			
			
		
			
			theNode.addClass("l"+theLevel+"Active").removeClass("l"+theLevel+"InActive");
			theNode.next().show();
			
			showParentNode(theNode);
		}
	}
});


function showParentNode(theNode){
	var theLevel= theNode.get(0).className.substring(1,2);
	if(theLevel ==0) return false;
	
	theLevel = theLevel - 1;	
	theNode.parent().parent().show();
	theNode.parent().parent().prev().addClass("l"+theLevel+"Active").removeClass("l"+theLevel+"InActive");
	
	showParentNode(theNode.parent().parent());
}


function showContent(elm){
	if(typeof elm != 'undefined'){
		var nodePath= elm.id;
		if(typeof elm != 'undefined'){
			var url = requestURI;
				url += '?_nfpb=true';
				url += '&path='+nodePath;
			
			if (pageLabel == 'searchResults') {
				url += '&_pageLabel=WelcomePage';
			}
			
			window.location.href=url;
		}
	}
	return false;
}


function setHref(elm){
	if(typeof elm != 'undefined'){	
		var nodePath= elm.id;
		if(typeof elm != 'undefined'){
			var url = requestURI;
				url += '?_nfpb=true';
				url += '&path='+nodePath;
			
			
			elm.href=url;
		}
	}
	return false;
}


function popContent(elm){
	if(typeof elm != 'undefined'){	
		var nodePath= elm.id;
		if(typeof elm != 'undefined'){
			var url = 'showHTMLContent?path='+nodePath;
			
			
			window.open(url,'OPBInfo','toolbar=no,menubar=no,location=no,scrollbars=yes');
		}
	}
	return false;
}

var windowHandler ;

function openSubWindow(elm){
	windowHandler = window.open(elm.href,'OPBSecDoc','toolbar=no,menubar=no,location=no,scrollbars=yes');		
}

function closeSubWindow(){
	if(windowHandler !=null ){				
		try{					
			windowHandler.close();
		}catch(e){
			windowHandler = window.open('blank.html','OPBSecDoc','');
			windowHandler.close();					
		}
	}			
}

function gotoEServices(){
	
	var url = 'https://' + location.hostname + '/eservices/eServices.portal?_nfpb=false&_pageLabel=WelcomePage&_to=eServices';
	
	windowHandler = window.open(url,'eServices');		
	
}


function gotoEAlert(){
	var url = requestURI+'?_nfpb=true&_nfls=false&_pageLabel=eAlert&eAlert_1_actionOverride=%2Fca%2Fopb%2Fportal%2Fpageflow%2FeAlert%2Fbegin';		
		
	window.location.href=url;
	
	return false;
}



function showImage(){
	var numberOfImages = 10;
	var whichImage = Math.round(Math.random()*(numberOfImages-1));
	document.write('<img src="images/specialFeaturesBanner/'+ whichImage+'.jpg">');
}


function showRightImage(){
	var numberOfImages = 14;
	var whichImage = Math.round(Math.random()*(numberOfImages-1));
	document.write('<img src="images/pageBanner/'+ whichImage+'.jpg">');
}

function openSubEServicesWindow(){

    var url= 'https://' + location.hostname + '/eservices/eServices.portal?_nfpb=false&_pageLabel=WelcomePage&_to=eServices';
    
	windowHandler = window.open(url,'eServices');		
}