﻿$(document).ready(function() {
	$(function() {
		var zIndexNumber = 1000;
		$("div").each(function() {
			$(this).css("zIndex", zIndexNumber);
			zIndexNumber -= 10;
		});
	});
	
	$("#footer").footer();
	
	$("#navigation UL").lavaLamp({
		fx: "backout",
		speed: 700
	});
	
	$("#slider").nivoSlider({ animSpeed:500, pauseTime: 3000, controlNav: false });
	
	$(".parallax-layer").parallax({
		yparallax: false
  	});

	if($.browser.msie != true) {
		$(".fade-content").hover(function() {
			$(this).fadeTo("slow", 1.0);
		}, function() {
			$(this).fadeTo("slow", 0.4);
		});
	}
	 
	$(function() {    
  
		//Get the height of the first item  
		$('#mask').css({'height':$('#tab-1').height()});    
		  
		//Calculate the total width - sum of all sub-panels width  
		//Width is generated according to the width of #mask * total of sub-panels  
		$('#tab-container').width(parseInt($('#mask').width() * $('#tab-container div').length));  
		  
		//Set the sub-panel width according to the #mask width (width of #mask and sub-panel must be same)  
		$('#tab-container div.tab-content').width($('#mask').width());  
		  
		//Get all the links with rel as panel  
		$('a[rel=tab-container]').click(function () {  
			$(this).css("outline", "none");
			//Get the height of the sub-panel  
			var panelheight = $($(this).attr('href')).height();  
			  
			//Set class for the selected item  
			$('a[rel=tab-container]').removeClass('current');  
			$(this).addClass('current');  
			  
			//Resize the height  
			$('#mask').animate({'height':panelheight},{queue:false, duration:500});           
			  
			//Scroll to the correct panel, the panel id is grabbed from the href attribute of the anchor  
			$('#mask').scrollTo($(this).attr('href'), 300);
			  
			//Discard the link default behavior  
			return false;  
		});  
	});
	
	$(function() {    
		$("#form1").ajaxForm(function() { 
			$("#form1")[0].reset();
			$("#message-sent").css("display", "block");
		}); 
	});
});

function setCurrent(crr) {
	$("#navigation LI.current").removeClass("current");
	$("#" + crr).addClass("current");
}
