// JavaScript Document

function togglecat(catid)
{
	
	
	myCat = document.getElementById(catid);
	
	myCatClass = myCat.className;
		
	if (myCatClass == "open") 
	{
		closecat(catid);
	}
	else
	{
		opencat(catid);	
	}
	
}


function opencat(catid)
{	
	myCat = document.getElementById(catid);
	
	myCatChildren = myCat.getElementsByTagName("ul");
		
	myCatArrows = myCat.getElementsByTagName("input");

	myCatArrows[0].src = "http://" + location.host + "/blog/arrowdown10px.gif";
		
	if (myCatChildren.length > 0)
	{		
			myCatChildren[0].style.display = "block";
		
	}
	else
	{
		AJAXopencat(catid);
	}
	
	myCat.className = "open";
}

function closecat(catid)
{	
	myCat = document.getElementById(catid);
	myCatChildren = myCat.getElementsByTagName("ul");
	myCatArrow = myCat.getElementsByTagName("input");
	myCatArrow[0].src = "http://" + location.host + "/blog/arrow10px.gif";
	
	if (myCatChildren.length > 0)
	{
		for (i = 0; i < myCatChildren.length; i++)
		{
			myCatChildren[i].style.display = "none";
			//myCat.removeChild(myCatChildren[i]);
		}
	}
	
	myCat.className = "closed";
}

function getAttribute(attributeName, elementRef)
{alert("in getAttribute" + elementRef.nodeName);
	for (i = 0; i < elementRef.attributes.length; i++)
	{	//alert(i);
		if (elementRef.attributes[i].nodeName.toLowerCase() == 'onclick')
		{
			return elementRef.attributes[i];
		}
	}
}
//**************************************************************
//AJAX to update IGNORE and RESOLVED
//**************************************************************
function getAJAXobj()
{
  var xmlHttp;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    // Internet Explorer
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      try
      {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e)
      {
        alert("Your browser does not support AJAX!");
        return false;
      }
    }
  }
  return xmlHttp;
}


function AJAXopencat(id)
{
		var xmlHttp = getAJAXobj();
			
		 xmlHttp.onreadystatechange=function()
		 {
			if(xmlHttp.readyState==4)
			{
			 	var responseData=xmlHttp.responseText;
				
				updateDiv = document.getElementById(id);
				updateDiv.innerHTML = updateDiv.innerHTML + (responseData);


			}
		 }
		 
		
		var url = "http://" + location.hostname + "/blog/get_catlisting.asp";
		url = url + "?id=" + id + "&unique=" + Math.random();
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
}
