//Google ads generator (javascript)
//David Jamin  

//********** Global Variables **********//
var o_urlstring = document.URL;
o_urlstring = path(o_urlstring);
o_urlstring = replace(o_urlstring, "_");

function google_ad_request_done(google_ads) {
    /*
     * This function is required, but may be left blank
     * if no ads are required.
     */
}

function google_radlink_request_done(radlinks) {
    /*
     * This function is required and is used to display
     * the ads that are returned from the JavaScript
     * request. You should modify the document.write
     * commands so that the HTML they write out fits
     * with your desired Link Unit layout.
     */
    if (radlinks.length < 1)
      return;

	if (o_urlstring.indexOf("writ.news") != -1){
    	document.write("<td nowrap>&nbsp;<span class=\"header\">Related Ads</span></td></tr>\n");
		document.write("<tr><td bgcolor=\"#333333\" height=\"1\"><img src=\"http://images.findlaw.com/shared/spacer.gif\" height=\"1\" width=\"1\"></td></tr></table><p>\n");
		document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" width=\"92%\" align=\"center\"><tr align=\"LEFT\"><td>\n");
    	for(i=0; i < radlinks.length; ++i) {
      		document.write("<a style=\"text-decoration:underline;\" class=\"textsmall\" target=\"_top\" href=\"/fl_ads.html?google_kw=" + radlinks[i].url_escaped_term + "&google_page_url=" + window.location + "\"><b>" + radlinks[i].term + "</b></a></span>\n");
		}
		document.write("</td></tr></table>\n");
		document.write("<hr>\n");
	}else if (o_urlstring.indexOf("news.") != -1){
		document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
		document.write("<tr><td><a href=\"http://boards.lp.findlaw.com/\" class=\"left-linkdes\">Related Ads</a></td></tr>");
		document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>");

    	for(i=0; i < radlinks.length; ++i) {
      		document.write("<a target=\"_top\" style=\"text-decoration:underline;\" class=\"textsmall\" href=\"/fl_ads.html?google_kw=" + radlinks[i].url_escaped_term + "&google_page_url=" + window.location + "\"><b>" + radlinks[i].term + "</b></a>\n");
    	}
    	document.write("</td></tr></table>\n");
	}else if ((o_urlstring.indexOf("casecode") != -1) || (o_urlstring.indexOf("caselaw") != -1)){
    	document.write("<span class=\"text\"><b>&nbsp;&nbsp;&nbsp;Related Ads</b></span><p>\n");
    	for(i=0; i < radlinks.length; ++i) {
      		document.write("<span sytle=\"text-decoration:underline;\" class=\"smalltext\"><a target=\"_top\" href=\"/fl_ads.html?google_kw=" + radlinks[i].url_escaped_term + "&google_page_url=" + window.location + "\"><b>" + radlinks[i].term + "</b></a></span>\n");
		}
    	document.write("<hr>\n");
	}
}

     google_ad_client = 'ca-findlaw-radlinks_js'; 
	if ((o_urlstring.indexOf("casecode") != -1) || (o_urlstring.indexOf("caselaw") != -1)){
     	google_ad_channel = 'url_targeting';
	}else{
     	google_ad_channel = 'keyword_targeting';
     	google_kw_type = 'broad';
     	google_kw = temp_google_kw;
	}
     google_ad_output = 'js';
     google_max_num_ads = '0';
     google_page_url = o_urlstring;
     google_language = 'en';
     google_encoding = 'utf-8';
     google_hints = '';
     google_contents = '';
     google_safe = 'high';
     google_num_radlinks = '5';
     google_max_radlink_len = '35';
     google_rl_filtering = 'high';
     google_rl_mode = 'relevance';

