
;(function($){
	$(function(){

		/************* CODE FOR INPUT EFFECTS  ********/
		$('input:text').focus(function(){
			if(this.value==this.defaultValue){this.value=''}
		})
		$('input:text').blur(function(){
			if(!this.value){this.value=this.defaultValue;}
		})
		$('input:password').focus(function(){
			if(this.value==this.defaultValue){this.value=''}
		})
		$('input:password').blur(function(){
			if(!this.value){this.value=this.defaultValue;}
		})
		$('textarea').focus(function(){
			if(this.value==this.defaultValue){this.value=''}
		})
		$('textarea').blur(function(){
			if(!this.value){this.value=this.defaultValue;}
		})
		/************* END CODE FOR INPUT EFFECTS  ********/
		$('div.banner-container').append('<ul id="pagination"></ul>')
		if( $('#slider')){
			iindevSlideShowinIt()// AutoSlideShow
		}// END IF()
						   
	})// END OF DOCUMENT READY FUNCTION
	

})(jQuery)


/************* CODE FOR SLIDING IMAGE  CHANGES   ********/
var currentlyRunning	= false
var autoSlidingPointer	= false
var totalItemCount		= 0
var $slider				= false
var $slider_item		= false
var $sliderBullet_Li	= false
var itemShowingSpeed	= 500
var itemSlidingInterval= 3500
var presentlyShown		= 0
var nextItemToShow		= 0

function iindevSlideShowinIt(){
	
	// Count the image numbers and setup the arrows..
	totalItemCount	= jQuery('#slider div.slider-inner-panel').length
	jQuery('#pagination').html('<li class="active"></li>')
	for(var i=1; i<totalItemCount; i++){
		jQuery('#pagination').append('<li></li>')
	}

	// Dynamically setup the width of the arrows container
	$('#pagination').width( totalItemCount * 20)
	
	$slider_item		= jQuery('#slider div.slider-inner-panel')
	$sliderBullet_Li	= jQuery('#pagination li')

	// Show the first image
	$slider_item.fadeOut(1)
	$slider_item.eq(0).fadeIn(itemShowingSpeed)
	
	autoSlidingPointer = setInterval( 'autoRunTheSlider()', itemSlidingInterval )
	
	$sliderBullet_Li.each(function(i){
		jQuery(this).click(function(){
			if(currentlyRunning || (presentlyShown == i)) return false
			
			clearInterval(autoSlidingPointer)
			
			nextItemToShow	= i
	
			currentlyRunning = true
			
			$sliderBullet_Li.eq(presentlyShown).removeClass('active')
			$sliderBullet_Li.eq(nextItemToShow).addClass('active')
			
			$slider_item.eq(presentlyShown).fadeOut(itemShowingSpeed)
			$slider_item.eq(nextItemToShow).fadeIn(itemShowingSpeed, function(){
				presentlyShown = nextItemToShow
				currentlyRunning = false
				autoSlidingPointer = setInterval( 'autoRunTheSlider()', itemSlidingInterval )
			})
			
		})
	})

}

function autoRunTheSlider(){
	
	nextItemToShow	= ( presentlyShown == (totalItemCount-1) ) ? 0 : presentlyShown+1
	
	currentlyRunning = true
	
	$sliderBullet_Li.eq(presentlyShown).removeClass('active')
	$sliderBullet_Li.eq(nextItemToShow).addClass('active')
	
	$slider_item.eq(presentlyShown).fadeOut(itemShowingSpeed)
	$slider_item.eq(nextItemToShow).fadeIn(itemShowingSpeed, function(){
		presentlyShown = nextItemToShow
		currentlyRunning = false
	})
	
}
/*********** END CODE FOR SLIDING IMAGE  CHANGES ********/

