var adWindow = null;
function popupAd( url, name, height, width )
{ // Pops up an Ad window.
  // Precondition: url is the address of the page to show or an empty string.
  //   name is the name of the ad window. height and width are the dimensions of
  //   the ad window in pixels. 
  // Postcondition: An Ad window is displayed. If url is an empty string,
  //   nothing will be displayed. A reference to this window is stored in global
  //   variable adWindow.
  
	var winName = (name)? name : "AdWindow";
	var winFeatures = "toolbar=0," + 
			  "directories=0," + 
			  "menubar=0," + 
			  "scrollbars=1," + 
			  "resizable=1," + 
			  "maximize=0," + 
			  "width=" + ((width)? width : 480) + "," + 
			  "height=" + ((height)? height : 450) + "";

	// Open ad pop-up window for non-WebTV browsers because 
	//   WebTV doesn't support the window.open() method.
	if( navigator.appName.indexOf("WebTV") == -1 )
	{
		if( url )  // URL available?
		{  // Pop up ad
			adWindow = window.open( url, winName, winFeatures );
		}
	}
}

function popUnderAd( url, name, height, width )
{ // Creates a "pop under" window ad.
  // Precondition: url is the address of the page to show or an empty string.
  //   name is the name of the ad window. height and width are the dimensions of
  //   the ad window in pixels. 
  // Postcondition: An Ad window is displayed in a non-intrusive way. If url is an 
  //   empty string,nothing will be displayed. A reference to this window is stored in global
  //   variable adWindow.

	popupAd( url, name, height, width );
	if( !( null == adWindow || typeof( adWindow.focus ) == "undefined" ) )
	{
		self.focus();
		adWindow.blur();
	}	
}
