$(document).ready(function(){
	$(function() {
    $('.navigation li').each(function() {
        if ( $(this).children('ul').size() > 0 ) {
            $(this).addClass('parent');
			$(this).append('<span></span>');
        }           
    });
});
$("a.switch").click(function(){
		$(this).toggleClass("alt");
		$("div#members").toggle(300);
		$("div#promo").toggle(300);
		});
 $('.navigation ul > li').hover(
        function () {
            $('ul', this).slideDown(100);
        }, 
        function () {
            $('ul', this).slideUp(100);         
        }
    );
 $('.navigation ul li ul').hover(
        function () {
            $(this).parent().find("a").slice(0,1).addClass("current");
        }, 
        function () {
           $(this).parent().find("a").slice(0,1).removeClass("current");       
        }
    );
	 $('.copyright a').hover(
        function () {
			$(this).find("span").animate({marginTop :'5px'}, 300);
            $(this).find("em").animate({opacity :1}, 300);
        }, 
        function () {
			$(this).find("span").animate({marginTop :'17px'}, 300);
          $(this).find("em").animate({opacity :0}, 300);    
        }
    );
	$(".ptables ul.green > li, #single ul.green > li").hover(function(){
		$(this).addClass("highlight");
		$('ul.green > li').not(this).removeClass("highlight");
	});
	$(".ptables ul.blue > li, #single ul.blue > li").hover(function(){
		$(this).addClass("highlight");
		$('ul.blue > li').not(this).removeClass("highlight");
	});
	$(".planstable > li").hover(function(){
		$(this).addClass("highlight");
		$('.planstable > li').not(this).removeClass("highlight");
	});
	$(".steps > li:not(.showing)").find("p").css({display :'none'});
	$(".steps > li").click(function(){
		$(this).addClass("showing");
		 $(this).find("p").slideToggle('fast', function() { });
		$('.steps > li').not(this).removeClass("showing");
		$('.steps > li').not(this).find("p").slideUp('fast', function() { });
	});
    $("#home .ptables .green").jcarousel({
		scroll: 1,
		visible: 4,
    });
	 $("#home .ptables .blue").jcarousel({
		scroll: 1,
		visible: 4,
    });
	$("#home #featuredrotate").jcarousel({
		scroll: 1,
		visible: 1,
    });
		 $('.jcarousel-next,.jcarousel-prev').hover(
        function () {
           $(this).animate({opacity: 1}, 100);
        }, 
        function () {
            $(this).animate({opacity: 0.7}, 300)        
        }
    );
	 $('#featured').cycle({ 
    fx:     'fade', 
    speed:   1200, 
    timeout: 0, 
	 pause:   1 
});
$('#goto1').click(function() { 
    $('#featured').cycle(0); 
    return false; 
}); 
 
$('#goto2').click(function() {  
    $('#featured').cycle(1);  
    return false;  
}); 
$('#goto3').click(function() {  
    $('#featured').cycle(2);  
    return false;  
}); 
$('#goto4').click(function() {  
    $('#featured').cycle(3);  
    return false;  
}); 
$('#goto5').click(function() {  
    $('#featured').cycle(4);  
    return false;  
}); 
     $(".options ul li a").click(function(){
		 $('.options ul li a').not(this).removeClass("active");
         $(this).addClass("active");
    });	
 $("#contact").validate({
    rules: {
      name: "required",    // simple rule, converted to {required: true}
      email: {             // compound rule
      required: true,
      email: true
      },
      message: {
        required: true
      }
    },
    messages: {
	  name: "x",
	  email: "x",
      message: "Please enter a message."
    }
  });
 $(".blogbox li").hover(function(){
		$(this).animate({paddingLeft: "30px"},300);
		},function(){
		$(this).animate({paddingLeft: "15px"},300);
		});
  	$("#contact").ajaxForm({
			target: '#error',
			success: function() {
			$('#error').animate({ opacity: 1 }, 400);
			}
		}); 
		$("#network a span").hover(function(){
        $('#network a span').not(this).stop().animate({ opacity: 0 }, 400);
        },function(){
        $('#network a span').not(this).stop().animate({ opacity: 1 }, 400);
        });
});
