// ndoruff 02/13/2009
function textCounter(field, maxlimit)
{
	/* used to limit the number of characters entered in a textarea */
	try {
		if (field.value.length > maxlimit) {	
			field.value = field.value.substring(0, maxlimit);
		}
	} catch (exceptionObj) {
		return false;
	}	
}


// bkoehler 11/21/2006
function showBio(url) {
	// loads the bio page for the selected person
	try {
		var myform = document.getElementById("our_people");
		myform.action = url;
		myform.submit();
	} catch (exceptionObj) {
		;
	}
}


// ndoruff 05-23-2006
function siteSearchEnter(myfield, myevent)
{
	var keycode;
	if (window.event) 
		keycode = window.event.keyCode;
	else if (myevent) 
		keycode = myevent.which;
	else 
		return true;

	if (keycode == 13)
	{
		siteSearch();
		return false;
	}
	else
		return true;
}


function gotoOnlineService()
{
	var url;
	try
	{
		var opt = document.getElementById("opt_online_svcs");
		var opt_value = opt.options[opt.selectedIndex].value;
		var new_window = true;
		if (isEmptyString(opt_value) || opt_value == "Select an online service")
		{
			return true;
		}
		else
		{
			if (opt_value == "eview")
			{
				url = "http://eview.mesirowfinancial.com";
			}
			else if (opt_value == "eview_advanced_strategies")
			{
				new_window = false;
				url = "http://www.mesirowfinancial.com/advancedstrategies/eview/as_eview_login.jsp";
			}
			else if (opt_value == "eview_benefits")
			{
				url = "http://www.mesirowfinancial.com/insuranceservices/corporations/employeebenefits/eview/eview_benefits_login.jsp";
			}
			else if (opt_value == "eview_currency_advisor")
			{
				url = "https://access.mesirowfinancial.com/mfcm";
			}
			else if (opt_value == "eview_pro")
			{
				url = "http://eviewpro.mesirowfinancial.com";
			}
			else if (opt_value == "eview_safetyweb")
			{
				url = "http://safetyweb.mesirowfinancial.com";
			}
			else if (opt_value == "eview_surety")
			{
				new_window = false;
				url = "http://www.mesirowfinancial.com/insuranceservices/corporations/propertyandcasualty/surety/eview_surety_login.jsp";
			}
			else if (opt_value == "which_eview")
			{
				new_window = false;
				url = "http://www.mesirowfinancial.com/which_eview.jsp";
			}
			else if (opt_value == "eview_private_equity")
			{
				new_window = false;
				url = "http://www.mesirowfinancial.com/privateequity/eview/login.jsp?process=new_login";
			}
			
			if (new_window) {
				window.open(url, "");
			}
			else {
				window.open(url, "_self");
			}
			
			opt.selectedIndex = 0;
			return true;
		}
	}
	catch (exceptionObj)
	{
		return true;
	}
}

function gotoOurBusiness()
{
	try
	{
		var opt = document.getElementById("opt_businesses");
		var opt_value = opt.options[opt.selectedIndex].value;
		if (isEmptyString(opt_value) || opt_value == "Browse by Businesses")
		{
			return true;
		}
		else
		{
			var anchor = document.getElementById("our_business_anchor");
			anchor.href = opt_value;
			anchor.click();
			return true;
		}
	}
	catch (exceptionObj)
	{
		return true;
	}
}

function emailAFriend(url)
{
	var this_page = location.href;

	myPopup = window.open("/tools/eaf.jsp?popup=true&url=" + this_page,"email_a_friend","width=500,height=525,scrollbars=yes,resizable=yes,dependent=yes,screenx=50,screeny=50");
	if (!myPopup.opener)
		myPopup.opener = self;
}

