if ( typeof thisNode == "undefined")
  var thisNode = "/" ;
var thisAncestor = thisNode.split("/")[0] ;

var ie = document.getElementById?true:false;
ie?formSize=37:formSize=29;

function openWin(url)
{ 
var navWin = window.open(url,"NewWin", "scrollbars,toolbar=false,menubar=false,resizable=false,width=740,height=595,top=0,right=1000"); 
}

function getGlobalNavStyleSheets()
{
  var output = '' ;
  output += '<LINK href="http://media.washingtonpost.com/wp-srv/globalnav/globalnav.css" rel="stylesheet" type="text/css">' ;
  // output += '<style>\n<!--\n@import url("http://media.washingtonpost.com/wp-srv/globalnav/globalnav.css");\n-->\n</style>' ;
  return output ;
}
document.write( getGlobalNavStyleSheets() ) ;

function getTop(position,color,channel)
{
  var output = '' ;
  output += ('<TABLE WIDTH="760" BORDER="0" CELLPADDING="0" CELLSPACING="0" BACKGROUND="http://media.washingtonpost.com/wp-srv/images/spacer.gif">') ;
  output += ('') ;

	// start logic for inserting REG-CONDITIONAL display
	// JOBS site should not display sign in/out information
  if ( position == "top" && (channel.indexOf("jobs") == -1) )
  {
    output += ('<TR>') ;
    output += ('<TD COLSPAN="8" HEIGHT="1" BGCOLOR="#FFFFFF" ALIGN="left">');
		
		// if the user is on a .washingtonpost.com domain
		var url= window.location.href
		if (url.indexOf(".washingtonpost.com")!=-1)
		{
		//check to the see if the user is signed in
			if (document.cookie.indexOf("wpniuser") != -1)
			{
			  var start = (document.cookie.indexOf("wpniuser") + 9);
			  var end = (document.cookie.indexOf(";",start)) == -1 ? document.cookie.length : document.cookie.indexOf(";",start);
			  cookieuser = document.cookie.substring(start,end);
		
		// show their username and registration links
			  if(cookieuser.indexOf("@") != -1) cookieuser = cookieuser.substring(0,cookieuser.indexOf("@"));
			  output += ('&nbsp;<span class="globalnav_business_2">&nbsp;Hello '+cookieuser+'</span>');
			  output += ('<span class="globalnav_business_1">&nbsp;&nbsp;&nbsp;<a href="/ac2/wp-dyn?node=admin/registration/manage&destination=manage&nextstep=gather">Edit Profile</a>');
			  output += ('&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="/ac2/wp-dyn?node=admin/registration/login&destination=logout&nextstep=confirm">Sign out</a></span>');
			}
			
		//if they're not signed in and on .washingtonpost.com, prompt them to sign in
			else
			{
			  output += ('&nbsp;<span class="globalnav_business_2">&nbsp;<a href="/ac2/wp-dyn?node=admin/registration/login&destination=login&nextstep=gather">Sign In</a></span>');
			  output += ('&nbsp;&nbsp;&nbsp;<span class="globalnav_business_1">|&nbsp;&nbsp;&nbsp;<a href="/ac2/wp-dyn?node=admin/registration/register&destination=register&nextstep=gather">Register Now</a></span>');
			 }
		
		}

    output += ('</TD>') ;
    output += ('</TR>') ;
		output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#CCCCCC"><SPACER TYPE="BLOCK" HEIGHT="1" WIDTH="760"></TD></TR>');
  }
//end REG-CONDITIONAL sign-in/sign-out logic

  output += ('<TR>') ;
  output += ('<TD WIDTH="10" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="10" height="1"></TD>') ;
  output += ('<TD WIDTH="355" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="355" height="1"></TD>') ;
  output += ('<TD WIDTH="16" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="16" height="1"></TD>') ;
  output += ('<TD WIDTH="54" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="54" height="1"></TD>') ;
  output += ('<TD WIDTH="134" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="134" height="1"></TD>') ;
  output += ('<TD WIDTH="16" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="16" height="1"></TD>') ;
  output += ('<TD WIDTH="165" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="165" height="1"></TD>') ;
  output += ('<TD WIDTH="10" HEIGHT="1" BGCOLOR="#'+color+'"><spacer type="block" width="10" height="1"></TD>') ;
  output += ('</TR>') ;
  output += ('') ;
  output += ('<TR>') ;
  output += ('<TD WIDTH="10" HEIGHT="1" BGCOLOR="#FFFFFF"><spacer type="block" width="10" height="1"></TD>') ;
  output += ('<TD COLSPAN="3" HEIGHT="1" BGCOLOR="#FFFFFF"><A HREF="http://www.washingtonpost.com/"><img src="http://media.washingtonpost.com/wp-srv/globalnav/images/wpcomSmallLogo.gif" width="208" height="40" border="0"></A></TD>') ;
  output += ('<TD COLSPAN="4" HEIGHT="1" BGCOLOR="#FFFFFF" ALIGN="right">') ;
  output += ('<table cellpadding="0" cellspacing="0" border="0" width="325">') ;
  output += ('<tr>') ;
  output += ('<td width="1" height="26"><spacer type="block" height="26"></td></td>') ;
  output += ('<td align="right" valign="bottom"><span class="globalnav_business_2"><A HREF="http://www.washingtonpost.com/wp-dyn/print/a1">PRINT EDITION</A></span><span class="globalnav_business_1"> | <A HREF="http://washpost.com/wpnihomepage">Subscribe to</span></A></td>') ;
  output += ('<td rowspan="2"><A HREF="http://washpost.com/wpnihomepage"><img src="http://media.washingtonpost.com/wp-srv/globalnav/images/twpShortLogo.gif" width="135" height="40" border="0"></A></td>') ;
  output += ('</tr>') ;
  output += ('<tr><td colspan="2" width="187" height="7"><spacer type="block" width="187" height="7"></td>') ;
  output += ('</tr>') ;
  output += ('</table>') ;
  output += ('</TD>') ;
  output += ('</TR>') ;
  output += ('') ;
  output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#000000"><spacer type="block" height="1"></TD></TR>') ;
  output += ('') ;
  output += ('<TR>') ;
  output += ('<TD BGCOLOR="#0D3159"><spacer type="block" width="10"></TD>') ;
  output += ('<TD BGCOLOR="#0D3159" ALIGN="left">') ;
  output += ('<span class="globalnav_main">') ;
  output += ('<A HREF="http://www.washingtonpost.com/" target="_top">NEWS</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/opinion/" target="_top">OPINION</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/sports/" target="_top">SPORTS</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/artsandliving/" target="_top">ARTS &amp; LIVING</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/artsandliving/entertainmentguide/" target="_top">ENTERTAINMENT</A>') ;
  output += ('</span>') ;
  output += ('</TD>') ;
  output += ('<TD BGCOLOR="#345C89"><img src="http://media.washingtonpost.com/wp-srv/globalnav/images/leftFade2.jpg" width="16" height="21" border="0"></TD>') ;
  output += ('<TD COLSPAN="2" BGCOLOR="#345C89" ALIGN="middle">') ;
  output += ('<span class="globalnav_main">') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/liveonline/" target="_top">Discussions</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/photo/" target="_top">Photos &amp; Video</A>') ;
  output += ('</span>') ;
  output += ('</TD>') ;
  output += ('<TD BGCOLOR="#5B87B8"><img src="http://media.washingtonpost.com/wp-srv/globalnav/images/rightFade2.jpg" width="16" height="21" border="0"></TD>') ;
  output += ('<TD BGCOLOR="#5B87B8" ALIGN="right">') ;
  output += ('<span class="globalnav_main">') ;
  output += ('<A HREF="http://www.washingtonpost.com/wl/jobs/home" target="_top">JOBS</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/cars/" target="_top">CARS</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-dyn/realestate/" target="_top">REAL ESTATE</A>') ;
  output += ('</span>') ;
  output += ('</TD>') ;
  output += ('<TD BGCOLOR="#5B87B8"><spacer type="block" width="10"></TD>') ;
  output += ('</TR>') ;
  output += ('') ;
  output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#000000"><spacer type="block" height="1"></TD></TR>') ;
  output += ('') ;
  output += ('</TABLE>') ;

  return output ;
}

