/**
* File: categorySearchResultFunctions.js
* Author: Brian Schemp
* 
* Purpose: 
*
* History: 02/08/2010 Brian - Created.
*
*
*/


/*
* Set the event handlers.
*/
function setEventHandlers() {
	//set onChange event for the goto page pull-down.
	$(".goto-page-select").change(function(evt) {
		evt.preventDefault();
		window.location = $(this).val();
	});	
	
	
	//set onChange event for the results per page pull-down.
	$(".results-per-page-select").change(function(evt) {
		evt.preventDefault();
		window.location = $(this).val();
	})		
}

/*
* Preload the category search images.
*
*/
function preloadCategoryImages() {
	jQuery.preLoadImages("/images/categorysearch/back_button_over.png", "/images/categorysearch/back_button_over.png");
	jQuery.preLoadImages("/images/categorysearch/next_button_over.png", "/images/categorysearch/next_button_over.png");
}

/**
 * Set-up the roll-overs for the bread-crumb images.
 */
function setImageRollovers() {
	//set image elements
	var homeImage = $(".home-button").find("img");
	var returnToMainCategoryImage = $(".return-button").find("img");
	var backButtonImage = $(".back-button").find("img");
	var nextButtonImage = $(".next-button").find("img");
	
	//set mouse-over and mouse-out events for Home image.
	homeImage.hover(
		function(){
			swapImage(homeImage, "home_button_over.png","/images/categorysearch/");
		},
		
		function(){
			swapImage(homeImage, "home_button.png", "/images/categorysearch/");
		}		
	);	
			
	//set mouse-over and mouse-out events for Return To Main Category image.
	returnToMainCategoryImage.hover(
		function(){
			swapImage(returnToMainCategoryImage, "return_button_over.png", "/images/categorysearch/");
		},
		
		function(){
			swapImage(returnToMainCategoryImage, "return_button.png", "/images/categorysearch/");
		}		
	);
	
	//set mouse-over and mouse-out events for Back button image.
	backButtonImage.hover(
		function(){
			swapImage(backButtonImage, "back_button_over.png", "/images/categorysearch/");
		},
		
		function(){
			swapImage(backButtonImage, "back_button.png", "/images/categorysearch/");
		}		
	);
	
	//set mouse-over and mouse-out events for Next button image.
	nextButtonImage.hover(
		function(){
			swapImage(nextButtonImage, "next_button_over.png", "/images/categorysearch/");
		},
		
		function(){
			swapImage(nextButtonImage, "next_button.png", "/images/categorysearch/");
		}		
	);	
}

/*
* Remove the top product search results stats bar.
*
*/
function removeTopProductSearchResultStats() {
	if($("#topProductSearchResultsStats").length > 0) {
		$("#topProductSearchResultsStats").remove();	
	}
}

/*
* Remove the bottom product search results stats bar.
*
*/
function removeBottomProductSearchResultStats() {	
	if($("#bottomProductSearchResultsStats").length > 0) {
		$("#bottomProductSearchResultsStats").remove();
	}	
}

/*
* Remove the top bread crumb bar.
*
*/
function removeTopBreadCrumbBar() {
	if($("#topBreadCrumbContainer").length > 0) {
		$("#topBreadCrumbContainer").remove();	
	}	
}

/*
* Remove the bottom bread crumb bar.
*
*/
function removeBottomBreadCrumbBar() {
	if($("#bottomBreadCrumbContainer").length > 0) {
		$("#bottomBreadCrumbContainer").remove();
	}	
}
