function get_object(id)
{
	if (document.getElementById)
	{
		return document.getElementById(id);
	}
	else if (document.all)
	{
		return document.all[id];
	}
	else if (document.layers)
	{
		return document.layers[id];
	}
	else
	{
		return null;
	}
}

function show_hide (id)
{
	object = get_object (id);
	if (object)
	{
		if (object.style.display == "none")
		{
			object.style.display = "";
		}
		else
		{
			object.style.display = "none";
		}
	}
}

function Rate (url, file)
{
	loadXMLDoc (url + 'ajax.php?do=rate&id=' + file);
}

var xmlhttp;
var container_content;

function loadXMLDoc(url)
{
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
		xmlhttp.onreadystatechange=xmlhttpChange;
		xmlhttp.open("GET", url, true);
		xmlhttp.send(null);
	}
	// code for IE
	else if (window.ActiveXObject)
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		if (xmlhttp)
		{
			xmlhttp.onreadystatechange=xmlhttpChange;
			xmlhttp.open("GET", url, true);
			xmlhttp.send();
		}
	}
}

function xmlhttpChange()
{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	{
		// if "OK"
		if (xmlhttp.status==200)
		{
			eval(xmlhttp.responseText);
		}
		else
		{
			alert("Problem retrieving data.  Status: " + xmlhttp.status)
		}
	}
}

function change_fade (object, opacity)
{
	var userAgent = navigator.userAgent.toLowerCase();
	obj = get_object(object);
	if (userAgent.indexOf('msie') != -1)
	{
		opacity = opacity * 100;
		get_object (object).style.filter="alpha(style=0, opacity=" + opacity + ")";
	}
	else
	{
		obj.style.opacity = opacity;
	}
}  

function fade_in (object, value)
{
	var opacs = ["0",".1",".2",".3",".4",".5",".6",".7",".8",".9","1"];

	get_object (object).innerHTML = value;

	for (var i = 0; i < 11; i++)
	{
		setTimeout('change_fade(\'' + object + '\', \'' + opacs[i] + '\');', i * 100);
	}
}

function fade_out (object)
{
	var opacs = ["0",".1",".2",".3",".4",".5",".6",".7",".8",".9","1"];
	opacs.reverse();

	get_object(object).style.opacity = 1;

	for (var i = 0; i < 11; i++)
	{
		setTimeout('change_fade(\'' + object + '\', \'' + opacs[i] + '\');', i * 100);
	}
}
