// JavaScript Document
var loginDown = false;
var images = 6;
var current = 1;
var length = 500;
var blurbTitles =[
				  "Industry Practitioners",
				  "Measurable Results",
				  "Proven Delivery",
				  "Experienced Collaborators",
				  "Principled Leadership",
				  "Integrated Delivery"];
var blurbText =[
				  "We are industry practitioners. We are street wise. Our success is based on a been-there, done-that, hit the numbers, produced-the-results, know-how. No theories, no guesswork.",
				  "Measurement is simple. Did the revenues increase? Did the margins increase? Are the client-facing employees more inspired to do what is required? Are they more skilled? Did Alchemy Group impact your overall revenue performance? By how much?",
				  "You can always count on us. We are solid - we will be here. Our focus is helping you drive quarterly revenue this quarter and help you consistently meet market expectations in a principled way.",
				  "We are not single threaded and multiple threads are not easily broken. We serve as a catalyst. We win and sometime lose, together. We are committed to your success, just ask our clients.",
				  "We are grounded in timeless leadership principles. We have a strong sense of what is right, a belief, a respect, and strong corporate integrity. We do what we do with conviction and a sincere desire to serve other industry professionals.",
				  "Seamless delivery ensures the shortest time to benefit. Tightly integrated delivery with process optimization, integrated sales and marketing best practices, market research and education services."];
var currentTab="services";
var rotatecolors =[
				  "#e6ecec",
				  "#e6ecec",
				  "#e8f6ec",
				  "#789fb9",
				  "#fbf0e5",
				  "#204ab1"];


$(document).ready(function(){
						   
  // $(".image1").fadeOut("slow");
   //$(".image1").animate({"opacity": 0}, 1000, "" , function(){ alert("done")});
   $("#services_slide").easySlider({prevText: 'Back', nextText: 'More Services'});
   $("#roles_slide").easySlider({prevText: 'Back', nextText: 'More Roles', prevId: 'prevBtn2', nextId: 'nextBtn2'});
   $("#roles_list").hide();

    $(".rotater").css({"background":"url(http://www.alchemygroupinc.com/wp-content/themes/alchemy/library/media/images/rotate1.png) center no-repeat"});
	$(".blurb h3").text(blurbTitles[0]);
	$(".blurb p").text(blurbText[0]);
	
	$(document).everyTime(10000, function() {
										 
		if(current == images)
			current = 0;
			
		current++;
		
	  	$(".rotater").animate({"opacity": 0}, length, "" , function(){finishedFade()});
		$(".blurb h3").text(blurbTitles[current-1]);
		$(".blurb p").text(blurbText[current-1]);
		doCufon();
	})
	
	$(".tabs ul li .roles").click(function(){
		$(".tabs ul li .roles").css({"background-position":"top"});
		$(".tabs ul li .services").css({"background-position":"bottom"});
		currentTab = "roles";
		$("#services_list").fadeOut(500,function(){
			$("#roles_list").fadeIn(500);
			
		});						
	});
	$(".tabs ul li .roles, .tabs ul li .services").mouseover(function(){
					$(this).css({"background-position":"top"});						   
	});
	$(".tabs ul li .roles, .tabs ul li .services").mouseout(function(){
		
		if(currentTab == "services")
			$('.tabs ul li .roles').css({"background-position":"bottom"});
		if(currentTab == "roles")
			$('.tabs ul li .services').css({"background-position":"bottom"});
			
	});
	
	$(".tabs ul li .services").click(function(){
		$(".tabs ul li .services").css({"background-position":"top"});
		$(".tabs ul li .roles").css({"background-position":"bottom"});
		currentTab = "services";
		$("#roles_list").fadeOut(500,function(){
			$("#services_list").fadeIn(500);
		});						
	});
});

function doCufon(){
	Cufon.replace('.blurb h3');	
}
function finishedFade(){
	var background = "url(http://www.alchemygroupinc.com/wp-content/themes/alchemy/library/media/images/rotate" + current + ".png) center no-repeat";
	$(".rotater").css({"background":background});
	$(".rotaterBG").css({"background-color":rotatecolors[current-1]});
	$(".rotater").animate({"opacity": 1}, length, "");
	
	
}
