$(document).ready(function(){

$('input[type=text]').focus(function(){ 
	if($(this).val() == $(this).attr('defaultValue'))
	{$(this).val('');}
});

$('input[type=text]').blur(function(){
	if($(this).val() == '')
	{$(this).val($(this).attr('defaultValue'));} 
});

$('input[type=password]').focus(function(){
	if($(this).val() == $(this).attr('defaultValue'))
	{$(this).val('');}
});

$('input[type=password]').blur(function(){
	if($(this).val() == '')
	{$(this).val($(this).attr('defaultValue'));} 
});



/*
$('#left-nav li a').click(function(){
	$(this).parent().find('ul').toggle('fast');
	return false;
});
*/




/* Home Page Masthead */
$('#slider').cycle({
    timeout:  5000,
    prev:    '#prev',
    next:    '#next',
    pause: true
});

$('#pause').live('click', function() {
    $('#slider').cycle('pause');
    $(this).before('<a href="#" id="resume">Resume</a>');
    $(this).remove();
    return false;
});

$('#resume').live('click', function() {
	// Live handler called.
	$('#slider').cycle('resume');
	$(this).before('<a href="#" id="pause">Pause</a>');
    $(this).remove();
	return false;
});



// Home Page accordian menu
$('.service-list li a.list-link').click(function(){
	sublist = $(this).parent().find('.sub-list');
	$('.open').parent().find('.sub-list').slideUp();
	$(this).addClass('open');
	if ($(sublist).is(':animated')){
		//nothing
	} else {
		sublist.slideToggle();
	}
	return false;
});






/*
	
	; ;
	
	var speed = 600,
    closeAnimationPositions = [ 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2 ],
    closeSpeed = Math.round(speed / closeAnimationPositions.length),
	
    close = $('.service-list li a').click(function(e) {
      e.preventDefault();
      var positions = closeAnimationPositions.slice(0);
      
      //if there is one already open, close it first. 
      if ($('a').hasClass('open-list')){
      	$('.open-list').parent().find('.sub-list').slideUp();
      	positions.reverse();
      	// animate the image
	      $(positions).each(function(i, position) {
	        var offset = position * -16;
	        setTimeout(function() {
	          $('.open-list').css({ backgroundPosition: "0 " + offset + "px" });
	          if (i == 10 && hide == true){     
	        	//ok the animation finished. and it's closed. lets restart. 	
	        	$('.open-list').removeClass('open-list');
	          }
	        }, i * closeSpeed);
	                  
	        
	      });
      } else {
      
      }
      
      //determine which order the animation plays
      if ($(this).hasClass('open-list')){
	  	positions.reverse();	  	
	  	hide = true;
	  } else {
	  	$(this).addClass('open-list');
	  	hide = false;
	  }
	  
	  sublist = $(this).parent().find('.sub-list');
	  
	  
	  // make sure it doesn't keep animating if it keeps getting clicked
	  if ($(sublist).is(':animated')){
	  	//console.log('double rainbow all the way');
	  } else {
	  	sublist.slideToggle(speed);
	  }
			 
	  
	  // animate the image
      $(positions).each(function(i, position) {
        var offset = position * -16;
        setTimeout(function() {
          $('.open-list').css({ backgroundPosition: "0 " + offset + "px" });
          if (i == 10 && hide == true){     
        	//ok the animation finished. and it's closed. lets restart. 	
        	$('.open-list').removeClass('open-list');
          }
        }, i * closeSpeed);
                  
        
      });
      
      
    });
*/






   

});
