jQuery.ajaxSetup ({  
	cache: false  
});
var ajax_load = '<img src="images/loading.gif" alt="Loading..." />';  
var loadUrl = '/ajax.asp';  

jQuery(document).ready(function() {
	jQuery("#nav").css('backgroundPosition','0px -2000px');
	//SPRITE SETUP
	jQuery('#nav LI').hover(function(){
		var tempIndex = parseInt($('#nav LI').index(this));
		jQuery("#nav").css('backgroundPosition','0px ' + -tempIndex*60 +'px');
	}, function() {
		jQuery("#nav").css('backgroundPosition','0px -2000px');
	});
	// SETUP DIALOG DIVS
	jQuery('#dialog').hide();
	jQuery('#dim').hide();
	jQuery('#dim').css('height', jQuery(document).height());
	jQuery('#dim').click(function() {
		jQuery('BODY').css('overflow','auto');
		jQuery('#dim').toggle();
		jQuery('#dialog').hide();
	});

	jQuery('.buttonDisclaimer').click(function () {
		revealDialog('disclaimer');
		return false;
	});

});

// DIALOG BOX WITH AJAX
function revealDialog(element){
	jQuery('BODY').css('overflow','hidden');
	jQuery('#ajax').load(loadUrl + ' #' + element, null, function(){
		// VALIDATE FORM THEN AJAX SUBMIT
		if (element == 'mainDoorway'){
			revealer();
		}
		var v = jQuery('#formContact').validate({
			submitHandler: function(form){
				jQuery(form).ajaxSubmit({
					target: "#ajax",
					success: function() { 
						//jQuery('#dialog').animate({borderWidth:'10px', width:'740px', height:'430px'},400);
						jQuery('#dialogWrapper').toggle();
						}  
				});
			}
		});
	});
	jQuery('#close').click(function () {
		jQuery('BODY').css('overflow','auto');
		jQuery('#dim').hide();
		jQuery('#dialog').css({'border':'0px solid #fff', 'width':'760px', 'height':'450px'});
		jQuery('#dialog').hide();

	});
	jQuery('#dialog').css('top', (jQuery(window).scrollTop() + 50) + 'px');
	jQuery('#dim').toggle();
	jQuery('#dialog').toggle();
}

// RESIZE DIM ON WINDOW CHANGE
jQuery(window).bind('resize', function(){
   jQuery('#dim').css('height', jQuery(window).height());
});

function revealer() {
	//jQuery('#revealerItemsBox').hide();
	jQuery('#revealerItemsAll').hide();
	jQuery('#revealerItemsBoxClose').click(function() {
			jQuery('#revealerItemsBox').animate({'left':'1000px'},200);
	});
	jQuery('#revealerItemsList LI').hover(function() {
			jQuery(this).addClass('hover');
		}, function() {
			jQuery(this).removeClass('hover');
		})
		.click(function() {
			var tempIndex = $('#revealerItemsList LI').index(this);
			var tempLI = $('#revealerItemsAll LI:eq('+tempIndex+')');
			jQuery('#revealerItemsBox DIV').html(tempLI.html());
			jQuery('#revealerItemsBox').animate({'left':'0px'},200);
			return false;
	});
}





















