<!--************************************************************************************--!>
//  PictureSlider (v1.0) -	This JavaScript is protected by copyright (c) and MUST NOT be \\
//				  	  		used without a licence - available from wcsgroup.co.uk	      \\
//--************************************************************************************--\\
//																						  \\
//  See the PictureSlider (v1.0) User Guide												  \\
//  for full instuctions on setting up and using this script.							  \\
//					   		 															  \\
//--************************************************************************************--\\
//--                        <<<< DO NOT EDIT ABOVE THIS LINE >>>>						--\\
//--************************************************************************************--\\

var ScriptPath = "../";
var PictureSliderTitle = "";
var TotalItems = 10;
var StartPosition = 5;
var TableWidth = 500;
var DropHeight = 30;
var TableBackColor = "#95BAFF";
var WindowBorderColor = "#777777";
var ButtonHoverColor = "#DDDDDD";
var ButtonClickColor = "#BBBBBB";
var ImageTarget = "_blank";
var DropTarget = "_blank";
var PopTarget = "_blank";
var ItemText = new Array(TotalItems), ItemImage = new Array(TotalItems), ItemImageURL = new Array(TotalItems);
var ItemDropText = new Array(TotalItems), ItemDropURL = new Array(TotalItems);
var ItemPopImage = new Array(TotalItems), ItemPopURL = new Array(TotalItems);

ItemText[0] = "Garage Games";
ItemImage[0] = "thumbnails/portfolio_garagegames.jpg";
ItemImageURL[0] = "http://www.enlightener.co.uk/portfolio/garagegames";
ItemDropText[0] = "Garage Games";
ItemDropURL[0] = "http://www.enlightener.co.uk/portfolio/garagegames";
ItemPopImage[0] = "portfoliogaragegames_framed.jpg";
ItemPopURL[0] = "http://www.enlightener.co.uk/portfolio/garagegames";

ItemText[1] = "Hotel/Restaurant Le Lion d'Or";
ItemImage[1] = "thumbnails/portfolio_leliondor.jpg";
ItemImageURL[1] = "http://www.enlightener.co.uk/portfolio/leliondor";
ItemDropText[1] = "Hotel/Restaurant Le Lion d'Or";
ItemDropURL[1] = "http://www.enlightener.co.uk/portfolio/leliondor";
ItemPopImage[1] = "portfolioleliondor_framed.jpg";
ItemPopURL[1] = "http://www.enlightener.co.uk/portfolio/leliondor";

ItemText[2] = "James Labels & Supplies Ltd";
ItemImage[2] = "thumbnails/portfolio_jls.jpg";
ItemImageURL[2] = "http://www.jameslabels.co.uk";
ItemDropText[2] = "James Labels & Supplies Ltd";
ItemDropURL[2] = "http://www.jameslabels.co.uk";
ItemPopImage[2] = "portfoliojls_framed.jpg";
ItemPopURL[2] = "http://www.jameslabels.co.uk";

ItemText[3] = "Bijou du Morvan";
ItemImage[3] = "thumbnails/portfolio_bijoudumorvan.jpg";
ItemImageURL[3] = "http://www.bijoudumorvan.com";
ItemDropText[3] = "Bijou du Morvan";
ItemDropURL[3] = "http://www.bijoudumorvan.com";
ItemPopImage[3] = "portfoliobijoudumorvan_framed.jpg";
ItemPopURL[3] = "http://www.bijoudumorvan.com";

ItemText[4] = "Smoke Free Homes";
ItemImage[4] = "thumbnails/portfolio_smokefreehomes.jpg";
ItemImageURL[4] = "http://www.smokefreefamilies.co.uk";
ItemDropText[4] = "Smoke Free Homes";
ItemDropURL[4] = "http://www.smokefreefamilies.co.uk";
ItemPopImage[4] = "portfoliosmokefreehomes_framed.jpg";
ItemPopURL[4] = "http://www.smokefreefamilies.co.uk";

