var MBA = {
		_MBA:this,
		_currSlideIndex:null,
		_slidesContainerID:"",
		_slideBaseClassname:"",
		_slideShowStarted:false,
		_slideShowDirection:"fwd",
		_setLength:null,
		_slideShowWithNav:false,
		init:function()
		{
			this._setLength = document.getElementById(this._slidesContainerID).getElementsByTagName('div').length;
			this._currSlideIndex = 0;
			this._refreshNavDisplay();
		},
		_getNextSlideIndex:function()
		{
			if(this._slideShowDirection == "fwd"){
				if(this._currSlideIndex+1 < this._setLength)return this._currSlideIndex + 1;
				else return 0;
			} else{
				if(this._currSlideIndex == 0)return this._setLength -  1;
				else return  this._currSlideIndex - 1;
			}
		},
		setSlideShowWithNav:function(val)
		{
			this._slideShowWithNav = val;
		},
		setSlidesContainerID:function(val)
		{
			this._slidesContainerID = val;
		},
		setSlideBaseClassname:function(val)
		{
			this._slideBaseClassname = val;
		},
		_setSlideShowDirection:function(val)
		{
			this._slideShowDirection = val;
		},
		_refreshNavIcons:function()
		{
			if(document.getElementById("projectNavigation")){
				var arrIcons =  document.getElementById("projectNavigation").getElementsByTagName("a");
				if(this._currSlideIndex+1 == this._setLength){
					arrIcons[0].setAttribute("class","navActive");
					arrIcons[1].setAttribute("class","navUnactive");
				} else if (this._currSlideIndex == 0){
					arrIcons[0].setAttribute("class","navUnactive");
					arrIcons[1].setAttribute("class","navActive");
				} else {
					arrIcons[0].setAttribute("class","navActive")
					arrIcons[1].setAttribute("class","navActive")
				}
			}
		},
		_refreshNavDisplay:function()
		{
			var currImageNumber =  this._currSlideIndex + 1;
			if(this._slideShowWithNav)$("#navDisplay").html("image " + currImageNumber + " of " + this._setLength);
		},
		doSlideShow:function(slideShowDirection)
		{
			this._setSlideShowDirection(slideShowDirection);
			var nextSlideIndex = this._getNextSlideIndex();
			//$("."+this._slideBaseClassname+this._currSlideIndex + " p").css("display","none");
			//$("."+this._slideBaseClassname+nextSlideIndex + " p").css("display","none");
			$("div."+this._slideBaseClassname+this._currSlideIndex).fadeOut("slow");
			$("div."+this._slideBaseClassname+nextSlideIndex).fadeIn("slow");
			$("p."+this._slideBaseClassname+this._currSlideIndex).css("display","none");
			$("p."+this._slideBaseClassname+nextSlideIndex).css("display","block");
			//$("."+this._slideBaseClassname+this._currSlideIndex + " p").css("display","block");
			//$("."+this._slideBaseClassname+nextSlideIndex + " p").css("display","block");
			if(this._slideShowDirection == "fwd"){
				if(nextSlideIndex != 0)this._currSlideIndex++;
				else this._currSlideIndex = 0;
			} else {
				if(this._currSlideIndex != 0)this._currSlideIndex--;
				else this._currSlideIndex = this._setLength -1;
			}
			this._refreshNavDisplay();
		}
}
