(function($){


$.fn.feature_class=function(){ 

/////////////////////////////////////           SLIDES

/*
$('.imageLink').mouseover(function(){
$(".imageTitleAndDescription", this).stop().animate({top:'60px'},{queue:false,duration:300});
})

$('.imageLink').mouseout(function(){
$(".imageTitleAndDescription", this).stop().animate({top:'125px'},{queue:false,duration:300});
})
*/


$('#playPauseBtn').click(function(){
//alert('clicked');	
if($(this).attr('playPause')=='play'){
clearInterval(slideshowInterval);
$(this).attr('playPause','pause');
$(this).css({'background-position':'0px 0px'});
}
else{
$(this).attr('playPause','play');
//$(this).css({'background':'yellow'});
$(this).css({'background-position':'0px -23px'});
//clearInterval(slideshowInterval);
slideshowInterval=setInterval(function() { 
fadeFeature();}, 5000); 
fadeFeature();	
}

});



$('.option').click(function(){

// update play pauseBtn
$('#playPauseBtn').attr('playPause','play');
//$('#playPauseBtn').css({'background':'yellow'});
$('#playPauseBtn').css({'background-position':'0px -23px'});

currentIndex=$(this).attr('loadIndex');
clearInterval(slideshowInterval);
slideshowInterval=setInterval(function() { 
fadeFeature();
}, 5000); 
fadeFeature();

})

/*
options_array=$(".option");
options_array.each(function() {
$(this).attr('loadFeatureId');
});
*/


/*
//$("#slide_2").fadeIn();

i=1;
slideBtns_array=$(".slideBtn");
slideBtns_array.each(function() {
$(this).attr("id", "slideBtn_"+i);
$(this).data("index",i);
i++;})


slideBtns_array.click(function(){

//alert($(this).data('index'));
//$("#slide_"+$(this).data('index')).fadeIn();
//$("#slide2").fadeIn();
//slides_array.fadeIn();
clearInterval(slideshowInterval);
slideshowInterval=setInterval(function() { 
fadeFeature();
}, 5000); 

currentIndex=$(this).data('index');
fadeFeature();
;});
*/


/*
function fadeFeature(ind){
currentIndex=ind;	
slides_array.hide();
slideBtns_array.css({'background':'#ff00ff'});
$("#slide_"+ind).fadeIn();
$("#slideBtn_"+ind).css({'background':'#888'});
if(currentIndex==slideBtns_array.length){currentIndex=0}
else{currentIndex++;}
alert(currentIndex);
}
*/

//window.setInterval('fadeFeature2()', 1000);


slideshowInterval=setInterval(function() { 
fadeFeature();
}, 5000); 



currentIndex=1;

function fadeFeature(){	
//reset
$('.feature').hide();
$(".featureCaption").hide();
$('.option').css({'background-position': '0px 0px'});
//fadeIn and slide In
$("#feature_"+currentIndex).fadeIn();
$("#featureCaption_"+currentIndex).slideDown();
$("#option_"+currentIndex).css({'background-position': '0px -75px'});

if(currentIndex==$('.option').length){currentIndex=1}
else{currentIndex++;}
}


fadeFeature();

//CLOSE FEATURE FUNCTION
}
				
	
// CLOSE FUNCTION
})(jQuery);
		
