$(function() {
	//Documentation located in special.docs.js

  
	$("#spring-modal").each(function() {
		var springModalWidth = ($(window).width()-$(this).width())/2;
		$(this).css('left',springModalWidth);
		$(this).css('top','70px');
		$(this).jqm({closeClass:'spring-close,'}).jqmShow();
	});


	/*
	Expanding List
	Page: dc-preferred-wedding-vendors.php
	Developer: frank.yoon@sabre.com, 9/30/11
	*/
	$('.slideToggleList>li>h3').click(function() {
		$('~ ul', this).slideToggle('fast', function() {
			if ($(this).parent().hasClass('slideToggled')) {
				$(this).parent().removeClass('slideToggled');
			}
			else {
				$(this).parent().addClass('slideToggled');
			}
		});
	});
	
	/*
	Form: includes/rfp.php
	Page: washington-dc-meeting-rfp.php
	Developer: frank.yoon@sabre.com, 10/11/11
	If respond by fax is selected, then set the fax number textfield to required. 
	If the fax number textfield is empty while being set to required, then also add focus to it.
	*/
	$('#contact-list input').change(function() {
		if($('#contact_fax').is(':checked')) {
			$('#fax').addClass('required');
			if(!$('#fax').val())
				$('#fax').focus();
		} else {
			$('#fax').removeClass('required');
		}
	});

	/*
	If Food & Beverage is required, then show the Hospitality and Banquet Requirements textfield. 
	*/
	$('#food-drink-required input').change(function() {
		if($('#food-drink-yes').is(':checked')) {
			$('#other_requirements').parent().css('display', 'block');
		} else {
			$('#other_requirements').parent().css('display', 'none');
		}
	});

	/*
	Form: includes/wedding-rfp.php
	Page: washington-dc-wedding-rfp.php
	Developer: frank.yoon@sabre.com, 10/11/11
	If respond by fax is selected, then set the fax number textfield to required. 
	If the fax number textfield is empty while being set to required, then also add focus to it.
	*/
	$('#services-list input').change(function() {
		if($('#contact_fax').is(':checked')) {
			$('#fax').addClass('required');
			if(!$('#fax').val())
				$('#fax').focus();
		} else {
			$('#fax').removeClass('required');
		}
	});

});

