var helpWindow;
function openHelpWindow()
{

	//if (helpWindow!=null &&  !helpWindow.closed)
	//{
		//helpWindow.focus();
		//return;
	//}
	
	helpWindow = window.open('displayHelp.x', 'HelpWindow', 'subwindow, scrollbars=yes, resizable=no, menubar=no, toolbar=no, status=no,, width=550, height=700');
	if (helpWindow.closed)
	{
		alert('Disable Popup Blocker to open new window');
   	} else {
		helpWindow.focus();
	}
}
	
// For opening the ESA Document in a new window with the following properties.
function openESAWindow(lang)
{	
	if ( lang == 'en' )
	{
		window.open('/esa_agreement.html', 'ESA', 'width=850, height=600, resizable=no, menubar=no, toolbar=no, status=no, copyhistory=no, directories=no, scrollbars=yes');		
	} else if ( lang == 'es' ) {
		window.open('/spanish_esa_agreement.html', 'ESA', 'width=850, height=600, resizable=no, menubar=no, toolbar=no, status=no, copyhistory=no, directories=no, scrollbars=yes');		
	}
	return false;
}	



function openContactUsWindow(){
window.open('/NwbhWeb/staticweb/displayEmailHelpPage.x', 'ContactUs', 'width=850, height=600, resizable=no, menubar=no, toolbar=no, status=no, copyhistory=no, directories=no, scrollbars=yes');
}

/*
function portalSSO(appID,newWindow)
{
	if(newWindow) {
	   window.open('/NwbhWeb/content/protected/SSO?rType=NBHSSO&appId='+appID);
	} else {
	   window.location.href=("/NwbhWeb/content/protected/SSO?rType=NBHSSO&appId="+appID);
	}
}

function portalSSOOwens(appID,newWindow,lang)
{
	if(newWindow) {
	   window.open('/NwbhWeb/content/protected/SSO?rType=NBHSSO&appId='+appID+'&lang='+lang);
	} else {
	   window.location.href=("/NwbhWeb/content/protected/SSO?rType=NBHSSO&appId="+appID+'&lang='+lang);
	}
}
*/	
	
function portalSSO(appID,newWindow)
{
	if(newWindow) {
	   window.open('/NwbhWeb/content/ssoForward.x?appId='+appID);
	} else {
	   window.location.href=("/NwbhWeb/content/ssoForward.x?appId="+appID);
	}
}

function portalSSOOwens(appID,newWindow,lang)
{
	if(newWindow) {
	   window.open('/NwbhWeb/content/ssoForward.x?appId='+appID+'&lang='+lang);
	} else {
	   window.location.href=("/NwbhWeb/content/ssoForward.x?appId="+appID+'&lang='+lang);
	}
}


function portalHW(topicURL,newWindow)
{
  if(newWindow){
    window.open(topicURL);
  } else {
    window.location.href=topicURL;
  }
 }
 
// ONload function
function onLoadFuntion() 
{
	// set CSS display to None if right Nav is present
	elem = document.getElementById("rightNav");
	if(elem != null)
	{
		$('#rightNav ul:not(.subnav)').css('display','none');
	}	
}
 // Collapse Right Nav
function close_all(element_id) 
{
	if($(element_id).css('display')=='none')
	{
		$('#rightNav ul:not(.subnav)').hide('fast');						
	}									
}

function isEmpty(msg) 
{
	if ( msg == null || msg.length == 0 ) { return true; } else { return false; }	
}

function isValidReqDropDown(dropDownVal) 
{
	if ( dropDownVal == 'Select' || dropDownVal == null || dropDownVal.length == 0 ) { return false; } else { return true; }	
}

function isValidDate(dateValue) 
{
	dateMonth = "";
	dateDay = "";
	dateYear = "";
	dateIndex = 0;
	dateIndex2 = 0;

	dateIndex = dateValue.indexOf('/');
	
	if ( dateIndex == -1 || dateIndex > 2 ) { return false; }
	
	dateMonth = dateValue.substring(0, dateIndex);
	dateIndex2 = dateValue.indexOf('/', dateIndex+1);
	
	if ( dateIndex2 == -1  ) { return false; }
	
	dateDay = dateValue.substring(dateIndex+1, dateIndex2);
	dateYear = dateValue.substring(dateIndex2+1);
	
	if ( dateYear.length != 4 ) { return false; }
	
	if ( dateMonth > 0 && dateMonth < 13 && dateDay > 0 && dateDay < 32 && dateYear > 1900 ) { return true; }
	
	return false;
}

