var SP = SP || {};
SP.Forms = {};
SP.Banners = {};
SP.Tabs = {};
SP.Media = {};

SP.Forms.setSubmitButton = function() {
	var button = jQuery("form a.button");

	button.click(function(e) {
		e.preventDefault();
		jQuery(this).parents("form:first").submit();
	});
}

SP.Forms.setInquiry = function() {
	var fixed = jQuery("#inquiry fieldset.when p label input.fixed");
	var other = jQuery("#inquiry fieldset.when p label input").not(".fixed");

	fixed.parent().next().hide();

	if(fixed.is(":checked")) {
		fixed.parent().next().show();
	}
	
	fixed.click(function() {
		fixed.parent().next().show();
	});

	other.click(function() {
		fixed.parent().next().hide();
	});

}

SP.Banners.setBannerRotation = function() {
	jQuery("#content-header").scrollable();
}

SP.Tabs.setTabs = function() {
	jQuery("ul.tabs").tabs("div.panes > div");
}

SP.Media.setGallery = function() {
	jQuery("a[rel^='prettyPhoto']").prettyPhoto({
		default_width: 500,
		default_height: 344,
		theme: 'facebook'
	});
}
