// Common site functions and variables

/**********************************************************************/
//! Variables

// Options passed into modal windows
var modalOptions = {
	'opacity':80,
	'overlayCss':{backgroundColor:'#000'}
}


/**********************************************************************/
//! AJAX modal window

// Set up AJAX
function modal(url, data) {
	if (data==null) data={};
	$.post(url, data, modalResponse);
} // End function modal()

// Process response
function modalResponse(data) {
	if (data) {
		// Close existing modal, if any
		$.modal.close();

		// Set up new modal
		$('#modal-content').html(data);
		$('#modal').modal(modalOptions);
	}
} // End function modalResponse()

// Close modal window
function closeModal() {
	$.modal.close();
} // End function closeModal()


/**********************************************************************/
//! FAQ show/hide

function faqSlider() {
	$('.faq dd').hide(); // Hide answers
	if ($.browser.msie && parseInt($.browser.version)==8) {
		// IE8 glitch: inline-block causes the content to get CUT OFF, so this is the hack-fix
		$('.faq').parent().css({'display':'block', 'float':'left'});
	}
	$('.faq dt').css('cursor','pointer').click(function() {
		// Close all the rest
		$('.faq dd').hide();

		// Toggle answer
		$(this).next().slideToggle();
	});
} // End function faqSlider()

