function insertWBR(str) {
	var output = '' ;
	for ( var i=0; i<str.length; i++ ) {
		output += str.charAt(i) ;
		output += '<wbr/>' ;
	}
	return output ;
}
function google_ad_request_done(google_ads) {

	if (google_ads.length > 0 ) { // Debugging output
		// document.write (google_ads.length +	" ad(s) returned.<br>");
	} else { 
		// document.write( "0 ads returned. <br>"); 
		return;
	}

	var s = '';
	var i;

	/*
	* Verify that there are actually ads to display.
	*/
	if (google_ads.length == 0) {
		return;
	}

	/*
	* If an image or Flash ad is returned, display that ad.
	* Otherwise, build a string containing all of the ads and
	* then use a document.write() command to print that string.
	*/

	if (google_ads[0].type == "flash") {
		s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
					' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
					' WIDTH="' + google_ad.image_width +
					'" HEIGHT="' + google_ad.image_height + '">' +
					'<PARAM NAME="movie" VALUE="' + google_ad.image_url + '">'
					'<PARAM NAME="quality" VALUE="high">'
					'<PARAM NAME="AllowScriptAccess" VALUE="never">'
					'<EMBED src="' + google_ad.image_url +
					'" WIDTH="' + google_ad.image_width +
					'" HEIGHT="' + google_ad.image_height + 
					'" TYPE="application/x-shockwave-flash"' + 
					' AllowScriptAccess="never" ' + 
					' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';

	} else if (google_ads[0].type == "image") {
		s += '<a href="' + google_ads[0].url +
					'" target="_top" title="go to ' + google_ads[0].visible_url +
					'"><img border="0" src="' + google_ads[0].image_url +
					'"width="' + google_ads[0].image_width +
					'"height="' + google_ads[0].image_height + '"></a>';

	} else {
		s += ('<link href="http://www.washingtonpost.com/wp-adv/css/sponsorship.css" rel="stylesheet" type="text/css" media="all"/>');
		s += ('<div align="left">') ;
		s += ('<div class="sponsorshiphack"><b></b></div>') ;
		s += ('<div class="sponsorship">') ;
		s += ('<h2>Ads by Google</h2>') ;
		s += ('<div class="sponsorshipcontent">') ;
		s += ('<div class="sponsorshipbox">') ;

		if (google_ads.length == 1 || location.href.match('test_ads=google1')) {
			/*
			* Partners should adjust text sizes
			* so ads occupy the majority of ad space.
			*/
				var i = 0 ;
				s += '<p><a href="' + google_ads[i].url + '" ' +
					'onmouseout="window.status=\'\';return true" ' +
					'onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true" ' +
					'style="text-decoration:none">' +
					'<span style="text-decoration:underline;color:#0C4790;">' +
					'<b>' + google_ads[i].line1 + '</b><br/></span></a>' + 
					'<span style="color:#000000;font-weight:normal;">' +
					google_ads[i].line2 + ' ' +
					google_ads[i].line3 + '<br/></span>' +
					'<a href="' + google_ads[i].url + '" ' +
					'onmouseout="window.status=\'\';return true" ' +
					'onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true" ' +
					'style="text-decoration:none"><span style="font-size:7pt;color:#5A87BD;font-weight:normal;">' +
					insertWBR(google_ads[i].visible_url) + '</span></a></p>';
		} else if (google_ads.length > 1) {
			/*
			* For text ads, append each ad to the string.
			*/
			for(i=0; i < google_ads.length; ++i) {
				s += '<p><a href="' + google_ads[i].url + '" ' +
					'onmouseout="window.status=\'\';return true" ' +
					'onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true" ' +
					'style="text-decoration:none">' +
					'<span style="text-decoration:underline;color:#0C4790;">' +
					'<b>' + google_ads[i].line1 + '</b><br/></span></a>' + 
					'<span style="color:#000000;font-weight:normal;">' +
					google_ads[i].line2 + ' ' +
					google_ads[i].line3 + '<br/></span>' +
					'<a href="' + google_ads[i].url + '" ' +
					'onmouseout="window.status=\'\';return true" ' +
					'onmouseover="window.status=\'go to ' +
					google_ads[i].visible_url + '\';return true" ' +
					'style="text-decoration:none"><span style="font-size:7pt;color:#5A87BD;font-weight:normal;">' +
					insertWBR(google_ads[i].visible_url) + '</span></a></p>';
			}
		}
		s += ('</div></div></div></div>') ;

	}

	document.write(s);

	return;
}

	// google_page_url = 'http://www.washingtonpost.com/'; // comment out after testing.
	// google_ad_client = 'ca-washingtonpost_js'; // move to advertisingLinks_v2.js (will change with each node (or ancestor)
	google_ad_output = 'js';
	google_max_num_ads = '3';
	google_safe = 'high';
	google_adtest = 'off'; // change to 'off' for launch

	document.write('<s\cript language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></s\cript>') ;



