window.onload = jsFnOnload;

/*** Set up functions on page load ***/
function jsFnOnload()
{
	if (document.getElementById)
	{
		/* Open external links in new window */		 
		aLinks = document.getElementsByTagName("a");				
		for (aIndex = 0; aIndex < aLinks.length; aIndex++)
		{
			if ((aLinks[aIndex].href.indexOf('www.ampnetconnect.eu/web/EMEA/Home/Online-Catalog/') > 0))
			{
				aLinks[aIndex].target = '_blank';
			}
		}
		
		
		aProductContent = document.getElementById('productcontent');
		if (aProductContent != null)
		{
			var aDiv = document.getElementsByTagName("div");
			var aFirst = true;
			if (aDiv != null) 
			{
				for(aDivIndex=0; aDivIndex < aDiv.length; aDivIndex++)
				{
					if(aDiv[aDivIndex].className=='tab')
					{
						if(aFirst) aFirst = false;
						else aDiv[aDivIndex].style.display = 'none';
					}
				}
			}
		}
		
		aProductMenu = document.getElementById('productmenu');
		if (aProductMenu != null)
		{
			aProductMenu.firstChild.style.border = '1px solid #000';     
			aProductMenu.firstChild.style.borderBottom = '1px solid #000';
			aProductMenu.firstChild.style.backgroundColor = "#000";
			
			var aLinks = aProductMenu.getElementsByTagName("a");
			if (aLinks != null) 
			{
				for(aLinkIndex=0; aLinkIndex < aLinks.length; aLinkIndex++)
				{
					aLinks[aLinkIndex].onclick = ShowProductTab;
				}
			}
		}
	}	
}

function ShowProductTab()
{
	HideTabs();
	aTabID = this.href.substr(this.href.indexOf('#')+1);
	
	ResetBorders();
	
	this.parentNode.style.border = '1px solid #000';     
	this.parentNode.style.borderBottom = '1px solid #000';
	this.parentNode.style.backgroundColor = "#000";

	aTab = document.getElementById(aTabID);
	if (aTab != null) aTab.style.display = 'block';

	return false;
}

function ResetBorders()
{
	aProductMenuContent = document.getElementById('productmenu');
	if (aProductMenuContent != null)
	{
		var aLi = aProductMenuContent.getElementsByTagName("li");
		if (aLi != null) 
		{
			for(aLiIndex=0; aLiIndex < aLi.length; aLiIndex++)
			{
				aLi[aLiIndex].style.border = '1px solid #666';     
				aLi[aLiIndex].style.borderBottom = '1px solid #000';
				aLi[aLiIndex].style.backgroundColor = "#666";
			}
		}
	}
}


//hide all tabs
function HideTabs()
{
	aProductContent = document.getElementById('productcontent');
	if (aProductContent != null)
	{
		var aDiv = document.getElementsByTagName("div");
		if (aDiv != null) 
		{
			for(aDivIndex=0; aDivIndex < aDiv.length; aDivIndex++)
			{
				if(aDiv[aDivIndex].className=='tab') aDiv[aDivIndex].style.display = 'none';
			}
		}
	}
}

function JSFnImageZoom(url)
{
	var aWindow = window.open(url, 'productbig', 'menubar=no, resizeable=no, toolbar=no, width=900px, height=900px');
	aWindow.focus();
	return false;
}
/**********************************************************************************************************************************/

