// funny bunny homepage JS
function xmlHttp()
{
	var xmlHttp;
	
	try
	{
		// Opera 8.0+, Firefox, Safari
		xmlHttp = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		 catch (e) 
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				alert("Your browser does not support AJAX.");
				return false;
			}
		}
	}
	return xmlHttp;
}

function homeVideoTabs(tab, p, sfw) {	
	
	var ajaxRequest = xmlHttp();
	
	ajaxRequest.open("GET", site_root+"homeVideoTabs.php?tab="+tab+"&p="+p+"&id="+Math.random()+"&sfw="+sfw, true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function(){
	
		if(ajaxRequest.readyState == 1)
		{
			document.getElementById("video-scroll").innerHTML += "Loading...";
		}
		else if(ajaxRequest.readyState == 2)
		{
			document.getElementById("video-scroll").innerHTML += "Loaded...";
		}
		else if(ajaxRequest.readyState == 3)
		{
			document.getElementById("video-scroll").innerHTML += "Interactive...";
		}
		
		if(ajaxRequest.readyState == 4)
		{			
			
			if(ajaxRequest.status == 200)
			{
				
				document.getElementById("video-scroll").innerHTML = ajaxRequest.responseText;
				
				document.getElementById("popular").className="tab-inactive";
				document.getElementById("rated").className="tab-inactive";
				document.getElementById("discussed").className="tab-inactive";
				
				document.getElementById(tab).className="tab-active";
								
			}
			else 
			{
				document.getElementById("video-scroll").innerHTML = "Server Not Responding";
			}
		}
	}
}
function addClicks(id){
	
	ajaxRequest = xmlHttp();
	
	ajaxRequest.open("GET", site_root+"addPlugClick.php?id="+id+"&rn="+Math.random(), true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			if(ajaxRequest.status == 200)
			{
				
			}
			else
			{
			
			}
		}
	}
}
function loginShow(id, lid)
{
	
	if(document.getElementById(id).style.display == 'none')
	{
		document.getElementById(id).style.display = 'block';
		document.getElementById(lid).innerHTML = "Login -";
	}
	else
	{
		document.getElementById(id).style.display = 'none';	
		document.getElementById(lid).innerHTML = "Login +";
	}
}

function submit_form() {
		document.login_form.submit();
}