function getSearch()
{
  var output = ""

  output += ('<TABLE WIDTH="760" BORDER="0" CELLPADDING="0" CELLSPACING="0" BACKGROUND="http://media.washingtonpost.com/wp-srv/images/spacer.gif">') ;
  output += ('') ;
  output += ('<TR><TD COLSPAN="8" BGCOLOR="#EEEEEE">') ;
  output += ('<table width="760" cellpadding="0" cellspacing="0" border="0">') ;
  output += ('<tr bgcolor="#EEEEEE">') ;
  output += ('<td width="10"><spacer type="block" width="10"></td>') ;
  output += ('<td align="left"><span class="globalnav_search">SEARCH:</span></td>') ;
  output += ('<td valign="middle">') ;
  output += ('<FORM name="searchform1" action="http://www.washingtonpost.com/cgi-bin/search99.pl" method="post">') ;
  output += ('<INPUT type="hidden" value="news" name="searchsection">') ;
  output += ('<INPUT type="radio" name="searchdatabase" value="news" checked></td><td><img src="http://media.washingtonpost.com/wp-srv/globalnav/images/news.gif" width="30" height="29" border="0"></td>') ;
  output += ('<td><INPUT type="radio" name="searchdatabase" value="google"></td>') ;
  output += ('<td><img src="http://media.washingtonpost.com/wp-srv/globalnav/images/webByGoogle.gif" width="89" height="29" border="0"></td>') ;
  output += ('<td align="top">') ;
  output += ('<INPUT size="'+formSize+'" name="searchtext">') ;
  output += ('</td>') ;
  output += ('<td>') ;
  output += ('<INPUT type="image" height="29" alt="Search" width="24" src="http://media.washingtonpost.com/wp-srv/globalnav/images/goButton.gif" border="0" valign="bottom">') ;
  output += ('</td>') ;
  output += ('</FORM>') ;
  output += ('<td width="15"><spacer type="block" width="15"></td>') ;
  output += ('<td class="globalnav_search_mostemailed" align="center" width="320"><a href="http://www.washingtonpost.com/wp-srv/mostemailed/index.html"><b>Top 20 Most E-mailed Articles</b></a></td>') ;
  output += ('<td width="10"><spacer type="block" width="10"></td>') ;
  output += ('</tr>') ;
  output += ('</table>') ;
  output += ('</TD></TR>') ;
  output += ('') ;
  output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#666666"><spacer type="block" height="1"></TD></TR>') ;
  output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#FFFFFF"><spacer type="block" height="1"></TD></TR>') ;
  output += ('</TABLE>') ;

  return output ;
}

