// JavaScript Document

//alert(window.location.href);

var numClasses = 7;

function switchCross(id,table) {
	temp = document.getElementById(id);
	if(temp.src.match("expand")) {
		temp.src='/images/icons/contract.png';
		toggleDiv(table, false);
	}
	else {
		temp.src='/images/icons/expand.png';
		toggleDiv(table, false);
	}
}

function toggleDiv(id, boolAll) {
	temp = document.getElementById(id).style;
	if (boolAll) {
		temp.visibility = 'visible';
		temp.display = 'block';
		temp.height = 'auto';
	} else {
		if (temp.visibility == 'visible') {
			temp.visibility = 'hidden';
			temp.display = 'none';
			temp.height= 'auto';
		}
		else {
			temp.visibility = 'visible';
			temp.display = 'block';
			temp.height = 'auto';
		}	
	}
}


function showOnly(id) {
	for (i=1;i<=numClasses;i++) {
	  	objectHead = "divHead" + i;
	  	objectTable = "divTable" + i;
	  	temp = document.getElementById(objectHead);
	  	if (i!=id) {
			if(temp.src.match("contract")) {
				temp.src='/images/icons/expand.png';
				hideClass(objectTable);
			}
		}
		else {
			if(temp.src.match("expand")) {
				temp.src='/images/icons/contract.png';
				showClass(objectTable);
			}	
		}
   	}
}

function hideClass(id) {
	temp = document.getElementById(id).style;
	if (temp.visibility == 'visible') {
		temp.visibility = 'hidden';
		temp.display = 'none';
		temp.height= 'auto';
	}
}

function showClass(id) {
	temp = document.getElementById(id).style;
	if (temp.visibility == 'hidden') {
		temp.visibility = 'visible';
		temp.display = 'block';
		temp.height = 'auto';
	}
}

function expandAll(numDivs) {
	for (i=1;i<=numDivs;i++) {
	  	objectHead = "divHead" + i;
		//alert(objectHead);
	  	objectTable = "divTable" + i;
	  	temp = document.getElementById(objectHead);
	  	if(temp.src.match("expand")) {
			temp.src='/images/icons/contract.png';
			toggleDiv(objectTable, true);
	  	}
   	}
}

function switchClass (strid) {
	if (strid == '0') {
		expandAll(numClasses);
	}
	else {
		showOnly(strid);	
	}
}