var scrolldir = 0
var ipos = 0
var t
var iheight
var top
var bottom

var curdd = ""
var ct = ""

function ddopen(choice)
{
	ddcancel()
	if (curdd)
	{
		ddclose()
	}
	curdd = choice
	document.getElementById("choices"+curdd).style.visibility="visible"
	document.getElementById(curdd).style.overflow="visible"
}

function ddclose()
{
	document.getElementById("choices"+curdd).style.visibility="hidden"
	document.getElementById(curdd).style.overflow="hidden"
}

function ddclosetime()
{
	ct = setTimeout("ddclose()",500)
}

function ddcancel()
{
	if (ct)
	{
		window.clearTimeout(ct);
		ct = null;
	}
}

function init()
{
	iheight = document.getElementById("inner").offsetHeight
	top = 0
	bottom = (iheight * (0-1) + 416)
}

function CShow(choice)
{
	var clink = "CLink" + choice
	var comments = "Comments" + choice
	document.getElementById(clink).innerHTML = '<a href="javascript:CClose(\'' + choice + '\')">Hide Comments</a>'
	document.getElementById(comments).style.width = "auto"
	document.getElementById(comments).style.height = "auto"
	init()
}

function CClose(choice)
{
	var clink = "CLink" + choice
	var comments = "Comments" + choice
	document.getElementById(clink).innerHTML = '<a href="javascript:CShow(\'' + choice + '\')">View/Post Comments</a>'
	document.getElementById(comments).style.width = "0px"
	document.getElementById(comments).style.height = "0px"
	init()
}

function Go(choice)
{
	document.location = choice;
}

function Over(choice)
{
	document.getElementById(choice).style.color = "red"
}

function Out(choice)
{
	document.getElementById(choice).style.color = "black"
}

function Wheel(event)
{
	/*var delta = 0;
	if (!event)
	{
		event = window.event;
	}
	if (event.wheelDelta)
	{
		delta = event.wheelDelta/120;
		if (window.opera)
		{
			delta = -delta;
		}
	}
	else if (event.detail) 
	{
		delta = -event.detail/3;
	}
	event.returnValue = false;
	if (delta == -1)
	{
		ipos -= 150
	}
	else if (delta == 1)
	{
		ipos -= (0-150)
	}
	if (ipos > top)
	{
		ipos = top
	}
	else if (ipos < bottom)
	{
		ipos = bottom
	}
	document.getElementById("inner").style.top = ipos + "px"*/
}

function boost(jump)
{
	ipos -= (0-jump)
	if (ipos < bottom)
	{
		ipos = bottom
	}
	if (ipos > top)
	{
		ipos = top
	}
	document.getElementById("inner").style.top = ipos + "px"
}

function doscroll(dir)
{
	if (dir != 0)
	{
		scrolldir = dir
		scrolling()
	}
	else
	{
		clearTimeout(t)
	}
}

function scrolling()
{
	if ((scrolldir < 0 && ipos > bottom) || (scrolldir > 0 && ipos < top))
	{
		ipos = ipos - (scrolldir * (0-1))
		document.getElementById("inner").style.top = ipos + "px"
		t = setTimeout("scrolling()",10)
	}
}

function AJAX_FUNCTION(DOVAR)
{
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="PHP_PAGE.php?VAR=" + DOVAR + "&sid="+Math.random()
  xmlHttp.onreadystatechange=AJAXCALL
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function AJAXCALL() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("AJAXDIV").innerHTML=xmlHttp.responseText
  }
}

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;
}