// JavaScript Document

	

$(document).ready(function() {

		$("#tab-menu li").click(function(e){
			switch(e.target.id){
				case "tab-one":
					//change status & style menu
					$("#tab-one").addClass("active");
					$("#tab-two").removeClass("active");
					$("#tab-three").removeClass("active");
					//display selected division, hide others
					$("div.tab-one").fadeIn();
					$("div.tab-two").css("display", "none");
					$("div.tab-three").css("display", "none");
				break;
				case "tab-two":
					//change status & style menu
					$("#tab-one").removeClass("active");
					$("#tab-two").addClass("active");
					$("#tab-three").removeClass("active");
					//display selected division, hide others
					$("div.tab-two").fadeIn();
					$("div.tab-one").css("display", "none");
					$("div.tab-three").css("display", "none");
				break;
				case "tab-three":
					//change status & style menu
					$("#tab-one").removeClass("active");
					$("#tab-two").removeClass("active");
					$("#tab-three").addClass("active");
					//display selected division, hide others
					$("div.tab-three").fadeIn();
					$("div.tab-one").css("display", "none");
					$("div.tab-two").css("display", "none");
				break;
			}
			//alert(e.target.id);
			return false;
		});	
	
		$('.contact_form').ajaxForm(function(data) {
			if (data==1){alert('Please fill out the required fields to submit your enquiry.')}
			else if (data==0){alert('Your enquiry has been submitted. We will get back to your shortly.'); $('.contact_form').resetForm();}
		});
		
		$('.rotator') 
		.cycle({ 
			fx:     'fade', 
			speed:  'slow', 
			timeout: 0, 
			next:   '.more'
		});
		
		$(".fancybox").fancybox();

		
		
});	

$(document).ready(function(){
	$(".scroll").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();
		
		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;
		
		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];
		
		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;
		
		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
});

$(document).ready(function() {

  $('#tab-one').click(function(){

	  $('html, body').animate({
		  scrollTop: $(".taba").offset().top
	  }, 1000);

   });

  $('#tab-two').click(function(){

	  $('html, body').animate({
		  scrollTop: $(".taba").offset().top
	  }, 1000);

   });

	  $('#tab-three').click(function(){

	  $('html, body').animate({
		  scrollTop: $(".taba").offset().top
	  }, 1000);

   });

});