function validEmailAFriendForm()
{
	var control = document.getElementById("sender_name");
	if (isEmpty(control))
	{
		alert("Please enter the Sender Name.");
		control.focus();
		return false;
	}

	control = document.getElementById("sender_email");
	if (isEmpty(control))
	{
		alert("Please enter the Sender E-mail Address.");
		control.focus();
		return false;
	}

	if (!validEmailAddress(control.value))
	{
		alert("The Sender E-mail Address entered does not appear to be a valid email address.");
		control.focus();
		return false;
	}

	control = document.getElementById("recipient_name");
	if (isEmpty(control))
	{
		alert("Please enter the Recipient Name.");
		control.focus();
		return false;
	}

	control = document.getElementById("recipient_email");
	if (isEmpty(control))
	{
		alert("Please enter the Recipient E-mail Address.");
		control.focus();
		return false;
	}

	if (!validEmailAddress(control.value))
	{
		alert("The Recipient E-mail Address entered does not appear to be a valid email address.");
		control.focus();
		return false;
	}

	return true;
}

function validContactUsForm()
{

	var contact_method = document.contact_us.elements['contact_method'];

	var control = document.contact_us.elements['first_name'];
	if (isEmpty(control))
	{
		alert("Please enter a First Name.");
		control.focus();
		return false;
	}

	control = document.contact_us.elements['last_name'];
	if (isEmpty(control))
	{
		alert("Please enter a Last Name.");
		control.focus();
		return false;
	}

	if (contact_method[2].checked)
	{
		control = document.contact_us.elements['address'];
		if (isEmpty(control))
		{
			alert("Please enter a Street Address.");
			control.focus();
			return false;
		}

		control = document.contact_us.elements['city'];
		if (isEmpty(control))
		{
			alert("Please enter a City.");
			control.focus();
			return false;
		}

		control = document.contact_us.elements['state'];
		var country = document.contact_us.elements['country'].value;
		var state = control.value
		if (isEmptyString(country) || country == '--' || country == 'US' || country == 'CA')
		{
			if (isEmptyString(state) || state == '--')
			{
				alert("Please select a State or Province.");
				control.focus();
				return false;
			}
		}

		control = document.contact_us.elements['country'];
		var country = control.value
		if (isEmptyString(country) || country == '--')
		{
			alert("Please select a Country.");
			control.focus();
			return false;
		}

		control = document.contact_us.elements['postal_code'];
		if (isEmpty(control))
		{
			alert("Please enter a Postal or Zip Code.");
			control.focus();
			return false;
		}
	}

	if (contact_method[0].checked)
	{
		control = document.contact_us.elements['phone'];
		if (isEmpty(control))
		{
			alert("Please enter a Phone Number.");
			control.focus();
			return false;
		}
	}

	control = document.contact_us.elements['email'];
	if (isEmpty(control))
	{
		alert("Please enter an E-mail Address.");
		control.focus();
		return false;
	}
	else
	{
		if (!validEmailAddress(control.value))
		{
			alert("The E-mail Address entered does not appear to be a valid email address.");
			control.focus();
			return false;
		}
	}

	control = document.contact_us.elements['reason_type'];
	var reason = control.value
	if ( isEmptyString( reason ) )
	{
		alert("Please select the Reason for contacting us.");
		control.focus();
		return false;
	}
	else
	{
		control = document.contact_us.elements['account_number'];
		var account = control.value;
		if ( reason == "Account Issue/Inquiry" && isEmptyString( account ) )
		{
			alert("Please enter your account number.");
			control.focus();
			return false;
		}
	}

	control = document.contact_us.elements['inquiry'];
	var inquiry = control.value
	if ( isEmptyString( inquiry ) )
	{
		alert("Please enter the description of your inquiry.");
		control.focus();
		return false;
	}

	return true;
}

