$(function() {
	//Documentation located in special.docs.js

	$(document).pngFix({
	    blankgif:'/images/blank.gif'
	});

	$('div#content h1').sifr(
		{ strSWF: '/flash/scala-sans-ot.swf', strColor: '#aace2c', strLinkColor: '#aace2c', strHoverColor: '#aace2c', strWmode: 'transparent', strCase: 'upper' },
		{ expressInstall: true }
	);

	$('div#sidebar h3').sifr(
		{ strSWF: '/flash/scala-sans-ot.swf', strColor: '#c3d941', strLinkColor: '#c3d941', strHoverColor: '#c3d941', strWmode: 'transparent', strCase: 'upper' },
		{ expressInstall: true }
	);

	$('div#home-push h3').sifr(
		{ strSWF: '/flash/scala-sans-ot.swf', strColor: '#c3d941', strLinkColor: '#c3d941', strHoverColor: '#c3d941', strWmode: 'transparent', strCase: 'upper' },
		{ expressInstall: true }
	);
	
	/*$('ul#nav-primary > li.current').each(function() {
		$(this).children('ul').hide().animate({height: 'show'}, 1000); //.remove().clone(true).prependTo('#nav-primary')										 
	});*/

	//MSN Map
	var openFn=function(hash){
		hash.w.show();
		var difference = $(window).width() - $('#msnmap-wrapper').width();
		difference = difference / 2;
		$('#msnmap-wrapper').css({left:difference+275,top:$(window).scrollTop()+10});
		$('#map').msnMap({listView:true});
	};
	var hideFn=function(hash){
		hash.w.hide()
		hash.o.remove();
		$('.places').remove();
	};
	$("#view-map-btn").each(function() {
		$('body').append($('.jqmWindow'));
		$('#msnmap-wrapper').jqm({trigger:'#view-map-btn a', onShow: openFn, onHide: hideFn});
	});

	// Hover effect for submit button on forms
	$("form.standard .buttons input").hover(function() {
		$(this).attr("src","/images/layout/btn-submit-on.gif");
	}, function() {
		$(this).attr("src","/images/layout/btn-submit.gif");
	});


	//Flashes


	$("body.home div#masthead").flash(
		{src:"flash/new-forest-luxury-hotel.swf",
		 width:727,
		 height:508,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"},
			function(htmlOptions) { //Use this to specify a query string, take out if not needed.
				htmlOptions.flashvars.xmlPath = "/flash/xml/home-masthead.xml";
                htmlOptions.flashvars.flvPath = "/flash/flvs/limewood.flv";
				$(this).html($.fn.flash.transform(htmlOptions));
		});

	$("div#photo-gallery-flash").flash(
		{src:"flash/photo-gallery.swf",
		 width:668,
		 height:496,
		 wmode:"transparent",
		 allowFullScreen:"true",
		 quality:"high"},
		 {version:"8"},
			function(htmlOptions) { //Use this to specify a query string, take out if not needed.
				htmlOptions.flashvars.xmlPath = "/flash/xml/images.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		});


	// IE required red triangle fix
	ie = /*@cc_on!@*/false;

	if ( ie ) { 
    	var els = $('select.required', this ); 
        els.each(function() { 
			var img = $('<img class="ie-icon-required" src="/images/icon-required.gif"/>'), p = $(this).parents('.field'); 
            $(this).after( img ); 
        }); 
    } 

	/* adds "odd" class to odd rows in tables */
	$("table tr:nth-child(odd)").addClass("odd");

	$('#instructions-map').toggle(function(e){
	    e.preventDefault()
	    $(this).next().show();
	    $(this).addClass('toggle')
	}, function(e){
	    e.preventDefault()
	    $(this).removeClass('toggle')
	    $(this).next().hide();
	});

});
