function Search()
{
	var term = $("#search_field").val();
	window.location = "http://www.novanatural.com/?search=" + term + "";
}


function HideNativeNavigationElements()
{
	$("#left_navigation a[href='/customer-support']").parent().prepend("<hr>");
	$("#left_navigation a[href='/Wish-List']").parent().parent().nextAll().hide();
	$("#left_navigation a[href='/Wish-List']").parent().html("<a href='/nova-natural-gift-card'>Gift&nbsp;Certificate</a><br /><a href='/Wish-List'>Wish List</a>");
}

function ShowNavigationLocation()
{
/**
	jQuery.expr[':'].contains = function(a, i, m) { 
	  return jQuery(a).text().indexOf(m[3].toUpperCase()) >= 0; 
	};

	var breadcrumb = $("#breadcrumbs:contains('GROWING')").length;
	if(breadcrumb > 0)
	{
		$("#growing a").css("border-bottom","10px solid #519CBA");
		$("#growing a").css("color","#333");
	}
	
	breadcrumb = $("#breadcrumbs:contains('PLAYING')").length;
	if(breadcrumb > 0)
	{
		$("#playing a").css("border-bottom","10px solid #92AF47");
		$("#playing a").css("color","#333");
	}	
	
	breadcrumb = $("#breadcrumbs:contains('LEARNING')").length;
	if(breadcrumb > 0)
	{
		$("#learning a").css("border-bottom","10px solid #E4A014");
		$("#learning a").css("color","#333");
	}
	
	breadcrumb = $("#breadcrumbs:contains('WEARING')").length;
	if(breadcrumb > 0)
	{
		$("#wearing a").css("border-bottom","10px solid #C7494B");
		$("#wearing a").css("color","#333");
	}
	
	breadcrumb = $("#breadcrumbs:contains('LIVING')").length;
	if(breadcrumb > 0)
	{
		$("#living a").css("border-bottom","10px solid #846EAC");
		$("#living a").css("color","#333");
	}
	
	breadcrumb = $("#breadcrumbs:contains('SALE')").length;
	if(breadcrumb > 0)
	{
		$("#sale a").css("border-bottom","10px solid #4B617D");
		$("#sale a").css("color","#333");
	}	
**/


	var breadcrumb =  $("#breadcrumbs").html();

	if(breadcrumb.search("GROWING") > -1)
	{
		$("#growing a").css("border-bottom","10px solid #519CBA");
		$("#growing a").css("color","#333");
	}
	
	if(breadcrumb.search("PLAYING") > -1)
	{
		$("#playing a").css("border-bottom","10px solid #92AF47");
		$("#playing a").css("color","#333");
	}	
	
	if(breadcrumb.search("LEARNING") > -1)
	{
		$("#learning a").css("border-bottom","10px solid #E4A014");
		$("#learning a").css("color","#333");
	}
	
	if(breadcrumb.search("WEARING") > -1)
	{
		$("#wearing a").css("border-bottom","10px solid #C7494B");
		$("#wearing a").css("color","#333");
	}
	
	if(breadcrumb.search("LIVING") > -1)
	{
		$("#living a").css("border-bottom","10px solid #846EAC");
		$("#living a").css("color","#333");
	}
	
	if(breadcrumb.search("SALE") > -1)
	{
		$("#sale a").css("border-bottom","10px solid #4B617D");
		$("#sale a").css("color","#333");
	}	




	HideNativeNavigationElements();
}

//Initiate Left Navigation
$(document).ready(function() 
{
	$('img').error(function() {
	  	$(this).remove();
	});


	$(".slider-3").rotator({
		loop: true,
		backwards: false,
		delay: 6000
	});

});

function HighlightLeftNavigation()
{
	$(".iBullet").hide();
	
	$(".portletHandle:eq(0) tr").each(function (i){
		var categoryName = $(this).text();
	   	if(categoryName == "HOME" || categoryName == "PLAYING" || categoryName == "GROWING" || categoryName == "LEARNING" || categoryName == "WEARING" || categoryName == "LIVING" || categoryName == "SALE")
		{
	    	$(this).css("text-transform","uppercase");
		}
		else
		{
			$(this).css("text-transform","capitalize");
	                $(".portletHandle td[colspan='1']").siblings().css("padding-left", "10px");
		}
	
	});
}


function ChangeImage(imgSrc)
{
	$("#main_image").attr("src",imgSrc);
}

function CopySizeOptions()
{
	$('#custcol_size option').clone().appendTo('#select_size');
}

function ChangeMatrixValue(list)
{
	if(list == "size")
	{
		var selectedIndex = $("#select_size").prop("selectedIndex");
		$('#custcol_size').prop("selectedIndex", selectedIndex);
	}
}

function HideNativeOptions()
{
	$("#custcol_size_fs").parent().parent().hide();
}

function ChangeQty()
{
	var selectedQty = $("#select_qty option:selected").val();
	$("#qty").val(selectedQty);	
}

function convertDollarToInt(dollarAmount)
{
	return dollarAmount.replace(/[$,]/gi, "")*1;
}
