var moveme2
var globalcounter2 = 1
var width2 = 260
var currentvalue2 = 0
var polarity2
var freeze2 = false
var noOfItems2 = 3
var width = 260

function resetall2(e){
	
document.getElementById('solution-finder-1').style.top = "51px"
document.getElementById('solution-finder-2').style.top = "51px"
document.getElementById('solution-finder-3').style.top = "51px"

if (e != 1 )
{document.getElementById('solution-finder-1').style.zIndex = 0
document.getElementById('solution-finder-1').style.left = width + 'px'
}
else
{document.getElementById('solution-finder-2').style.zIndex = 8}

if (e != 2)
{document.getElementById('solution-finder-2').style.zIndex = 0
document.getElementById('solution-finder-2').style.left =  width + 'px'}
else
{document.getElementById('solution-finder-2').style.zIndex = 8}

}

function polarstart2(p) {

if (p == "n"){
	polarity2 = "-"
	currentvalue2 = width2
}
else
{
	currentvalue2 = (width2 - (width2*2)) + 15
	polarity2 = "+"
	document.getElementById('solution-finder-' + globalcounter2).style.left = "-271px"
	document.getElementById('solution-finder-' + globalcounter2).style.zIndex = 9 
}

moveme2 = setInterval("move2('"+polarity2+"')",5)
}



function move2(p) {

if (p == "-"){
	leftValue2 = width2
}
else
{
leftValue2 = (width2 - (width2*2)) + 15
}
		
		moveAmount2 = 15
		freeze2 = true
		
		if (p == "-")
		{
		if (currentvalue2 >= 15){
			leftValue2 = (leftValue2 - moveAmount2)
			currentvalue2 = currentvalue2 - moveAmount2
			document.getElementById('solution-finder-' + globalcounter2).style.left = currentvalue2 + "px"
			if (globalcounter2 > 1){
				document.getElementById('solution-finder-' + (globalcounter2-1)).style.left = ((currentvalue2-width2)+15) + "px"
			}
			if (globalcounter2 == 1){
				document.getElementById('solution-finder-' + (noOfItems2)).style.left = ((currentvalue2-width2)+15) + "px"
			}
			document.getElementById('solution-finder-' + globalcounter2).style.zIndex = 9 
			}
			
		if (currentvalue2 <= 15){
		    document.getElementById('solution-finder-' + (globalcounter2)).style.left = "15px"
			clearInterval(moveme2)
			freeze2 = false
		}
			
		}
		else
		{
		if (currentvalue2 <= 15){
			leftValue2 = leftValue2 + moveAmount2
			currentvalue2 = currentvalue2 + moveAmount2
			document.getElementById('solution-finder-' + globalcounter2).style.left = currentvalue2 + "px"
			if (globalcounter2 < noOfItems2){
				document.getElementById('solution-finder-' + (globalcounter2+1)).style.left = (currentvalue2+width2) + "px"
			}
			
			if (globalcounter2 == noOfItems2){
				document.getElementById('solution-finder-').style.left = (currentvalue2+width2) + "px"
			}
			
			}
			
		if (currentvalue2 >= 15){
		    document.getElementById('solution-finder-' + (globalcounter2)).style.left = "15px"
			clearInterval(moveme2)
			freeze2 = false
		}

		}
		
	}

function next2(){
if (freeze2==false){

	if (globalcounter2 >= noOfItems2){
	        clearInterval(moveme2)
			resetall2(globalcounter2)
			globalcounter2 = 1
			polarstart2('n')
	}
	else
	{
		resetall2(globalcounter2)
		polarstart2('n')
		globalcounter2 = globalcounter2 + 1
	}
}
else
{

	if (globalcounter2 < noOfItems2){
		resetall2(globalcounter2)
		polarstart2('n')
		globalcounter2 = globalcounter2 + 1
	}
	
	else{
		resetall2(globalcounter2)
		globalcounter2 = 1
		polarstart2('n')
	}

}
}

function previous2(){
	
if (freeze2==false){
if (globalcounter2 > 1 ){
resetall2(globalcounter2)
globalcounter2 = globalcounter2 - 1
polarstart2('p')
}
else
{
globalcounter2 = noOfItems2
polarstart2('p')
}
}
}

function toggleLayer(layerID){

var layer = document.getElementById(layerID)

layer.style.left = "15px"
layer.style.top = "51px"
}


