


$(document).ready(function(){
$("#contact_form").submit(function(){

var str = $(this).serialize();

   $.ajax({
   type: "POST",
   url: "contact_form.php",
   data: str,
   success: function(msg){
    
$("#note").ajaxComplete(function(event, request, settings){

if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
$("#contact_form_wrapper").hide();
}
else
{
result = msg;
}

$(this).html(result);

});

}

 });
   
return false;

});

$(document).ready(function() {
    $('input[type="text"],textarea').addClass("idleField");
	$('input[type="text"],textarea').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    $('input[type="text"],textarea').blur(function() {
    	$(this).removeClass("focusField").addClass("idleField");
        if ($.trim(this.value == '')){
        	this.value = (this.defaultValue ? this.defaultValue : '');
    	}
    });
	
});

});


// --------------------------------------------------- //
//           Start Social Share Tab JS            //
// --------------------------------------------------- //

(function( $ ) {
  $(document).ready(function() { 
    var url = window.location.href;
    var host =  window.location.hostname;
    var title = $('title').text();
    title = escape(title); //clean up unusual characters
 
    var twit = 'http://twitter.com/home?status='+title+'%20'+url;
    var facebook = 'http://www.facebook.com/sharer.php?u='+url
    var digg = 'http://digg.com/submit?phase=2&url='+url+'&amp;title='+title;
    var stumbleupon = 'http://stumbleupon.com/submit?url='+url+'&amp;title='+title;
    var buzz = 'http://www.google.com/reader/link?url='+url+'&amp;title='+title+'&amp;srcURL='+host;
    var delicious  = 'http://del.icio.us/post?url='+url+'&amp;title='+title;
 
    var tbar = '<div id="shareTab"><span>SHARE<br><a href="#min" id="minimize" title="Minimize"> <img src="img/social-icons/minimize.png" /> </a></span><div id="sicons">';
    tbar += '<a href="'+twit+'" target="_blank" id="twit" title="Share on twitter"><img src="img/social-icons/twitter.png"  alt="Share on Twitter" width="32" height="32" /></a>';
    tbar += '<a href="'+facebook+'" target="_blank" id="facebook" title="Share on Facebook"><img src="img/social-icons/facebook.png"  alt="Share on facebook" width="32" height="32" /></a>';
    tbar += '<a href="'+digg+'" target="_blank" id="digg" title="Share on Digg"><img src="img/social-icons/digg.png"  alt="Share on Digg" width="32" height="32" /></a>';
    tbar += '<a href="'+stumbleupon+'" target="_blank" id="stumbleupon" title="Share on Stumbleupon"><img src="img/social-icons/stumbleupon.png"  alt="Share on Stumbleupon" width="32" height="32" /></a>';
    tbar += '<a href="'+delicious+'" target="_blank" id="delicious" title="Share on Del.icio.us"><img src="img/social-icons/delicious.png"  alt="Share on Delicious" width="32" height="32" /></a>';
    tbar += '<a href="'+buzz+'" target="_blank" id="buzz" title="Share on Buzz"><img src="img/social-icons/google-buzz.png"  alt="Share on Buzz" width="32" height="32" /></a>';
    tbar += '</div></div>';
 
    // Add the share tool bar.
    $('body').append(tbar); 
    $('#shareTab').css({opacity: .9}); 
    // hover.
    $('#shareTab').bind('mouseenter',function(){
      $(this).animate({height:'44px', width:'285px', opacity: 1}, 400);
      $('#shareTab img').css('display', 'inline'); 
	  $('#shareTab span').animate( {'font-size' : '12px', 'font-weight' : 'normal', 'margin-right' : '15px'} );
    });	  
    //leave
    $('#shareTab').bind('mouseleave',function(){
      $(this).animate({ opacity: .7}, 400);
    });  
    // Click minimize
    $('#shareTab #minimize').click( function() { 
      minshare(); 
      $.cookie('minshare', '1');  
    }); 
 
    if($.cookie('minshare') == 1){
      minshare();
    }  
    
    function minshare(){
      $('#shareTab').animate({height:'35px', width: '98px'}, 400);  //minimized dimensions
      $('#shareTab img').css('display', 'none');
	  $('#shareTab span').animate( {'font-size' : '22px', 'font-weight' : 'bold', 'margin-top' : '4px', 'margin-left' : '6px'} );
      return false;
    }  
  });
})(jQuery);




