// JavaScript Document

//////////////////////////////////////////////////////////////////////////////////////////////////////
// The header_footer.js script is leveraged by most of the BellSouth.com sites. Because updates are // 
// distributed to a number of third parties outside of the BellSouth network certain parts of this  //
// should be removed before distributing to avoid javascript errors for these groups.               //
// All code snippets that should be removed are notated as 'BellSouth.com exclusive content'        //
//                                                                                                  //
// IMPORTANT: the writeFooter() function contains calls to these BellSouth exclusive functions.     //
// These function calls also need to be removed before distribution.                                //
//////////////////////////////////////////////////////////////////////////////////////////////////////

// creates a variable from the current URL that is leveraged in a number of the functions below.
var currURL = unescape(window.location.href);
var currREF = unescape(document.referrer); //Added 12-15-05 
var thisDay = new Date();
var fullYear = thisDay.getFullYear();

function getProtocol()
{	
	// function for building location dependent URLs 
	var defaultName = "http:";
	
	if(location.protocol)
	{
		return location.protocol;
	}
	else
	{
		return defaultName;
	}
}

var protocolString = getProtocol();

if ( (currURL.indexOf('iocecstgwww') > -1) || (currURL.indexOf('macpreprod') > -1)  || (currURL.indexOf('ordering-preprod') > -1)  || (currURL.indexOf('mactest') > -1)  || (currURL.indexOf('krabby') > -1)  || (currURL.indexOf('localhost') > -1)  || (currURL.indexOf('preprodconnect') > -1) ) {
var searchDomain = 'http://ask.att.com/esh/main/chainAction.do?';
var searchFormDomain = 'http://www.att.com/global-search/search.jsp';
//var searchDomain = 'http://ask.stage.att.com/esh/main/chainAction.do?';
//var searchFormDomain = 'http://ask.stage.att.com/esh/main/chainAction.do';
var searchPop = 'http://ask.stage.att.com/esh/chc/chainAction.do?';
var relDomain = '';
} else {
var searchDomain = 'http://ask.att.com/esh/main/chainAction.do?';
var searchFormDomain = 'http://www.att.com/global-search/search.jsp';
//var searchDomain = 'http://ask.att.com/esh/main/chainAction.do?';
//var searchFormDomain = 'http://ask.att.com/esh/main/chainAction.do';
var searchPop = 'http://ask.att.com/esh/chc/chainAction.do?';
var relDomain = protocolString + '//www.bellsouth.com';
}


////////////////////////////////////////////////////////////////////////////////////////////////////
// Begin BellSouth.com exclusive content                                                          //
// The following functions create a cookie that is used for tracking reports and to determine     //
// customer type. This code should be removed before distribution to third party vendors outside  //
// of the BellSouth.com network.                                                                  //
////////////////////////////////////////////////////////////////////////////////////////////////////

document.write('<SCR' + 'IPT LANGUAGE="JavaScript" SRC="' + relDomain + '/global/promos/day1.js');
document.write('"></SCR' + 'IPT>');

//Favicon
document.write('<link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon" />');

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments\cf1