ItemText[5] = "Morvan Bed & Breakfast";
ItemImage[5] = "thumbnails/portfolio_morvanbandb.jpg";
ItemImageURL[5] = "http://www.morvanbandb.com";
ItemDropText[5] = "Morvan Bed & Breakfast";
ItemDropURL[5] = "http://www.morvanbandb.com";
ItemPopImage[5] = "portfoliomorvanbandb_framed.jpg";
ItemPopURL[5] = "http://www.morvanbandb.com";

ItemText[6] = "ebook Mansion";
ItemImage[6] = "thumbnails/portfolio_ebooks.jpg";
ItemImageURL[6] = "http://www.wcsgroup.co.uk/eb";
ItemDropText[6] = "ebook Mansion";
ItemDropURL[6] = "http://www.wcsgroup.co.uk/eb";
ItemPopImage[6] = "portfolioebookmansion_framed.jpg";
ItemPopURL[6] = "http://www.wcsgroup.co.uk/eb";

ItemText[7] = "Natural Health";
ItemImage[7] = "thumbnails/portfolio_naturalhealth.jpg";
ItemImageURL[7] = "http://www.enlightener.co.uk/portfolio/naturalhealth";
ItemDropText[7] = "Natural Health";
ItemDropURL[7] = "http://www.enlightener.co.uk/portfolio/naturalhealth";
ItemPopImage[7] = "portfolionaturalhealth_framed.jpg";
ItemPopURL[7] = "http://www.enlightener.co.uk/portfolio/naturalhealth";

ItemText[8] = "Outliners - Specialist Quilters";
ItemImage[8] = "thumbnails/portfolio_outliners.jpg";
ItemImageURL[8] = "http://www.enlightener.co.uk/portfolio/outliners";
ItemDropText[8] = "Outliners - Specialist Quilters";
ItemDropURL[8] = "http://www.enlightener.co.uk/portfolio/outliners";
ItemPopImage[8] = "portfoliooutliners_framed.jpg";
ItemPopURL[8] = "http://www.enlightener.co.uk/portfolio/outliners";

ItemText[9] = "Balti Stan Indian Cuisine";
ItemImage[9] = "thumbnails/portfolio_baltistan.jpg";
ItemImageURL[9] = "http://www.enlightener.co.uk/portfolio/baltistan";
ItemDropText[9] = "Balti Stan Indian Cuisine";
ItemDropURL[9] = "http://www.enlightener.co.uk/portfolio/baltistan";
ItemPopImage[9] = "portfoliobaltistan_framed.jpg";
ItemPopURL[9] = "http://www.enlightener.co.uk/portfolio/baltistan";

//--************************************************************************************--\\
//--                        <<<< DO NOT EDIT BELOW THIS LINE >>>>                       --\\
//--************************************************************************************--\\

