// remap jQuery to $
(function($){
	$(document).ready(function()	{	
		
		//clearField("#SearchForm_SearchForm");
		
		$(".showOnClickContainer").hide(); 
		$("#Password input.hidden").val(false); 
		$(".confirmedpassword .showOnClick a").click(function(){ 
			$(".showOnClickContainer").toggle(); 
			var _v = $(".showOnClickContainer").css("display") == "block" ? true : false; 
			$("#Password input.hidden").val(_v); 
		});
		
		$('#slider').nivoSlider({
			pauseTime:10000,
			pauseOnHover:false,
			controlNavThumbs:true,
			pauseOnHover:true,
			captionOpacity:0.9
		});
		
		var searchBox = $("#SearchForm_SearchForm_Search");
		var searchBoxDefault = "Search";  
		searchBox.focus(function(){  
			if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");  
		});  
		searchBox.blur(function(){  
			if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);  
		});  
		
		$('a.lightbox').lightBox({
			imageLoading: 'themes/direct/images/loading.gif',
			imageBtnClose: 'themes/direct/images/lightbox-btn-close.gif',
			imageBtnPrev: 'themes/direct/images/lightbox-btn-prev.gif',
			imageBtnNext: 'themes/direct/images/lightbox-btn-next.gif',
			imageBlank: 'themes/direct/images/lightbox-blank.gif'
		});
		
	});
})(this.jQuery);

// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};

// catch all document.write() calls
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);
