function getAbsoluteLeft(objectId) {
	o = document.getElementById(objectId);	return getObjectLeft(o)}function getObjectLeft(o) {
	oLeft = o.offsetLeft;
	while(o.offsetParent!=null) {
		oParent = o.offsetParent;
		oLeft += oParent.offsetLeft;
		o = oParent;
	}
	return oLeft;
}

function getAbsoluteRight(objectId) {
	o = document.getElementById(objectId);	return getObjectRight(o);}function getObjectRight(o) {
	oRight = getObjectLeft(o) + o.offsetWidth;
	return oRight;
}
function getAbsoluteTop(objectId) {
	o = document.getElementById(objectId);
	return getObjectTop(o);
}

function getObjectTop(o) {
	oTop = o.offsetTop;
	while(o.offsetParent!=null) {
		oParent = o.offsetParent;
		oTop += oParent.offsetTop;
		o = oParent;
	}
	return oTop;
}
function getAbsoluteBottom(objectId) {
	oBottom = getAbsoluteTop(objectId);
	oBottom += document.getElementById(objectId).offsetHeight;
	return oBottom;
}function getObjectBottom(o) {	oBottom = getObjectTop(o);	oBottom += o.offsetHeight;	return oBottom;}
var lastRateSection = "T";
function ShowRates(RateType) {
      var linkPrefix = "RL_";
      var divSuffix = "Rates";
      document.getElementById(linkPrefix+RateType).className = "keyRatesLinkOn";
      document.getElementById(RateType+divSuffix).style.display = "";
      document.getElementById(linkPrefix+lastRateSection).className = "";
      document.getElementById(lastRateSection+divSuffix).style.display = "none";
      SelectGraph(RateType, 1);
      lastRateSection = RateType;
}
/*function ShowRates(RateType) {
	document.getElementById('RL_T').className = "";
	document.getElementById('RL_M').className = "";
	document.getElementById('RL_C').className = "";
	document.getElementById('MRates').style.display = "none";
	document.getElementById('CRates').style.display = "none";
	switch (RateType) {
		case "T":
			document.getElementById('RL_T').className = "keyRatesLinkOn";
			break;
		case "M":
			document.getElementById('MRates').style.top = getAbsoluteTop('TRates') + "px";
			document.getElementById('MRates').style.left = getAbsoluteLeft('TRates') + "px";
			document.getElementById('MRates').style.width = document.getElementById('TRates').offsetWidth;
			document.getElementById('MRates').style.height = document.getElementById('TRates').offsetHeight;
			document.getElementById('MRates').style.display = "";
			document.getElementById('RL_M').className = "keyRatesLinkOn";
			break;
		case "C":
			document.getElementById('CRates').style.top = getAbsoluteTop('TRates') + "px";
			document.getElementById('CRates').style.left = getAbsoluteLeft('TRates') + "px";
			document.getElementById('CRates').style.width = document.getElementById('TRates').offsetWidth;
			document.getElementById('CRates').style.height = document.getElementById('TRates').offsetHeight;
			document.getElementById('CRates').style.display = "";
			document.getElementById('RL_C').className = "keyRatesLinkOn";
			break;
	}
	SelectGraph(RateType, 1);
}*/

function ExternalLink(linkHref) {
	if (document.getElementById('ExternalLinkForm')) {
		document.getElementById('ExternalLinkForm').action = linkHref;
		document.getElementById('ExternalLinkForm').submit();
	}
}

function RisksPopup() {
	window.open("/wsi/data/company/tdat/Risks.asp","Risks","resizable=yes,scrollbars=no,width=705,height=537");
}

function ExpressQueryButton() {
	if ((document.getElementById('EQ_CUSIP').value=="") && (document.getElementById('EQ_Issue').value=="")) {
		alert("You must enter a CUSIP or Issue Name to search for.");
		return;
	}
	document.getElementById('ExpressQueryForm').submit();
}

