$(function(){

	var panelOpen = function(ele){
		ele.attr('src', '/images/icons/ico-arrow-up.gif');
		ele.next().children('.expanderText').html('Click to close');

	}
	var panelClose = function(ele){
		ele.attr('src', '/images/icons/ico-arrow-down.gif');
		ele.next().children('.expanderText').html('Click to open');
	}
	
	$('.comCommentLink').click(function(){
		var parentdiv = $(this).parent();
		var unclediv = parentdiv.siblings();
		parentdiv.toggleClass("hidden");
		unclediv.toggleClass("hidden");
		var parentdiv = null;
		var unclediv = null;
		return false;
	});
	
	$('.expander,.expanderText').click(function(){
		if ($(this).hasClass('expanderText')){
			var sib = $(this).parent().siblings('ul')
			if (sib.hasClass('hidden')){
				sib.slideDown().toggleClass('hidden');
				panelOpen($(this).parent().prev());
			}else{
				sib.slideUp().addClass('hidden');
				panelClose($(this).parent().prev());
			}
			var sib = null;
			return false;

		}else if($(this).hasClass('expander')){
			var sib = $(this).siblings('ul')
			if (sib.hasClass('hidden')){
				sib.slideDown().toggleClass('hidden');
				panelOpen($(this));
			}else{
				sib.slideUp().addClass('hidden');
				panelClose($(this));
			}
			var sib = null;
		}
	});
	
	$('#chkOtherswhy').click(function(){
		$(this).parent().siblings('#txtOtherswhy').toggle();
	});
	$('#chkOthers').click(function(){
		$(this).parent().siblings('#txtOthers').toggle();
	});
	
});