
function checkAll(ref) {

	var chkAll = document.getElementById('checkit');
	var checks = document.getElementsByName('ids[]');
	var boxLength = checks.length;
	var allChecked = false;
	var totalChecked = 0;
	if ( ref == 1 ) {
		if ( chkAll.checked == true ) {
			for ( i=0; i < boxLength; i++ ) {
				checks[i].checked = true;
			}
		}
		else {
			for ( i=0; i < boxLength; i++ ) {
				checks[i].checked = false;
			}
		}
	}
	else {
		for ( i=0; i < boxLength; i++ ) {
			if ( checks[i].checked == true ) {
				allChecked = true;
				continue;
			}
			else {
				allChecked = false;
				break;
			}
		}
		if ( allChecked == true ) {
			chkAll.checked = true;
		}
		else {
			chkAll.checked = false;
		}
	}
	for ( j=0; j < boxLength; j++ ) {
		if ( checks[j].checked == true ) {
			totalChecked++;
		}
	}
}

function getHttpObject() {
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}


function display_advertise(page)
{

	if(type != 0 && type < 4)
	{
		advertiseHttp=getHttpObject();

		if (advertiseHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		}

		var url="/movies/link_page/" + link_page +  "/type/" + type + "/id/" + id+ "/tp/" + tp ;
		url=url+"/page/"+page;

		advertiseHttp.onreadystatechange=stateChanged;
		advertiseHttp.open("GET",url,true);
		advertiseHttp.send(null);
	}
}

function stateChanged()
{
	if (advertiseHttp.readyState==4)
	{
		document.getElementById("category_thumbs_holder").innerHTML=advertiseHttp.responseText;
	}
}

function playMovie(movieID){
	 document.getElementById('movie_thumb_' + movieID).style.visibility='visible';
	 document.getElementById('movie_thumb_info_' + movieID).style.display='none';

}
function stopMovie(movieID){
	document.getElementById('movie_thumb_' + movieID).style.visibility='hidden';
	document.getElementById('movie_thumb_info_' + movieID).style.display='inline';

}