function validNutraceuticalsForm()
{

	var contact_method = document.contact_us.elements['contact_method'];

	var control = document.contact_us.elements['first_name'];
	if (isEmpty(control))
	{
		alert("Please enter a First Name.");
		control.focus();
		return false;
	}

	control = document.contact_us.elements['last_name'];
	if (isEmpty(control))
	{
		alert("Please enter a Last Name.");
		control.focus();
		return false;
	}

	control = document.contact_us.elements['company'];
	if (isEmpty(control))
	{
		alert("Please enter a Company Name.");
		control.focus();
		return false;
	}

	if (contact_method[0].checked)
	{
		control = document.contact_us.elements['phone'];
		if (isEmpty(control))
		{
			alert("Please enter a Phone Number.");
			control.focus();
			return false;
		}
	}

	if (!contact_method[0].checked)
	{
		control = document.contact_us.elements['email'];
		if (isEmpty(control))
		{
			alert("Please enter an E-mail Address.");
			control.focus();
			return false;
		}
		else
		{
			if (!validEmailAddress(control.value))
			{
				alert("The E-mail Address entered does not appear to be a valid email address.");
				control.focus();
				return false;
			}
		}
	}

	return true;
}

function eviewSuretyValidator(theForm)
{
	if (theForm.txtLogon.value == "")
	{
		alert("Please enter a value for the \"User ID\" field.");
		theForm.txtLogon.focus();
		return;
	}

	if (theForm.txtPassword.value == "")
	{
		alert("Please enter a value for the \"Password\" field.");
		theForm.txtPassword.focus();
		return;
	}

	var checkOK = "!@#$%^&*()?~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-";
	var checkStr = theForm.txtPassword.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
	}

	if (!allValid)
	{
		alert("Please enter only letter and digit characters in the \"Password\" field.");
		theForm.txtPassword.focus();
		return;
	}

 	theForm.submit();
	theForm.reset();
}

function eviewBenefitsValidator(theForm)
{
	if (theForm.txtID.value == "")
	{
		alert("Please enter a value for the \"User ID\" field.");
		theForm.txtID.focus();
		return;
	}

	if (theForm.txtPsw.value == "")
	{
		alert("Please enter a value for the \"Password\" field.");
		theForm.txtPsw.focus();
		return;
	}

 	theForm.subBtn.click();
	//theForm.submit();
	theForm.reset();
}

function showRolloverLinks(link_id)
{
	var link_id_objects;

	// the businesses
	var rolloverItems = new Array(6);
	rolloverItems[0] = "ro_item_0";
	rolloverItems[1] = "ro_item_1";
	rolloverItems[2] = "ro_item_2";
	rolloverItems[3] = "ro_item_3";
	rolloverItems[4] = "ro_item_4";
	rolloverItems[5] = "ro_item_5";

	// the image src and alt properties associated with each business
	var rolloverItemImgs = new Array(6);

	for ( var i = 0; i < rolloverItemImgs.length; i++ )
	{
		rolloverItemImgs[i] = new Array(2);
	}

	rolloverItemImgs[0][0] = "/images/businesses/bus_inv-mgmt.jpg";
	rolloverItemImgs[0][1] = "Investment Management";
	rolloverItemImgs[1][0] = "/images/businesses/bus_inv-svcs.jpg";
	rolloverItemImgs[1][1] = "Investment Services";
	rolloverItemImgs[2][0] = "/images/businesses/bus_insurance.jpg";
	rolloverItemImgs[2][1] = "Insurance Services";
	rolloverItemImgs[3][0] = "/images/businesses/bus_inv-bank.jpg";
	rolloverItemImgs[3][1] = "Investment Banking";
	rolloverItemImgs[4][0] = "/images/businesses/bus_consulting.jpg";
	rolloverItemImgs[4][1] = "Consulting";
	rolloverItemImgs[5][0] = "/images/businesses/bus_real-estate.jpg";
	rolloverItemImgs[5][1] = "Real Estate";

	// unhighlight each business item
	for ( var i = 0; i < rolloverItems.length; i++ )
	{
		link_id_objects = document.getElementById(rolloverItems[i]);
		link_id_objects.className = "rollover_item";
	}

	if (link_id != null)
	{
		// highlight the selected business
		link_id_objects = document.getElementById("ro_item_" + link_id);
		link_id_objects.className = "rollover_item_s";

		// show the image associated with the selected business
		var business_img = document.getElementById("business_img");
		if (business_img != null)
		{
			business_img.src = rolloverItemImgs[link_id][0];
			business_img.alt = rolloverItemImgs[link_id][1];
		}
	}
	else
	{
		var business_img = document.getElementById("business_img");
		if (business_img != null)
		{
			business_img.src = "/images/common/mf_bldg_home.jpg";
			business_img.alt = "Mesirow Financial";
		}
	}

	// the business services
	var rolloverLinks = new Array(6);
	rolloverLinks[0] = "ro_link_0";
	rolloverLinks[1] = "ro_link_1";
	rolloverLinks[2] = "ro_link_2";
	rolloverLinks[3] = "ro_link_3";
	rolloverLinks[4] = "ro_link_4";
	rolloverLinks[5] = "ro_link_5";

	// unhighlight any selected business services
	for ( var i = 0; i < rolloverLinks.length; i++ )
	{
		link_id_objects = document.getElementsByName(rolloverLinks[i]);
		if (link_id_objects.length != null)
		{
			for (var j = 0;  j < link_id_objects.length;  j++)
			{
				link_id_objects[j].className = "rollover_link";
			}
		}
	}

	// highlight the selected business services
	if (link_id != null)
	{
		link_id_objects = document.getElementsByName("ro_link_" + link_id);

		if (link_id_objects.length != null)
		{
			for (var i = 0;  i < link_id_objects.length;  i++)
			{
				link_id_objects[i].className = "rollover_link_s";
			}
		}
	}
}

