function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

function getVid(unit, sort){
	http.open('get', 'http://video.gotgame.com/index.php/home/getVideos/'+sort+'/'+unit);
	http.onreadystatechange = handleVote;
	http.send(null);
}

function handleVote(){
	if(http.readyState == 4){
		document.getElementById('main_video_list').innerHTML=http.responseText;
	}
}

function unit_toggle(unit){
	if (unit=='view')
		document.getElementById('unit_toggle').innerHTML=
			"<a class=\"selected\" onclick=\"getVid('view', 'day');\">Views</a> | <a onclick=\"getVid('vote', 'day'); unit_toggle('vote')\">Votes</a>";
	else
				document.getElementById('unit_toggle').innerHTML=
			"<a onclick=\"getVid('view', 'day'); unit_toggle('view'); \">Views</a> | <a class=\"selected\" onclick=\"getVid('vote', 'day'); \">Votes</a>";
}