var MoreInfo = {
	addCSS: function(cssSrc, cssTitle) {
		var css = document.createElement("link");
		css.type = "text/css";
		css.rel = "stylesheet";
		css.href = cssSrc;
		css.media = "screen";
		css.title = cssTitle;
		document.getElementsByTagName("head")[0].appendChild(css);
	},
	
	addDiv: function(divId) {
		var div = document.createElement("div");
		div.id = divId;
		div.name = divId;
		div.style.display = "none";
		document.body.appendChild(div);
	},
	
	addIframe: function(divId, frameId, frameSrc) {
		if(!document.getElementById(frameId)) {
			var iframe = document.createElement("iframe");
			iframe.id = frameId;
			iframe.name = frameId;
			iframe.src = frameSrc;
			iframe.frameBorder = "0";
			var div = document.getElementById(divId);
			div.appendChild(iframe);
		}
	},
	
	modClass: function(a,o,c1,c2) {
		switch (a){
			case 'swap':
				o.className=!MoreInfo.modClass('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
			break;
			case 'add':
				if(!MoreInfo.modClass('check',o,c1)){o.className+=o.className?' '+c1:c1;}
			break;
			case 'remove':
				var rep=o.className.match(' '+c1)?' '+c1:c1;
				o.className=o.className.replace(rep,'');
			break;
			case 'check':
				return new RegExp('\\b'+c1+'\\b').test(o.className)
			break;
		}
	},
	
	initMoreInfo: function(){
	MoreInfo.addCSS("http://www.usnewsuniversitydirectory.com/css/Interrupter-moreinfo.css", "moreinfo");
		MoreInfo.addDiv("moreinfo");
		fnShow = function(){
			var myIBox = document.getElementById("ibox");
			var myContent = document.getElementById("ibox_content").firstChild.id;
			if(myContent == "moreinfo") {
				var myParent = document.location.href;
				var myLink = document.getElementById("moreinfo_link").href.replace(/&amp;/g,"&");
				var arg = ( myLink.indexOf("?") > 0 ) ? "&" : "?";
				MoreInfo.addIframe("moreinfo", "moreinfo_iframe", myLink + arg + "parent=" + escape(myParent).replace('online-education','onlineeducation'));
				MoreInfo.modClass("add", myIBox, "moreinfo_class")
			}
		}
		fnHide = function(){
			var myIBox = document.getElementById("ibox");
			MoreInfo.modClass("remove", myIBox, "moreinfo_class")
		}
		iBox.addEvent(iBox,"show",fnShow);
		iBox.addEvent(iBox,"hide",fnHide);
	},
	
	addToWindowOnLoad: function () {
		if (window.addEventListener) window.addEventListener("load", MoreInfo.initMoreInfo, false);
		else if (window.attachEvent) window.attachEvent("onload", MoreInfo.initMoreInfo);
	}
}

MoreInfo.addToWindowOnLoad();