function printThisPage()
{
	//var this_page = location.href;
	//myPopup = window.open(this_page + "?print=true","print_this_page","width=500,height=450,scrollbars=yes,resizable=yes,dependent=yes,screenx=50,screeny=50");
	//myPopup = window.open("/home/print.jsp","print_this_page","width=500,height=450,scrollbars=yes,resizable=yes,dependent=yes,screenx=50,screeny=50");
	//myPopup = window.open("/home/print.html","print_this_page","width=500,height=450,scrollbars=yes,resizable=yes,dependent=yes,screenx=50,screeny=50,menubar=yes,toolbar=yes");

	/* 
		remove any script tags, this was causing a problem when displaying
		email addresses creating using document.write("<SCRIPT
	*/
	var centerContentHTML = document.getElementById("center_content").innerHTML;
	var re = new RegExp('(<script.+>)(.+)(<\/script>)', 'gi');
	var newCenterContentHTML = centerContentHTML.replace(re, "");


	myPopup = window.open("","print_this_page","width=600,height=450,scrollbars=yes,resizable=yes,dependent=yes,screenx=50,screeny=50");
	if (!myPopup.opener)
		myPopup.opener = self;
	myPopup.document.open();
	myPopup.document.write("<html>");
	myPopup.document.write("	<head>");
	myPopup.document.write("		<title>Print This Page</title>");
	myPopup.document.write("		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=US-ASCII\">");
	myPopup.document.write("		<link rel=\"stylesheet\" href=\"/styles/mf.css\" type=\"text/css\"/>");
	myPopup.document.write("	</head>");
	myPopup.document.write("	<body class=\"body_popup\">");
	myPopup.document.write("	<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">");
	myPopup.document.write("	<tr>");
	myPopup.document.write("	<td>");
	myPopup.document.write("	<img src=\"/images/common/mesfin_logo.gif\" border=\"0\" width=\"170\" height=\"38\" alt=\"Mesirow Financial\"></a>");
	myPopup.document.write("	</td>");
	myPopup.document.write("	<td align=\"right\" style=\"padding-right:15px;\">");
	myPopup.document.write("	<span class=\"no_print\"><input name=\"print_btn\" type=\"button\" class=\"submit_button\" value=\"Print\" onclick=\"javascript: window.print();\">&nbsp;&nbsp;");
	myPopup.document.write("	<input name=\"close_btn\" type=\"button\" class=\"submit_button\" value=\"Close\" onclick=\"javascript: window.close();\"></span>");
	myPopup.document.write("	</td>");
	myPopup.document.write("	</tr>");
	myPopup.document.write("	</table>");
	myPopup.document.write("	<div class=\"centerContent\">");
	//myPopup.document.write(document.getElementById("center_content").innerHTML);
	myPopup.document.write(newCenterContentHTML);
	myPopup.document.write("	</div>");
	//myPopup.document.write("	<div style=\"position: absolute; bottom: 0px;\">");
	myPopup.document.write("	<div>");
	myPopup.document.write("		<table class=\"footerPrint\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">");
	myPopup.document.write("		<tr>");
	myPopup.document.write("			<td style=\"text-align: center;\">");
	myPopup.document.write("				<span class=\"text\">800.453.0600 | Copyright &#169 " + new Date().getFullYear() + " Mesirow Financial. All Rights Reserved.</span>");
	myPopup.document.write("			</td>");
	myPopup.document.write("		</tr>");
	myPopup.document.write("	</table>");
	myPopup.document.write("	</div>");
	myPopup.document.write("	</body>");
	myPopup.document.write("</html>");
	myPopup.document.close();
	myPopup.focus();
}

/****************************************************************************************
* Displays a disclaimer ti the vax consulting site.
****************************************************************************************/
function gotoNavConsulting()
{
	try {
		var myPopup = window.open("/advancedstrategies/eview/disclaimer.jsp","NavConsulting","width=750,height=650,scrollbars=yes,resizable=yes,dependent=yes,screenx=50,screeny=50");
		if (myPopup != null)
		{
			if (!myPopup.opener)
			{
				myPopup.opener = self;
			}
		}
		else
		{
			alert("The requested action requires you to allow popups from this set.");
		}
	} catch (exceptionObj) {
		;
	}
}

function isEmpty(control)
{
	var text = control.value;
	text = trimSpaces(text);
	return(text.length == 0);
}

function isEmptyString(value)
{
	value = trimSpaces(value);
	return(value.length == 0);
}


function trimSpaces(inString)
{

	if (inString.length == 0)
	{
		return("");
	}

	for (count=0; count < inString.length; count++)
	{
		tmpChar = inString.substring (count, count+1);
		if (tmpChar != " ")
		{
			break;
		}
	}
	inString = inString.substring(count,inString.length);
	count = inString.length;
	for (count; count > 0; count--)
	{
		tmpChar = inString.substring (count-1, count);
		if (tmpChar != " ")
		{
			break;
		}
	}
	inString = inString.substring(0,count);
	return (inString);
}

function removeChar(character, inString)
{

	var outString="";

	if ( inString.length == 0 ) return (inString);

	for (count=0; count < inString.length; count++)  {
		tmpChar = inString.substring (count, count+1);
		if (tmpChar != character) {
			outString = outString + tmpChar;
		}
	}
	return (outString);
}

function goTo(control)
{
	control.focus();
}

function randomFlashFile() {
	flash_files = new Array();
	flash_files[0]="/flash/homepage/Homepage_Flash_v1_061108"
	flash_files[1]="/flash/homepage/Homepage_Flash_v2_061108"
	flash_files[2]="/flash/homepage/Homepage_Flash_v3_061108"
	flash_files[3]="/flash/homepage/Homepage_Flash_v4_061108"
	flash_files[4]="/flash/homepage/Homepage_Flash_v5_061108"
	flash_files[5]="/flash/homepage/Homepage_Flash_v6_061108"
	flash_files[6]="/flash/homepage/Homepage_Flash_v7_061108"

	random_num = Math.round((Math.random() * 7));
	return flash_files[random_num];
}

/*
function validEmailAddress(address)
{
	var atSymbolPos = address.indexOf('@');

	if ( atSymbolPos < 1 )
	{
		return false;
	}

	if ( address.lastIndexOf('.') < atSymbolPos )
	{
		return false;
	}

	if ( address.indexOf("@.") > 0)
	{
		return false;
	}
	
	return true;
}
*/

function validEmailAddress(email_address)
{
	var re = new RegExp("(\\S+)@(\\S+\\.)(\\w+)(\\.\\w+)*");
	return email_address.match(re);
}

function siteSearch()
{
	try
	{
		var query_string = document.getElementById("search_query").value;
		document.location.href = "/search/default.jsp?q=" + query_string
	}
	catch (exceptionObj)
	{
		return true;
	}
}

function formCheck (form)
{
    var i, j, name, funcName, message, index, func;

	//EM 1/12/99 extra check: if "Referral" is selected in sys combobox, must fill referral textbox
	try
	{
		if (form.sys.value == "Referral")
		{
			if (!nonEmpty(form.Referral))
			{
				alert("Please enter a Referrer");
				form.Referral.focus(); // return focus
				return(false);
			}
		}
	}
	catch (exceptionObj)
	{
		;
	}

	try
	{
		for (i = 0; i < form.length; i++)
		{
			j = form.elements[i].name.length;
			if ((j > 6) && (form.elements[i].name.substring(j-6,j) == "_check"))
			{
				name = form.elements[i].name.substring(0,j-6); // the field we are checking
				index = indexIn(form.elements, name);
				j = form.elements[i].value.indexOf(":"); // where we split the content
				funcName = form.elements[i].value.substring(0,j); // get the check function
				message = form.elements[i].value.substring(j+1,form.elements[i].value.length);
				func = funcName + "(form." + name + ")";

				//alert(func);

				if (!eval(func))
				{
					// execute the func
					alert("Form error: " + message); // give error message
					form.elements[index].focus(); // return focus
					return(false); // go back with bad news
				}
			}
		}
		return(true); // submit if we are using the onSubmit method
	}
	catch (exceptionObj)
	{
		//alert(exceptionObj.message);
		return(false);
	}
}

function hasNum (text)
{
	// check for text field with numbers
    var RefString="1234567890", Count, TempChar;
    text.value = spaceTrim(text.value); // trim extra spaces
    if (text.value.length == 0)
	{
		// empty is bad
        return(false);
    }
    for (Count=0; Count < text.value.length; Count++)
	{
		TempChar= text.value.substring (Count, Count+1);
		if (RefString.indexOf (TempChar, 0)!=-1)
		{
			return (true); // found a number!
		}
    }
    return (false);
}

function isEmail (text)
{
	// check is its email
    text.value = stripSpaces(text.value); // strip all the spaces
    if (text.value.length == 0)
	{ // empty is bad
        return(false);
    }
    var pos = text.value.indexOf("@"); // where is it
    if ((pos < 1) || (pos > (text.value.length - 6)))
	{
        return(false);
    }
    return(true);
}

function stripSpaces (InString)
{
	OutString="";
	for (Count=0; Count < InString.length; Count++)
	{
		TempChar=InString.substring (Count, Count+1);
		if (TempChar!=" ")
		{
			OutString=OutString+TempChar;
		}
	}
	return (OutString);
}

function indexIn (arr, elem)
{
    var i;
    for (i=0; i<arr.length; i++)
	{
        if (arr[i].name == elem)
		{
            return(i);
        }
    }
    return(-1);
}

function spaceTrim(InString)
{
	if (InString.length == 0)
	{
		// empty
		return(""); // don't do anything
	}
	var LoopCtrl=true;
	while (LoopCtrl)
	{
		if (InString.indexOf("  ") != -1)
		{
			Temp = InString.substring(0, InString.indexOf("  "))
			InString = Temp + InString.substring(InString.indexOf("  ")+1,
				InString.length)
		}
		else
		{
			LoopCtrl = false;
		}
	}
	if (InString.substring(0, 1) == " ")
	{
		InString = InString.substring(1, InString.length)
	}
	if (InString.substring (InString.length-1) == " ")
	{
		InString = InString.substring(0, InString.length-1)
	}
	return (InString)
}

function nonEmpty (text)
{
	// check for empty text field
	//alert(text.value);
    text.value = spaceTrim(text.value); // trim extra spaces
    if (text.value.length == 0)
	{
		// empty is bad
        return(false);
    }
    return(true);
}

function oneOption (optList)
{
	// check that a drop down list item was selected
	var optValue = optList.value
	if (isEmptyString(optValue) || optValue == '--')
	{
		return false;
	}
	return true;
}

function oneRadio (ctrlRadio)
{
	// check that a radio button was selected
    var i;
    for (i=0; i<ctrlRadio.length; i++)
	{
        if (ctrlRadio[i].checked == true)
		{
            return true;
        }
    }
    return false;
}

function checkOpen(sId)
{
	if (document.getElementById(sId).style.display=="none") {
		openDiv(sId)
	}
	else {
		closeDiv(sId)
	}
}

function openDiv(sId)
{
	document.getElementById(sId).style.display="block";
}

function closeDiv(sId) {
	document.getElementById(sId).style.display="none";
}

function keyContactsSearch(sDepartmentId) {
	if (sDepartmentId!="") {
		document.people_search.department.value = sDepartmentId
	}
	
	document.people_search.submit()
}

function keyContactsPage(form_name, direction)
{
	myForm = document.getElementById(form_name);
	myForm.prev_or_next.value = direction;
	myForm.submit();
}

/*
function leftMenuClick(lm_href)
{
	try
	{
		var left_menu_anchor = document.getElementById("lm_anchor");
		left_menu_anchor.href = lm_href;
		left_menu_anchor.click();
		return true;
	}
	catch (exceptionObj)
	{
		return true;
	}
}

function leftMenuMO(lm_item, lm_class)
{
	try
	{
		lm_item.className = lm_class;
		return true;
	}
	catch (exceptionObj)
	{
		return true;
	}
}
*/



function leftMenuItemHL(item_id, class_name)
{

	try
	{
		document.getElementById("lm_item_" + item_id).className = class_name;
		document.getElementById("lm_item_a_" + item_id).className = class_name;
	}
	catch (exceptionObj)
	{
		;
	}
}

function clickLeftMenuItem(item_id)
{

	try
	{
		var menu_ahref = document.getElementById("lm_item_a_" + item_id);
		menu_ahref.click();
	}
	catch (exceptionObj)
	{
		;
	}
}

function ibTransactions( vYear, vIndustry, vFS )
{
	var doc = document.cibTransactions;
	doc.searchYear.value     = vYear;
	doc.searchIndustry.value = vIndustry;
	doc.searchFS.value       = vFS;
	doc.submit();
}

/***************************************************************************
 * Hides the page content and displays an error message in the event of a
 * a jsp error.
 **************************************************************************/
function displayPageError(errorDivID, pageDivID)
{

	try {
		var errorDiv = document.getElementById(errorDivID);
		if (errorDiv != null) {
			errorDiv.style.display = "inline";
		}

		var pageDiv = document.getElementById(pageDivID);
		if (pageDiv != null) {
			pageDiv.style.display = "none";
		}
	} catch (e) {
		;
	}
}


/***************************************************************************
 * View the press releases for the selected year.
 **************************************************************************/
function viewPRs(yearToView)
{

	try {
		var myForm = document.getElementById("press_releases");
		myForm.year.value = yearToView
		myForm.submit();
	} catch (e) {
		;
	}
}

/***************************************************************************
 * An ajax call to display the content associated with the selected home
 * page content button.
 * 05/27/2008 Bill Koehler: created
 **************************************************************************/
function homePageBtnContent(pageToLoad, btnID)
{
	try {
		var url = "type=btn&pg=" + pageToLoad + "&btnid=" + btnID;
		var req = newXMLHttpRequest();
		req.onreadystatechange = getReadyStateHandler(req, homePageBtnContentUpdate, homePageBtnContentError);
		req.open("POST", "/home/hpContent.jsp", true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(url);
	} catch (e) {
		homePageTabContentError("inline");
	}
}


/***************************************************************************
 * Display the result returned back by the ajax call.
 * 05/27/2008 Bill Koehler: created
 **************************************************************************/
function homePageBtnContentUpdate(ajaxResponse)
{
	try {
		hideDisplayElement("hpBtnContentError", "none");
		var content = document.getElementById("hpBtnContent");
		content.innerHTML = ajaxResponse.responseText;
		hideDisplayElement("hpBtnContent2", "inline");
	} catch (e) {
		homePageBtnContentError();
	}
}

/***************************************************************************
 * The ajax call failed display an error message.
 * 05/27/2008 Bill Koehler: created
 **************************************************************************/
function homePageBtnContentError(display)
{
	hideDisplayElement("hpBtnContent2", "none");
	hideDisplayElement("hpBtnContentError", "inline");
}

/***************************************************************************
 * An ajax call to display the content associated with the selected home
 * page menu tab.
 **************************************************************************/
function homePageTabContent(pageToLoad, tabID)
{
	try {
		var url = "type=tab&pg=" + pageToLoad + "&tabid=" + tabID;
		var req = newXMLHttpRequest();
		req.onreadystatechange = getReadyStateHandler(req, homePageTabContentUpdate, homePageTabContentError);
		req.open("POST", "/home/hpContent.jsp", true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(url);
	} catch (e) {
		homePageTabContentError();
	}
}


/***************************************************************************
 * Display the result returned back by the ajax call.
 **************************************************************************/
function homePageTabContentUpdate(ajaxResponse)
{
	try {
		hideDisplayElement("hpTabContentError", "none");
		var content = document.getElementById("hpTabContent");
		content.innerHTML = ajaxResponse.responseText;
		hideDisplayElement("hpTabContent2", "inline");
	} catch (e) {
		homePageTabContentError();
	}
}

/***************************************************************************
 * The ajax call failed display an error message.
 **************************************************************************/
function homePageTabContentError(display)
{
	hideDisplayElement("hpTabContent2", "none");
	hideDisplayElement("hpTabContentError", "inline");
}


/***************************************************************************
 * Hides/display the selected element.
 * 05/27/2008 Bill Koehler: created
 **************************************************************************/
function hideDisplayElement(elementID, display)
{

	try {
		var pageElement = document.getElementById(elementID);
		if (pageElement != null) {
			pageElement.style.display = display;
		}
	} catch (e) {
		;
	}
}


/***************************************************************************
 * Hides/display elements on the contact us page based on the method
 * of communication selected.
 * 05/27/2008 Andrew Dilg: created
 **************************************************************************/
function checkContactUsComType(items)
{

	var phone_setting = "none";
	var mail_setting = "none";

	if (items == 'phone')
	{
		phone_setting = "";
	}
	else if (items == 'mail')
	{
		mail_setting = "";
	}

	document.getElementById("phone_type").style.display = phone_setting;

	for (var i = 0; i < 5; i++)
	{
		document.getElementById("mail_type_" + i).style.display = mail_setting;
	}
}

/***************************************************************************
 * Hides/display elements on the contact us page based on the reason
 * for inquiry list box item selected.
 * 05/27/2008 Andrew Dilg: created
 **************************************************************************/
function changeContactUsReason()
{
	var vReason = document.getElementById( "reason_type" );
	var vIndex  = vReason.options.selectedIndex;
	var vValue  = vReason.options[vIndex].value;
	vTR = document.getElementById( "reason_inquiry" );
	if ( vValue == "Account Issue/Inquiry" )
		vTR.style.display = "";
	else
		vTR.style.display = "none";
}
