function inputBoxDefaultText(targ,deftext){
	if ($(targ).length > 0){
		
		$(targ).val(deftext);
		
		$(targ).click(function() {
			if($(this).val() == deftext){
				$(this).val('');			
			}
		});		
			
		$(targ).blur(function() {
			if($(this).val() == ''){
				$(this).val(deftext);
			}
		});	
	}
	
}

function beforeServicesSlider(curr,next,opts){
	var title = $(next).children('a').attr('title');
	var href = $(next).children('a').attr('href');
	var speed = opts['speed'] / 2;
	if(title != $('#services-ribbon h3').html()){
		$('#services-ribbon h3').fadeOut(speed,function(){
			$('#services-ribbon .find-out-more a').attr('href',href);
			$('#services-ribbon h3').html(title).fadeIn();
		});
		
	}
}

$(document).ready(function() {
	inputBoxDefaultText('#mc_signup_form input[type="text"]','Email Address')
	
	$('a[href^="http://"]').filter(function() {
		return this.hostname && this.hostname !== location.hostname;
	}).attr('target', '_blank');
	
	
    $('#services-slider').cycle({
		fx: 'fade',
		speed: 1000,
		pause: true,
		before: beforeServicesSlider,
		prev: '#services-slider-controls .prev',
		next: '#services-slider-controls .next',
	});
    
    $('#services-slider-controls a.toggle').click(function(){
    	$('#services-slider').cycle('toggle');
    	$(this).toggleClass('pause play');
    	return false;
    });
    
    var contactScrollAmount = $('#contact-dropdown').css('marginTop');
    $('#contact-us a').toggle(function() {
		$('#contact-dropdown').animate({
			marginTop: 0
		}, 
			1000
		);
	  return false;
	}, function() {
		$('#contact-dropdown').animate({
			marginTop: contactScrollAmount
		}, 
			1000
		);

	});

});
