

$(document).ready(function(){
	    textArray = [];
	    window.currentSlide = 1;
	    target = $('#showText');
	 	
	 	window.thank = function(){
	 		alert('"Thank you for your submission! We appreciate the love!"')
	 	}
	   /* Home Rotator */
	   //$('#slideShow').css('display','none');

	   $('#slideShow').jqFancyTransitions({direction:'random', width: 727, height: 375, navigation:true,links:true });
	   $('#ft-buttons-slideShow').css('display','none !important')
	   $('.accountBtn').fancybox();
		/* Home Carousel */
		$('.bannerText').each(function(i,text){
			textArray.push(text);
		});

        $('#dnn_carousel li').mouseenter(function(){
        	$(this).find('.bannerText').css('display','block');
	    });
        $('#dnn_carousel li').mouseleave(function(){
           $(this).find('.bannerText').css('display','none');
	    });
	    $('#ft-prev-slideShow, #ft-next-slideShow').text('');
       // $('.rotatorImg').live('mouseenter', function(){
       // 	 var myIndex;
       // 	 myIndex = $.makeArray($('.rotatorImg')).indexOf(this);
       // 	 console.log(myIndex)
       // 	 $(this).bt(textArray[myIndex]);
       // });
	   // function(e){
	   //  	var $me = $(this);
	   //  	var myIndex = $.makeArray('.rotatorImg').indexOf(this);
	   //  	$me.animate({
	   //  	   top:'+=50px'
	   //  	}, 500);
	   //  	showBubble(e,myIndex);
	   //    },
	   //    function(){
	   //  	var $me = $(this);
	   //  	$me.animate({
	   //  	   top:'-=50px'
	   //  	}, 500);   
	   //  	hideBubble();   	
	   //    }



    // $('.rotatorImg').mouseleave(function(){
    // 	var $me = $(this);
    // 	$me.not(':animated').animate({
    // 	   top:'-=30px'
    // 	}, 500);
    // });    
    //target.html(textArray[0]);
	// $('#boutique').boutique({
	// 	container_width: 500,
	// 	speed:	 900,
	// 	hoverspeed:	 300,
	// 	hovergrowth:	0.0,
	// 	behind_opac:	0.5,
	// 	back_opac:	 0.2,
	// 	back_size: 0.3,
	// 	behind_size:	0.6,
	// 	front_img_width: 175,
	// 	front_img_height: 250,
	// 	autoplay:	 true,
	// 	autointerval:	5000,
	// 	freescroll:	 false,
	// 	move_on_hover:	false
	// });
	var viewingSet = 1;

	$('.bottomNext').click(function(e){

		if(viewingSet === 1){
			$('#cardDeck').not(':animated').animate({
				scrollLeft:'+=620px'
			}, 1000, function(){
				viewingSet = 2;
			});
		}else{
			return false;
		}
		e.preventDefault();
	});
	$('.bottomPrev').click(function(e){
		if(viewingSet === 2){
			$('#cardDeck').not(':animated').animate({
				scrollLeft:'-=620px'
			}, 1000, function(){
				viewingSet = 1;
			});
			
		}else{
			return false;
		}

		e.preventDefault();
	});

	$('.rotatorImg').hover(function(e){
		$(this).animate({
			top:'+=20px'
		}, 100)
    }, function(){
		$(this).animate({
			top:'-=20px'
		}, 100)    	
    });

	$('.fancy').fancybox();	
	$('.ourMenu').fancybox();
	//$('.btn_login').fancybox({
		//hideOnOverlayClick:false,
		//margin: 150,
		//width : 930, 
		//height : 600
	//});
	// $('.rightArrow').click(function(e){
	// 	e.preventDefault();
	// 	numOfSlides = 7;
	// 	boutique_ext_next();
	// 	// determine current slide
	// });

	// $('.leftArrow').click(function(){
	// 	boutique_ext_prev();	
	// });



    // TESTIMONIES //
    // truncate text
    $('.testimony_text').each(function(){
    	var myText = $(this).text(),
    	    newText;
    	if(myText.length > 75){
    		newText = myText.substring(0,80);
    		$(this).text(newText).append('...');	
    	}
    });
    // author privacy
    $('.author').each(function(){
    	var myText = $(this).text(),
    	    firstName,
    	    lastName,
    	    newText;

    	newText = myText.split(' ');
    	firstName = newText[0];
    	lastName = newText[1].substring(0,1) + '.';

    	$(this).text('- ' + firstName + ' ' + lastName);
    });
});

function showBubble(e,textIndex){
	var bubble = $('#bubble');

	bubble.css('display', 'block');

	bubble.css('top', e.clientY -200);
	bubble.css('left', e.clientX)
	bubble.text(textArray(textIndex))
}

function hideBubble(){
	var bubble = $('#bubble');
	bubble.fadeOut('fast');
}
function move_callback(anchor){ 
		numOfSlides = 7;	
		target.fadeOut('fast', function(){
			target.html(textArray[window.currentSlide-1]);
			target.css('display','block');
			target.fadeIn('fast');
		});
}









