$(document).ready(function(){

$(function() {
	$(document).ready(function(){
        // clear input on focus, if still in default
        $("input").focus(function() {

          if($(this).val()==$(this).attr("value")) {
            $(this).val("");
          }
        });

        // if field is empty afterward, add text again
        $("input").blur(function() {
          if($(this).val()=="") {
            $(this).val($(this).attr("value"));
          }
        });

      });
      
	$(document).ready(function(){
        // clear textarea on focus, if still in default
        $("textarea").focus(function() {

          if($(this).val()==$(this).attr("value")) {
            $(this).val("");
          }
        });

        // if field is empty afterward, add text again
        $("textarea").blur(function() {
          if($(this).val()=="") {
            $(this).val($(this).attr("value"));
          }
        });

      });
});

//
var numRand = Math.floor(Math.random()*4);
		
		    $('.mast').cycle({
				speed: 200,
				fx: 'blindY',
				timeout: 8000,
			    pager: '#teamnav',
			    startingSlide: numRand,
			    pagerAnchorBuilder: pagerFactory});
			    
			function pagerFactory(idx, slide) {
        		var n = $('.team img:eq('+idx+')').attr("alt");
        		return '<li><a href="#">'+n+'</a></li>';
        	}
		

//
$("#formcontain").css("height","680px");
		
		$('#form_tab').hover(
			function(){
				$('.navlinks').css("z-index", "198");
				$("#formcontain").css("height","780px");
			},
			function(){
				var pos = $("#formholder").position();
				if (pos.top <= 20){
					$('.navlinks').css("z-index", "200");
				}
				if (pos.top < 240){
					$("#formcontain").css("height","680px");
					
				}
				
			});
		
		$('#close').mousedown(function(){

					$('#formholder').animate({top: "0px"}, 400,function(){$('.navlinks').css("z-index", "200");});
					
				});	
			
		$('#formholder').draggable({ containment: 'parent', handle: '#form_tab', axis: 'y', cursor: 'pointer' });
		
		
//		
	$(function() {
		$('.bookmark').hover(function(){
			$(this).contents().find('img').animate({paddingBottom: "8px"}, 200);
		},function(){
			$(this).contents().find('img').animate({paddingBottom: "1px"}, 200);
		});
		
		$('.servlinks a').hover(function(){
			$(this).animate({paddingBottom: "8px"}, 200);
		},function(){
			$(this).animate({paddingBottom: "3px"}, 200);
		});
		
		$('.servlinks2 a').hover(function(){
			$(this).animate({paddingBottom: "8px"}, 200);
		},function(){
			$(this).animate({paddingBottom: "3px"}, 200);
		});
		
	});
	
//
$('#slider').draggable({ containment: 'parent', axis: 'x', cursor: 'pointer' });

});