var _h = null;

function toggleTab()
{
	clearTimeout( _h );
	
	var tWw = getEbId('tab-workwear');
	var tSw = getEbId('tab-security');
	var tFw = getEbId('tab-footwear');
	var tMw = getEbId('tab-medical');
	var tTw = getEbId('tab-traffic');
	var tCw = getEbId('tab-corporate');

	var pKg = getEbId('page-general');
	var pWw = getEbId('page-workwear');
	var pSw = getEbId('page-security');
	var pFw = getEbId('page-footwear');
	var pMw = getEbId('page-medical');
	var pTw = getEbId('page-traffic');
	var pCw = getEbId('page-corporate');

	clearTabBorders(tWw);
	clearTabBorders(tSw);
	clearTabBorders(tFw);
	clearTabBorders(tMw);
	clearTabBorders(tTw);
	clearTabBorders(tCw);
	
	tWw.style.width = "106px";
	tSw.style.width = "127px";
	tFw.style.width = "104px";
	tMw.style.width = "145px";
	tTw.style.width = "162px";
	tCw.style.width = "156px";
	
	pKg.style.display = 'none';
	pWw.style.display = 'none';
	pSw.style.display = 'none';
	pFw.style.display = 'none';
	pMw.style.display = 'none';
	pTw.style.display = 'none';
	pCw.style.display = 'none';
	
	switch( arguments[0] )
	{
		case 'tab-workwear':

			tWw.className = 'on';
			tSw.className = 'off';
			tFw.className = 'off';
			tMw.className = 'off';
			tTw.className = 'off';
			tCw.className = 'none';
			
			tWw.style.width = "105px";
			
			setTabBorders(tWw, false, true)
			
			pWw.style.display = 'block';
			
			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-workwear.jpg')";
			
			break;
			
		case 'tab-security':

			tWw.className = 'none';
			tSw.className = 'on';
			tFw.className = 'off';
			tMw.className = 'off';
			tTw.className = 'off';
			tCw.className = 'none';
			
			tSw.style.width = "125px";
			
			setTabBorders(tSw, true, true)
			
			pSw.style.display = 'block';
			
			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-security.jpg')";

			break;
			
		case 'tab-footwear':

			tWw.className = 'off';
			tSw.className = 'none';
			tFw.className = 'on';
			tMw.className = 'off';
			tTw.className = 'off';
			tCw.className = 'none';
			
			tFw.style.width = "102px";
			
			setTabBorders(tFw, true, true)
			
			pFw.style.display = 'block';
			
			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-footwear.jpg')";

			break;
			
		case 'tab-medical':

			tWw.className = 'off';
			tSw.className = 'off';
			tFw.className = 'none';
			tMw.className = 'on';
			tTw.className = 'off';
			tCw.className = 'none';
			
			tMw.style.width = "143px";
			
			setTabBorders(tMw, true, true)
			
			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-medical.jpg')";

			pMw.style.display = 'block';

			break;
			
		case 'tab-traffic':

			tWw.className = 'off';
			tSw.className = 'off';
			tFw.className = 'off';
			tMw.className = 'none';
			tTw.className = 'on';
			tCw.className = 'none';

			tTw.style.width = "160px";

			setTabBorders(tTw, true, true)
			
			pTw.style.display = 'block';
			
			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-traffic.jpg')";

			break;
			
		case 'tab-corporate':

			tWw.className = 'off';
			tSw.className = 'off';
			tFw.className = 'off';
			tMw.className = 'off';
			tTw.className = 'none';
			tCw.className = 'on';

			tCw.style.width = "155px";

			setTabBorders(tCw, true, false)

			pCw.style.display = 'block';

			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-corporate.jpg')";

			break;
		
		default:
		
			tWw.className = 'off';
			tSw.className = 'off';
			tFw.className = 'off';
			tMw.className = 'off';
			tTw.className = 'off';
			tCw.className = 'off';
		
			pKg.style.display = 'block';
		
			getEbId('stock').style.backgroundImage = "url('/_assets/images/stock-default.jpg')";
		
			break;
	}
	
	_h = setTimeout( 'toggleTab()', 30000 );
}



function clearTabBorders()
{
	var a = arguments;
	
	a[0].style.borderLeft = "0px";
	
	a[0].style.borderRight = "0px";
}

function setTabBorders()
{
	var a = arguments;
	
	if( a[1] )
	{
		a[0].style.borderLeft = "1px solid #ffffff";
	}

	if( a[2] )
	{
		a[0].style.borderRight = "1px solid #ffffff";
	}
}

function preloadImages()
{
	var img00 = getImageObject('_assets/images/stock-default.jpg');	

	var img01 = getImageObject('_assets/images/stock-workwear.jpg');
	
	var img02 = getImageObject('_assets/images/stock-security.jpg');
	
	var img03 = getImageObject('_assets/images/stock-medical.jpg');
	
	var img04 = getImageObject('_assets/images/stock-traffic.jpg');
	
	var img05 = getImageObject('_assets/images/stock-corporate.jpg');
	
	var img06 = getImageObject('_assets/images/tab-line-break.png');
	
	var img07 = getImageObject('/_shared/images/btn_working-basket.gif');	

	var img08 = getImageObject('/_shared/images/btn_working-catalogue.gif');
}
