

function go() {
	loadFeed('twitter.com/statuses/user_timeline/808654.rss','1');
	loadFeed('feeds.feedburner.com/Adsoak','2');
	loadFeed('www.bozell.com/insights/categories/interactive/feed/','3')
	//loadFeed('www.nytimes.com/services/xml/rss/nyt/MediaandAdvertising.xml','4');
	//loadFeed('www.ibelieveinadv.com/feed','5');
	//loadFeed('feeds.feedburner.com/AdweekBreakingNews','6');
	//loadFeed('feeds.feedburner.com/MarketingInsideOut','7');
	//loadFeed('feeds.feedburner.com/Adpulp','8');
	//loadFeed('www.adverblog.com/index.xml','9');
	loadFlickr('api.flickr.com/services/feeds/photos_public.gne?format=rss2&author=31385474@N00','10');
	loadYouTube('www.youtube.com/rss/tag/advertising.rss','11');
}

setInterval("updateCounter()",1000);
var counter=600;

function updateCounter() {
	counter--;
	if (counter==-1) {
	counter=61;
	//document.getElementById('counter').innerHTML='Checking.....';
	
	go();
	
	
	} else {
		
	//document.getElementById('counter').innerHTML='Checking for updates in: ' + counter;
	
	}
}




//start toggle at 0 so only the first 10 lines are shown

for (var i=1;i < 12;i++) {
window['togglecolumn' + i]=0;

}


//function to control the showmore link...need to make this more flexible for multiple columns
function showmore(column) {
	 
	if (window['toggle' + column]==0) {
		document.getElementById(column+'-more').style.display='block';
		document.getElementById(column+'-showmore').innerHTML='Less';
		window['toggle' + column]=1;
	} else {
		document.getElementById(column+'-more').style.display='none';
		document.getElementById(column+'-showmore').innerHTML='More';
		window['toggle' + column]=0;
	}
	
		
}

//function to show and hide each links description on mouseover / mouseout
function showDescription(theDiv) {
	targetDiv="description"+theDiv;
	document.getElementById(targetDiv).style.position='absolute';
	document.getElementById(targetDiv).style.display='block';
}

function hideDescription(theDiv) {
	targetDiv="description"+theDiv;
	document.getElementById(targetDiv).style.display='none';
}




//AJAX FUNCTIONS
//create a boolean variable to check for IE instances

//set up an array and a counter so we can fire up multiple xmlhttp requests inside the same function (THATS RIGHT)
var xmlhttp = new Array();;
var xi = new Array();
xi[0] - 1;


function makerequest(serverPage, objID, column2) {
	
	
	
var xhrsend = xi.length;


for (var i=0; i<xi.length; i++) {

	if (xi[i] == 1) {
		xi[i] = 0;
		xhrsend = i;
		break;
	}
}

xi[xhrsend] = 0;


//are we using IE?
try {
	//if js version is greater than 5, then the following will not produce an error
	xmlhttp[xhrsend] = new ActiveXObject("Msxml2.XMLHTTP");
	//alert ("You are using Microsoft Internet Explorer");
	//if it errors, catch it, then try something else
} catch (e) {
	//if not, then check for older version of active x object
	try {
		//if older IE version
		xmlhttp[xhrsend] = new ActiveXObject("Microsoft.XMLHTTP");
		//alert ("You are using Microsoft Internet Explorer");
	//catch the error again
	} catch(E) {
		//else, this must not be IE
		xmlhttp[xhrsend] = false;
	}
}


//if indeed we are not using IE, then use javascript to create the xml request object
if (!xmlhttp[xhrsend] && typeof XMLHttpRequest != 'undefined') {
	xmlhttp[xhrsend] = new XMLHttpRequest(); 
	//alert ("You are NOT using Microsoft Internet Explorer");
}


	//assign a variable to the object passed to this function 
	var obj = document.getElementById(objID);
	//open the connection
	xmlhttp[xhrsend].open("GET", serverPage);
	//wait for an OK from the server
	xmlhttp[xhrsend].onreadystatechange = function() {
		//if the ready state is 4 (ok) and the status is 200 (complete)
		if (xmlhttp[xhrsend].readyState == 4 && xmlhttp[xhrsend].status == 200) {
			//set the inner html of the object to what was received
			obj.innerHTML = xmlhttp[xhrsend].responseText;
				column='';
				//stretcher=window['stretcher'+column];
				toggle=window['display'+column];
				//myAccordion=window['myAccordion'+column];
				//set up accordions for each feed
				//var stretchers= document.getElementsByClassName('stretcher');
				//var toggles = document.getElementsByClassName('display');
				//var myAccordion = new fx.Accordion(
				//toggles, stretchers, {opacity: true, height: true, width: false, duration: 400});
				//var found = false;
				
				//autoexpand first entry....not using this for now.
				//if (!found) myAccordion.showThisHideOpen(stretchers[0]);
			
		}
	}
	//send the request (we arent sending any data, just getting it, so we use null)
	xmlhttp[xhrsend].send(null);

}

function loadFeed(feed, column) {
		makerequest('includes/rss.php?feed='+feed+'&column='+column+'','column'+column+'',column);
		
}

function loadFlickr(feed, column) {
		makerequest('includes/flickr.php?column='+column+'','column'+column+'');
}

function loadYouTube(feed, column) {
		makerequest('includes/youtube.php?feed='+feed+'&column='+column+'','column'+column+'');
}

