$(document).ready(function() 
{
	$(".display_thumbs").click(function () { 
		$.get("./_ui/js/change_display.ajax.php", { display: "thumbs" }, function(data)
		{
			window.location.reload();
		});
	});
	$(".display_list").click(function () { 
		$.get("./_ui/js/change_display.ajax.php", { display: "list" }, function(data)
		{                                                    
			window.location.reload();
		});
	});
	$(".display_all").click(function () { 
		$.get("./_ui/js/change_display.ajax.php", { display: "all" }, function(data)
		{                                                    
			window.location.reload();
		});
	});
	$(".display_default").click(function () { 
		$.get("./_ui/js/change_display.ajax.php", { display: "default" }, function(data)
		{                                                    
			window.location.reload();
		});
	});
			
	$("#retailers a").click(
		function(){
			$("#retailers").toggleClass("active");
			}
		);
	 
	 $('a.show_retailer').click(function(){

	 $('a.show_retailer').hide(); 
	 $('a.hide_retailer').show();      
	 $('#retailer').slideDown("slow");
   });
	 $('a.hide_retailer').click(function(){
	 $('#retailer').slideUp("normal");
	$('a.hide_retailer').hide();
	$('a.show_retailer').show(); 
   });
	
	 $('#note').hide();
	 $('.show_note').click(function(){
	 $('#note').slideDown("slow");
	 $('.show_note').hide();
   });
		$('.hide_note').click(function(){
	 $('#note').slideUp("normal");
	 $('.show_note').show();
   });
		$('.toggle_location_results').click(function(){
	 $('#location_results').slideToggle("normal");
   });
   
   /*$('#terms').click(function(){
	 $('.place_order_button').toggle("normal");
   });*/
   
   $('.change_packaging').click(function()
   {
		 var ID = $(this).attr('rel');
		 var VALUE = $('#packaging_'+ID).val();
		 $('#packaging').val(VALUE);
		 //alert('The items have been added to your cart.');
   });
   
   /*$("input.text, textarea.text").focusFields("#d40000", 1, "#f3e784", );*/

   
	$("input:text, textarea, input:password").each(function(){
		if(this.value == '')
			this.value = this.title;
	});
	$("input:text, textarea, input:password").click(function(){
		if(this.value == this.title)
			this.value = '';
	});
	$("input:text, textarea, input:password").blur(function(){
		if(this.value == '')
			this.value = this.title;
	});
	$("input:image, input:button, button:submit").click(function(){
		$(this.form.elements).each(function(){
			if(this.type =='text' || this.type =='textarea' || this.type =='password'){
				if(this.value == this.title && this.title != ''){
					this.value='';
				}
			}
		});
	});     
 });

function checkfields()
{
	if (document.getElementById('name').value == '')
	{
		alert('You must enter your name');
		return false;
	}
	else
	{
		if (document.getElementById('phone').value == '' && document.getElementById('email').value == '')
		{
			alert('You must enter either your phone number or e-mail address');
			return false;
		}
	}
}

function change_packaging()
{
	var ID = $(this).attr('rel');
	alert(ID);
	return false;
}