//Ajax Handlers for Updating Videos (being watched, hot videos etc) on the Home Page
function update_hot_videos(){
	killVideoThumbs();
	var hot_videos = document.getElementById('hot_videos');
	hot_videos.innerHTML = '<div style="margin-top:139px;text-align:center;width:100%;"><img src="images/spinna.gif" alt="Loading your request" /></div>';
	var url = 'ajax/hot_videos.php?m='+Math.floor(Math.random()*100000)
	xmlhttp.open("GET", url);
	xmlhttp.onreadystatechange = hot_videos_handler;
	xmlhttp.send(null);
}
	
function hot_videos_handler(){
	var hot_videos = document.getElementById('hot_videos');
	if(xmlhttp.readyState == 4) {
		hot_videos.innerHTML = xmlhttp.responseText;
	}
}

function update_watched_videos(){
	killVideoThumbs();
	var watched_videos = document.getElementById('watched_videos');
	watched_videos.innerHTML = '<div style="margin-top:139px;text-align:center;width:100%;"><img src="images/spinna.gif" alt="Loading your request" /></div>';
	var url = 'ajax/videos_watched.php?m='+Math.floor(Math.random()*100000)
	xmlhttp.open("GET", url);
	xmlhttp.onreadystatechange = watched_handler;
	xmlhttp.send(null);
}

function watched_handler(){
	var watched_videos = document.getElementById('watched_videos');
	if(xmlhttp.readyState == 4) {
		watched_videos.innerHTML = xmlhttp.responseText;
	}
}