var Curr = 0;
var MoveSize = 80;
var tw = (TableWidth / 2) - 72;
document.write('<div id="psTable" style="width:' + TableWidth + 'px">');
document.write('<div id="psHead" class="PSTitle">' + PictureSliderTitle + '</div>');
document.write('<div id="psLeft" onmousedown="this.style.backgroundColor=\'' + ButtonClickColor + '\'" onmouseup="this.style.backgroundColor=\'' + ButtonHoverColor + '\'" onmouseover="this.style.backgroundColor=\'' + ButtonHoverColor + '\'" onmouseout="this.style.backgroundColor=\'' + TableBackColor + '\'"><a href="javascript:moveto(Curr - 1, 2);self.focus();"><img class="Arrows" src="' + ScriptPath + 'images/arrowleft.gif" alt="Previous" /></a></div>');
document.write('<div id="psRight" onmousedown="this.style.backgroundColor=\'' + ButtonClickColor + '\'" onmouseup="this.style.backgroundColor=\'' + ButtonHoverColor + '\'" onmouseover="this.style.backgroundColor=\'' + ButtonHoverColor + '\'" onmouseout="this.style.backgroundColor=\'' + TableBackColor + '\'"><a href="javascript:moveto(Curr + 1, 2);self.focus();"><img class="Arrows" src="' + ScriptPath + 'images/arrowright.gif" alt="Next" /></a></div>');
document.write('<div id="psStrip"><div id="psWindow"></div><div id="psContent">');
for (var i = 0; i < TotalItems; i++) {
	document.write('<a href="javascript:moveto(' + i + ', 0)" class="PSImage"><img class="thumbs" src="' + ScriptPath + 'images/' + ItemImage[i] + '" id="Item' + i + '" alt="' + ItemText[i] + '" /></a>');
}
document.write('</div></div>');
document.write('<div id="psDrop" style="height:' + DropHeight + 'px"><div id="psDropContent" class="PSDrop"></div></div>');
document.write('</div><div id="psPopContent"></div>');
document.getElementById("psLeft").style.backgroundColor = TableBackColor;
document.getElementById("psRight").style.backgroundColor = TableBackColor;
document.getElementById("psStrip").style.backgroundColor = TableBackColor;
document.getElementById("psStrip").style.width = (TableWidth - 60) + "px";
document.getElementById("psWindow").style.borderColor = WindowBorderColor;
document.getElementById("psWindow").style.left = tw + "px";
document.getElementById("psDropContent").style.backgroundColor = TableBackColor;
document.getElementById("psDropContent").style.width = (TableWidth - 60) + "px";
document.getElementById("psContent").style.left = TableWidth + "px";
moveto(StartPosition - 1, -1);

function moveto(ItemNo, init) {
	OldCurr = Curr;
	if (ItemNo > Curr || init == -1) {
		Curr = ItemNo;
		movenext();
	} 
	else if (ItemNo < Curr) {
		Curr = ItemNo;
		moveprevious();
	}
	if ((OldCurr != Curr && init != 1) || init == -1) {
		for (var i = 0; i < TotalItems; i++) {
			document.getElementById("Item" + i).style.filter = "alpha(opacity=50)";
			document.getElementById("Item" + i).style.opacity = 0.5;
			document.getElementById("Item" + i).style.MozOpacity = 0.5;
		}
		if (OldCurr > -1 && OldCurr <= TotalItems && Curr > -1 && Curr <= TotalItems) fader(Curr, OldCurr, 75);
	}
	if (OldCurr != Curr) {
		document.getElementById("psDropContent").style.top = "2px";
		changetext(Curr, 1);
	}
	else if (init == 0 && Curr <= TotalItems && Curr >= 0) changecontents(Curr, 2);
}

function fader(FadeIn, FadeOut, alpha) {
	if (window.fadervar) clearTimeout(fadervar);
	if (alpha > 0) {
		document.getElementById("Item" + FadeOut).style.filter = "alpha(opacity=" + (50 + alpha) + ")";
		document.getElementById("Item" + FadeOut).style.opacity = 0.5 + (alpha / 100);
		document.getElementById("Item" + FadeOut).style.MozOpacity = 0.5 + (alpha / 100);
		alpha = alpha - 2;
		fadervar = setTimeout("fader(" + FadeIn + ", " + FadeOut + ", " + alpha + ")", 10);
	}
	else if (alpha <= 0 && alpha >- 50) {
		document.getElementById("Item" + FadeIn).style.filter = "alpha(opacity=" + (50 - alpha) + ")";
		document.getElementById("Item" + FadeIn).style.opacity = 0.5 - (alpha / 100);
		document.getElementById("Item" + FadeIn).style.MozOpacity = 0.5 - (alpha / 100);
		alpha = alpha - 2;
		fadervar = setTimeout("fader(" + FadeIn + ", " + FadeOut + ", " + alpha + ")", 15);
	}
}

