// JavaScript Document

/*--- IE 5 SUPPORT FOR PUSH ---*/

if (typeof Array.prototype.push == "undefined") {
  Array.prototype.push = function(str) {
    this[this.length] = str;
  }
}

/*--- CROSS PLATFORM ELEMENT ID ---*/

function getObject(objectId) 
{
	if (document.all && !document.getElementById) 
	{
		return document.all(objectId);
	} 
	else 
	{
		return document.getElementById(objectId);
	}
}

/*--- SUPPORT FOR ASTERICKS VALUE IN GET TAGNAME FOR IE5 ---*/

function ie_getElementsByTagName(str) 
{
	if (str=="*") 
	{
		return document.all;
	} 
	else 
	{
		return document.all.tags(str);
	}

	if (document.all) 
	{
		document.getElementsByTagName = ie_getElementsByTagName;
	}
}

////////////////////////////////////////////////////////////////////////////


/*--- FIND AN ID AND SET IT'S CLASS ---*/

function setClassById(idVal, classVal) 
{
	getObject(idVal).className=classVal;
}

/*--- FIND ALL ELEMENTS WITH CURRENT CLASS, SWAP THEM WITH A NEW CLASS ---*/

function swapClassByClass(currentClass,newClass) 
{ 
	var 
	i=0,
	allPageTags=document.getElementsByTagName("*");

	for (i;i<allPageTags.length;i++) 
	{ 
		if (allPageTags[i].className==currentClass) 
		{ 
			allPageTags[i].className=newClass;
		} 
	} 
}

/*--- FIND ALL CLASSES AND SWAP THEM, THEN FIND AN ID AND SET IT  ---*/

function swapClassById (idVal,newClass,currentClass) 
{
		 swapClassByClass(newClass,currentClass);
		 setClassById(idVal,newClass);
}

function showHideTagInId (idstr, tagstr, tagidx) {
	var 
	i=0,
	idstr = idstr,
	tagstr = tagstr,
	tagidx = (tagidx-1),
	tgs = getObject(idstr).getElementsByTagName(tagstr),
	wclass = new Array();

	for (i;i<tgs.length;i++) 
	{
		if ((tgs[i].className == "show")||(tgs[i].className == "hide")) 
		{
		wclass.push(tgs[i]);
		tgs[i].className="hide";
		}
	}
	wclass[tagidx].className="show";
}

/*--- SHOW and HIDE ID ---*/

function showId(i) 
{
	getObject(i).className="show"
}
function hideId(i)
{
	getObject(i).className="hide"
}



