// Clennett's Timber Mitre 10 Custom Script
// (c) 20011 Tiger Media http://www.tigermedia.com.au
// All Rights Reserved.


// Input Box Placeholders

$(document).ready(function(){
     $("#email").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
	$("#FullName").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
	$("#CAT_Search").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
	$("#ContactName").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
	$("#ContactEmail").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
	$("#ContactPhone").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#ContactCompany").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-FullName").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-EmailAddress").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-HomeAddress").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-HomeCity").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-HomeState").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-HomeZip").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
     $("#rewards-HomePhone").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
	$(".cmformfield").focus(function(){
          if (this.value == this.defaultValue)
          {
               this.value = "";
          }
     }).blur(function(){
          if ( ! this.value.length) 
          {
               this.value = this.defaultValue;
          }
     });
});


// Product List Random Sort


$(document).ready(function(){
$('ul#product-list').each(function(){
// get current ul
var $ul = $(this);
// get array of list items in current ul
var $liArr = $ul.children('li');
// sort array of list items in current ul randomly
$liArr.sort(function(a,b){
// Get a random number between 0 and 10
var temp = parseInt( Math.random()*10 );
// Get 1 or 0, whether temp is odd or even
var isOddOrEven = temp%2;
// Get +1 or -1, whether temp greater or smaller than 5
var isPosOrNeg = temp>5 ? 1 : -1;
// Return -1, 0, or +1
return( isOddOrEven*isPosOrNeg );
})
// append list items to ul
.appendTo($ul);
});
});