function inertia(MovedBy) {
	if (MovedBy < MoveSize - 80) MoveItBy = 35;
	else if (MovedBy < MoveSize - 60) MoveItBy = 18;
	else if (MovedBy < MoveSize - 40) MoveItBy = 10;
	else if (MovedBy < MoveSize - 30) MoveItBy = 6;
	else if (MovedBy < MoveSize - 10) MoveItBy = 4;
	else if (MovedBy < MoveSize - 5) MoveItBy = 2;
	else if (MovedBy < MoveSize) MoveItBy = 1;
}

function movenext() {
	if (Curr > TotalItems - 1) Curr = TotalItems - 1;
	MovedBy = (Curr - 1) * -MoveSize - parseInt(document.getElementById("psContent").style.left) + ((TableWidth - 140) / 2);
	if (MovedBy < MoveSize) {
		inertia(MovedBy);
		document.getElementById("psContent").style.left = (parseInt(document.getElementById("psContent").style.left) - MoveItBy) + "px";
		movenextvar = setTimeout("movenext()", 50);
	}
}

function moveprevious() {
	if (Curr < 0) Curr = 0;
	MovedBy = parseInt(document.getElementById("psContent").style.left) - ((Curr + 1) * -MoveSize) - ((TableWidth - 140) / 2);
	if (MovedBy < MoveSize) {
		inertia(MovedBy);
		document.getElementById("psContent").style.left = (parseInt(document.getElementById("psContent").style.left) + MoveItBy) + "px";
		movepreviousvar = setTimeout("moveprevious()", 50);
	}
}

function changetext(ItemNo, Counter) {
	if (window.changetextvar) clearTimeout(changetextvar);
	if (Counter > 0 && Counter < 40) {
		if (Counter < 20) document.getElementById("psDropContent").style.top = (parseInt(document.getElementById("psDropContent").style.top) - 2) + "px";
		else if (Counter > 20) document.getElementById("psDropContent").style.top = (parseInt(document.getElementById("psDropContent").style.top) + 2) + "px";
		Counter = Counter + 1;
		if (Counter == 20) changecontents(ItemNo, 1);
		changetextvar = setTimeout("changetext(" + ItemNo + ", " + Counter + ")", 15);
	}
}

function changecontents(ItemNo, task) {
	for (var i = 0; i < TotalItems; i++) {
		if (ItemNo == i) {
			if (task == 1) {
				if (ItemDropURL[i] != "") {
					document.getElementById("psDropContent").innerHTML = '<a href="' + ItemDropURL[i] + '" target="' + DropTarget + '">' + ItemDropText[i] + '</a>';
				}
				else {
					document.getElementById("psDropContent").innerHTML = ItemDropText[i];
				}
				if (ItemPopURL[i] != "") {
					document.getElementById("psPopContent").innerHTML='<a href="' + ItemPopURL[i] + '" target="' + PopTarget + '"><img src="' + ScriptPath + 'images/' + ItemPopImage[i] + '" alt="' + ItemText[i] + '" class="PopImage" /></a>';
				}
				else if (ItemPopImage[i] != "") {
					document.getElementById("psPopContent").innerHTML='<img src="' + ScriptPath + 'images/' + ItemPopImage[i] + '" alt="' + ItemText[i] + '" class="PopImage" />';
				}
				else {
					document.getElementById("psPopContent").innerHTML='';
				}
			}
			else if (ItemImageURL[i] != "") {
				if (ImageTarget == "_blank") {
					window.open(ItemImageURL[i]);
				}
				else if (ImageTarget == "_parent") {
					parent.location.href = ItemImageURL[i];
				}
				else if (ImageTarget == "_self") {
					location.href = ItemImageURL[i];
				}
				else if (ImageTarget == "_top") {
					top.location.href = ItemImageURL[i];
				}
				else {
					parent.ImageTarget.location.href = ItemImageURL[i];
				}
			}
			break;
		}
	}
}
