function createRequestObject() 
{
	var returnObj = false;
	
    if(window.XMLHttpRequest) {
        returnObj = new XMLHttpRequest();
    } else if(window.ActiveXObject) {
		try {
			returnObj = new ActiveXObject("Msxml2.XMLHTTP");

			} catch (e) {
			try {
			returnObj = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
			}
			
    }
	return returnObj;
}

var http = createRequestObject();
var target;

// This is the function to call, give it the script file you want to run and the div tag you want it to output to.
function sendRequest(scriptFile, targetElement)
{	
	target = targetElement;
	try{
	http.open('get', scriptFile, true);
	}
	catch (e){
	document.getElementById(target).innerHTML = e;
	return;
	}
	http.onreadystatechange = handleResponse;
	http.send("");	
}

function handleResponse()
{	
	if(http.readyState == 4) {		
	try{
		var strResponse = http.responseText;
		document.getElementById(target).innerHTML = strResponse;
		$("#tabs").tabs();
		$("#tabs").tabs( "select","tabs-2");

		// Load the feeds API and set the onload callback.
    	LoadDynamicFeedControl();
		} catch (e){
		document.getElementById(target).innerHTML = e;
		}	
	}
}

function LoadDynamicFeedControl() {
	var feeds = [
		{title: 'Squash Canada',
		 url: 'http://twitter.com/statuses/user_timeline/24840248.rss'
		},
		{title: 'World Squash',
		 url: 'http://www.worldsquash.org/ws/?feed=rss2'
		},
		{title: 'Women`s International Squash Players Association',
		 url: 'http://www.worldsquash.org/ws/?feed=rss2&cat=9'
	}];
	
	var options = {
			stacked : true,
			horizontal : false,
			title : "Squash News"
	}
	
	new GFdynamicFeedControl(feeds, 'feed-control', options);
}