function setCookie(name, value, expires, path, domain, secure)
{
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

 // name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist\cf1
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1)
  {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

//returns a random value from 1 to 10 million
function getRand()
{
var n =10000000; //uper perameter from 0 to 10 mill
var val = Math.round(Math.random() * n);
return val.toString(); 
}

//writes a cookie 
function writeCookie()
{
var delimeter='&'; var yearLen=3;
var cookieName="bs_metriccookie"; var val = "metricValue="+getRand()+delimeter;

var domainValue=document.domain;

if((domainValue=="")||(domainValue==" "))domainValue="bellsouth.com";

var today = new Date(); var expDate = new Date (today.getFullYear()+yearLen,today.getMonth(),today.getDay());
 //expDate is set for 3 years  from whatever date

val+=" expDate="+expDate+delimeter;
if(!getCookie(cookieName))  setCookie(cookieName,val,expDate,"/",domainValue);
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds\cf1
function deleteCookie(name, path, domain)
{
  if (getCookie(name))
  {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

//cookie stuff
var expires = "";
var path ="/";
var domain = "bellsouth.com";
var secure = "";

cookiestuff = ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
	  
var branch_string = "";
function branch_place(branch, url)
{
branch_string = branch_string + "xxx" + branch;
document.cookie = "branch=" + escape(branch_string) + cookiestuff;
window.location = url;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
// End BellSouth.com exclusive content for writing cookies                                          //
//////////////////////////////////////////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Begin Global Headers and Footer functions ////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

// Logic to determine customer type - leveraged in writeGlobalNav()

// These arrays contain the URLs that determine which tab navigation image to display. 
// There is not an array for residential as it is the default in the event that the current URL does not match
// any of the strings in these arrays.
var custID_smlBiz = new Array ('smallbusiness.bellsouth.com','contact.bellsouth.com/smallbusiness','/bapco/','/apps/adsl/','smallbusiness','=sbs','http://www.bellsouth.com/apps/orderstatus/jsp/checkordstatus.jsp','busUnit=SBS')
var custID_lrgBiz = new Array ('largebusiness.bellsouth.com','bellsouthlargebusiness.com','interconnection.bellsouth.com/notifications/network/','/apps/bsldto/','/bsldto/','/ebs/')
var custID_aboutUs = new Array ('/employment/','bellsouthcorp.com','/investor/','/community/','corporate_governance','/suppliers/','ethics.bellsouth.com','/federal/','contact.bellsouth.com/bipman/','aboutus','aboutus/index.html','/tariffs','mediaroom.com','legal.html','privacydoc.html','termsofuse.html','noticeofcopyright.html')
//wr6025 5/4/06 bh: added 'legal.html','privacydoc.html','termsofuse.html','noticeofcopyright.html' to aboutUs arry
var custID_none = new Array ('/mastercard','/myAcct','apps/cpr/home/login','/apps/nlss','/eshkana','/esh/main','/ermsfp/emailus','att.com/search/bls')

// wr 6470
var tabRESIDENTIAL = "null";
var tabSMALLBUSINESS = "smlBiz";
var tabLARGEBUSINESS = "lrgBiz";
var tabABOUTUS = "aboutUs";
var tabNONE = "none";

var customerTypeID = tabRESIDENTIAL;
function getCustomerTypeID()
{
    var urlMatch= -1;
    //initial custerTypeID search - checks for match in URL string for small Business
    var arrayLen = custID_smlBiz.length;
    for(var i=0; i < arrayLen; i++){
	urlMatch = currURL.indexOf (custID_smlBiz[i]);
	if(urlMatch != -1){
	    customerTypeID = tabSMALLBUSINESS; 
	    break;   
	}  
    }
    //if a match was not found above check for match in URL string for large business
    if(customerTypeID == "null"){
    //search for match in custID_smlBiz
	var arrayLen = custID_lrgBiz.length;
	for(var i=0; i < arrayLen; i++){
	    urlMatch = currURL.indexOf (custID_lrgBiz[i]);
	    if(urlMatch != -1){
		customerTypeID = tabLARGEBUSINESS;
		break;   
	    }  
	}
    }
    //if a match was not found above check for match in URL string for About Us
    if(customerTypeID == "null"){
    //search for match in custID_smlBiz
	var arrayLen = custID_aboutUs.length;
	for(var i=0; i < arrayLen; i++){
	    urlMatch = currURL.indexOf (custID_aboutUs[i]);
	    if(urlMatch != -1){
		customerTypeID = tabABOUTUS; 
		break;   
	    }  
	}
    }
    if(customerTypeID == "null"){
    //search for match in custID_none
	var arrayLen = custID_none.length;
	for(var i=0; i < arrayLen; i++){
	    urlMatch = currURL.indexOf (custID_none[i]);
	    if(urlMatch != -1){
		customerTypeID = tabNONE; 
		break;   
	    }   
	}
    }
    // if a match is not found above the script assumes the user is a residential customer
} // efunc  //e wr 6470
// use this on every page for the nav back
function writeNavBack()
{
	var tStr='<div id="globalNavBackWide">';
	tStr+='<img src="' + relDomain + '/images/navback.jpg" width="825" height="79" border="0" alt="">\n';
	tStr+='</div>';
	document.writeln(tStr);
}

// use this on every page to write the BellSouth Logo 
function writeLogo()
{
	document.write(day1logo_wide);
}

function writeServiceLinks()
{

 var tStr='<div id="globalServiceLinksWide" class="whtlink"><a href="http://www.yellowpages.com/" class="whtlink" name="&lid=Yellowpage+Link&lpos=Homepage+Header+Links">YELLOWPAGES.COM&trade;</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://www.bellsouth.com/specialneeds/index.html" class="whtlink" name="&lid=Special+Needs+Link&lpos=Homepage+Header+Links">Accessible Equipment</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://www.bellsouth.com/spanish/index.html" class="whtlink" name="&lid=Spanish+Link&lpos=Homepage+Header+Links">En Espa&ntilde;ol</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://interconnection.bellsouth.com/" class="whtlink" name="&lid=Wholesale+Link&lpos=Homepage+Header+Links">Wholesale</a>&nbsp;&nbsp;';
if ((officialNameInd==null) || (officialNameInd!="on")) //pre day 1
{
tStr+='|&nbsp;&nbsp;<a href="http://www.att.jobs" class="whtlink" name="&lid=Careers+Link&lpos=Homepage+Header+Links">Careers</a>&nbsp;&nbsp;';
}
tStr+='|&nbsp;&nbsp;<a href="https://emailus.sbc.com/ermsfp/emailus?service=external/Home" class="whtlink" name="&lid=Contact+Us+Link&lpos=Homepage+Header+Links">Contact Us</a></div>';
 
tStr+='<div id="globalServiceLinksWide2">YELLOWPAGES.COM&trade;&nbsp;&nbsp;|&nbsp;&nbsp;Accessible Equipment&nbsp;&nbsp;|&nbsp;&nbsp;En Espa&ntilde;ol&nbsp;&nbsp;|&nbsp;&nbsp;Wholesale&nbsp;&nbsp;';
if ((officialNameInd==null) || (officialNameInd!="on")) //pre day 1
{
tStr+='|&nbsp;&nbsp;Careers&nbsp;&nbsp;';
}
tStr+='|&nbsp;&nbsp;Contact Us</div>';

 document.writeln(tStr);
 bumpServiceLinks();
}
function bumpServiceLinks()
{
//  // bump service links over to right if day 1
  if ((officialNameInd!=null) && (officialNameInd=="on")) //post day 1
  {
    if ( (document.getElementById("globalServiceLinksWide")!=null) && (document.getElementById("globalServiceLinksWide2")!=null) )
    {
	var tObj=document.getElementById("globalServiceLinksWide");
	var tObj2=document.getElementById("globalServiceLinksWide2");
//	tObj.style.visibility="hidden";
//	tObj2.style.visibility="hidden";
	tObj.style.left="320px";
    	tObj2.style.left="322px";
//	tObj.style.visibility="visible";
//	tObj2.style.visibility="visible";
    }
  }
}

// use this on pages that need the quick links
function writeGlobalSearch()
{
    var tStr='<div id="globalSearchWide">';
    //Old Search
	/*tStr+='<form onsubmit="return submitQuestion();" method="POST" action="' + searchDomain + '" name="question_form">\n';
	tStr+='<input type="hidden" name="ui_mode" value="question"><input type="hidden" name="charset" value="UTF-8"><input type="hidden" name="language" value="en-US"><input type="hidden" name="Ask" value="Ask"><input name="qsource" value="gn" type="hidden"><input name="context" value="new" type="hidden">\n';
	tStr+='<div id="ask1">Ask a Question</div>\n';
	tStr+='<div id="ask2">Ask a Question</div>\n';
	tStr+='<div id="searchField"><input name="search" type="text" value="" maxlength="150" onFocus="clearSearchBox()" class="smallFont" style="border-right: 1px solid #CCC; border-left: 1px solid #000; border-top: 1px solid #000; border-bottom: 1px solid #CCC; height:18px; width:150px; padding:2px;">\n';
	tStr+='<input type="image" title="Click here to ask a question" value="ASK" name="ACTION" src="' + relDomain + '/images/buttons/gh_search2.gif" width="22" height="20" alt="Click here to ask a question" border="0" style="vertical-align:middle;"></div>\n';*/
	
	//New Search Form
	tStr+='<form method="GET" action="' + searchFormDomain + '" id="question_form" name="question_form">\n';
	tStr+='<div id="ask1">Search</div>\n';
	tStr+='<div id="ask2">Search</div>\n';
	tStr+='<div id="searchField"><input name="q" type="text" value="" maxlength="150" class="smallFont" style="border-right: 1px solid #CCC; border-left: 1px solid #000; border-top: 1px solid #000; border-bottom: 1px solid #CCC; height:18px; width:150px; padding:2px;"><input type="hidden" name="tab" value="Res" /><input type="hidden" name="App_ID" value="BLS" />\n';
	tStr+='<input type="image" src="' + relDomain + '/images/buttons/gh_search2.gif" value="Go" alt="Submit search" class="btnGo" id="searchSubmit" style="vertical-align:middle;"></div>\n';
    tStr+='</form>\n';
	tStr+='</div>';
	document.writeln(tStr);
}

function writeGlobalNav()
{	
	if(customerTypeID == tabSMALLBUSINESS){
	  var tStr='<div id="globalTabSmallBusinessWide">';
          tStr+='<img src="' + relDomain + '/images/buttons/gh_nav_small_business.gif" width="505" height="24" border="0" usemap="#cust_smallbiz">\n';
          tStr+='<map name="cust_smallbiz">';
	  tStr+='<area shape="poly" coords="5,20,16,8,86,9,96,16,87,20" href="javascript: branch_place(&#39;residential&#39;, &#39;https://www.bellsouth.com/index.html&#39;)" alt="Residential">';
	  tStr+='<area shape="poly" coords="92,21,108,2,294,2,312,21" href="javascript: branch_place(&#39;smallbiz&#39;, &#39;http://smallbusiness.bellsouth.com/&#39;)" alt="Small Business">';
	  tStr+='<area shape="poly" coords="424,21,410,7,316,8,309,16,316,21" href="javascript: branch_place(&#39;largebiz&#39;, &#39;http://www.att.com/gen/landing-pages?pid=9214&#39;)" alt="Enterprise">';
	  tStr+='<area shape="poly" coords="428,21,418,16,426,9,487,8,500,22" href="javascript: branch_place(&#39;aboutus&#39;, &#39;http://www.bellsouth.com/aboutus/index.html&#39;)" alt="About Us">';
	  tStr+='</map>';
	  tStr+='</div>';
	  document.writeln(tStr);
	  if (hbx)
	  { 
		hbx.acct="DM5606085BDM;DM551012D0VA";
	  }
    }
	else if(customerTypeID == tabLARGEBUSINESS){
          var tStr='<div id="globalTabLargeBusinessWide">';
          tStr+='<img src="' + relDomain + '/images/buttons/gh_nav_lrg_business.gif" width="506" height="24" border="0" usemap="#cust_lrgbiz">\n';
          tStr+='<map name="cust_lrgbiz">';
	  tStr+='<area shape="poly" coords="99,22,2,21,17,8,87,8" href="javascript: branch_place(&#39;residential&#39;, &#39;http://www.bellsouth.com/index.html&#39;)" alt="Residential">';
	  tStr+='<area shape="poly" coords="101,22,94,15,102,9,198,8,211,17,202,22" href="javascript: branch_place(&#39;smallbiz&#39;, &#39;http://smallbusiness.bellsouth.com/&#39;)" alt="Small Business">';
	  tStr+='<area shape="poly" coords="423,23,404,2,222,3,203,22" href="javascript: branch_place(&#39;largebiz&#39;, &#39;http://www.att.com/gen/landing-pages?pid=9214&#39;)" alt="Enterprise">';
	  tStr+='<area shape="poly" coords="426,23,419,17,429,8,491,9,502,22" href="javascript: branch_place(&#39;aboutus&#39;, &#39;http://www.bellsouth.com/aboutus/index.html&#39;)" alt="About Us">';
	  tStr+='</map>';
	  tStr+='</div>';
	  document.writeln(tStr);
	}
	else if(customerTypeID == tabABOUTUS){
      var tStr='<div id="globalTabAboutUsWide">';
      tStr+='<img src="' + relDomain + '/images/buttons/gh_nav_about_us.gif" width="478" height="24" border="0" usemap="#cust_aboutus">\n';
      tStr+='<map name="cust_aboutus">';
	  tStr+='<area shape="poly" coords="101,22,88,9,17,8,2,21" href="javascript: branch_place(&#39;residential&#39;, &#39;http://www.bellsouth.com/index.html&#39;)" alt="Residential">';
	  tStr+='<area shape="poly" coords="214,26,200,8,102,9,95,16,106,24" href="javascript: branch_place(&#39;smallbiz&#39;, &#39;http://smallbusiness.bellsouth.com/&#39;)" alt="Small Business">';
	  tStr+='<area shape="poly" coords="311,22,318,15,310,8,212,9,208,16,212,22" href="javascript: branch_place(&#39;largebiz&#39;, &#39;http://www.att.com/gen/landing-pages?pid=9214&#39;)" alt="Enterprise">';
	  tStr+='<area shape="poly" coords="314,21,335,-1,454,1,476,22" href="javascript: branch_place(&#39;aboutus&#39;, &#39;http://www.bellsouth.com/aboutus/index.html&#39;)" alt="About Us">';
	  tStr+='</map>';
	  tStr+='</div>';
	  document.writeln(tStr);
	}
	else if(customerTypeID == tabNONE){
      var tStr='<div id="globalTabAboutUs">';
      tStr+='<img src="' + relDomain + '/images/buttons/gh_nav_null.gif" width="478" height="24" border="0" usemap="#cust_none">\n';
      tStr+='<map name="cust_none">';
	  tStr+='<area shape="poly" coords="5,20,16,8,86,9,96,16,87,20" href="javascript: branch_place(&#39;residential&#39;, &#39;http://www.bellsouth.com/index.html&#39;)" alt="Residential">';
	  tStr+='<area shape="poly" coords="101,22,94,15,102,9,198,8,211,17,202,22" href="javascript: branch_place(&#39;smallbiz&#39;, &#39;http://smallbusiness.bellsouth.com/&#39;)" alt="Small Business">';
	  tStr+='<area shape="poly" coords="311,22,318,15,310,8,212,9,208,16,212,22" href="javascript: branch_place(&#39;largebiz&#39;, &#39;http://www.att.com/gen/landing-pages?pid=9214&#39;)" alt="Enterprise">';
	  tStr+='<area shape="poly" coords="314,24,320,15,327,8,389,8,402,24" href="javascript: branch_place(&#39;aboutus&#39;, &#39;http://www.bellsouth.com/aboutus/index.html&#39;)" alt="About Us">';
	  tStr+='</map>';
	  tStr+='</div>';
	  document.writeln(tStr);
	}
	else{ //if residential or no customerTypeID is defined
      var tStr='<div id="globalTabResidentialWide">';
      tStr+='<img src="' + relDomain + '/images/buttons/gh_nav_residential.gif" width="488" height="24" border="0" usemap="#cust_res">\n';
      tStr+='<map name="cust_res" id="cust_res">';
	  tStr+='<area shape="poly" coords="186,24,3,23,23,2,164,2" href="javascript: branch_place(&#39;residential&#39;, &#39;http://www.bellsouth.com/index.html&#39;)" alt="Residential">';
	  tStr+='<area shape="poly" coords="296,22,187,23,181,15,189,8,282,9" href="javascript: branch_place(&#39;smallbiz&#39;, &#39;http://smallbusiness.bellsouth.com/&#39;)" alt="Small Business">';
	  tStr+='<area shape="poly" coords="408,23,294,22,292,15,303,8,393,8" href="javascript: branch_place(&#39;largebiz&#39;, &#39;http://www.att.com/gen/landing-pages?pid=9214&#39;)" alt="Enterprise">';
	  tStr+='<area shape="poly" coords="407,21,402,15,409,9,471,8,484,22" href="javascript: branch_place(&#39;aboutus&#39;, &#39;http://www.bellsouth.com/aboutus/index.html&#39;)" alt="About Us">';
	  tStr+='</map>';
	  tStr+='</div>';
	  document.writeln(tStr);
	}
}

// Global variables for global header variations
var adShowTabsShowSearch = 0;
var adHideTabsHideSearch = 1;
var adShowTabsHideSearch = 2;
var adHideTabsShowSearch = 3;
// 
//	added code for hbx order confirmation extensio n
//
if (!hbx_ext)
{
	var hbx_ext = "";
	if (currURL.indexOf('/apps/rnr/ordering/answers/controller.jsp?action=orderconfirm') != -1)
	{
		hbx_ext = "_oc";
	}
	else if (currURL.indexOf('/apps/rnr/ordering/torder/controller.jsp?action=orderConfirm') != -1)
	{
		hbx_ext = "_oc";
	}
	else if (currURL.indexOf('/apps/corder/COrderReqDispatcher/submitOrderEvent') != -1)
	{
		hbx_ext = "_oc";
	}
}


//
// 	end code for hbx order confirmation extension
//

	//wr 6769
	//reference script that sets the HBX variables (it uses customerTypeID to segregate traffic)
	// wr xxxx 
	// added the hbx_ext to determine which hbx file to use
    document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.2" SRC="/scripts/hbx2' + hbx_ext + '.js');
    document.write('"></SCR' + 'IPT>');
	// e 6769
//main function to write bellsouth.com header
function writeCompleteHeader(globalNav,languageFlag) {

    var languageVar = languageFlag;
    //wr6470
    var tabSelection="";
    if (arguments.length>2)
    {
	tabSelection=arguments[2];
    }
    if ((tabSelection != null) && (tabSelection != ""))
    {
	customerTypeID = tabSelection;
    }
    else
    { 
	getCustomerTypeID();
    }
	
   // e wr6470
	if(globalNav == adHideTabsHideSearch || globalNav == adHideTabsShowSearch){
	   var hasNav = "false";	   
	}else{
	   var hasNav = "true";
	}
	
	if(globalNav == adHideTabsHideSearch || globalNav == adShowTabsHideSearch){
	   var hasSearch = "false";	   
	}else{
	   var hasSearch = "true";
	}
	
	//currently written in all cases regardless of passed arguments - writes background and logo
	writeNavBack();
	writeLogo();
		
		
	//currently the default header for spanish is: no tabs, no service links and no search
	if(languageVar == "spanish"){ 
	   if(hasNav == "true"){ //placeholder for future dev
	   
	   }else{

	   }
	}else{
	   if(hasNav == "true"){ //if hasNav is true write tabs and servicelinks
	      writeServiceLinks();
	      writeGlobalNav(languageVar);
		  if(hasSearch == "true"){ //if hasSearch is true write search
		    writeGlobalSearch();
		  }	      	   
	   }else{ //if not DHTML write only back to bellsouth portion
		  if(hasSearch == "true"){
		    writeGlobalSearch();
		  }	   
	   }	
	}	
}

//Begin functions for Global Navigation Search
function submitQuestion(){
  var searchVal = document.question_form.search.value;
  if(isEmpty(searchVal) || searchVal == ""){
	document.question_form.search.value = "";
	document.question_form.submit();
	return false;
  }else{
	document.question_form.submit();
	return false;				
  }			
}
		
function isEmpty(str){
  if (str == null){
	return false;
  }
  for (var intLoop = 0; intLoop < str.length; intLoop++){
	if (" " != str.charAt(intLoop)){
	  return false;		    
	}
  }
  return true;
}

// Clears initial value from search box onFocus
function clearSearchBox(){
  var searchVal = document.question_form.search.value;
  if(searchVal == ""){
	document.question_form.search.value = "";
  }
}
//End functions for Global Navigation Search

// This function writes the legal footer, logic determines the content layer
function writeFooter(languageVar)
{
    var language = languageVar;
	var tStr="";
	var catchLayer;
	var ie_ver = 0;
	
////////////////////////////////////////////////////////////////////////////////////////
//////////////////////// begin BellSouth.com exclusive content//////////////////////////
///This portion of code should be removed before distribution to third party vendors///
    
//Added 02-07-06 by Ernest Fretwell
//Updated 04-04-06 with HBX calls
//Call Tracking codes
function TrackingCall()
{
////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////// Begin Websidestory tracking code ///////////////////////////////////////
///////////////////////////Added 04-04-06 by Ernest Fretwell////////////////////////////////////////

//REQUIRED SECTION. 
//hbx 2 deleted wr 6470
// wr xxxx 
// added the hbx_ext to determine which hbx file to use
document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.1" SRC="/scripts/hbx.js');
document.write('"></SCR' + 'IPT>');

//Baynote scripts
document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.1" SRC="/scripts/baynote.js');
document.write('"></SCR' + 'IPT>');
document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.1" SRC="/scripts/baynote-observer.js');
document.write('"></SCR' + 'IPT>');

document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.1" SRC="//www.wireless.att.com/webtrends/scripts/dcs_tag.js');
document.write('"></SCR' + 'IPT>');

////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////// End Websidestory tracking code /////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
}
//End Tracking Code

	//Added TrackingCall() on 02-07-06 by Ernest Fretwell
	TrackingCall(); //Calls the tracking codes scripts
	writeCookie(); //writes a persistent cookie for tracking reports and customer type
	//custSat(); //fires additional customer satisfaction survey popups
	
	// end BellSouth.com exclusive content                                                //
	////////////////////////////////////////////////////////////////////////////////////////
	
	//checking ie for [real] browser version
	if (is_ie ) {
		var split_agt = agt.split('msie');
		ie_ver = parseInt(split_agt[1]);
	}

	//if (!(is_nav && (is_minor >= 4.7) || (is_ie && (ie_ver >= 5.0)))) {
	if (!(is_nav && (is_major >= 5) || (is_ie && (ie_ver >= 5.0)))) {
		tStr += '<p align="center" class="grey">This site is optimized for '
		tStr += '<a href="http://www.microsoft.com/windows/ie/default.asp" class="bread" target="_blank">Microsoft<sup class="bread">&reg;</sup> Internet Explorer</a>'
		tStr += ' versions 5.5 or higher ';
		tStr += 'and <a href="http://www.netscape.com" class="bread" target="_blank">Netscape Communicator</a> versions 6.2 or higher.'
	}

	if(language == "spanish"){ //spanish language variable
	  tStr+='<p align="center" class="grey">&copy;' + fullYear + ' AT&amp;T Intellectual Property.<br />Todos los derechos reservados. AT&amp;T, el logotipo de AT&amp;T y todas las otras marcas de AT&amp;T <br />contenidas aquí son marcas comerciales de AT&amp;T Intellectual Property y/o compañías afiliadas a AT&amp;T.<br />\n';
	  tStr+=' <a href="http://www.bellsouth.com/spanish/legal.html" class="bread">Notificaciones legales</a> y <a href="http://www.bellsouth.com/spanish/privacydoc.html" class="bread">Normas de privacidad</a>\n';	
	}else{
	  tStr+='<p align="center" class="grey">&copy;' + fullYear + ' AT&amp;T Intellectual Property.<br />All rights reserved. AT&amp;T, AT&amp;T logo and all other marks contained herein<br />are trademarks of AT&amp;T Intellectual Property and/or AT&amp;T affiliated companies.<br />\n';
	  tStr+=' <a href="http://www.bellsouth.com/legal.html?ft=legal" class="bread" target="_blank">Legal Notices</a> | <a href="http://www.att.com/privacy" class="bread" target="_blank">Privacy Policy</a> | <a href="http://www.att.jobs" class="bread" name="&lid=Careers+Link&lpos=Homepage+Footer+Links">Careers</a>';

//Olympic Logo & Link
tStr+='<br /><br /><a href="http://att.net/teamusa" target="_blank"><img src="' + relDomain + '/global/promos/images/usa.gif" width="226" height="26" border="0"></a>';

	}
	tStr+='</p>\n';
	tStr+='<br>\n';

	if (is_nav4)  //
	{
		for (eachLayer in document.layers) {
		  if ((eachLayer.indexOf('content') != -1) || (eachLayer.indexOf('legal') != -1)) catchLayer = eachLayer;
		}
		eval('document.' + catchLayer + '.document.writeln(tStr);');
	}
	else // ie or ns6
	{
		document.writeln(tStr);
	}
}

// This function writes the header for BellSouth popup windows
function writePopupHeader()
{
	var tStr='<div id="popupHeader">';
	tStr+='<table cellpadding="0" cellspacing="0" border="0" width="205" height="50">\n';
	tStr+='<tr>\n';
	tStr+='<td width="5">&nbsp;</td>\n';
	tStr+='<td><img src="' + relDomain + '/images/att_popup_logo.gif" height="40" width="87" alt="AT&amp;T"></td>\n';
	tStr+='</tr>\n';
	tStr+='</table>\n';
	tStr+='</div>';
	document.writeln(tStr);
}

////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////// End Global Headers and Footer functions ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////