/*
        *************************************************************
           
		   Site Developer:  Michael Duddles - Sept, 2011 

       **************************************************************
*/


jQuery(function($){

// crossfades for service icons
	$(".service_icon2").each(function (i, element) {
		var src = $(element).find("img").attr("src").replace(".png", "-hover.png");
		$(element).css({background: "url("+src+") no-repeat 0px 0px"});
		$(element).hover(function(){
			$(this).find("img").animate({opacity: 0}, 200);
		}, function(){
			if($(this).find("img:animated").size() == 0){
				$(this).find("img").animate({opacity: 1}, 200);
			} else {
				$(this).find("img").stop().animate({opacity: 1}, 200);
			}
		});
	});
	
	
// crossfades for buttons
	$(".main-button").each(function(i, element){
		var hover = $(element).clone().css({
			"background": "url(images/main-button-hover.jpg) no-repeat",
			"position": "relative", 
			"top": "-44px", 
			"z-index": "5", 
			"opacity": "0", 
			"margin-bottom": "-44px"
		});
		$(element).after(hover);
		$(element).next().hover(function(){
			$(this).animate({opacity: 1}, 200);
		}, function(){
			if($(this).is(":animated")){
				$(this).stop().animate({opacity: 0}, 200);
			} else {
				$(this).animate({opacity: 0}, 200);
			}
		});
	});
});
