// JScript source code

function hideSearchBox(e) {
	var targ;
	      e = (e) ? e : ((window.event) ? window.event : "")
			if (e) {
				if (e.target) {
				targ = e.target;
				}
				if (e.srcElement){
				targ = e.srcElement;
				}
			}

	  
	    
	    if (targ.nodeType == 3) // defeat Safari bug
		    targ = targ.parentNode;
		    
	  while(targ.tagName != "DIV")
        {   
             if(targ.parentNode) 
             {
               targ = targ.parentNode;
             }
             else
             {
             break;
             }
        }
        
	 if (targ.id != 'SearchBoxDiv' && targ.id != 'SearchOptions')
	 {
		showDiv('SearchOptions', 0);
	 }
}

document.onclick = hideSearchBox;
//document.onmouseout = hideSearchBox;
	
function showDiv(ID, iState) // 1 visible, 0 hidden
{
	var searchDiv = document.getElementById('SearchOptions');
	var searchBox = document.getElementById('navSearch_SearchBox');
	//searchDiv.style.top = searchBox.style.top + 143;
	document.getElementById(ID).style.display = iState ? "" : "none";
}

function GetSections()
{
	var sections = "";
	if (document.getElementById('navSearch_sections_0').checked)
	{
	sections = sections + '1';
	}
	else
	{
	sections = sections + '0';
	}
	
	if (document.getElementById('navSearch_sections_1').checked)
	{
	sections = sections + ',1';
	}
	else
	{
	sections = sections + ',0';
	}
	
	if (document.getElementById('navSearch_sections_2').checked)
	{
	sections = sections + ',1';
	}
	else
	{
	sections = sections + ',0';
	}
	
	if (document.getElementById('navSearch_sections_3').checked)
	{
	sections = sections + ',1';
	}
	else
	{
	sections = sections + ',0';
	}
	
	if (document.getElementById('navSearch_sections_4').checked)
	{
	sections = sections + ',1';
	}
	else
	{
	sections = sections + ',0';
	}
	
	if (document.getElementById('navSearch_sections_5').checked)
	{
	sections = sections + ',1';
	}
	else
	{
	sections = sections + ',0';
	}
	
	if (document.getElementById('navSearch_sections_6').checked)
	{
	sections = sections + ',1';
	}
	else
	{
	sections = sections + ',0';
	}

	return sections;
}

function clear_textbox(item, text)
{
if (item.value == text)
item.value = "";
} 

function expandIt(ArrayName)
{
	if(typeof(ArrayName) == "object")
	{
		for (i = 1; i < ArrayName.length; i++)
		{
			document.getElementById(ArrayName[i]).style.display = (document.getElementById(ArrayName[i]).style.display == "none" ) ? "" : "none";	
		}
		
	}
	else
	{
		document.getElementById(ArrayName).style.display = (document.getElementById(ArrayName).style.display == "none" ) ? "" : "none";	
	}
}

	NS4 = (document.layers);
	IE4 = (document.all);
	NS6 = (document.getElementById && !IE4);

	var currentPreview = '0';
	
function showPreview(previewId,previewLink)
{
	
	scrollY = getTop(previewLink);
	
	if(currentPreview == previewId){
		//location.href = 'showbio.asp?Show=' + bioId;
	}else{
		if(currentPreview != '0'){
			document.getElementById('preview' + currentPreview).style.display = 'none';
		}
		document.getElementById('preview' + previewId).style.display = '';
		currentPreview = previewId;
	}
}

function hidePreview()
{
	document.getElementById('preview' + currentPreview).style.display = 'none';
}

	function getLeft(el){
	var xPos = el.x;
	if(xPos){
		return xPos;
	}else{
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null){
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		}
		return xPos;
	}
}

function getTop(el){
	var yPos = el.y;
	if(yPos){
		return yPos;
	}else{
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null){
		    yPos += tempEl.offsetTop;
		    tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

	function emailWarning()
		{
			var messageBody="By continuing, you are confirming that you have read and understand this notice.\n\n";
			messageBody = messageBody + "Sending email to anyone at our firm does not constitute a business relationship.\nAnything you send to anyone at our firm will not be confidential or privileged unless we have agreed to represent you.\n\n";
			messageBody = messageBody + "Information on this Web site is for general use and is not legal advice.";
			return window.confirm(messageBody); 
		}

		//function to check valid email address
		function isValidEmail(strEmail){
		validRegExp = /^.+@.+\..{2,3}$/;
		//strEmail = document.forms[0].email.value;

		// search email text for regular exp matches
			if (strEmail.search(validRegExp) == -1) 
		{
			return false;
			} 
			return true; 
		}
		
		function checkCheckBox() {	
			if (document.Form1.cbAgree.checked == false) 
				{ return false; }	
			else 
				{ return true; }	
		}

		function contact_form_check() 
		{
			var element;
			var String_value;
			
			element=document.Form1.ContactName;
			if (element.value=="") 
   			{
				alert('Please enter Full Name.');
				element.focus();
				return false;
			}
			
			element=document.Form1.ContactEmail;
			if (element.value=="") 
   			{
				alert('Please enter your email address.');
				element.focus();
				return false;
			}

			if(isValidEmail(element.value)==false & element.value!="")
			{  	
  				alert("Please enter a valid email address.") 	
 				element.focus();  	
  				element.select();  	
   				return false;	
			} 

			if (checkCheckBox()==false) 
   			{
				alert('You must agree to the Privacy Policy and Terms of Use.');
				//document.frmTest.cbAgree.focus();
				return false;
			}
			return true;
		}
		
		function subscribe_form_check() 
		{
			var element;
			var String_value;
			
			element=document.Form1.Last;
			if (element.value=="") 
   			{
				alert('Please enter Last Name.');
				element.focus();
				return false;
			}
			
			element=document.Form1.Email;
			if (element.value=="") 
   			{
				alert('Please enter your email address.');
				element.focus();
				return false;
			}

			if(isValidEmail(element.value)==false & element.value!="")
			{  	
  				alert("Please enter a valid email address.") 	
 				element.focus();  	
  				element.select();  	
   				return false;	
			} 
			
			if (checkEAlertBox()==false) 
   			{
				alert('You must select at least one E-Alert.');
				return false;
			}

			if (checkCheckBox()==false) 
   			{
				alert('You must agree to the Privacy Policy and Terms of Use.');
				return false;
			}
			
			return true;
		}	