function ToolTip(strTerm, El) {
	var strToolTip = "";
	switch(strTerm.toUpperCase()) {
		case "ACTIVE TREASURY":
			strToolTip = "The most commonly referenced treasuries which include a 3 month, 6 month, 2 year, 3 year, " +
				"5 year, 10 year and 30 year.";
			break;
		case "ACCRUED INTEREST":
			strToolTip = "Interest that has accumulated between the most recent interest payment and the sale date " +
				"of a bond.  When a bond is sold in the secondary market, the amount of accrued interest that the " +
				"current bondholder receives is added to the price of the bond to equal its total cost.";
			break;					case "AGENCY":			strToolTip = "Government-sponsored enterprises (GSEs) securities, also referred to as Agencies, are " +				"issued by entities created by Congress to fund loans to certain groups of borrowers such as homeowners, "				"farmers and students.";			break;
		case "AMT":
			strToolTip = "Bonds with interest that may be subject to the alterative minimum tax (AMT) when a taxpayer " +
				"has certain tax preference items or deductions. Each individual should consult with his/her tax advisor " +
				"to determine potential exposure to the AMT.";
			break;
		case "APY":
			strToolTip = "The effective annual rate of return taking into account the effect of compounding interest.";
			break;
		case "AUCTION CLOSE":
			strToolTip = "The date and time orders for the Auction will close. The cut off times to place an order will " +
				"be in advance of the auction time.  Check with your broker to confirm the cut off time for auction orders.";
			break;
		case "AUCTION DATE":
			strToolTip = "The date that the auction is held. Treasury auctions occur regularly and have a set schedule. " +
				"Auctions are announced in advance in major newspapers.";
			break;
		case "BANK QUALIFIED":
			strToolTip = "Bonds that can be invested in by banks and trust departments. These bonds are usually rated " +
				"investment grade or higher.";
			break;
		case "BEY":
			strToolTip = "An adjustment to a yield to reflect its greater present value, created because of monthly " +
				"or quarterly interest as opposed to semiannual interest payments on most other types of bonds.";
			break;
		case "CALLABLE":
			strToolTip = "A bond, which is redeemable by the issuer prior to the specified maturity date at a " +
				"specified price (at or above par).";
			break;
		case "CALL DATE":
			strToolTip = "Date on which bonds can be retired.";
			break;
		case "CALL PRICE":
			strToolTip = "Yield of a bond priced to the first call date rather than maturity.";
			break;
		case "CALL PROTECTION":
			strToolTip = "Provision in a bond indenture setting a certain period during which the bond cannot be " + 
				"called away by the issuer. ";
			break;
		case "CALL SCHEDULE":
			strToolTip = "Dates associated with early redemption of bond.";
			break;		case "CD CALLABLE":			strToolTip = "CDs containing a call feature that will allow the issuer to redeem (or call) the CD prior to the stated maturity.";			break;		case "CD NON-CALL":			strToolTip = "A CD that has a fixed maturity and pays periodic interest payments.";			break;			case "CDS":			strToolTip = "Certificates of deposit (CDs) are issued by banks or thrift institutions. When you invest " +				"in a CD, you agree to hold that investment for a set period of time, in exchange for a fixed interest " +				"rate. The types of CDs available through TD AMERITRADE are called brokered CDs. They are similar to CDs " +				"purchased directly from a bank, except they can be traded on the open market.";			break;
		case "CLOSE DATE":
			strToolTip = "Date issue is no longer available for purchase.";
			break;					case "CORPS-AAA":		case "CORPS-AA":		case "CORPS-A":			strToolTip = "Corporate bonds are debt obligations issued by public and private companies to finance their " +				"expenses and provide funds for new and continuing operations.";			break;
		case "COUPON":
			strToolTip = "Rate of interest the issuer promises to pay to the bondholder until maturity, expressed as " +
				"an annual percentage of face value.";
			break;
		case "CURRENT YIELD":
			strToolTip = "Annual interest on a bond divided by the market price. It is the actual income rate of " +
				"return as opposed to the coupon rate (the two would be equal if the bond were bought at par) or the " +
				"yield to maturity.";
			break;
		case "CUSIP":
			strToolTip = "The Committee on Uniform Security Identification Procedures, which was established under " +
				"the auspices of the American Bankers Association to develop a uniform method of identifying municipal, " +
				"U.S. Government, and corporate securities. Every bond issue has a unique CUSIP number.  The first six " +
				"digits of the nine digit CUSIP identify the issuer.";
				break;
		case "DATED DATE":
			strToolTip = "Date from which accrued interest is calculated on new bonds and other debt instruments. " +
				"The buyer pays the issuer an amount equal to the interest accrued from the dated date to the issue's " +
				"settlement date. With the first interest payment on the bond, the buyer is reimbursed.";
			break;
		case "DEFEASED":
			strToolTip = "Securities that have been secured by another asset, such as cash or a cash equivalent, " +
				"by the debt-issuing firm.";
			break;
		case "DELIVERY":
			strToolTip = "Refers to the completion of a bond transaction in the secondary market. For bonds bought or " +
				"sold in the secondary market, delivery (and payment) must be in three business days.";
			break;
		case "ESCROWED TO MATURITY":
			strToolTip = "Extra revenues from an issue are placed in an escrow account for the express purpose of " +
				"ensuring payment of bonds at maturity. Changes the effective maturity of the bond.";
			break;
		case "FACE VALUE":
			strToolTip = "The value of the bond as given on the certificate or instrument, also in the case of an " +
				"interest bearing bond, the value on which interest payments are calculated.  Bonds are redeemed at " +
				"maturity at their face value unless the issuer defaults.";
			break;
		case "FACTOR":
			strToolTip = "Represents the amount of principal remaining on the bond.";
			break;					case "FIGG":			strToolTip = "<strong>Fixed Income Group Personal Guidance</strong><br /><br />\n" +				"For one-on-one guidance with bonds and CDs, contact the Fixed Income Guidance Group. " +				"Our experienced specialists can help you:\n" +				"<ul><li>Determine how bonds and CDs may fit your portfolio</li>\n" +				"<li>Explain the wide range of bonds and CDs that are available at TD AMERITRADE</li>\n" +				"<li>Provide guidance on investment strategies such as bond laddering</li>\n" +				"<li>Consolidate your other investments with TD AMERITRADE</li></ul>\n" +				"Call the Fixed Income Guidance Group at <strong>800-934-4445</strong> and speak with one " +				"of our specialists Monday through Friday from 8 am to 6:30 pm ET.";			break;
		case "FIRST COUPON":
			strToolTip = "Date first interest payment is paid.";
			break;
		case "GENERAL OBLIGATION":
			strToolTip = "A municipal bond backed by the full faith and credit (which includes the taxing and further " +
				"borrowing power) of a municipality. A GO bond is repaid with general revenue and borrowings, as opposed " +
				"to a revenue bond, which is repaid with the revenue from a specific facility built with the borrowed " +
				"funds, such as a toll road.";
			break;
		case "INDUSTRY":
			strToolTip = "Indicates business issuer participates in.";
			break;
		case "INSURED":
			strToolTip = "Bonds that are insured against default by a municipal insurance provider.";
			break;
		case "INSURANCE":
			strToolTip = "Type of insurance, in case of default.";
			break;					case "IPOTYPES":					strToolTip = "<strong>Initial Public Offering (IPO):</strong> An initial public offering is when a " +
				"company issues common stock or shares to the public for the first time.<br />\n" +
				"<strong>Secondary Offering:</strong> The issuance of new stock for public sale from a company " +
				"that has already made its initial public offering (IPO).<br />\n" +
				"<strong>Follow-on Offering:</strong> An offering of additional existing shares after a company " +				"has had an initial public offering.";						break;
		case "LAST COUPON":
			strToolTip = "Date last interest payment is paid.";
			break;
		case "LISTED":
			strToolTip = "Bonds that are listed and traded over the major exchanges: NYSE, AMEX and NASDAQ.";
			break;
		case "MARKET":
			strToolTip = "Primary (new issues), as opposed to secondary.";
			break;
		case "MATERIAL EVENTS":
			strToolTip = "Events which may impact the issuer's ability to pay.";
			break;
		case "MATURITY": 
			strToolTip = "Date when the principal amount of a security becomes due and payable. Maturity dates on " +
				"bonds vary from 1 day to 30 years from the date of issue.";
			break;
		case "MINIMUM QUANTITY":
			strToolTip = "Minimum number of bonds required by offering dealer for an order.";
			break;		case "MUNICIPAL":			strToolTip = "A type of bond issued by a state, state agency or authority, or a political " +				"subdivision such as a county, city, town or village. They are used primarily to finance " +				"public capital projects such as schools, roads, highways, bridges, hospitals, public works " +				"and low income housing."			break;		case "MUNIS-AAA":		case "MUNIS-AA":		case "MUNIS-A":			strToolTip = "Municipal bonds are interest-bearing debt obligations issued by a state, state agency " +				"or authority, or a political subdivision such as a county, city, town or village, to fund public projects.";			break;
		case "ORDER QUANTITY":
			strToolTip = "Number of bonds.";
			break;
		case "OTHER STRIPS":
			strToolTip = "Coupons removed from a bond and then selling the separate parts as a zero coupon bond " +
				"and interest paying coupons.";
			break;
		case "PAY FREQUENCY":
			strToolTip = "How often the bond pays interest (ex. semi-annually, monthly, at maturity).";
			break;
		case "PRE-REFUNDED":
			strToolTip = "Procedure used by issuers to refinance bonds to lower interest expenses. The issuer " +
				"sells new bonds with a lower yield and uses the proceeds to safely invest, usually buying US " +
				"treasury securities, the interest from which is used to make payments on the higher-yielding bonds.";
			break;
		case "PRICE":
			strToolTip = "For bonds, prices are specified per $100. For example, buying a bond for $95.50 " +
				"represents paying $955.00 for the bond.";
			break;
		case "PRINCIPAL":
			strToolTip = "Face value of a bond that must be repaid at maturity, as separate from the interest. " +
				"The actual market value may be higher or lower.";
			break;
		case "PROMOTIONCODE":
			strToolTip = "If you don't have an access code, call a Special Products representative at " +
				"<nobr><b>800-934-4445</b></nobr> to see how you can qualify for our Competitive CD Special Offer.";
			break;
		case "PUTABLE":
			strToolTip = "Bond that allows its holder to redeem the issue at specified intervals before maturity " +
				"and receive full face value.";
			break;
		case "PURPOSE":
			strToolTip = "What the proceeds of a bond are to be used for.";
			break;
		case "QUANTITY":
			strToolTip = "Total number available.";
			break;
		case "RATINGS":
			strToolTip = "Credit quality evaluations of bonds and notes made by independent ratings agencies.";
			break;
		case "REVENUE":
			strToolTip = "Bond issued to finance public works such as bridges or tunnels or sewer systems and " +
				"supported directly by the revenues of the project being financed. In contrast, a General Obligation " +
				"or GO bond is backed by the taxes of the issuing municipality.";
			break;
		case "SECONDARY":
			strToolTip = "Exchanges and over-the-counter markets where securities are bought and sold subsequent to " +
				"original issuance, which took place in the primary or new issues market.";
			break;
		case "SETTLEMENT DATE":
			strToolTip = "The date on which a trade is settled, up to 3 days after the Trade Date.";
			break;
		case "SINKING FUND":
			strToolTip = "Money accumulated on a regular basis in a separate custodial account that is used to redeem " +
				"debt securities or preferred stock issues.";
			break;
		case "STEP COUPON":
			strToolTip = "A bond with a coupon rate that increases periodically until maturity.";
			break;
		case "TA EXECUTION TYPE":
			strToolTip = "Non-competitive.  With a noncompetitive bid, a bidder agrees to accept the rate or yield " +
				"determined at auction.";
			break;
		case "TA PRODUCT TYPE":
			strToolTip = "The US Treasury sells bills, notes, bonds and Treasury Inflation-Protected Securities (TIPS) " +
				"through public auctions. ";
			break;
		case "TA TRANSACTION FEE":
			strToolTip = "All Treasury auction orders are charged a $25 commission.";
			break;
		case "TAX STATUS":
			strToolTip = "Indicates whether a bond is taxable or not.";
			break;
		case "TEY":
			strToolTip = "The yield an investor would have to obtain on a taxable corporate or U.S. government bond, " +
				"to match the same after-tax yield on a municipal bond. The formula is: the tax-free yield divided by " +
				"the difference of 100 minus the current tax bracket.<br /><br />" +
				"For example, if your tax bracket is 30% and a tax-free bond yields 6%, its Taxable Equivalent Yield is " +
				"8.57% (6%/1-30% = 6%/70% = 8.57%).";
			break;
		case "TFY":
			strToolTip = "Effective yield after tax implications are considered.";
			break;
		case "TOTAL COST":
			strToolTip = "Principal plus accrued interest.";
			break;
		case "TRADE DATE":
			strToolTip = "The day that a trade takes place. The settlement date usually follows the trade date by three " +
				"business days (sometimes called T+3), but varies depending on the transaction and method of delivery used.";
			break;					case "TREASURY":			strToolTip = "U.S. Treasury securities are debt obligations issued by the U.S. government.  U.S. Treasuries are " +				"backed by the full faith and credit of the U.S. government.";			break;
		case "TREASURY AUCTION":
			strToolTip = "U.S. Treasury securities are debt obligations issued by the U.S. government to " +
				"support the day-to-day operations of the federal government and to finance the national debt."
			break;
		case "TREASURY STRIPS":
			strToolTip = "Treasury strips are zero-coupon securities created by the U.S. Treasury by separating the " +
				"principal and interest cash flows from standard treasury securities.";
			break;
		case "TREASURY TYPE":
			strToolTip = "Debt securities issued by the U. S. Treasury and backed by the \"full faith and credit\" of the " +
				"U. S. government. These are the most credit-worthy of all debt instruments because of the pledge to repay " +
				"these debts and if necessary, the ability of the U.S. government to print money to make payments. They  " +
				"include: Treasury bonds, T-bills, T-notes and saving bonds.";
			break;
		case "WORKOUT DATE":
			strToolTip = "The period of time in which temporary yield discrepancies between fixed income securities are adjusted.";
			break;
		case "YIELD":
			strToolTip = "A measure of the income generated by a bond, determined based on the price and the coupon " +
				"of the bond.  Current Yield is a simple calculation: the annual interest payment divided by the current " +
				"price of the bond. Yield to Maturity or Yield to Call is a better indicator and allows investors to " +
				"compare bonds of different maturities or price.";
			break;					case "YR_ANI":			strToolTip = "Government-sponsored enterprises (GSEs) securities, also referred to as Agencies, " +				"are issued by entities created by Congress to fund loans to certain groups of borrowers such as " +				"homeowners and farmers. All GSE debt is sponsored but not guaranteed by the federal government. " +				"The risk of investing in these bonds varies based on the GSE that issued them (credit risk)."			break;					case "YR_CD":			strToolTip = "A CD is a promissory note from a bank or thrift institution that typically offers a higher " +
				"rate of interest than a regular savings account because it restricts the depositor from withdrawing " +
				"funds prior to its time-based maturity date.  CDs generally have maturity dates ranging from 3 months " +
				"to as long as 10 years or more, with a minimum deposit of $1,000. The types of CDs available through " +
				"TD AMERITRADE are called brokered CDs. They are similar to CDs purchased directly from a bank, except " +				"they can be traded on the open market";			break;					case "YR_CEFS":			strToolTip = "A Closed End Fund is usually a publicly traded investment company that invests in a variety of " +				"securities such as stocks and bonds. Capital is raised mainly through an initial public offering " +				"and proceeds are invested according to the fund's investment objectives.  Closed End Funds may " +				"trade at a discount to their net asset value.***";			break;					case "YR_MNI":			strToolTip = "Municipal bonds are interest-bearing debt obligations issued by a state, state agency or " +
				"authority, or a political subdivision such as a county, city, town or village, to fund public projects.";			break;					case "YR_MTN":			strToolTip = "Corporate notes are fixed-rate, unsecured, continuously offered debt obligations from a " +
				"variety of issuers with maturities ranging from short-term to long-term. The risk of investing in " +
				"these bonds varies based on the credit rating of the company that issued them.";			break;					case "YR_PREF":			strToolTip = "Preferred Securities may include Preferred Stock, Trust Preferreds, Subordinated Notes " +				"and Capital Securities.  Preferred Securities generally pay a fixed coupon rate. New issue Preferred " +				"Securities are generally priced at $25 per share and the coupon rate is determined by variables " +				"including current interest levels and the credit rating of the corporation.****";			break;					case "YR_SP":			strToolTip = "Structured products are short-term notes whose value is determined by the price movement " +				"of the asset underlying the note and/or the imbedded option volatility of a single equity, basket of " +				"equities, index or basket of indices. **Structured products are pre-packaged investments and " +				"generally contain a derivative or option component";			break;					case "YR_TAUC":			strToolTip = "U.S. Treasury securities are debt obligations issued by the U.S. government to support " +
				"the day-to-day operations of the federal government and to finance the national debt. U.S. Treasuries " +
				"are backed by the full faith and credit of the U.S. government. However, the government guarantee only " +
				"applies to repayment of principal and interest earned if held to maturity.";			break;					case "YR_UITS":			strToolTip = "A Unit Investment Trust is a fixed portfolio of professionally selected fixed income, " +				"equity, global or multi-asset securities that typically do not change during the life of the trust. " +				"Investors purchase units which represent an undivided ownership in the entire portfolio. Unlike " +				"mutual funds, UITs are sold only by prospectus and the underlying securities in the UITs are not " +				"sold or new ones bought, except in certain limited situations.*";			break;
		case "YTM":
			strToolTip = "Concept used to determine the rate of return an investor will receive if a long-term, " +
				"interest-bearing investment, such as a bond, is held to its maturity date.";
			break;
		case "YTW":
			strToolTip = "Lowest yield possible after call and other provisions are considered.";
			break;					case "ZEROS":			strToolTip = "Treasury Zeros or STRIPS are fixed-income securities sold at a significant discount to face " +				"value that offer no interest payments because they mature at par. STRIPS are issued by the U.S. Treasury " +				"and are backed by the full faith and credit of the U.S. Government.";			break;
		case "ZERO COUPON":
			strToolTip = "A bond where no periodic interest payments are made. The investor receives a single payment " +
				"at maturity. Zeros are issued at a discount.";
			break;
		default:
			strToolTip = "No definition found for " + strTerm;
			break;
	}
	showTooltip(strToolTip, El);
}

