$(document).ready(function() {				   
	Cufon.replace('#header ul li a', {hover: true });
	$(".jq_hidden").hide();
	$("label.overlabel").overlabel();
	$('input[type=text]').addClass('text');
  $('input[type=submit]').addClass('submit');
  

   $('ul.flip').cycle({ 
     prev:    '#prev', 
     next:    '#next',
     fx:      'scrollHorz'
   });
  
  if ($('#slideshow').length && jQuery().cycle ) {
     $('#slideshow').cycle({ 
        fx:     'fade', 
        speed:   300, 
        timeout: 7000, 
        pagerEvent: 'mouseover',
        pauseOnPagerHover: true,
        pager:  '#quatro',
        pagerAnchorBuilder: function(idx, slide) {
           return '#quatro li:eq(' + (idx) + ') a';
        },
        updateActivePagerLink: function(pager, currSlideIndex) { 
             $("#quatro li a").stop().animate({	
    						"margin-top": "0px",
    						"height": "127px"						
    						}, 500);
            $('#quatro li:eq('+currSlideIndex+') a').stop().animate({	
    						"margin-top": "-38px",
    						"height": "165px"						
    						}, 200);
        }
      });	
  }
  
	$("#quatro a").hover(
		function() {
		$(this).stop().animate({	
						"margin-top": "-38px",
						"height": "165px"						
						}, 200);
	},
	function() {	  
		$(this).stop().animate({
						"margin-top": "0px",
						"height": "127px"
						}, 500);
	});
	
	$("#quatro a").click(function() {
      window.location = $(this).attr("href");
  });
	

  
  $('ul.people a').live('click', function(e){
        var target = $(this).attr('href');
        var id = $(this).data('memberId');
        $("img.ajax-loader").show();
        
       $('#ajax_load').load(target+' #content_load', function(response, status, xhr) {
        if (status == "error") {
          var msg = "Sorry but there was an error: ";
          $(this).html(msg + xhr.status + " " + xhr.statusText);
        }
        else {
          $('ul.people li').removeClass('active');        
          $('ul.people li').each(function() {
            if($("a", this).data('memberId') == id) {
                $(this).addClass('active');
            }          
          });
        }
        $("img.ajax-loader").hide();
      });       
        e.preventDefault();
		    e.stopImmediatePropagation();
		    window.scrollTo(0,0);
    });	
    //load the first member
    $('body.about-us ul.people li:eq(0) a').trigger('click');
    




    $('a[data-confirm]').live('click', function(e){
	    if (confirm($(this).data('confirm'))) {
		    this.href += '&confirmed=1';
	    } else {
		    e.preventDefault();
		    e.stopImmediatePropagation();
	    }
    });	


});

