/* openFile opens a url from a specified select field in the FunctionForm */

function openFile(list) {
	if(!document.FunctionForm || !document.FunctionForm.elements.length) return;
	var f = eval("document.FunctionForm.elements['" + list + "']");
	if(!f.selectedIndex) alert('Please select a quarter from the list.');
	else {
		window.open(f.options[f.selectedIndex].value);
	}
}

/* Popup Windows 
 * 
 * To open a URL in a Popup Window, use this line in the HTML
 * <a href="JavaScript:void popUp(URL,windowWidth,windowHeight)"></a>
 * or
 * <a href=# onclick="popUp(URL,windowWidth,windowHeight); return false;"></a>
 * 
 * If the window should be resizable, have scrollbars and a status bar, 
 * add an additional argument of 1 or true to the end as follows:
 * <a href="JavaScript:void popUp(URL,windowWidth,windowHeight,1)"></a>
 * or
 * <a href=# onclick="popUp(URL,windowWidth,windowHeight,1); return false;"></a>
 */

var popup = null;

function popUp(page,width,height,secondaryFeatures) { 
 	if (popup && !popup.closed) popup.close(); 
	popup = null;
	var theTop = (screen.height/2)-(height/2);
 	var theLeft = (screen.width/2)-(width/2);
 	var features = "top=" + theTop + ",left=" + theLeft + ",height=" + height + ",width=" + width;
 	if (secondaryFeatures) features += ",resizable,scrollbars,status";
	popup = window.open(page,"popup",features);
	popup.focus();
 }



/* Leaving BellSouth Warning
 *
 * function for presenting user with popup indicating that they're
 * leaving the site before continuing to an external page.
 *
 * Use the following syntax in the HTML:
 * <a href=# onclick="javascript:exitingWin(URL); return false;"></a>
 */

function exitingWin(loc) {
	var destination = '/investor/leaving.html?' + escape(loc);
	window.open(destination,"Leave","top=190,left=180,width=400,height=180");
}

/* Confirm exiting of BellSouth site
 *
 * Add the onclick method to a link as shown below to require user 
 * confirmation before following link:
 *
 * <a href="URL" onclick="return confirmExit();">
 *
 * where URL is the actual URL to which the user to will go if 
 * they click the "OK" button.
 *
 * By default, the message displayed will be: 
 *  "You are now exiting the BellSouth Investor Relations web site 
 *   and are about to enter another company's web site. Continue?"
 *
 * To display an alternate message, just provide it as an argument:
 * <a href="URL" onclick="return confirmExit('alternate message');">
 */
function confirmExit(msg) {
	return true;
	var str = (msg) ? msg : "You are now exiting the BellSouth Investor Relations web site and are about to enter another company's web site. Continue?";
	return confirm(str);
}

/* Footer text generation:
 */

function writeIRFooter() {
	document.write('<div id="InvestorFooter">');
	document.write('<p>This site contains forward looking statements and delayed stock quotes. View our <a href="/investor/legal2.html#safeharbor">Safe Harbor Notice</a> and <a href="/investor/legal2.html#quotedisclaimer">Stock Quote Disclaimer</a> for more details.</p>');
	document.write('<p><a href="http://www.bellsouth.com/legal.html">Legal Notices and Privacy Statement</a> | <a href="http://ethics.bellsouth.com/">Ethics, Compliance and Business Conduct</a></p>');
	document.write('<p>Copyright 2004, BellSouth. All Rights Reserved.</p>');
	document.write('</div>');
}

/* Generation of left-hand navigation menu:
 */
function writeIRNav() {
	var str = '';
	var itemArray = [
		new IRNavItem("Investor Relations","/investor/index.html"),
		new IRNavItem("Quarterly Financial Data","/investor/ir_financial.html"),
		new IRNavItem("Webcasts &amp; Presentations","http://investor.bellsouth.com/ireye/ir_site.zhtml?ticker=bls&item_id=\'pres.htm\'&script=11959",1),
		new IRNavItem("Corporate Information","/investor/ir_corpinfo.html"),
		new IRNavItem("Company Reports","/investor/reports.html"),
		new IRNavItem("Newsroom","http://bellsouth.mediaroom.com/index.php?s=press_releases&category=683843"),
		new IRNavItem("Shareholder Services","/investor/ir_shareholder.html"),
		new IRNavItem("Stock &amp; Dividend Data","/investor/ir_stockdiv.html"),
		new IRNavItem("Corporate Governance","http://www.bellsouth.com/corporate_governance/"),
		new IRNavItem("Contacts","/investor/ir_investorcontacts.html"),
		new IRNavItem("Analysts","http://investor.bellsouth.com/ireye/ir_site.zhtml?ticker=BLS&script=500",1),
		new IRNavItem("SEC Filings","/investor/secfilings.html"),
		new IRNavItem("Legal Notices","/investor/legal2.html")
	];
	// stock ticker image:
	str += '<div id="InvestorStockTicker"><a href="/investor/ir_stockdiv.html"><img src="http://quotes.corporate-ir.net/media_files/nys/bls/QI/bls_qi_5.jpg" border="0"></a></div>';
	// nav item list:
	str += '<ul id="InvestorNav">';
	for(var i=0; i<itemArray.length; i++) {
		var itm = itemArray[i];
		str += '<li>';
		if(itm.URL) {
			str += '<a href="' + itm.URL;
			if(itm.confirmExit) str += '" onClick="return confirmExit();';
			if(itm.target) str += '" target="' + itm.target;
			str += '">';
		}
		str += itm.text;
		if(itm.URL) str += '</a>';
		str += '</li>';
	}
	str += '</ul>';
	document.write(str);
}

// navigation item object constructor
function IRNavItem (text, URL, confirmExit, target) {
	this.text = (text) ? text : false;
	this.URL = (URL) ? URL : false ;
	this.confirmExit = (confirmExit) ? true : false ;
	this.target = (target) ? target : false ;
}



