jQuery(function(){
	//form focus styling
	 $('input[type="text"]').focus(function() {  
		 $(this).addClass("focusField");  
		 if (this.value == this.defaultValue){  
			 this.value = '';  
		 }  
		 if(this.value != this.defaultValue){  
			 this.select();  
		 }  
	 });  
	 $('input[type="text"]').blur(function() {  
		 $(this).removeClass("focusField");  
	 });
	 
	//email spam protection
    $('.email').each(function() {  
		var $email = $(this);  
		var address = $email.text()  
        .replace(/\s*\[at\]\s*/, '@')  
        .replace(/\s*\[dot\]\s*/g, '.');  
		$email.html('<a href="mailto:' + address + '">'  
        + address +'</a>');  
    });
	
	//removes links from client product pages
	$('#clients h2 a').click(function() {return false;});
	$('#clients .image a').click(function() {return false;});
	$('.product-name .productitemcell a').click(function() {return false;});
	
	//stops min order auto fill
	$('#clients .productTextInput').attr("value","");
	
	//small product border
	$('.productSmall tr td:first-child').addClass('border');
	
	//animates when item added to cart
	$('input.productSubmitInput').click(function() {
		$('#login-info')
        .animate( { backgroundColor:"#7AFB73" }, 500 )
		.animate( { backgroundColor:"#F9F9F9" }, 400 );
	});
	
	//removes PDF box on large pages if custom2 = nopdf
	$('.nopdf').remove();
	
	//back button
	$('a.back').click(function() {
		window.history.back();
	});
	
	//adds GST Inclusive to preview
	$('.cartSummaryItem a.cartSummaryLink').before('(inc GST)');
	
    //Form Field Value Swap
    swapValues = [];
    $(".webform input[type='text']").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });
});