function getTopGlobalNav(channel,greyrule)
{
  var output = ""

  if ( greyrule )
    output += getTop("bottom","666666",channel) ;
  else
    output += getTop("top","FFFFFF",channel) ;

  var noSearchList = new Array("cars","realestate","jobs","warrenbrown", "nosearch", "classifieds");
  var hasSearch = true;

  for( i=0; i<noSearchList.length; i++ )
  {
		if( channel.indexOf(noSearchList[i]) > -1 )
		{
	      hasSearch = false;
	      break;
		}
  }
  if ( hasSearch )
    output += getSearch() ;
  else 
  {
    output += ('<TABLE WIDTH="760" BORDER="0" CELLPADDING="0" CELLSPACING="0" BACKGROUND="http://media.washingtonpost.com/wp-srv/images/spacer.gif">') ;
    output += ('<TR><TD HEIGHT="1" BGCOLOR="#FFFFFF"><spacer type="block" height="1"></TD></TR>') ;
    output += ('</TABLE>') ;
  }
  return output ;
}

function getBottomGlobalNav(swallowit)
{
  var output = '' ;
  output += getTop("bottom","666666") ;

  output += ('<TABLE WIDTH="760" BORDER="0" CELLPADDING="0" CELLSPACING="0" BACKGROUND="http://media.washingtonpost.com/wp-srv/images/spacer.gif">') ;
  output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#FFFFFF">') ;
  output += ('<!-- start bank of links -->') ;
  output += ('<table width="760" cellpadding="0" cellspacing="0" border="0">') ;
  output += ('<tr>') ;
  output += ('<td width="10" rowspan="2"><spacer type="block" width="10"></td>') ;
  output += ('<td width="430" height="1"><spacer type="block" width="430" height="1"></td>') ;
  output += ('<td width="10" rowspan="2"><spacer type="block" width="10"></td>') ;
  output += ('<td width="300"><spacer type="block" width="300"></td>') ;
  output += ('<td width="10" rowspan="2"><spacer type="block" width="10"></td>') ;
  output += ('</tr>') ;
  output += ('') ;
  output += ('<tr>') ;
  output += ('<td valign="top"><span class="globalnav_business_3"><a href="http://www.washingtonpost.com" target="_top">washingtonpost.com</a>:</span>') ;
  output += ('<span class="globalnav_business_2"> ') ;
  output += ('<a href="javascript:openWin(\'http://www.washingtonpost.com/wp-srv/admin/help/popup/frame_page.html\')">Contact Us</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/contents/aboutsite.htm" target="_top">About washingtonpost.com</A><br>') ;
  output += ('</span>') ;
  output += ('<span class="globalnav_business_1"> ') ;
  output += ('<A HREF="http://www.washingtonpost.com/ac2/wp-dyn?node=admin/email" target="_top">E-mail Newsletters</A> | ') ;
  output += ('<A HREF="http://pqasb.pqarchiver.com/washingtonpost/" target="_top">Archives</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/contents/devices.htm" target="_top">Wireless Access</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-adv/mediakit/mediacenter/front.htm" target="_top">Media Center</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-adv/mediakit/adinfo/" target="_top">Advertise</A><br>') ;
  output += ('<A HREF="http://www.mywashingtonpost.com/" target="_top">mywashingtonpost.com</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/headlines/" target="_top">Our Headlines on Your Site</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/contents/permissions.htm" target="_top">Rights and Permissions</A><br>') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/guide/setashome.htm" target="_top">Make Us Your Home Page</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/jobs/WPNIJobSearch.html" target="_top">Work at washingtonpost.com</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/hr/intern.html" target="_top">Internships</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/wp-srv/contents/" target="_top">Site Index</A><br>') ;
  output += ('') ;
  output += ('</span>') ;
  output += ('</td>') ;
  output += ('<td valign="top">') ;
  output += ('<span class="globalnav_business_3">The Washington Post: </span>') ;
  output += ('<span class="globalnav_business_1">') ;
  output += ('<A HREF="http://washpost.com/wpnihomepage" target="_top">Subscribe</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/subscriberservices" target="_top">Subscriber Services</A><br>') ;
  output += ('<A HREF="http://adsite.washpost.com/" target="_top">Advertise</A> | ') ;
  output += ('<A HREF="http://ee.washpost.com/index.jsp" target="_top">Electronic Edition</A> | ') ;
  output += ('<A HREF="http://www.washingtonpost.com/buyphotos" target="_top">Online Photo Store</A><br>') ;
  output += ('</span>') ;
  output += ('') ;
  output += ('<span class="globalnav_business_3">The Washington Post Co.: </span>') ;
  output += ('<span class="globalnav_business_1">') ;
  output += ('<A HREF="http://washpost.com/" target="_top">Information</A><br>') ;
  output += ('<A HREF="http://www.washpostco.com/co_web.htm" target="_top">Other Washington Post Co. Websites</A>') ;
  output += ('</span>') ;
  output += ('') ;
  output += ('</td>') ;
  output += ('</tr>') ;
  output += ('</table>') ;
  output += ('<!-- end bank of links -->') ;
  output += ('</TD></TR>') ;
  output += ('<TR><TD COLSPAN="8" HEIGHT="1" BGCOLOR="#666666"><spacer type="block" height="1"></TD></TR>') ;
  output += ('</TABLE>') ;
  output += ('') ;

  output += getSearch() ;

  output += ('<TABLE WIDTH="760" BORDER="0" CELLPADDING="0" CELLSPACING="0" BACKGROUND="http://media.washingtonpost.com/wp-srv/images/spacer.gif">') ;
  output += ('<TR>') ;
  output += ('<TD COLSPAN="5" HEIGHT="1" BGCOLOR="#FFFFFF" ALIGN="left">&nbsp;&nbsp;<span class="globalnav_business_1"><A HREF="http://www.washingtonpost.com/wp-srv/interact/longterm/talk/members.htm" target="_top">User Agreement and Privacy Policy</A> | &copy; <A HREF="http://www.washingtonpost.com/wp-srv/interact/longterm/talk/copy.htm" target="_top">Copyright</A> 1996-'+(new Date()).getFullYear()+' The Washington Post Company</span></TD>') ;
  output += ('<TD COLSPAN="3" HEIGHT="1" BGCOLOR="#FFFFFF" ALIGN="right">&nbsp;</TD>') ;
  output += ('</TR><form action="http://www.washingtonpost.com/wl/jobs/JobSearchServlet" method="post" name="JobsAtWPNI" target="_new"><input type="hidden" name="featuredEmpl" value="9181"><input type="hidden" name="jobCat" value="-1"><input type="hidden" name="jobFunc" value="-1"><input type="hidden" name="location" value="-1"><input type="hidden" name="jobStat" value="-1"><input type="hidden" name="education" value="-1"><input type="hidden" name="keyword" value=""><input type="hidden" name="agentname" value=""><input type="hidden" name="search" value="Search"><input type="hidden" name="formName" value="null"></form>') ;
  output += ('</TABLE>') ;

  return output ;
}

