// Tab setting
function ShowTabContent(tabID)
{
	HideAllTab();
	ShowTab(tabID);
}

function HideAllTab(){
	//loop through the array and hide each element by id
	for (var i=1;i<=tabCount;i++){
		Hidediv(i);
	}		  
}

function Hidediv(id) {
	//safe function to hide an element with a specified id
	var tabBodyId = "tab_body"+id;
	var tabId = "tab"+id;
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(tabBodyId).style.display = 'none';
		document.getElementById(tabId).style.borderBottom = '1px solid #CCCCCC';
		document.getElementById(tabId).style.borderLeft = '1px solid #CCCCCC';
		document.getElementById(tabId).style.borderRight = '1px solid #CCCCCC';
		document.getElementById(tabId).style.borderTop = '1px solid #CCCCCC';
		document.getElementById(tabId).style.backgroundImage = 'url(images/bgback7.jpg)';
		document.getElementById(tabId).style.fontWeight = 'normal';
	}
	else {
		if (document.layers) { // Netscape 4
			document.tabBodyId.display = 'none';
			document.tabId.borderBottom = '1px solid #CCCCCC';
			document.tabId.borderLeft = '1px solid #CCCCCC';
			document.tabId.borderRight = '1px solid #CCCCCC';
			document.tabId.borderTop = '1px solid #CCCCCC';
			document.tabId.backgroundImage = 'url(images/bgback7.jpg)';
			document.tabId.fontWeight = 'normal';
		}
		else { // IE 4
			document.all.tabBodyId.style.display = 'none';
			document.all.tabId.style.borderBottom = '1px solid #CCCCCC';
			document.all.tabId.style.borderLeft = '1px solid #CCCCCC';
			document.all.tabId.style.borderRight = '1px solid #CCCCCC';
			document.all.tabId.style.borderTop = '1px solid #CCCCCC';
			document.all.tabId.style.backgroundImage = 'url(images/bgback7.jpg)';
			document.all.tabId.style.fontWeight = 'normal';
		}
	}
}

function ShowTab(id) {
	//safe function to show an element with a specified id
	var tabBodyId = "tab_body"+id;
	var tabId = "tab"+id;
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(tabBodyId).style.display = 'block';
		document.getElementById(tabId).style.borderBottom = 'none';
		document.getElementById(tabId).style.backgroundImage = 'url(images/bgback6.jpg)';
		document.getElementById(tabId).style.fontWeight = 'bold';

	}
	else {
		
		if (document.layers) { // Netscape 4
			document.tabBodyId.display = 'block';
			document.tabId.borderBottom = 'none';
			document.tabId.backgroundImage = 'url(images/bgback6.jpg)';
			document.tabId.fontWeight = 'bold';
		}
		else { // IE 4
			document.all.tabBodyId.style.display = 'block';
			document.all.tabId.style.borderBottom = 'none';
			document.all.tabId.style.backgroundImage = 'url(images/bgback6.jpg)';
			document.all.tabId.style.fontWeight = 'bold';
		}
	}
}
//Tab Setting code ends here

function displayBanner()
{
	images = new Array(2);
	
	images[0] = "<a href='beam_align_tool.htm'><img src='images/mainbanner2.jpg' border=0></a>";
	
	images[1] = "<a href='trans_sample_holder.htm'><img src='images/mainbanner3.jpg' border=0></a>";
	
	index = Math.floor(Math.random() * images.length);
	
	document.write(images[index]);
}

//Modal popup
function modalWindow(pageName, dialogWidthValue, dialogHeightValue) 
{
	var leftValue = screen.width/2 - dialogWidthValue/2;
	var topValue = screen.height/2 - dialogHeightValue/2;

	/*if (window.showModalDialog) 
	{
		window.showModalDialog(pageName,"popup","dialogWidth:"+dialogWidthValue+"px;dialogHeight:"+dialogHeightValue+"px;dialogLeft="+leftValue+";dialogTop="+topValue+";resizable=yes;status=no");
	} 
	else 
	{*/
		newwindow = window.open(pageName,'ultrafastpopup','modal=yes,top='+topValue+',left='+leftValue+',height='+dialogHeightValue+',width='+dialogWidthValue+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
		if (window.focus) {newwindow.focus();}

	//}
} 