// JavaScript Document

//Declieration for Image path
var imgPic = new Array();
	imgPic[0] = "<p>\" I've seen a noticeable improvement in my daughter's maths and her teacher has even commented on how she is so much more confident in class... \"</p>";
	imgPic[1] = "<p>\" I was very impressed with the professionalism that Cohort Tuition showed me, which made me more determined to have my child tutored by them... \"</p>";
	//imgPic[2] = "<p>\" Vestibulum a suscipit lacus. Cras placerat quam eget nibh bibendum volutpat. Etiam diam arcu, placerat sit amet facilisis eu, aliquam faucibus magna... \"</p>";
	//imgPic[3] = "<p>\" Donec nec mauris in orci convallis euismod. Etiam a felis lacus, id ultricies libero. Nunc eget nibh vel felis ullamcorper tristique ut et mi. Suspendisse adipiscing posuere gravida. Mauris et lacus enim. Pellentesque egestas elit lorem... \"</p>";
	//imgPic[4] = "<p>\" Nam quis nulla non orci sodales vulputate. Curabitur id velit lorem. Mauris lacinia rhoncus velit at dignissim. In id mauris sem. Donec urna dolor, fermentum nec lobortis eu... \"</p>";


//do not customize the following values
var millisec = 1000;
var contrl = 0;
var imgCount = 0;


//section for next/previous function
function slideImg(contrlval, opacStart, opacEnd) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	var obj = document.getElementById('testiContainer');
	
	obj.style.opacity = 0;
	obj.style.MozOpacity = 0; 
	obj.style.KhtmlOpacity = 0; 
	obj.style.filter = "alpha(opacity= "+ 0 +")";
	
	if(contrl > contrlval){ //for PREVIOUS function		
		if(imgCount == 0){
			imgCount = imgPic.length;
			obj.innerHTML = imgPic[imgCount-1];
			
			if(opacStart < opacEnd) { 
				for(i = opacStart; i <= opacEnd; i++) 
					{
					setTimeout("changeOpac(" + i + ", 'testiContainer')",(timer * speed)); 
					timer++;  
				}
			}
		}
		else{
			obj.innerHTML = imgPic[imgCount-1];
			
			if(opacStart < opacEnd) { 
				for(i = opacStart; i <= opacEnd; i++) 
					{
					setTimeout("changeOpac(" + i + ", 'testiContainer')",(timer * speed)); 
					timer++;  
				}
			}
		}
		
		imgCount--;
	}
	else if(contrl < contrlval){ //for NEXT function
		if(imgCount == (imgPic.length-1)){
			imgCount = -1;
			obj.innerHTML = imgPic[imgCount+1];
			
			if(opacStart < opacEnd) { 
				for(i = opacStart; i <= opacEnd; i++) 
					{
					setTimeout("changeOpac(" + i + ", 'testiContainer')",(timer * speed)); 
					timer++;  
				}
			}
		}
		else{
			obj.innerHTML = imgPic[imgCount+1];
			
			if(opacStart < opacEnd) { 
				for(i = opacStart; i <= opacEnd; i++) 
					{
					setTimeout("changeOpac(" + i + ", 'testiContainer')",(timer * speed)); 
					timer++;  
				}
			}
		}
		
		imgCount++;
	}
}


//change the opacity for different browsers 
function changeOpac(opacity, obj) {
	var object = document.getElementById(obj).style;
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}
