// funny bunny homepage JS
var site_root = 'http://www.tooshocking.com/';

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) {	
	
	var ajaxRequest = xmlHttp();
	
	ajaxRequest.open("GET", site_root+"homeVideoTabs.php?tab="+tab+"&p="+p+"&id="+Math.random(), true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function(){
	
	
		if(ajaxRequest.readyState == 4)
		{			
			
			if(ajaxRequest.status == 200)
			{
				
				document.getElementById("middle_video").innerHTML = ajaxRequest.responseText;
				document.getElementById("loading").style.display = 'none';
				
				document.getElementById("popular").className="tab_normal";
				document.getElementById("rated").className="tab_normal";
				document.getElementById("discussed").className="tab_normal";
				
				document.getElementById(tab).className="tab_selected";
								
			}
			else 
			{
				document.getElementById("middle_video").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 +";
	}
}
homeVideoTabs('popular', '0');