// JavaScript Document
function addLoadEvent(func) 
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function') 
  {
    window.onload = func;
  } 
  else
  {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function hideAns(){
	//alert("woop");
	ansArr = getElementByClass("div", "ans");
	//alert(ansArr.length);
	ansArr[ansArr.length] = document.getElementById("docsList");
	ansArr[ansArr.length] = document.getElementById("linksList");
	ansArr[ansArr.length] = document.getElementById("faqList");
	ansArr[ansArr.length] = document.getElementById("dropins");
	ansArr[ansArr.length] = document.getElementById("gdocsList");
	for(var k=0; k<=ansArr.length-1;k++)
	{
		ansArr[k].style.display = "none";
	}
	addOnClick()
}
function addOnClick()
{
	qArr = getElementByClass("h4", "q");
	for(var k=0; k<=qArr.length-1;k++)
	{
		qArr[k].onclick = function()
		{
			var theAnsId = "a"+this.id;
			var theAns = document.getElementById(theAnsId);
			if(theAns.style.display == "none")
			{
				theAns.style.display = "block";
			}
			else
			{
				theAns.style.display = "none";
			}
			return false;
		}
	}
	document.getElementById("sTit").onclick = function()
		{
			var theList = document.getElementById("dropins");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				this.style.backgroundImage = "url(./img/arrowd.jpg)";
			}
			else
			{
				theList.style.display = "none";
				this.style.backgroundImage = "url(./img/arrow.jpg)";
			}
			return false;
		}
	document.getElementById("dTit").onclick = function()
		{
			var theList = document.getElementById("docsList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				this.style.backgroundImage = "url(./img/arrowd.jpg)";
			}
			else
			{
				theList.style.display = "none";
				this.style.backgroundImage = "url(./img/arrow.jpg)";
			}
			return false;
		}
	document.getElementById("lTit").onclick = function()
		{
			var theList = document.getElementById("linksList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				this.style.backgroundImage = "url(./img/arrowd.jpg)";
			}
			else
			{
				theList.style.display = "none";
				this.style.backgroundImage = "url(./img/arrow.jpg)";
			}
			return false;
		}
	document.getElementById("fTit").onclick = function()
		{
			var theList = document.getElementById("faqList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				this.style.backgroundImage = "url(./img/arrowd.jpg)";
			}
			else
			{
				theList.style.display = "none";
				this.style.backgroundImage = "url(./img/arrow.jpg)";
			}
			return false;
		}
		document.getElementById("gdTit").onclick = function()
		{
			var theList = document.getElementById("gdocsList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				this.style.backgroundImage = "url(./img/arrowd.jpg)";
			}
			else
			{
				theList.style.display = "none";
				this.style.backgroundImage = "url(./img/arrow.jpg)";
			}
			return false;
		}
		document.getElementById("docLink").onclick = function()
		{
			var theList = document.getElementById("docsList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				document.getElementById("dTit").style.backgroundImage = "url(./img/arrowd.jpg)";
			}
		}
	document.getElementById("linkLink").onclick = function()
		{
			var theList = document.getElementById("linksList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				document.getElementById("lTit").style.backgroundImage = "url(./img/arrowd.jpg)";
			}
		}
		document.getElementById("dropinLink").onclick = function()
		{
			var theList = document.getElementById("dropins");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				document.getElementById("sTit").style.backgroundImage = "url(./img/arrowd.jpg)";
			}
		}
		document.getElementById("gdocsLink").onclick = function()
		{
			var theList = document.getElementById("gdocsList");
			if(theList.style.display == "none")
			{
				theList.style.display = "block";
				document.getElementById("gdTit").style.backgroundImage = "url(./img/arrowd.jpg)";
			}
		}
}
function getElementByClass(ele, c)
{
	var eleArr = new Array();
	var retArr = new Array();
	var j = 0;
	var cClassStr = new String();
	//alert(ele+" "+c);
	eleArr = document.getElementsByTagName(ele);
	for(var i=0; i<=eleArr.length-1;i++)
	{
		var cClass = eleArr[i].className;
		cClassStr += cClass+" ";
		if(cClass == c)
		{
			retArr[j] = eleArr[i];
			j++;
		}
	}
	//alert(cClassStr);
	return retArr;
}
addLoadEvent(hideAns);