function isValidDOB(dobDateString) 
{
	var currentDate = new Date();
	var dobDateObj = new Date(dobDateString);
	if ( dobDateObj > currentDate ) { return false; } else { return true; }
}

function validateDate(SDate,EDate){
   var endDate = new Date(EDate);   
    var startDate= new Date(SDate);
    if(startDate > endDate){
     return false;
     }
     return true; 
 }
	
function isValidZIP(field)
{
	var valid = "0123456789-";
	var hyphencount = 0;
	
	if ( field.length != 5 && field.length != 10 ) { return 0; }
	
	for (var i=0; i < field.length; i++) 
	{
		temp = "" + field.substring(i, i+1);
		if (temp == "-") { hyphencount++; }
		if (valid.indexOf(temp) == "-1") { return 1; }			
		if ( (hyphencount > 1) || ( (field.length==10) && ""+field.charAt(5) != "-" ) ) { return 2; }
	}
}

function isValidCanadianZIP(zip)
{
	var validChars = /[^$A-Za-z0-9_\ \.]/;
	if ( validChars.test(zip) ) { return false; } else { return true; }
}

function isValidPhoneNumber(phoneNumber)
{
	if ( !isEmpty(phoneNumber) && ( isNaN(phoneNumber) || phoneNumber.length < 10 || phoneNumber.length > 10 ) ) { return false; } else { return true; }
}

function isValidEmail(email)
{
	var reg = /^([A-Za-z0-9_\-\.\,\!\#\$\%\&\*\+\-\/\=\?\^\_\`\{\|\}\~\'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if ( !isEmpty(email) && !reg.test(email) ) { return false; } else { return true; }
}

function isValidPassword(password)
{
	var validNumeric = /[0-9]/;
	var validUpperCase = /[A-Z]/;	
	if ( !validNumeric.test(password) && !validUpperCase.test(password) ) { return false; } else { return true; }
}

function isValidAlphaNumeric(field)
{
	var validChars = /[^$A-Za-z0-9]/;
	if ( validChars.test(field) ) { return false; } else { return true; }
}

function beginsWithNumeral(alpNm)
{
	var regEx = /^[a-zA-Z][a-zA-Z0-9]/i;
	if ( regEx.test(alpNm) ) { return false; } else { return true; }
}

<!--Collapsable Section Script Begins-->
// pass in true for noBlock if being used with a non-block level tag
function dsp(loc, noBlock){
   if(document.getElementById){
      var foc=loc.firstChild;
      foc=loc.firstChild.innerHTML?
         loc.firstChild:
         loc.firstChild.nextSibling;
      foc.innerHTML=foc.innerHTML=='+'?'-':'+';
      foc=loc.parentNode.nextSibling.style?
         loc.parentNode.nextSibling:
         loc.parentNode.nextSibling.nextSibling;
         if (noBlock) {
      		foc.style.display=foc.style.display==''?'none':'';
      	} else {
      		foc.style.display=foc.style.display=='block'?'none':'block';
      	}
      }}

<!--Collapsable Section Script Ends-->

<!--Help Text Pop up Boxes-->
/** js/jquery function to display help text. Pass in parameters for box positioning, box width, and div names.
  note the script below should be placed on the jsp and a div structure with an id of 'helpDiv' is required.
  If multiple help boxes are required on the page, then you will need unique div ids and ids for the close a href.
  Currently, CSS styling only exists for the helpDiv div.

$(document).ready(function(){
	
  	$(function() {
		$('#hide').click(function() {
			$('#helpDiv').hide(400);
		});
   	});
 });
 */
 // function takes IE and FF left/top positions, text box width, div name of text box and an inner div name to 
 //display close link
function show_help(ieL, ieT, ffL, ffT, boxWidth, divName, innerDiv) {
   $(function() {
	
		if ( $.browser.msie ) {
			$(divName).css({ position: "absolute", left: ieL, top: ieT });
		} else {
			$(divName).css({ position: "absolute", left: ffL, top: ffT });
		}
		
		$(divName).width(boxWidth);
		$(innerDiv).width(30);
		$(innerDiv).css({ float: "right", margin: "8" });
		$(divName).show(400); //400 indicates milliseconds to open, increase/decrease to change effect
	 
   });
 }
 
 <!--End Help Text Pop up Boxes-->
 