jQuery.fn.AnimateMenu = function(associatedImage) {
	return this.each(function(){
		jQuery(this).hover(
			function() {
				jQuery(associatedImage).removeClass('hover_hide');
			},
			function() {
				jQuery(associatedImage).addClass('hover_hide');
			}
		);
	});
};

jQuery.fn.PerformSearch = function(searchTermElement) {
	return this.each(function(){
		jQuery(this).click(function(){
			var searchTerm = jQuery('input#' + searchTermElement + "'").val();
			var resultsUrl = GetSiteUrl() + '/products-page?view_type=grid&product_search=' + searchTerm;
			window.location.replace(resultsUrl);
			//window.navigate('"' + resultsUrl '"');
		});
	});
};

// Clear default text of an input field
jQuery.fn.clearDefault = function(options) {
	var defaults = {
	initialText: "Search"
	};
	options = jQuery.extend(defaults, options);
	return this.each(function() {
		jQuery(this).focus(function() {
			if (this.value == options.initialText)
				this.value = "";
			else
		this.select();
	});
	jQuery(this).blur(function() {
		if (this.value == "")
			this.value = options.initialText;
		});
	});
};

jQuery(document).ready(function() {
	ProductTabs();
});

function ProductTabs()
{
	//When page loads...
	jQuery(".tab-content").hide();
	jQuery("#tabs ul li:first").addClass("ui-state-active").show();
	jQuery(".tab-content:first").show();

	//On Click Event
	jQuery("#tabs ul li").click(function() 
	{
		jQuery("#tabs ul li").removeClass("ui-state-active"); 
		jQuery(this).addClass("ui-state-active");
		jQuery(".tab-content").hide();

		var activeTab = jQuery(this).find("a").attr("href");
		jQuery(activeTab).fadeIn();
		return false;
	});
	
	jQuery("#read-reviews").click(function()
	{
		jQuery("#tab-link-reviews").click();
	});
}

function GetSiteUrl()
{
	return jQuery('#siteurljs').val();
}

function GetProductsUrl()
{
	return jQuery('#productsurljs').val();
}