var firstCallToPlaceChannelNav = true ;
function placeChannelNav(channel)
{
  var output = '' ;

  if ( firstCallToPlaceChannelNav)
    output += getTopGlobalNav(channel) ;
  else if (channel.indexOf("jobs")>-1)  
    output += getTopGlobalNav(channel,true) ;
  else
    output += getBottomGlobalNav() ;

  firstCallToPlaceChannelNav = false ;
  
  document.write( output ) ;

  /** NON-CORE STUFF **/
  //--------------- EZULA FIX --------------------//
  // if the channel isn't cars - added because of a cars specific issue
	// if the channel isn't jobs - added because of a jobs specific issue
  if ( (channel.indexOf("cars") == -1) && (channel.indexOf("jobs") == -1) )
  {
    //alert(channel);
    document.write("<style type=\"text/css\">span {font-size:1px}</style>");
  }
  
}

// THE FOLLOWING CODE PLACES A UNIVERSAL PERSISTENT COOKIE RESIDENT ON USERS' MACHINES
// THE FOLLOWING CODE PLACES A UNIVERSAL PERSISTENT COOKIE RESIDENT ON USERS' MACHINES
var upc_url = new String(document.location.href) ;

// if (upc_url.indexOf(".washingtonpost.com") > -1)
if (upc_url.indexOf(".washingtonpost.com") > -1)
{
  c = document.cookie; 
  var pos = c.indexOf("WPNIUCID"); 
  if (pos == -1) 
  {
    d = new Date(); 
    i = "WPNI"+ d.getTime() +"."+ Math.round(Math.random()*10000); 
    d.setTime(d.getTime() + 31104000000); 
    document.cookie = "WPNIUCID="+ i + 
                      "; expires="+ d.toGMTString() + 
                      "; path=/"+ 
                      "; domain=.washingtonpost.com";
  }
}
