// Submenu Rollovers (for IE only)
// TEMPLATE: default_main.html
startList = function()
{
	if (document.all&&document.getElementById)
	{
		navRoot = document.getElementById("menu1");
		for (i=0; i<navRoot.childNodes.length; i++)
		{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI")
			{
				node.onmouseover=function()
				{
					navRoot2 = document.getElementById("menu1");
					for (i=0; i<navRoot2.childNodes.length; i++)
					{
						node2 = navRoot2.childNodes[i];
						if (node2.nodeName=="LI")
						{
							node2.className=node2.className.replace(" sfhover", "");
						}
					}

					this.className+=" sfhover";
					// setTimeout('this.className+=\' sfhover\'',500);
				}

				node.onmouseout=function()
				{
					navRoot2 = document.getElementById("menu1");
					for (i=0; i<navRoot2.childNodes.length; i++)
					{
						node2 = navRoot2.childNodes[i];
						if (node2.nodeName=="LI")
						{
							node2.className=node2.className.replace(" sfhover", "");
						}
					}

					// this.className = this.className.replace(" sfhover", "");
					// setTimeout("this.className=this.className.replace(' sfhover', '')", 100);
					// alert(this.className);
					// 'this.className=this.className.replace(\' sfhover\', \'\'); }'
//							
				}

			}
		}
	}
}
window.onload=startList;

function winpop(url, width, height)
{
	day = new Date();
	id = day.getTime();

	if (screen)
	{
		win_x = (screen.width - width ) / 2;
		win_y = (screen.height - height ) / 2;
	}
	else
	{
		win_x = 0;
		win_y = 0;
	}

	eval("page"+id+" = window.open('"+url+"', '"+id+"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left = "+win_x+",top = "+win_y+"');");
}

function processFeaturesTable(table_id)
{
	// remove empty rows
	var myTable = document.getElementById(table_id);
	var no_rows = myTable.rows.length;
	for (i = no_rows-1; i >= 0; i--)
	{
		var content = myTable.rows[i].cells[1].innerHTML;
		if (content == "")
		{
			myTable.deleteRow(i);
		}
	}
}

function proccessTableTitles(table_id)
{
	// remove titles that have no rows underneath
	var myTable = document.getElementById(table_id);
	var no_rows = myTable.rows.length;
	var last_title_id = -99;
	for (i = no_rows-1; i >= 0; i--)
	{
		var tableclass = myTable.rows[i].cells[0].className;
		if(tableclass == 'featureHead')
		{
			if (i + 1 == last_title_id)
			{
				// no items between two titles, remove
				myTable.deleteRow(last_title_id);
			}
			else if (i - 1 == no_rows)
			{
				// last row in the table, no items underneath
				myTable.deleteRow(i);
			}
			last_title_id = i;
		}
	}	
}

if(!document.getElementById)
{
	if(document.all)
	{
		accessObj = function()
		{
			if(typeof document.all[arguments[0]]!="undefined")
				return document.all[arguments[0]];
			else
				return null;
		}
	}
	else if(document.layers)
	{
		accessObj = function()
		{
			if(typeof document[arguments[0]]!="undefined")
				return document[arguments[0]];
			else
				return null;
		}
	}
}
else
{
	accessObj = function()
	{
		return document.getElementById(arguments[0]);
	}
}

var imglist = new Array;
var next = 0;
var mytime;

function addImage(url)
{
	imglist[imglist.length] = url;
}

function showImage()
{
	var obj = accessObj("homepageimage");
	obj.src = imglist[next];
	next++;
	if (next>imglist.length-1)
		next = 0;
	mytime = setTimeout('showImage()', 4500)
}