// CA Simplicity JavaScript. 

// replace images for vbmenu_control, fix double tcat
var rows = document.getElementsByTagName("tr"); 
var j = 0;
var row = false;
var item = false;
var imglist = false;
var attr = "";
var change = false;
var found = false;
var tcat = false;
for (var i = 0; i < rows.length; i++)
{ 
    row = rows[i];
	if(row.className == '')
	{
		// find all class="thead"
		change = false;
		tcat = false;
		for(j = 0; j < row.childNodes.length; j++)
		{
			item = row.childNodes[j];
			if(item.className == 'thead')
			{
				change = true;
			}
			if(item.className == 'tcat')
			{
				if(tcat)
				{
					item.className = 'tcat tcat2';
				}
				tcat = true;
			}
		}
		if(change)
		{
			row.className = 'thead-row';
			imglist = row.getElementsByTagName("img");
			for(j = 0; j < imglist.length; j++)
			{
				attr = imglist.item(j).src;
				if(attr.indexOf('menu_open.gif') > 0)
				{
					attr = attr.replace(/menu_open.gif/, 'menu_open2.gif');
					imglist.item(j).src = attr;
				}
			}
		}
	}
	if(row.className == 'vbmenu_dark')
	{
		imglist = row.getElementsByTagName("img");
		for(j = 0; j < imglist.length; j++)
		{
			attr = imglist.item(j).src;
			if(attr.indexOf('menu_open.gif') > 0)
			{
				attr = attr.replace(/menu_open.gif/, 'menu_open2.gif');
				imglist.item(j).src = attr;
			}
		}
	}
}

