// source for common gbtribune.com code

/* ------------- TABS ------------ */
function tabHide (tabName)
	{
	var elem = document.getElementsByTagName('span');
	var arry = new Array();
	
	for (i = 0, j = 0; i < elem.length; i ++)
		{
		att = elem[i].getAttribute('name');
		
		if (att == tabName)
			{
			arry[j] = elem[i];
			j++;
			}
		}
		
	i = 0;	
	while ( arry[i] )
		{
		arry[i].className = 'tabdeactive';
		
		document.getElementById(tabName+'_'+i+'_content').style.display = 'none';
		i++;
		
		}
	}

function tabOver (tabId, tabName)
	{
	tabHide(document.getElementById(tabId).getAttribute('name'));
	document.getElementById(tabId).className = 'tabactive';
	document.getElementById(tabId+'_content').style.display = 'inline';
	}
	
/* ------------- DISPLAY LARGE PIC WHEN MOUSE OVER THUMBNAIL------------ */
function showImage(image,imageID)
	{		
	document.getElementById('largeImage').src = image;
	
	//show correct caption
	if (imageID)
		{
		var elem = document.getElementsByTagName('div');
		var arry = new Array();
		for (i = 0, j = 0; i < elem.length; i ++)
			{
			att = elem[i].getAttribute('name');
			
			if (att == 'img_cap')
				{
				arry[j] = elem[i];
				j++;
				}
			}
			
		i = 0;	
		while ( arry[i] )
			{
			arry[i].style.display = 'none';				
			i++;		
			}
		document.getElementById(imageID+'_cap').style.display = 'block';	
		}
	}
/*-------------------- Display more info box -------------------------*/
function toggleMoreInfo(boxID)
	{
	boxID = boxID + "_info";
	currentDisplay = document.getElementById(boxID).style.display;
	
	if (currentDisplay == "none")
		{
		document.getElementById(boxID).style.display = "block";
		}
	else
		{
		document.getElementById(boxID).style.display = "none";	
		}
	}
/*-------------------- FILL IN fieldID.value with INPUT --------------*/
function quickchoose(fieldID,input)
	{
	if (document.getElementById(fieldID) && input)
		document.getElementById(fieldID).value = input;
	}
	
/*-------------------- Minimize boxes --------------*/
function toggleHidden (id) {
	iconID = id+'_icon';
	icon = document.getElementById(iconID);
	box  = document.getElementById(id);
	
	if (icon && box)
		{
		currentSetting = icon.innerHTML;
		if (currentSetting == '[+]')
			{
			icon.innerHTML = '[-]';
			box.style.display = 'block';
			}
		if (currentSetting == '[-]')	
			{
			icon.innerHTML = '[+]';
			box.style.display = 'none';
			}
			
		}
}

/*--------- JUMP TO page --------*/
function gotoPage (url,page) {
	window.location = url+page;
	}