jQuery.ajaxSetup ({  
	cache: false  
});
var ajax_load = '<img src="images/loading.gif" alt="Loading..." />';  
var loadUrl = '/ajax.asp';  

document.write('<style type="text/css">BODY{display:none}</style>');

jQuery(document).ready(function() {
	// TO FIX IE JQUERY FLICKER:
	// REVEAL BODY THAT WE HID WHEN THIS FILE WAS LOADED (line 7) 
	jQuery('body').css('display','block');

	// 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('#contentBackground H4 A:even').addClass('zebraEven');

// CLEAR LAST LI BORDER
	jQuery('.lined LI:last-child').css('border','none');

// CAPTURE AJAX BUTTONS
	jQuery('.buttonPrivacy').click(function () {
		revealDialog('privacy');
		return false;
	});
// SETUP VALIDATION
	jQuery('#formContact').validate();
	jQuery('#formArtist').validate();

// SETUP CORNERS
	jQuery('.corner').corner();
});

// DIALOG BOX WITH AJAX
function revealDialog(element){
	jQuery('BODY').css('overflow','hidden');
	jQuery('#ajax').load(loadUrl + ' #' + element, null, function(){
		if (element == 'contact') {
			jQuery('#ajax TABLE.zebra tr:even').addClass('zebraEven');
		}
			$('#ajax TABLE.zebra tr').mouseover(function() {
				$(this).addClass('zebraHover');
			});
			$('#ajax TABLE.zebra tr').mouseout(function() {
				$(this).removeClass('zebraHover');
			});

		// 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':'800px', '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());
});

















