// SET PAGE ON COLOURS

	var txtcol = '#fff';
	var onbgcol = '#393939';

// PAGE LOAD BEHAVIOUR

var sectionlinks = '';

var CurPage = '';

var linkCounter = 0;

var alllinks = '';

var thecatid = '';

	function linkPos(){

		CurPage = window.location.href;

		var CounterEnabled = 'Y';

		alllinks = document.links.length;
		
			for (var i = 0; i < document.links.length; i++)
			{
			
	
			if (document.links[i].href == CurPage && document.links[i].parentNode.className == 'wlinks')
			
				{
				document.links[i].style.color = txtcol;
				document.links[i].style.background = onbgcol;
				document.links[i].parentNode.style.display = 'block';
				document.links[i].parentNode.style.paddingTop = '60px';

				thecatid = document.links[i].parentNode.id;

				CounterEnabled = 'N';

				if(window.document.getElementById(thecatid + 'a')){

					window.document.getElementById(thecatid + 'a').style.color = txtcol;
					window.document.getElementById(thecatid + 'a').style.background = onbgcol;

					}

				
				}else{
				if(CounterEnabled == 'Y')	
				{
				linkCounter +=1;	
				}
			}
		}

	if(window.document.getElementById('iconsdiv')){scroller();homeimg()}	//ACTIVATE SCROLLER AND HOME IMG IF SCROLLER PRESENT

	// PREV and NEXT=====================

	if(!window.document.getElementById('homeimg') || window.document.getElementById('sitemap')){

		window.document.getElementById('prevnext').style.display = 'block';

		if(document.links[parseInt(linkCounter-1)].parentNode.id == thecatid){
			
			window.document.getElementById('btn-prev').href = document.links[linkCounter-1].href;
			window.document.getElementById('btn-prev').style.visibility = 'visible';
			}

		if(document.links[parseInt(linkCounter+1)].parentNode.id == thecatid){
			window.document.getElementById('btn-next').href = document.links[linkCounter+1].href;
			window.document.getElementById('btn-next').style.visibility = 'visible';
			}

		}
//====================================== new landing test

if(window.document.getElementById('landingLinks'))
{
for (var i = 1; i < window.document.getElementById('landingLinks').getElementsByTagName('a').length; i++)
	{
	var linkinnertxt = window.document.getElementById('landingLinks').getElementsByTagName('a')[i].innerHTML.substring(0,linktxtcnt).toLowerCase() + "..";	
	var startL = "<img src='" + window.document.getElementById('landingLinks').getElementsByTagName('a')[i].title + "'>"
	var endL = "<b>" + linkinnertxt + "</b>";
	window.document.getElementById('landingLinks').getElementsByTagName('a')[i].innerHTML = startL + endL;
	window.document.getElementById('landingLinks').getElementsByTagName('a')[0].style.display = 'none'
	}
}
//======================================
		

	}

// COUNT SECTION LINKS

	function wme(objid){

		document.write(window.document.getElementById(objid).getElementsByTagName('a').length - 1)

		}


// IMAGE SWAP HOME *************************************

	HomeImage = new Array('FRESHNET','24steps','KEYFORT','MADJESTER','VICOMSOFT','REEVESANDGALLAGHER');

	var PageFname;

	var arrCnt = HomeImage.length-1;

	function homeimg(){

			var imgnum = Math.round(Math.random() * arrCnt);
			
			if(HomeImage[imgnum] == 'FRESHNET'){PageFname = 'adverts-' + HomeImage[imgnum]}
			if(HomeImage[imgnum] == 'KEYFORT'){PageFname = 'brochures-leaflets-' + HomeImage[imgnum] + 2}
			if(HomeImage[imgnum] == 'VICOMSOFT'){PageFname = 'brochures-leaflets-' + HomeImage[imgnum] + 2}
			if(HomeImage[imgnum] == 'MADJESTER'){PageFname = 'illustration-' + HomeImage[imgnum] + 2}
			if(HomeImage[imgnum] == 'REEVESANDGALLAGHER'){PageFname = 'illustration-' + HomeImage[imgnum]}
			if(HomeImage[imgnum] == '24steps'){PageFname = 'logo-brand-design-' + HomeImage[imgnum]}

			window.document.getElementById('homeimg').src = 'home-' + HomeImage[imgnum] + '.jpg' ;
			window.document.getElementById('homeimgtxt').innerHTML = "&nbsp;- Above: " + HomeImage[imgnum] + ', slide ' + (imgnum + 1) + ' of ' + (arrCnt + 1);
			window.document.getElementById('homeimglink').href = PageFname + '.htm';

		}

// IMAGE SWAP PHOTO PAGES *************************************

	function imgswap(){
		if(window.document.getElementById('photo2').style.display != 'inline'){
			window.document.getElementById('photo1').style.display = 'none';
			window.document.getElementById('photo2').style.display = 'inline';
				window.document.getElementById('photo1txt').style.display = 'none';
				window.document.getElementById('photo2txt').style.display = 'inline';
			}else{
			window.document.getElementById('photo2').style.display = 'none';
			window.document.getElementById('photo1').style.display = 'inline';
				window.document.getElementById('photo2txt').style.display = 'none';
				window.document.getElementById('photo1txt').style.display = 'inline';
			}
		}

// COLOUR SELECTOR

	function bgclPic(obj){
		window.document.getElementById('panel').style.backgroundColor = obj.parentNode.bgColor;
		window.document.getElementById('hexref').value = obj.parentNode.bgColor;
		}


window.onload = new Function(" linkPos() ");