$(function() {
	// Replace tagged images with the proper Flash files
	$('.column_left li.widget_ote_image, div.rotator').flash({
		src: '/wp-content/themes/blackwood/flash/photos.swf',
		width: 326,
		height: 335,
		wmode: 'transparent'
	});

	$('body.location li.widget_ote_image, body.contact li.widget_ote_image').flash({
		src: '/wp-content/themes/blackwood/flash/map.swf',
		width: 326,
		height: 335,
		wmode: 'transparent'
	});

	$('body.press li.widget_ote_image').flash({
		src: '/wp-content/themes/blackwood/flash/press.swf',
		width: 326,
		height: 335,
		wmode: 'transparent'
	});


	// Style headers to prep them for sIFR
	$("h2").css({
		height: '20px',
		width: '474px',
		margin: '25px -10px .5em'
	});

	$("body.menu .column_left h2, body.cellar .column_left h2").css({
		float: 'right',
		width: '254px',
		margin: '12px 0 .5em -10px'
	});

	if ($.browser.msie) {
		$("body.menu .column_left h2, body.cellar .column_left h2").css({ width: '234px' })
		$("body .column_right h2").css({ width: '454px' })
		$("body.menu .column_left h2").css({ "margin-top": '25px' })
	};

	$("body.menu .column_left h3, body.cellar .column_left h3").css({
		height: '17px',
		margin: '12px 0 .5em -10px'
	});

	$("body.menu_page .column_left h2, body.menu_page .column_left h3").css({
		"margin-top": '25px'
	});

	$("body.events .column_right h2").css({
		"margin-bottom": '1.5em'
	});

	$("body.events .column_right h3").css({
		height: '17px'
	});

	// Exchange headers for Flash movies (sIFR)
	$('h2').sifr({
		strSWF: '/wp-content/themes/blackwood/flash/sifr.swf',
		strWmode: 'transparent'
	});

	$('body.events .column_right h3').sifr({
		strSWF: '/wp-content/themes/blackwood/flash/sifr.swf',
		strColor: "#6a290c",
		strWmode: 'transparent'
	});

	$('body .column_right h3, body.menu .column_left h3, body.cellar .column_left h3, body.menu_page .column_left h3').sifr({
		strSWF: '/wp-content/themes/blackwood/flash/sifr.swf',
		strWmode: 'transparent'
	});

	// Activate Datepicker for 12all form
	$('form.oted_12allform_form input.date').attachDatepicker({
		yearRange: '-100:0',
		dateFormat: 'mm/dd/yy',
		closeAtTop: false
	})
	
	// Add "Back to top" links"
	$('body.menu h3').after('<a href="#menu_top" class="back_to_top">Back to Top</a>');
});
