if(thumbArrayList2.length > 0){
	var currThumbSelected = thumbArrayList2[0];
	$(currThumbSelected).setStyle({borderColor:'#F1AB00'});
	$(currThumbSelected).setOpacity(1.0);
}

function PortThumbOver(id){
	if(id != currThumbSelected){
		$(id).setOpacity(1.0);
	}
}

function PortThumbOut(id){
	if(id != currThumbSelected){
		$(id).setOpacity(0.8);
	}
}

var thumbCurrPos = 1;

function Goto_Thumb(direction){
	$('traceInput').innerHTML = $('traceInput').innerHTML + "<div class='JSDebugField'>Proj IMG: " + thumbArrayList2.length + "</div>";
	
	if(thumbArrayList2.length > 3){
		var minThumbDisplay_Width = (totalThumbsWidth / 82) - 3;
		
		if(thumbArray.length >= 3){
			if(direction == "+"){
				//if(thumbCurrPos >= thumbSlideLimits[0]){
				if(thumbCurrPos == thumbArrayList2.length -2){
					$('RightArrow').setOpacity(0.4);
				}
				else {
					$('LeftArrow').setOpacity(1.0);
					$('RightArrow').setOpacity(1.0);
					if(totalThumbs > 3){
						new Effect.Move("SlidingThumbs", {x: -82, y: 0, duration: 0.2});
						thumbCurrPos = thumbCurrPos + 1;
						if(thumbCurrPos >= thumbSlideLimits[0]){$('RightArrow').setOpacity(0.4);}
					}
				}
				var leftPos = $('SlidingThumbs').getStyle('left');
			}
			else {
				if(thumbCurrPos != thumbSlideLimits[1]){
					if(totalThumbs > 3){
						new Effect.Move("SlidingThumbs", {x: +82, y: 0, duration: 0.2});
						$('LeftArrow').setOpacity(1.0);
						$('RightArrow').setOpacity(1.0);
						thumbCurrPos = thumbCurrPos - 1;
						if(thumbCurrPos == thumbSlideLimits[1]){$('LeftArrow').setOpacity(0.4);}
					}
				}
			}
		}
	}
}

function changeMainPortImage(idName){
	subPortImg = currPortImg;
	
	for(var i = 0; i < projectImage.length; i++){
		if(document.getElementById(idName).src == projectImage[i].src){
			//$('traceInput').innerHTML = $('traceInput').innerHTML + "<div class='JSDebugField'>Proj IMG: " + thumbCaption[i] + "</div>";
			document.getElementById(idName).title = thumbCaption[i];
			document.getElementById(idName).alt = thumbCaption[i];
		}
	}
	
	new Effect.Parallel([
		new Effect.Opacity(currPortImg, { sync: true, duration: 0.5, from: 1.0, to: 0.0, afterFinish:function(obj){ afterPortMainImg(subPortImg, 'In'); }}),
		new Effect.Move(idName, { sync: true, x: 0, y: 0, duration: 0.8, mode:'absolute' })
	], {
		duration: 2.3,
		delay: 0.1
	});
	currPortImg = idName;
}

function afterPortMainImg(id, content){
	new Effect.Parallel([
		new Effect.Move(subPortImg, { sync: true, x: outOfSight, y: 0, mode:'absolute'}),
		new Effect.Opacity(subPortImg, { sync: true, duration: 0.5, from: 0.0, to: 1.0, afterFinish:function(obj){ flipZindex(subPortImg, currPortImg); }})
	], {
		duration: 0.0,
		delay: 0.0
	});
}

function flipZindex(subPortImg, currPortImg){
	$(subPortImg).setStyle({zIndex:22});
	$(currPortImg).setStyle({zIndex:21});
	isthumbInit = false;
}

var isthumbInit = false;

function changeNextImgInQueqe(PortImgSource, arrVal){
	document.getElementById(subPortImg).src = PortImgSource;
	if(isthumbInit == false){
		isthumbInit = true;
		
		if(thumbArrayList2.length > 0){
			$(currThumbSelected).setStyle({borderColor:'#FFFFFF'});
			$(currThumbSelected).setOpacity(0.8);
			
			$(arrVal).setStyle({borderColor:'#F1AB00'});
			$(arrVal).setOpacity(1.0);
			currThumbSelected = arrVal;
		}
		changeMainPortImage(subPortImg);
	}
}