var day_xmlHttp,iss_xmlHttp;
var contentLength;

function textScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

{
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {               			
				div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
				div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
				div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
            }
        }
    }
this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

this.scrollUp = function() {
		if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

this.scrollDown = function() {
        if (this.div_obj) {
			this.scrollCursor += this.speed;
			this.div_obj.scrollTop = this.scrollCursor;
				
			if (this.div_obj.scrollTop == this.scrollCursor) {
				this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
			} else {
				this.scrollCursor = this.div_obj.scrollTop;
			}
		}
    }

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}
function showDay(day)
{	
	// Highlight the tab
	obj=document.getElementById("day"+day);
	clearClass(obj.parentNode);
	obj.className="selected";
	
	document.getElementById("calImg").src="/portals/tankard/_images/calendar_day_"+day+".gif";
	
	day_xmlHttp=GetXmlHttpObject()
	if (day_xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 	
	var url="/portals/tankard/schedule_ajax.asp?rid="+qs("rid")+"&d="+day+"&sid="+Math.random();			
	day_xmlHttp.onreadystatechange=day_stateChanged;
	day_xmlHttp.open("GET",url,true);
	day_xmlHttp.send(null);	
}
function clearClass(obj) {
	var items=obj.getElementsByTagName('li');
	for(var i=0; i<items.length ;i++) {
	    items[i].className='';
    }
}
function qs(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}
function day_stateChanged() 
{ 	
	if (day_xmlHttp.readyState==4)
	{ 			
		document.getElementById("dailySchedule").innerHTML = day_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;
}