var xmlHttp;

function ajax_get_videos(page)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	xmlHttp.onreadystatechange=stateChanged; 
	var url="/videos.php";
	url=url+"?page="+page;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	//alert(str);	
}

function ajax_get_all_videos()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	xmlHttp.onreadystatechange=stateChanged; 
	var url="/videos.php";
	url=url+"?showall=1";
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	document.getElementById('container_video').style.height = "";
	//alert(str);	
}

function stateChanged()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("area_video").innerHTML=xmlHttp.responseText 
		//document.getElementById("loading_image").style.display = "none";
	} 
	else
	{	
		//document.getElementById("loading_image").style.display = "block";
	}
}

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp = null;
	try 
	{
		// Firefox, Opera 8.0+, Safari
		objXmlHttp = new XMLHttpRequest();
		return objXmlHttp;
	}
	catch (e) 
	{
		 // Internet Explorer
		try 
		{ 
			objXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			return objXmlHttp;
		}
		catch (e) 
		{
			try 
			{
				objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				return objXmlHttp;
		  	}
		  	catch (e) 
		  	{
				alert("Your browser does not support AJAX!");
				return false;
		  	}
		}	
	}
}