function incrementValue(item) {
	if (!isNaN(item.value)) {
		item.value = parseFloat(item.value) + 1;
	}
}

function decrementValue(item, allowNegative) {
	if (!isNaN(item.value)) {
		item.value = parseFloat(item.value) - 1;
		if ((parseFloat(item.value) < 0) && (!allowNegative)) item.value = "0";
	}
}

// Steve's javascript for the order status
function bondSelectAll(element, id){
	element.checked = (element.checked == true) ? true : false;
	if (element.checked){bondToggleCancel(id, false);}
	else{bondToggleCancel(id, true);}
	
	var tableId = document.getElementById(id);
	var checkboxArray = tableId.getElementsByTagName("input");
	var checkboxArrayLength = checkboxArray.length;
	for (var i=1; i<checkboxArrayLength; i++){
		if (checkboxArray[i].className == "checkbox"){
			var cbId = checkboxArray[i].id.toString();
			cbId = cbId.slice(0, -2);
			if ((cbId!="sellOrders") && (cbId!="buyOrders"))
				bondToggleTextField(id, checkboxArray[i], cbId);
		}
	}
}

function bondToggleTextField(masterElement, element, id, checked){
	var masterCb = document.getElementById(masterElement + "Cb");
	if (checked){element.checked = (element.checked == true) ? true : false;}
	else{element.checked = masterCb.checked;}
	
	if (document.getElementById(id + "_BWROW")) {
		document.getElementById("BWSelected_" + document.getElementById(id + "_BWROW").value).checked = element.checked;
	}
	if (document.getElementById("OrderSelected_" + id)) {
		if (element.checked) document.getElementById("OrderSelected_" + id).value = "True";
		else document.getElementById("OrderSelected_" + id).value = "False";
		//alert("Set value " + id + ": " + document.getElementById("OrderSelected_" + id).value);
	}
	
	var selectedRow = document.getElementById(id);
	var selectedSSRow = document.getElementById(id + "sec");
	var srClassName = selectedRow.className;
	var srSSClassName = selectedSSRow.className;
	if (element.checked && (srClassName.indexOf("selected") <= 0)){
		selectedRow.className += " selected";
		selectedSSRow.className += " selectedsec";
	}
	else if (element.checked && (srClassName.indexOf("selected") > 0)){return;}
	else{
		if (srClassName.indexOf("selected") > 0){
			var updatedClass = srClassName.slice(0, -9);
			var updatedSSClass = srSSClassName.slice(0, -12);
			selectedRow.className = updatedClass;
			selectedSSRow.className = updatedSSClass;
		}
	}
	checkCancelBtnState(masterElement);
}

