// JavaScript Document
$(document).ready(function(){
	
	var UL = $("#menu > ul");
	var WIN = $("#frames");
	var LiHeight = $("#menu ul li").height();
	var WinHeight =  $("#window").height();
	$(UL).css( {backgroundPosition: "0 0"} )

		/*
		alert($("#tab1").height());
		alert($("#tab2").height());
		alert($("#tab3").height());
		alert($("#tab4").height());
		alert($("#tab5").height());
		*/

	$("#menu ul li").click(function(){
		

		
		var NrOrder = $(this).index();
		var bgPos = NrOrder * LiHeight;
		
		var winPos = NrOrder * WinHeight + 10 * NrOrder;

		//alert(WinHeight);
		$(UL).animate({backgroundPosition: '0px ' + bgPos + 'px'}) 
		
		$(WIN).animate({marginTop: "-" + winPos + "px"}, 1000);
   

		return false;
	});
	
	$('#CForm').ajaxForm({success: ContactResult});
	
	//Contact form
	$("#SendForm").click(function(){
		$.blockUI({ message: $('#CaptchaBox')});
		return false;
	});

	$('#SendCaptcha').click(function(){
		$.unblockUI();
		$('#FCaptcha').val($("#Captcha").val());
		$('#CForm').submit();
	});
	
});
function ContactResult(responseText, statusText, xhr, $form)
{
	if (responseText == 1)
	{
		$("#contform").html('<p>Thanks so much for being in touch. You\'ll get a lickety-split, lightening-fast response.<BR> In the meantime, keep thinking big!</p>');
	}
	else
	{
		alert(responseText);
	}
}
