
	 $(document).ready(function(){
	    
	    $('#sendLoginDetails').hide();
	    $('#forgot').toggle(function(){ 
			  $('#sendLoginDetails').show();
			},function(){ 
			  $('#sendLoginDetails').hide();
			});  
			
      var options = { 
			  dataType:'json', 
			  success: function( json ) {
			    if ( json.success )
			    {
			      $('#sendLoginDetails').html( json.message ).show().highlightFade({ speed:1000 });
				  }
				  else 
				  {
			      alert( "Error requesting login details, please try again" );
			    } 
			  } 
			}; 
		  
			$('#sendLoginDetailsFrm').ajaxForm( options );
								
		});		

    <!-- START Quick category select box -->
		
		function showBaseCategoryCategories()
		{ 
		  $('#basecategorycategories').load('/ajaxbasecategorycategories.q?catId=' + $('#categoryId').val() + '&baseCategory=' + $('#searchGender').val() + '&ac=' + new Date().getTime());
		}
		
		function redirectToCategory()
		{
		  if( $('#searchItem').val() != null && $('#searchItem').val() != '' )
		  {
		    var url = '/category/' + $('#searchItem').val() + '/' + trimString($('#searchItem option[@selected]').text());
		  }
		  else
		  {
		    var url = '/all/' + $('#searchGender').val(); 
		  }

		  window.location=escape(url);
		  
		  return false;
		}
		
		function redirectToSubCategory()
		{
		  if( $('#sortChild').val() != null && $('#sortChild').val() != '' )
		  {
		    var url = '/category/' + $('#sortChild').val() + '/' + trimString($('#sortChild option[@selected]').text());
		  }
		  else
		  {
		    var url = '/category/' + $('#parentCategory').val(); 
		  }

		  window.location=escape(url);
		  
		  return false;
		}		
		
		<!-- END Quick category select box --> 
		
		<!-- START view cart page -->
		
	 function sizeQuantity( sizeId, unitPrice, quantity )
	 {
	   var itemTotal = ( unitPrice / 100 ) * quantity;
	   $('#itemTotalPrice_' + sizeId).html( itemTotal.toFixed(2) );
	   calculateSubTotal();
	 };
  	 	
   function calculateSubTotal()
   {
     var subTotal = 0;
     $('strong.itemTotalPrice').each(function()
                    { 
                      subTotal += parseFloat( $(this).html() );
										});
										
     $('#subTotal').html( 'R' + subTotal.toFixed(2) );
     
     calculateTotalCartItems();
     calculateTotal( subTotal );								
   }
   
   function calculateTotalCartItems()
   {
     var totalCartItems = 0;
     $('.sizeQuantity').each( function()
                              {
                                totalCartItems += parseInt( $(this).val() );
                              });
     
     $('#cartItemCount').html( totalCartItems );   
     $('#numOfItems').html( totalCartItems );
   }
   
   function calculateTotal( subTotal )	 
   {
     var shippingcost = 0.00;
     
     if( $('.shippingOption').fieldValue() == 'Standard' )
     {
       $('#keedoStore').hide();
       $('#storeItem').attr("disabled","disabled");
        
       <!-- if( subTotal < 500.00 ) SHIPPING COST BELOW 500-->
      
       shippingcost = 50.00;
     }
     else
     {
       $('#keedoStore').show();
       $('#storeItem').removeAttr("disabled") 
     }
      
     $('#shippingCost').html( shippingcost.toFixed(2) );   
     var cartTotal = subTotal + shippingcost;
     $('#cartTotal').html( 'R' + cartTotal.toFixed(2) );
   }	
  	 	
   function changeShippingOption()
   {
     calculateSubTotal();
   }	 			
   
   function changeGiftOption()
   {
   	  if( $('#cartFrm input[name=wrapping]').val() == "true" )
	    {
	      $('#giftCardMessage').show();
	    }
	    else
	    {
	      $('#giftCardMessage').hide();
	    }
   }
		
		<!-- END view cart page -->
		
		<!-- START customer details page -->
		
	 function showExistingCustomerForm()
	  {
	    $('#existingCustomerFrm').show();
	    $('#detailCustomerFrm').hide();
	    
	    return false;
	  }
	
	  function showDetailCustomerForm()
	  {
	    $('#existingCustomerFrm').hide();
	    $('#detailCustomerFrm').show();
	    
	    return false;
	  }		
		
		<!-- END customer details page -->
		
		<!-- START product page -->
		
		function addProduct()
		{
			 var options = {
			  url:'/addtocart.q',
			  data:'sizeId=' + $('#colourSize').val() + '&quantity=' +$('#sizeQuantity').val() , 
			  dataType:'json',
			  type:'post', 
			  success: function( json ) { 
			      $('#numOfItems').html( json.numOfItems );
		     		$('#notifier').html( json.message ).show().highlightFade({ speed:1000 });
		     		$('#goCheck').show();	
			  }
		  };
			
			$.ajax(options);
			
  		return false;
		}		
		
		function addProductFromWishList( a, id )
		{
			 var options = {
			  url: a.href,
			  dataType:'json',
			  type:'post', 
			  success: function( json ) { 
			      $('#cartRow' + id).hide();
			      $('#numOfItems').html( json.numOfItems );
		     		$('#notifier').html( json.message ).show().highlightFade({ speed:1000 });
		     		$('#checkOutOption').show();
			  }
		  };
			
			$.ajax(options);
			
  		return false;
		}			
		
		function addWishListItem()
		{ 
			 var options = {
			  url:'/addtowishlist.q',
			  data:'sizeId=' + $('#colourSize').val(), 
			  dataType:'json',
			  type:'post', 
			  success: function( json ) { 
		     		$('#notifier').html( json.message ).show().highlightFade({ speed:1000 });
			  }
		  };
			
			$.ajax(options);
			
  		return false;
		}				
		
		<!-- END product page -->
		
		String.prototype.startsWith = function(str)
    {return (this.match("^"+str)==str)}
		
		function redirectToSite()
		{
		  if( $('#chooseCountry').val() != null && $('#chooseCountry').val() != '' )
		  {
		    url = $('#chooseCountry').val();
		   
		    if( url.startsWith( 'http' ) == false )
		    {
		      url = 'http://' + url;
		    }
		    
		    window.location.href=url;
		  }
		  
		  return false;
		}		
		
		<!-- START Util functions -->
		
		function trimString(str)
		{
			str = this != window? this : str;
			
			return str.replace(/^\s+/g, '').replace(/\s+$/g, '').replace(' ', '-');
	  } 		
	  
	  function clearSubscribe()
	  {
	    if( $('#subscribe').val() == 'email@address.com' )
	    {
	      $('#subscribe').val( '' );
	    }
	  }
	  
	  function setSubscribe()
	  {
	    if( $('#subscribe').val() == '' )
	    {
  	    $('#subscribe').val( 'email@address.com' );
  	  }
	  }
