//ADD SITE LOGO
document.write('<link rel="shortcut icon" href="/II/images/logo-2.ico">');


function gotoURL(oURL)
{
	window.location = oURL;
}

function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
	var steps = (horizontal?(content.getSize().scrollSize.x - content.getSize().size.x):(content.getSize().scrollSize.y - content.getSize().size.y))
	var slider = new Slider(scrollbar, handle, {	
		steps: steps,
		mode: (horizontal?'horizontal':'vertical'),
		onChange: function(step){
			// Scrolls the content element in x or y direction.
			var x = (horizontal?step:0);
			var y = (horizontal?0:step);
			content.scrollTo(x,y);
		}
	}).set(0);

	if( !(ignoreMouse) ){
		// Scroll the content element when the mousewheel is used within the 
		// content or the scrollbar element.
		$$(content, scrollbar).addEvent('mousewheel', function(e){	
			e = new Event(e).stop();
			var step = slider.step - e.wheel * 30;	
			slider.set(step);					
		});
	}
}

var GI_xmlHttp;

function getAttl(str)
{ 
	theDiv = document.getElementById("attl-ajax");
	theDiv.innerHTML = "<img src='II/images/ajax-loader.gif'/>Loading...";

	GI_xmlHttp=GetXmlHttpObject();
	if (GI_xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url="II/ajax/get-attl.php?q="+str;
	url=url+"&sid="+Math.random();

	GI_xmlHttp.onreadystatechange=function()
	{
		if (GI_xmlHttp.readyState==4 || GI_xmlHttp.readyState=="complete")
		{
			theDiv.innerHTML = "";
			//Create empty div and load the response into it...append that div to theDiv to enable the scripting
			var newdiv = document.createElement("div");
			newdiv.innerHTML = GI_xmlHttp.responseText;
			var container = theDiv;
			container.appendChild(newdiv);
			document.getElementById("episode-img").onload = function()
			{
				makeScrollbar( $('attl'), $('scrollbar1'), $('handle1'), true, false );
			}

		} 
	};
	GI_xmlHttp.open("GET",url,true);
	GI_xmlHttp.send(null);
}

function GetXmlHttpObject()
{
	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;
}

window.addEvent("domready", function() {
	//getAttl(0);
});
