var nCur=1;
var nLast=4;
var nCur2=1;
var nLast2=3;
var nInterval=9;
var nInterval2=12;

var nERPTimeOut
var nGPSTimeOut


function setERPView(nCur_){
	nLast =nCur;
	nCur=nCur_;
	switchERPview();
}

function toggleERPview(){
	nLast =nCur;
	nCur++;
	if (nCur==5) {nCur =1;} 
	switchERPview();
}
function switchERPview(){

  $("#feature"+nLast).fadeOut(300, function(){
		$("#key"+nCur).addClass('current');
		$("#key"+nLast).removeClass('current');
		$("#feature"+nCur).fadeIn(300,function(){
			clearTimeout(nERPTimeOut);
	
nERPTimeOut=setTimeout("toggleERPview()",1000*nInterval2);
		});
	});
	
}


function setGPSView(nCur_){
	nLast2 =nCur2;
	nCur2=nCur_;
	switchGPSview();
}

function toggleGPSview(){
	nLast2 =nCur2;
	nCur2++;
	if (nCur2==4) {nCur2 =1;} 
	switchGPSview();
	
}

function switchGPSview(){
	
	$("#gpsFeat"+nLast2).fadeOut(300, function(){
		$("#thumb"+nCur2).addClass('current');	
		$("#thumb"+nLast2).removeClass('current');
		$("#gpsFeat"+nCur2).fadeIn(300, function(){
			clearTimeout(nGPSTimeOut);	
	
nGPSTimeOut=setTimeout("toggleGPSview()",1000*nInterval);	
		});
	});
	
	
}  
$("#gpsFeat1").removeClass('visible');
$("#thumb"+nCur2).addClass('current');	
$("#gpsFeat"+nCur2).fadeIn(0);


$("#feature1").removeClass('visible');
$("#key"+nCur).addClass('current');
$("#feature"+nCur).fadeIn(0);


$("#thumb1").click(function(){setGPSView(1);});
$("#thumb2").click(function(){setGPSView(2);});
$("#thumb3").click(function(){setGPSView(3);});

$("#key1").click(function(){setERPView(1);});
$("#key2").click(function(){setERPView(2);});
$("#key3").click(function(){setERPView(3);});
$("#key4").click(function(){setERPView(4);});

 nERPTimeOut=setTimeout("toggleERPview()",1000*nInterval2);

nGPSTimeOut=setTimeout("toggleGPSview()",1000*nInterval);