var expandLinkText = "Expand order details";
var hideLinkText = "Hide order details";

function bondToggleRow(id, masterId){
	var rowId = document.getElementById(id + "sec");
	var img = document.getElementById(id + "img");
	if (masterId && (rowId.style.display == "none" && masterId.innerHTML == expandLinkText)){
		return;
	}
	else if (img.className == "expandicon"){
		rowId.style.display = "";
		img.className = "collapseicon";
	}
	else{
		rowId.style.display = "none";
		img.className = "expandicon";
	}
}
function BLInfoPopup() {	window.open("/wsi/data/company/tdat/BLAgreePopup.asp", "BL_PopUp", "height=600,width=800,location=no,menubar=no,directories=no,status=no,toolbar=no,scrollbars=yes");}
function bondToggleAllRows(id){
	var linkId = document.getElementById(id + "ToggleLink");
	linkId.innerHTML = (linkId.innerHTML == expandLinkText) ? hideLinkText : expandLinkText;
	var tableId = document.getElementById(id);
	var rowArray = tableId.getElementsByTagName("tr");
	var rowArrayLength = rowArray.length;
	for (var i=1; i<rowArrayLength; i++){
		if (rowArray[i].className.indexOf("rows ") >= 0){
			bondToggleRow(rowArray[i].id, linkId);
		}
	}
}

function bondToggleCancel(id, flag){
	var cancelBtn = id + "CancelBtn";
	if (flag){btnOff(cancelBtn);}
	else{btnOn(cancelBtn);}
}

function checkCancelBtnState(id){
	var tableId = document.getElementById(id);
	var cbArray = tableId.getElementsByTagName("input");
	var cbArrayLength = cbArray.length;
	for (var i=1; i<cbArrayLength; i++){
		if (cbArray[i].checked){
			bondToggleCancel(id, false);
			return;
		}
	}
	bondToggleCancel(id, true);
}

function TaxEquivYield() {
	window.open("http://www.investingbonds.com/learnmore.asp?catid=8&subcatid=54&id=206", "TEY", "height=600,width=800,location=no,menubar=no,directories=no,status=no,toolbar=no,scrollbars=yes");
}

function init(){
	bondToggleCancel("buyOrders", true);
	bondToggleCancel("sellOrders", true);
}
