// JavaScript Document

	var myTestimonials = new Array();
	var myId = new Array();
	var TimeToFade = 500.0;
	var curTestimonial = 0;
	
	myTestimonials[0] = "&#8220;Max was extremely informative and professional. He managed the whole project of creating an online presence for us and he produced an extremely well-designed website which is also content managed and very easy to update. We were delighted with his service and excellent final product!&#8221;<br /><span style='float: right; font-style:italic;'>Albert Debono, SAYIT!</span>";
	myId[0] = 0;
	
	myTestimonials[1] = "&#8220;We at DISCERN – Institute for Research on the Signs of the Times -  were extremely impressed with the speed and quality of work which Max delivered. Our organisation wanted to revamp our website and give it a new modern look.  After meeting to exchange ideas and brief him on our design requirements, Max created a simple, yet extremely professional design which was exactly what we had been looking for. The few slight modifications we suggested were implemented immediately. He also guided us through any technical issues we had, such as dealings with hosting companies, and our Facebook account! We are looking to work with him again in the future.&#8221;<br /><span style='float: right; font-style:italic;'>Rev Dr Joe Inguanez, Executive Director, DISCERN</span>";
	myId[1] = 1;
	
	var curTestimonial = Math.floor(Math.random()*2);
	
	function fade(eid)
	{
	  var element = document.getElementById(eid);
	  if(element == null)
		return;
	   
	  if(element.FadeState == null)
	  {
		if(element.style.opacity == null
			|| element.style.opacity == ''
			|| element.style.opacity == '1')
		{
		  element.FadeState = 2;
		}
		else
		{
		  element.FadeState = -2;
		}
	  }
	   
	  if(element.FadeState == 1 || element.FadeState == -1)
	  {
		element.FadeState = element.FadeState == 1 ? -1 : 1;
		element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
	  }
	  else
	  {
		element.FadeState = element.FadeState == 2 ? -1 : 1;
		element.FadeTimeLeft = TimeToFade;
		setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
	  }  
	}
		
	function animateFade(lastTick, eid)
	{  
	  var curTick = new Date().getTime();
	  var elapsedTicks = curTick - lastTick;
	 
	  var element = document.getElementById(eid);
	 
	  if(element.FadeTimeLeft <= elapsedTicks)
	  {
		element.style.opacity = element.FadeState == 1 ? '1' : '0';
		element.style.filter = 'alpha(opacity = '
			+ (element.FadeState == 1 ? '100' : '0') + ')';
		element.FadeState = element.FadeState == 1 ? 2 : -2;
		return;
	  }
	 
	  element.FadeTimeLeft -= elapsedTicks;
	  var newOpVal = element.FadeTimeLeft/TimeToFade;
	  if(element.FadeState == 1)
		newOpVal = 1 - newOpVal;
	
	  element.style.opacity = newOpVal;
	  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
	 
	  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
	}		
	
	function slideShow() {
		var changeTestimonial = document.getElementById("slideShowTestimonial");
		changeTestimonial.innerHTML = '' + myTestimonials[curTestimonial] + '';
	}
		
	function slideShowNext() {
		fade('slideShowTestimonial');
		setTimeout("sSN()",500);	
	}
		
	function sSN() {	
		curTestimonial++;
		if(curTestimonial > myTestimonials.length-1) { curTestimonial = 0; }
		var changeTestimonial = document.getElementById("slideShowTestimonial");
		changeTestimonial.innerHTML = '' + myTestimonials[curTestimonial] + '';
		fade('slideShowTestimonial');
	}
