window.onload = initLinks;

var myPhoto = new Array(
"images/portf/ashdene-house.jpg",
"images/portf/thedriftwoodshop.jpg",
"images/portf/hoorayfortoys.jpg",
"images/portf/lomans.jpg",
"images/portf/afcconsultants_fs.jpg",
"images/portf/branddeadstock_fs.jpg",
"images/portf/elitepassengertransport_fs.jpg",
"images/portf/joshuatree_fs.jpg",
"images/portf/taxreturnonlineservices_fs.jpg",
"images/portf/philton_fs.jpg",
"images/portf/norfolkpropertymaintenance_fs.jpg",
"images/portf/taxistotheairport_fs.jpg",
"images/portf/theredeyes_fs.jpg");



var myText = new Array(
"<a href='http://www.ashdene-house.co.uk' target='_blank'>ashdene-house.co.uk</a> - website design",
"<a href='http://www.thedriftwoodshop.co.uk' target='_blank'>thedriftwoodshop.co.uk</a> - design and hosting",
"<a href='http://www.hoorayfortoys.com' target='_blank'>hoorayfortoys.com</a> - development and hosting",
"<a href='http://www.lomans.co.uk' target='_blank'>lomans.co.uk</a> - design and hosting",
"<a href='http://www.afcconsultants.co.uk' target='_blank'>afcconsultants.co.uk</a> - design and hosting",
"<a href='http://www.branddeadstock.com' target='_blank'>branddeadstock.com</a> - design and hosting",
"<a href='http://www.elitepassengertransport.co.uk' target='_blank'>elitepassengertransport.co.uk</a> - design and hosting",
"<a href='http://www.thejoshuatreecornwall.com' target='_blank'>thejoshuatreecornwall.com</a> - design and hosting",
"<a href='http://www.taxreturnonlineservices.co.uk' target='_blank'>taxreturnonlineservices.co.uk</a> - design and hosting",
"<a href='http://www.philton.co.uk' target='_blank'>philton.co.uk</a> - design and maintenance",
"<a href='http://www.norfolkpropertymaintenance.com' target='_blank'>norfolkpropertymaintenance.com</a> - design and hosting",
"<a href='http://www.taxisstotheairport.co.uk' target='_blank'>taxisstotheairport.co.uk</a> - design and hosting",
"<a href='http://www.theredeyes.co.uk' target='_blank'>theredeyes.co.uk</a> - design and hosting");

var thisPhoto = 0;

function initLinks() {
	document.getElementById("previous").onclick = processPrevious;
	document.getElementById("next").onclick = processNext;
}


function processPrevious() {
	changeOpac(0)
	if (thisPhoto == 0) {
		thisPhoto = myPhoto.length;
	}
	thisPhoto--;
	document.getElementById("myPicture").src = myPhoto[thisPhoto];
	if (document.getElementById("myPicture").src.indexOf("v") != -1)
	{
		document.getElementById("myPicture").style.marginTop = 10 + "px";
	}
	else {
		document.getElementById("myPicture").style.marginTop = 10 + "px";
	}
	document.getElementById('pictureText').innerHTML = myText[thisPhoto];
	opacityShow()
	return false;
}

function processNext() {
	changeOpac(0)
	thisPhoto++;
	if (thisPhoto == myPhoto.length) {
		thisPhoto = 0;
	}
	document.getElementById("myPicture").src = myPhoto[thisPhoto];
	if (document.getElementById("myPicture").src.indexOf("v") != -1)
	{
		document.getElementById("myPicture").style.marginTop = 10 + "px";
	}
	else {
		document.getElementById("myPicture").style.marginTop = 10 + "px";
	}
	document.getElementById('pictureText').innerHTML = myText[thisPhoto];
	opacityShow()
	return false;
}


function opacityFade() {
	timer = 900;
	for(i = 100; i >= 0; i--) {
		setTimeout("changeOpac(" + i + ")",(timer));
		timer=timer+2;
	}
}
function opacityShow() {
	timer = 900;
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ")",(timer));
	timer=timer+2;
	}
}

function changeOpac(opacity) {
	var object = document.getElementById('myPicture').style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

