$(function() {
	 var toggleLoading = function() { $('#loading').toggle() };
	
    $('#meta_form, #service_form, #service_update, #add_a_client').fancybox({
		'autoDimensions' : false,
		'width' : 650,
		'height' : 520,
		'modal' : true,
		'overlayOpacity' : 0.8
	});
	
	$('.close_modal').live('click', function(){
		parent.$.fancybox.close();
		return false;
	});
	
	$('a#design').hover( function(){

		$('div.design span').css('background', 'url(http://upfrontconsultants.com/wp-content/themes/themes/Dark-Elegance/images/sprites.png) no-repeat -550px -201px');
		$('div.design_desc').fadeIn(1000);
	}, function (){
		$('div.design span').css('background', 'url(http://upfrontconsultants.com/wp-content/themes/themes/Dark-Elegance/images/sprites.png) no-repeat -550px -80px');
		$('div.design_desc').hide();
	});
	
	$('a#seo').hover( function(){

		$('div.seo span').css('background', 'url(http://upfrontconsultants.com/wp-content/themes/themes/Dark-Elegance/images/sprites.png) no-repeat -800px -200px');
		$('div.seo_desc').fadeIn(1000);
	}, function (){
		$('div.seo span').css('background', 'url(http://upfrontconsultants.com/wp-content/themes/themes/Dark-Elegance/images/sprites.png) no-repeat -800px -80px');
		$('div.seo_desc').hide();
	});
	
	$('a#development').hover( function(){

		$('div.development span').css('background', 'url(http://upfrontconsultants.com/wp-content/themes/themes/Dark-Elegance/images/sprites.png) no-repeat -1100px -200px');
		$('div.development_desc').fadeIn(1000);
	}, function (){
		$('div.development span').css('background', 'url(http://upfrontconsultants.com/wp-content/themes/themes/Dark-Elegance/images/sprites.png) no-repeat -1100px -80px');
		$('div.development_desc').hide();
	});
	
	$('#activate, #deactivate').bind('ajax:loading',  toggleLoading).bind('ajax:complete', toggleLoading);
	$('#add_a_client').live('click', function(){
		$('#embedded_client').show();
		return false;	
	});
	
	$('#service_has_associated').change( function(){
		if ($(this).val() == true ){
			$('#work_list').show();
		} else {
			$('#work_list').hide();
		}
	});
});
