var delay=100;
var i=0;
var stopMove= false;

function move(Direction) {

document.getElementById('thumbnails').style.top=i+"px";

if (Direction == "up") {
	i-= 20;
} else {
	i+= 20;
}

if (i > 0) { i= 0; }

if (stopMove == false) {
	setTimeout("move('" + Direction + "')", delay);
}

}


var Quote=new Array()
var URL=new Array()

Quote[0]= "<i>\"The flowers were exquisite and everyone commented on how stunning and perfectly decorated the venue was.\"</i><br> <div align=right>Rebecca, Templeton House wedding</div>";
Quote[1]= "<i>\"Never in my life have I seen such wonderful flowers\".</i><br> <div align=right>Sally, Warren House wedding</div>";
Quote[2]= "<i>\"Thank you for your special contribution to our perfect day\"</i><br> <div align=right>Rachel & Andy,  Templeton House wedding</div>";
Quote[3]= "<i>\"Without a doubt, one of the key features that made it so memorable was the display of so many wonderful flowers, and your arrangements won universal praise from our guests\"</i><br><div align=right>Gordon and Neil,Templeton House civil partnership</div>";
Quote[4]= "<i>\"We wanted to thank you properly for the amazing flowers which really helped make the day. We really appreciated all your hard work and effort\" </i><br> <div align=right>Resa and Michelle, Hampton Court House wedding</div>";
Quote[5]= "<i>\"The wonderful peonies and other flowers were absolutely stunning and were much admired\"</i><br> <div align=right>Christiane, private summer garden party at home</div>";
Quote[6]= "<i>\"We loved everything about the day and the flowers were an important part of it, so thank you for your hard work in making it all perfect\"</i><br> <div align=right>Barbara,Templeton House wedding</div>";
Quote[7]= "<i>\"The flowers were of a very high quality and extremely good value for money. I think you are a truly gifted florist, with very creative ideas. The flowers exceeded our expectations\"</i><br> <div align=right>Rachel, Templeton House wedding</div>";
Quote[8]= "<i>\"flowers were absolutely stunning. I nearly cried when I saw my bouquet. I had so many compliments on how nice they were, even from some of the guys, shocking!\"</i><br> <div align=right>Jennie, The Bingham Hotel, wedding reception</div>";

var Sign= '';
var Step= '';
var QuoteNumMax= 9;
var QuoteNum= Math.round(Math.random() * (QuoteNumMax - 1));
var MouseHovered= 0;
var LastColour= '#CCCCCC';

function changeMouseHovered(val) {
	MouseHovered= val;
	if (MouseHovered == 0) {
		document.getElementById('faderbox').style.color= LastColour;
	}
}

function changeFadeURL() {

if (URL[QuoteNum]) {
	document.location= './' + URL[QuoteNum];
} else {
	document.location= './page-Testimonials.html';
}

}

function startFade() {

doFade(43, 1);

}

function doFade(Step, Sign) {
	
	if (MouseHovered == 0) {
		LastColour= rgbtohex(Step, Step, Step);
		document.getElementById('faderbox').style.color= "#" + rgbtohex(Step, Step, Step);
	} else {
		document.getElementById('faderbox').style.color= '#333399';
	}
	
	if (Step == 53) { Timeout= 750; }
	if (Step == 43) { 
		NextSign= 1; 
		NextStep= 53;
		if (QuoteNum == (QuoteNumMax - 1)) { QuoteNum= 0; } else { QuoteNum= QuoteNum + 1; }
		if (Quote[QuoteNum]) {
			document.getElementById('faderbox').innerHTML= Quote[QuoteNum];	
		}
		Timeout= 250;
	} else {
		if (Step == 243) { 
			NextSign= 0; 
			NextStep= 233;
			Timeout= 1500;
		} else {
			NextSign= Sign;
			if (Sign == '1') {
				NextStep= Step + 10
			} else {
				NextStep= Step - 10;
			}
			Timeout= 250;
		}
	}

	setTimeout("doFade(NextStep, NextSign);", Timeout);

}

function hextorgb(n1,n2,n3,n4,n5,n6) {

n1 = replacevals(n1);
n2 = replacevals(n2);
n3 = replacevals(n3);
n4 = replacevals(n4);
n5 = replacevals(n5);
n6 = replacevals(n6);

var returnval = ((16 * n1) + (1 * n2));
var returnval1 = 16 * n3 + n4;
var returnval2 = 16 * n5 + n6;

return ((16 * n1) + (1 * n2))+","+((16 * n3) + (1 * n4))+","+((16 * n5) + (1 * n6));

}

function replacevals(n) {

if (n == "a") { n = "10"; }
if (n == "b") { n = "11"; }
if (n == "c") { n = "12"; }
if (n == "d") { n = "13"; }
if (n == "e") { n = "14"; }
if (n == "f") { n = "15"; }

return n

}

function replacevalsreverse(thenum) {
if (thenum == 10) { thenum = "a"; }
if (thenum == 11) { thenum = "b"; }
if (thenum == 12) { thenum = "c"; }
if (thenum == 13) { thenum = "d"; }
if (thenum == 14) { thenum = "e"; }
if (thenum == 15) { thenum = "f"; }

return thenum;
}

function rgbtohex(num1, num2, num3) {
return calc10to16(num1) + calc10to16(num2) + calc10to16(num3);

}

function calc10to16(num) {
if (num < 16) {
var thenum = replacevalsreverse(num);
return thenum;
}
else {
var themod=num % 16;
var thenum=((num-themod) / 16);
thenum = replacevalsreverse(thenum)
themod = replacevalsreverse(themod)

return ""+thenum+themod
}
}

