
var url = "http://legalmarketingreader.com/";
var title = "Legal Marketing Reader";

function addToFavorites(){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(url,title);
	} else if (navigator.appName == "Netscape") {
		window.sidebar.addPanel(title,url,"");
	} else {
		alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}


// All the Below is AHAH code

function initialize(obj) {
	topblogs(obj);
}

function moreblogs(obj) {
	document.getElementById('top').className="deselected";
	document.getElementById('publications').className="deselected";
	document.getElementById('more').className="selected";
	ahah('includes/moreblogs.html', obj, '', false);
}

function topblogs(obj) {
	document.getElementById('top').className="selected";
	document.getElementById('publications').className="deselected";
	document.getElementById('more').className="deselected";
	ahah('includes/topblogs.html', obj, '', false);
}

function publications(obj) {
	document.getElementById('publications').className="selected";
	document.getElementById('top').className="deselected";
	document.getElementById('more').className="deselected";
	ahah('includes/publications.html', obj, '', false);
}

function magpieBlogs(url) {
	if (url == 'includes/topblogs.html') {
		ahah("rss/lmr.php", 'blog1', '', true);
		ahah("rss/bodine.php", 'blog2', '', true);
		ahah("rss/kane.php", 'blog3', '', true);
		ahah("rss/campbell.php", 'blog4', '', true);
		ahah("rss/raintoday.php", 'blog5', '', true);
		ahah("rss/hassett.php", 'blog6', '', true);
		ahah("rss/allen.php", 'blog7', '', true);
		ahah("rss/jakes.php", 'blog8', '', true);
		ahah("rss/watercooler.php", 'blog9', '', true);

	} else if (url == 'includes/moreblogs.html') {
		ahah("rss/poll.php", 'blog1', '', true);
		ahah("rss/inhouserant.php", 'blog2', '', true);
		ahah("rss/golden.php", 'blog3', '', true);
		ahah("rss/counsel2counsel.php", 'blog4', '', true);
		ahah("rss/green.php", 'blog5', '', true);
		ahah("rss/wired.php", 'blog6', '', true);
		ahah("rss/whataboutclients.php", 'blog7', '', true);
		ahah("rss/shields.php", 'blog8', '', true);
		ahah("rss/lawyerist.php", 'blog9', '', true);
		
	} else if (url == 'includes/publications.html') {
		ahah("rss/law_counsel.php", 'blog1', '', true);
		ahah("rss/law_small_firm.php", 'blog2', '', true);
		ahah("rss/amlaw_daily.php", 'blog3', '', true);
		ahah("rss/wsj_law.php", 'blog4', '', true);
		ahah("rss/aba_topstories.php", 'blog5', '', true);
		ahah("rss/aba_lawpractice.php", 'blog6', '', true);
		ahah("rss/legalblogwatch.php", 'blog7', '', true);
		ahah("rss/bizjournals.php", 'blog8', '', true);
		ahah("rss/law_newswire.php", 'blog9', '', true);
	}
}


function ahah(url, target, funcname, normal) {
	function ahahDone() {
		if(req.readyState == 4){
			if(req.status == 200){
				if(!(target == undefined)){
					document.getElementById(target).innerHTML = req.responseText;
					if (!normal) { magpieBlogs(url); }
				}
				if(!(funcname == undefined)){
					eval(funcname+"(req.responseText);");
				}
			}else{
				if(!(target == undefined)){
					document.getElementById(target).innerHTML = "ahah error:\n"+req.statusText;
				}
				if(!(funcname == undefined)){
					eval(funcname+"(req.responseText);");
				}
			}
		}
	}

	if(!(target == undefined)){
		if (!normal) {
			document.getElementById(target).innerHTML = '<div class="loader"><span>Loading... <img src="images/loader.gif" alt="Ajax Loader" /></span></div>';
		}else{
			document.getElementById(target).innerHTML = '<div class="loader2"><span>Loading... <img src="images/loader.gif" alt="Ajax Loader" /></span></div>';
		}
	}
	if(window.XMLHttpRequest){
		var req = new XMLHttpRequest();
	}else if(window.ActiveXObject) {
		var req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(req){
		req.onreadystatechange = function() {
			ahahDone();
		};
		req.open("GET", url, true);
		req.send("");
	}
}
