function getStyleObject(objectId) 
{
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) 
	{
		// W3C DOM
		return document.getElementById(objectId).style;
    } 
	else if (document.all && document.all(objectId)) 
	{
		// MSIE 4 DOM
		return document.all(objectId).style;
    } 
	else if (document.layers && document.layers[objectId]) 
	{
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
    } 
	else 
	{
		return false;
    }
} // getStyleObject

function getObjectVisibility(objectId)
{
	var styleObject = getStyleObject(objectId);
	if(styleObject)
	{
		if(styleObject.visibility == 'hidden')
			return false;
		else
			return true;
	}
	else
	{
		return false;
	}
}

function getObjectDisplay(objectId)
{
	var styleObject = getStyleObject(objectId);
	if(styleObject)
	{
		if(styleObject.display == 'none')
			return false;
		else
			return true;
	}
	else
	{
		return false;
	}
}

function changeObjectVisibility(objectId, newVisibility) 
{
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) 
	{
		styleObject.visibility = newVisibility;
		return true;
    } 
	else 
	{
		// we couldn't find the object, so we can't change its visibility
		return false;
    }
} // changeObjectVisibility

function changeObjectDisplay(objectId, newDisplay) 
{
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
	
    if(styleObject) 
	{
		//alert(styleObject.display);
		styleObject.display = newDisplay;
		return true;
    } 
	else 
	{
		// we couldn't find the object, so we can't change its visibility
		return false;
    }
} // changeObjectDisplay

function moveObject(objectId, newXCoordinate, newYCoordinate) 
{
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject)
	{
		styleObject.left = newXCoordinate;
		styleObject.top = newYCoordinate;
		return true;
    } 
	else 
	{
		// we couldn't find the object, so we can't very well move it
		return false;
    }
} // moveObject


// function switchDiv()
//  this function takes the id of a div
//  and calls the other functions required
//  to show that div
//
function switchDiv(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll();
    changeObjectVisibility(div_id,"visible");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}

function switchDiv2(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll2();
    changeObjectVisibility(div_id,"visible");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}

function switchDiv3(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll3();
    changeObjectVisibility(div_id,"visible");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}

function switchDisplay(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
	if(style_sheet.display == 'none')
	{
	    changeObjectDisplay(div_id,"");
	}
	else
	{
		changeObjectDisplay(div_id,"none");
	}
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}

function switchPlus(object_id)
{
	var img_src = document.getElementById(object_id).src;

	var isPlus = img_src.indexOf('plus_btn.gif');
	
	if( isPlus != -1)
		document.getElementById(object_id).src = "/_img/support/minus_btn.gif";
	else 
		document.getElementById(object_id).src = "/_img/support/plus_btn.gif";
}

// function hideAll()
//  hides a bunch of divs
//
function hideAll()
{  
   changeObjectVisibility("subNav_GameInfo", "hidden");
   changeObjectVisibility("subNav_Guide", "hidden");
   changeObjectVisibility("subNav_News", "hidden");
   changeObjectVisibility("subNav_Support", "hidden");
   changeObjectVisibility("subNav_Gallery", "hidden");
   changeObjectVisibility("subNav_Events", "hidden");
}

function hideAll2()
{
   changeObjectVisibility("sStatus", "hidden");
}

function hideAll3()
{
   
   changeObjectVisibility("billing1_nopay","hidden");
   changeObjectVisibility("billing2_nopay","hidden");
   changeObjectVisibility("billing3_nopay","hidden");
   changeObjectVisibility("bans_nopay","hidden");


   changeObjectVisibility("billing","hidden");
   changeObjectVisibility("billing1","hidden");
   changeObjectVisibility("billing2","hidden");
   changeObjectVisibility("billing3","hidden");

   changeObjectVisibility("bugs","hidden");
   changeObjectVisibility("complaints","hidden");
   changeObjectVisibility("bans","hidden");
   changeObjectVisibility("general","hidden");
   changeObjectVisibility("karus","hidden");
   changeObjectVisibility("elmorad","hidden");
   changeObjectVisibility("status", "hidden");
   changeObjectVisibility("inter", "hidden");
   changeObjectVisibility("spotlight", "hidden");
}
