// JavaScript Document

$(document).ready(function() {
//Hide No Announcements Found Message
  	$('p:contains("No announcements found.")').addClass('hidden');
//Hide Empty Web Apps
	$('div.webApp:contains("No items found.")').addClass('hidden');
//Hide Empty Items Within Wedding Info & Contact Info App Fields	
	$('dd:empty').addClass('hidden');
	$('dt#ceremonyTime:empty').addClass('hidden');
//Add labels to Wedding Info & Contact Info App Fields When they Are Filled
	$('dd#photographer:not(:empty)').before('<dd class="listSubTitle">Photographer</dd>');
	$('dd#videographer:not(:empty)').before('<dd class="listSubTitle">Videographer</dd>');
	$('dd#caterer:not(:empty)').before('<dd class="listSubTitle">Caterer</dd>');
	$('dd#coordinator:not(:empty)').before('<dd class="listSubTitle">Wedding Coordinator</dd>');
	$('dt#ceremonyTime:not(:empty)').prepend('Ceremony | ');
	$('span#receptionTime:not(:empty)').prepend(' | ');
	$('dd#altContact1:not(:empty)').before('<dt class="listTitle">Alternative Contact 1</dt>');
	$('dd#altContact2:not(:empty)').before('<dt class="listTitle">Alternative Contact 2</dt>');
//Add couple's names under their picture when a picture is uploaded, or remove the picture holder if none is uploaded.
 	$('img.couplesPhoto[src*="ourwedding"]').after($('span#bridesFirstName').text()+" and "+ $('span#groomsFirstName').text());
	$('img.couplesPhoto[src=""]').addClass('hidden');
//Remove the 2nd line break that BC generates inside Request Form elements within text areas.
	$('div#TabbedPanels2 .TabbedPanelsContent br:nth-child(2)').remove();
//Remove the line breaks that BC automatically inserts between different elements inside Request Form text areas.
	$('div#TabbedPanels2 .TabbedPanelsContent > br').remove();
//Remove the line breaks that BC automatically inserts inside of lists before the first and after the last li in the Request Form text areas.
	$('div#TabbedPanels2 .TabbedPanelsContent ul > br').remove();
	$('div#TabbedPanels2 .TabbedPanelsContent ol > br').remove();

// Tabs Code that sets Tabs and remembers the last tab using a cookie (This Code Works Fine)
	$('#tabs,#tabsRequests').tabs({
		cookie:{}
	});

// Call custom dialog with Accordion Plugin.  
	$('.accordionDialog').click(function() {
		$(this).accordionDialog();
		return false;
	});
  
// Open JQuery DatePicker on Contact Us Page
    $('#Anniversary1').datepicker();
	
// Page Loading Image Removal
// 	$(window).load(function() {
//	$('#loading-image').show();
//	});

//Final Brackets to close Document Ready Function
})

