$(document).ready(function(){
	var rootPath = "http://cimarroncreek.com/images/sitepics/medium/";
	// //////////////////////////////////////////////// 
    // contentAccordion
    $('div.contentAccordion h3').click(function() {
		//$(this).siblings('h3').addClass('closed');
		//$(this).siblings('div').slideUp('fast');
		//$(this).next('div').slideDown('fast');
		//$(this).removeClass('closed');
	});
	
	$("div.subAccordion h4").toggle(
		function(){	
			if ($(this).next('div').css('display') == 'block') {
				 $(this).next("div").slideUp(300);
				 $(this).addClass("closed");
			} else {
				  $(this).next("div").slideDown(300);
				  $(this).removeClass("closed");
			}
		},
		function() { 
			if ($(this).next('div').css('display') == 'block') {
				 $(this).next("div").slideUp(300);
				 $(this).addClass("closed");
			} else {
				  $(this).next("div").slideDown(300);
				  $(this).removeClass("closed");
			}
		}
	);
		
	$("div.photos a").lightBox();
	
	/* CONFIG */		
	var	xOffset = 10;
	var	yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		var t = $(this).attr('title');
		var noZoom = $(this).attr('rel');
		var title = "";	
		if (noZoom == 1) { 
			$("body").append("<p id='tooltip'>"+ t +"</p>");
		} else {
			$("body").append("<p id='tooltip'>"+ t +"<br/><span>Click To Zoom</span></p>");
		}
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },function(){
		$("#tooltip").remove();
    });	
	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
	
	/* CONFIG */		
	var	xOffset = 10;
	var	yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.hatchTip").hover(function(e){											  
		var t = $(this).attr('title');
		var noZoom = $(this).attr('rel');
			$("body").append("<div id='hatchTip'><h5>"+ t +"</h5><p>"+noZoom+"</p></div>");
		$("#hatchTip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },function(){
		$("#hatchTip").remove();
    });	
	
	$("a.hatchTip").mousemove(function(e){
		$("#hatchTip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
	
	/* CONFIG */		
	
	/*$("a.hatchTip").hover(function(m){											  
		var t = $(this).attr('title');
		var r = $(this).attr('rel');
		var class = $(this).attr('class');
			$("body").append("<div id='hatchTip'><h5>"+ t +"</h5><p>"+r+"</p></div>");
		$("#hatchTip")
			.css("top",(m.pageY - xOffset) + "px")
			.css("left",(m.pageX + yOffset) + "px")
			.show();		
    },
	function(){
		$("#hatchTip").remove();
    });	
	
	$("a.hatchTip").mousemove(function(m){
		$("#hatchTip")
			.css("top",(m.pageY - xOffset) + "px")
			.css("left",(m.pageX + yOffset) + "px");
	});	*/
	
	$("div.vertIconNav ul li a.reportNavItem").click(function() {
		var hrefVal = $(this).attr('href');
		$(hrefVal).siblings('div').hide();
		$(hrefVal).show();
		if($(this).attr('tabindex') == 'yes') {
		} else {
			return false;
		}
	});
	$("a.tabNavItem").click(function() {
		var hrefVal = $(this).attr('href');
		$(hrefVal).siblings('div').hide();
		$(hrefVal).show();
		$(this).siblings().removeClass('current');
		$(this).addClass('current');
		return false;
	});
	/*$("div.hatchChartDetails div.categoryNav ul li a").click(function() {
		var hrefVal = $(this).attr('href');
		$(hrefVal).siblings('div').hide();
		$(hrefVal).show();
		return false;
	});*/
		
});

function filterByRiver(riverID, divToRefresh, dirLevels) {
	var divSelector = "#"+divToRefresh; 
	$(divSelector).html();	
	$(divSelector).load(dirLevels+'includes/content/flyfishing/angler-reports/_memReportsByRiver.cfm', {riverID: riverID});
}