/*  BEGIN: Forms bank popups */	
function Popup(ID) {
self.name="basement";
Ablak = window.open("","Ujablak",config="height=400,width=450,scrollbars=yes,resizable=yes");
Ablak.focus();
Ablak.document.write("<p style='text-color:#000000'><strong>The page is loading...</strong></p>");
Ablak.location.href="/AM/CustomSource/formsdetail.cfm?DNumber=" + ID;
}

function HWindow(whereto,xd,yd) { // still used 8.6.2009
TestWindow = window.open("","HelpWindow",config="height=" + xd + ",width=" + yd + ",scrollbars=yes,resizable=yes");
TestWindow.focus();
TestWindow.document.write("<strong>The page is loading... Please wait...</strong>");
TestWindow.location.href=whereto
}

function popuphelp(address) { // still used 8.6.2009
self.name="basement";
Ablak = window.open("","Ujablak",config="height=250,width=375,scrollbars=yes,resizable=yes");
Ablak.focus();
Ablak.document.write("<strong>The page is loading...</strong>");
Ablak.location.href=address;
}

/*  END: Forms bank popups */

/* J.Skemp, 2006.10.11 - Pop up window 350 px in width */
function popup350(CLocation) {
	self.name="basement";
	Ablak = window.open("","Ujablak",config="height=310,width=350,scrollbars=yes,resizable=yes");
	Ablak.focus(CLocation);
	Ablak.document.write("<strong>The page is loading ...<\/strong>");
	Ablak.location.href="/AM/AMTemplate.cfm?Template=/CM/HTMLDisplay.cfm&ContentID=" + CLocation;
}
/* J.Skemp, 2006.12.21 - Pop up window with contentid = CLocation and CWidth px in width */
function popupCW(CLocation,CWidth) {
	self.name="basement";
	Ablak = window.open("","Ujablak",config="height=310,width=" + CWidth + ",scrollbars=yes,resizable=yes");
	Ablak.focus(CLocation);
	Ablak.document.write("<strong>The page is loading ...<\/strong>");
	Ablak.location.href="/AM/AMTemplate.cfm?Template=/CM/HTMLDisplay.cfm&ContentID=" + CLocation;
}
/* J.Skemp, 2006.12.21 - Pop up window with contentid = CLocation, CWidth px in width and CHeight px in height */
function popupCWH(CLocation,CWidth,CHeight) {
	self.name="basement";
	Ablak = window.open("","Ujablak",config="height=" + CHeight + ",width=" + CWidth + ",scrollbars=yes,resizable=yes");
	Ablak.focus(CLocation);
	Ablak.document.write("<strong>The page is loading ...<\/strong>");
	Ablak.location.href="/AM/AMTemplate.cfm?Template=/CM/HTMLDisplay.cfm&ContentID=" + CLocation;
}
/* Pass the complete Url, not just the contentid. */
function popupClWH(CLocation,CWidth,CHeight) {
	self.name="basement";
	Ablak = window.open("","Ujablak",config="height=" + CHeight + ",width=" + CWidth + ",scrollbars=yes,resizable=yes");
	Ablak.focus(CLocation);
	Ablak.document.write("<strong>The page is loading ...<\/strong>");
	Ablak.location.href = CLocation;
}
//addEvent() by John Resig - J.Skemp, 2006.11.21
function addEvent( obj, type, fn ){ 
   if (obj.addEventListener){ 
      obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent){ 
      obj["e"+type+fn] = fn; 
      obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
      obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 
}

//addLoadEvent() - D. Conderman 2007.02.09
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
			oldonload();
			}
			eval(func);
		}
	}
}

// R.Lumley, 2007.12.28
var rssDivVar = "";
function importXML(xmlFile, rssDiv)
{
	rssDivVar = rssDiv;
	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = createList;
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4) createList()
		};
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}
	xmlDoc.load(xmlFile);
}

// R.Lumley, 2007.12.28
function createList()
{
	var x = xmlDoc.getElementsByTagName('item');
	var newEl = document.createElement('UL');
	if (x.length<3) {
		var feedItems = x.length;
	} else {
		var feedItems = 3;
	}
	for (i=0;i<feedItems;i++) {
		var row = document.createElement('LI');
		var linkAnchor = document.createElement('A');
		for (j=0;j<x[i].childNodes.length;j++) {
			if (x[i].childNodes[j].nodeType != 1) continue;
			if (x[i].childNodes[j].nodeName == "title"){
				var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
				linkAnchor.appendChild(theData);
				linkAnchor.href = "/AM/Template.cfm?Section=Practice411s_Advice_Alert&Template=/CustomSource/LOMAP/advice_alert.cfm#article" + i;
				row.appendChild(linkAnchor);
			}
		}
		newEl.appendChild(row);
	}
	document.getElementById(rssDivVar).appendChild(newEl);
}
// 2008.03.24 - Show emails for select browsers.
function createEmail(username, domain) {
	if (username) {
		if (!domain || (domain && domain == '')) {
			document.write('<a href="mailto:' + username + '@' + 'wisbar.org' + '">');
		} else { // there is a domain
			document.write('<a href="mailto:' + username + '@' + domain + '">');
		}
	}
}

//2009.12.10 J.Skemp - Return mailto link for email.
function ReturnMailTo(username, domain) {
	if (username) {
		if (!domain || (domain && domain == '')) {
			return "mailto:" + username + "@" + "wisbar.org";
		} else { // there is a domain
			return "mailto:" + username + "@" + domain;
		}
	}
}