// JavaScript Document

	$(document).ready(function() {		
			
		$("#ui-tabs-nav li img").click(function()
			{
				if ($(this).attr("id") == "tab_new_arrivals" || $(this).attr("id") == "tab_best_sellers") {
					$("#contentPagination").hide();
				}
				else {
					var $that = $(this);
					$("#contentPagination").show();
					$("#contentPaginationLeft a").each(function()
					{
						$(this).attr("href", $(this).attr("href").replace(/\/tab_selected.+/, "") + "/tab_selected/" + $that.attr("id"));
					});
				}
			}
		 );


		 // for quick view
		// add a click event to the close button which assign tb_remove to the event. tb_remove is a function in thickbox.js to close the thickbox.
		$('#quickViewTop img').live("click", function() {
					tb_remove();
				});
		
		$('#registerForm').submit(function(){
																			 var stateValue = $('#stateSelected').attr("value");
																			 if (stateValue == '' || stateValue == '--'){
																				 alert("Please select a state");
																				 return false;
																			 }
																			 else {
																			 	return true;
																			 }
																			 });

	});
	
				// used for magic zoom so the alt image will be displayed in the magic zoom
		function changeZoomImage() {
		
		// Step 1
		// Stop Magic Zoom
		MagicZoom_stopZooms();
		
		
		// Step 2
		// Re-initialize Magic Zoom
		MagicZoom_findZooms();
		}

