﻿// Toggle functionality for comments
$(document).ready(function(){
	$('#comments-title-container').toggle(
		function(){
			// Show comments
			$('#comments-container').show();
			$('#comments-toggle-show').hide();
			$('#comments-toggle-hide').show();
		},
		function(){
			// Hide comments
			$('#comments-container').hide();
			$('#comments-toggle-show').show();
			$('#comments-toggle-hide').hide();
		}
	);
	// Automatically display comment thread if direct-linked
	// 7/13/11 part of change to make the default action to have the comment box open instead of closed
	//if(window.location.href.indexOf('#comment-')>-1 || window.location.href.indexOf('#comments')>-1){
	if(window.location.href.indexOf('#comment-')<1 || window.location.href.indexOf('#comments')<1){
		$('#comments-title-container').click();
	}
	 //-----------------------------------------------------------------------------------------------------
     //8/11/11 added alternate version of this function to be used on the main landing pages (event-view.tpl, show_view.tpl)
	$('#commentslanding-title-container-landing-page').toggle(
		function(){
			// Show comments
			$('#commentslanding-container-landing-page').show();
			$('#commentslanding-toggle-show-landing-page').hide();
			$('#commentslanding-toggle-hide-landing-page').show();
		},
		function(){
			// Hide comments
			$('#commentslanding-container-landing-page').hide();
			$('#commentslanding-toggle-show-landing-page').show();
			$('#commentslanding-toggle-hide-landing-page').hide();
		}
	);
	// Automatically display comment thread if direct-linked
	if(window.location.href.indexOf('#commentslanding-')>-1 || window.location.href.indexOf('#commentslanding')>-1){
		$('#commentslanding-title-container-landing-page').click();
	}
});
// Enable hand pointer on rollover
$("#comments-title-container").css("cursor","pointer");
$("#commentslanding-title-container-landing-page").css("cursor","pointer");
