$(function() {

    /*
	$(document).pngFix();
	*/
	
	$('#res-adv-search').click(function() {
		$(this).hide();
		$('#adv-search').slideDown("slow");		
		return false;
	});
	$('#res-simp-search').click(function() {
		$('#adv-search').slideUp("slow",function() { $('#res-adv-search').show(); });		
		return false;
	});
	$('.follow-link').initializeFollowing();
	
	
	/*------- Interior Flash ----------*/
	//$("#dhr-flash").flash( {src:"http://www.destinationhotels.com/flash/branding/flash_logoDhr.swf?link=sunriver-resort", width:250, height:25, wmode:"transparent", quality:"high", allowscriptaccess:"always"}, {version:"7"});
	
	
	$('.form-help').hide();
	$('.help-link').toggle( function() {
		$(this).parents('.field').children('.form-help').show();
		return false;
	},function(){ 
	  $(this).parents('.field').children('.form-help').hide();
	  return false;
	});
	
	
	//Shows and hides disclaimer info for photo submission
	$('div.terms').hide();
	$('a.toggle').toggle(function(){ 
	  $(this).parents('li').children('.terms').show();
	  return false;
	},function(){ 
	  $(this).parents('li').children('.terms').hide();
	  return false;
	});

	if(BROWSER=='msie6') {
		$('#nav > ul > li').hover(
			function() { $(this).addClass('hover'); },
			function() { $(this).removeClass('hover'); }
		);					
	}
	
	$('#nav > ul > li').hover(
		function() { $(this).children('ul').hide().fadeIn(300); },
		function() { $(this).stop().children('ul').hide(); }
	);


	// Share Functionality
	$('.share-link').click(function(event) {
		event.preventDefault();
		$('.share-panel').hide();
		$(this).parents('.rss-item').find('.share-panel').css('display','inline');
	});
	$('.share-close').click(function(event){
		event.preventDefault();
		$(this).parents('.rss-item').find('.share-panel').slideUp('fast');
	});

});

(function($) {

	$.fn.initializeFollowing = function() {
		return this.each(function() {
			$('.follow-link').click(function(event) {
				event.preventDefault();
				$('.follow-panel').hide();
				$(this).siblings('.follow-panel').css('display','inline');
			});
			$('.follow-close').click(function(event){
				event.preventDefault();
				$(this).parent('.follow-panel').slideUp('fast');
			});
		});
	};

})(jQuery);

