$(document).ready(function(){

	var positions = ['50px','263px','473px'];
		
	var circle1 = $('.service-outline .circle-1');
	var circle2 = $('.service-outline .circle-2');
	var circle3 = $('.service-outline .circle-3');
	
	var effect = 'easeInBack';
	var effect2 = 'easeOutBack';
	
	var speed = 400;

	$('.service-outline').hover(function(){
		
		positions.sort(function() {return 0.5 - Math.random()}) //Array elements now scrambled
		circle1.stop(true,true).animate({'left':positions[0]}, {easing: effect, duration: speed });
		circle2.stop(true,true).animate({'left':positions[1]}, {easing: effect, duration: speed });
		circle3.stop(true,true).animate({'left':positions[2]}, {easing: effect, duration: speed });
		
	},function(){
	
		positions.sort(function() {return 0.5 - Math.random()}) //Array elements now scrambled
		circle1.stop(true,true).animate({'left':positions[0]}, {easing: effect, duration: speed });
		circle2.stop(true,true).animate({'left':positions[1]}, {easing: effect, duration: speed });
		circle3.stop(true,true).animate({'left':positions[2]}, {easing: effect, duration: speed });
	
	});
});





/* - BACK TO TOP BUTTON SLIDER
---------------------------------------------- */
$(document).ready(function(){
	$('#to-top-button').hide();
	
	var offset = $(document).scrollTop();
	var offsetBottom = offset + ($(window).height() - 60);
		
	$('#to-top-button').css({
		'top':offsetBottom
	});
	if(offset > 10){
		$('#to-top-button').fadeIn(900);	
	}
	$(window).scroll(function(){
		
		var offset = $(document).scrollTop();
			offsetBottom = offset + ($(window).height() - 60);
		
		if(offset > 1){
			$('#to-top-button').fadeIn(900);	
		}
		else{
			$('#to-top-button').fadeOut(900);	
		}
			
		$('#to-top-button').animate({
			top:offsetBottom
		},{duration:500,queue:false});
	});
});


$(document).ready(function() {
	$('.portfolio-container ul li a').fancybox({
		padding:5,
		overlayColor:'#000',
		overlayOpacity:0.6
	});
	
});


$(window).load(function() {
	$('.banner-top').nivoSlider({
        effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices: 18, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:4000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:false, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:false, // Stop animation while hovering
        manualAdvance:false // Force manual transitions
	});
	$('.client-list').bxSlider({
		speed:600,
		auto:false,
		pause:5000,
		easing:'easeInBack'
	});
	$('.highlights').bxSlider({
		speed:400,
		auto:true,
		pause:8000,
		easing:'easeInBack'
	});
	
});



$(document).ready(function(){
	$('input, textarea').focus(function(){
	    var elm = $(this),
	        value = elm.val(),
	        old = elm.data("placeholder");       
	    if (typeof old === "undefined"){
	        elm.data("placeholder", value);
	        old = value;
	    }
	    if (old == value){
	        elm.val("");
	    }
	}).blur(function() {
	    var elm = $(this);
	    if(elm.val() == ""){
	        elm.val(elm.data("placeholder"));
	    }
	});
});  
