// JavaScript Document

// Do image swapping
function updateimg(divid,img){
var fm_id=divid;
	// var for content_body_info_item_*
	var CBII =
	document.getElementById
	? document.getElementById(fm_id)
	: document.all
	  ? document.all[fm_id]
	  : document.layers[fm_id];
	
	
		 CBII.innerHTML = "<img src='images/" +img + "' alt='' width='200' height='172' />";
}


// Shows content for the given div id by changing all elements of class prodsShowBlock to 
// prodsHidden, and changing the single divid provided to prodsShowBlock
function displayContent(divid){

	var allShown = mygetElementsByClassName("prodsShowBlock");
	for (var i = 0; allShown[i] != null; i++) {
		allShown[i].setAttribute("class", "prodsHidden");
		allShown[i].setAttribute("className", "prodsHidden");
	}
	document.getElementById(divid).setAttribute("class", "prodsShowBlock");
	document.getElementById(divid).setAttribute("className", "prodsShowBlock");
	
}

// Get all elements of a certain class
function mygetElementsByClassName(classname) {
	var wholedoc = document.getElementsByTagName("body")[0];
	var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = wholedoc.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
	    if(re.test(els[i].className))a.push(els[i]);
	return a;
}

// Changes tab colors
function setTabColors(parentID,selectedID)
{
	var children = document.getElementById(parentID).childNodes;
	for(var i = 0; i < children.length; i++)
	{
		try{
			if(children.item(i).id == selectedID)
			{
				children.item(i).style.backgroundColor='#c5c5c5';
				children.item(i).style.color='#222';
				children.item(i).style.borderBottomColor='#c5c5c5';				
			}
			else 
			{
				children.item(i).style.backgroundColor='#dadada';
				children.item(i).style.color='#333';
				children.item(i).style.borderBottomColor='#aaa';	
			}
		}
		catch(err){}
	}
}























