// to launch in a new window, set rel="external" for the link.
// to launch in a specific frame, set rel="external:framename" for the link, where framename is the name of the targetted frame.

// XHTML Targetting Script
// ©2003 Marty Lamb, MartianSoftware.com
// http://www.martiansoftware.com/articles/xhtmltargetting.html

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel")) {
			var rel = anchor.getAttribute("rel");
			if (rel == "external") {
				anchor.target = "_blank";			
			} else if (rel.substring(0,9) == "external:") {
				anchor.target = rel.substring(9, rel.length);
			} 
		}
	}
}

window.onload = externalLinks;


// New Window Script
function displayWindow(url, width, height) {
     var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=yes,menubar=no,status=no' );
}

function gfGetXMLHTTP()
{   
	var xmlHTTP = null;
	try
	{	// Chrome, Firefox, Opera 8.0+, Safari
		xmlHTTP = new XMLHttpRequest();
	}
	catch(e)
	{   // Internet Explorer
		try
		{	try
			{	xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{   xmlHTTP = null;
			}
		}
		catch(e)
		{   try
			{	xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{	xmlHTTP = null;
			}
		}
	}
	return xmlHTTP;
}

function gfLoadRSSFeed(strElementName, strRSSURL, intItemCount, bDoShowImage, bDoShowDate, bDoShowDescription, strFilter1, strFilter2)
{						
	try
	{	
		var xmlHTTP = gfGetXMLHTTP();
		var objElement = document.getElementById(strElementName);

		// Exit the function if we can't get a XML HTTP object
		if( xmlHTTP == null)
			return false;

		// Parse the URL so this works in Production and Development
		var strURL = new String(window.location.href);
		var arrURL = strURL.split('/')
		
		strFilter1 = escape(strFilter1).replace(/\+/gi, '%2B');
		strFilter2 = escape(strFilter2).replace(/\+/gi, '%2B');
		
		strURL = (window.location.protocol == "https:" ? "https://" : "http://") + arrURL[2] + '/inc/ajax/LoadRSS.asp';
		strURL = 	strURL + 	'?u=' + escape(strRSSURL) + 
								'&c=' + intItemCount + 
								'&i=' + (bDoShowImage ? 'true' : 'false') + 
								'&dt=' + (bDoShowDate ? 'true' : 'false') + 
								'&ds=' + (bDoShowDescription ? 'true' : 'false') +
								'&f1=' + strFilter1 + 
								'&f2=' + strFilter2;
        xmlHTTP.open('GET', strURL, false);
		xmlHTTP.send(null);
		objElement.innerHTML = xmlHTTP.responseText;
		
	}
	catch(e)
	{   
		return false;
	}
	return true;
}