(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)


$(document).ready( function() {

	$('#layer-form-search #form-query').focus(function() {
    	if ($(this).attr('value') == 'Search the Website') $(this).attr('value', '');
    }).blur(function() {
    	if ($(this).attr('value') == '') $(this).attr('value', 'Search the Website');
    });     
	
	$("#layer_login_float .close-floatbar a").click(function(){
		$("#layer_login_float").slideUp();
		$.cookie("floatbar",1, { path: '/' });
	});
	
	if($.cookie("floatbar")){
		$("#layer_login_float").hide();
	}
	
	
	
	/** Add layer to sub menu **/
	$("#layer-menu-sub ol li:first").css("border","none");
		
	$("#layer-menu-sub ol li.state-selected").find("ol li").parent().prepend("<div class='layer-border-bottom'></div>");
		
	$("#layer-menu-sub ol li").prepend("<div class='icon-bullet'></div>");
		
	//$("#layer-menu-sub").prepend("<div class='layer-menu-top-bg'></div>");
	
	jQuery.preLoadImages("/graphics/tssa/logo-print.gif");
	
}); 


