//Flower background

$(document).ready(function() {
  $("#backgroundContainerMain").addClass("backgroundContainerImageMain");
});

$(document).ready(function() {
  $("#backgroundContainer").addClass("backgroundContainerImage");
});

$(document).ready(function() {
  $("#backgroundContainerHFGMain").addClass("backgroundContainerImageHFGMain");
});

$(document).ready(function() {
  $("#backgroundContainerHFG").addClass("backgroundContainerImageHFG");
});


// Search

		/**
		 * Written by Rob Schmitt, The Web Developer's Blog
		 * http://webdeveloper.beforeseven.com/
		 */

		/**
		 * The following variables may be adjusted
		 */
		var active_color = '#333'; // Colour of user provided text
		var inactive_color = '#999'; // Colour of default text

		$(document).ready(function() {
		  $("#search, #productSearchWord, #plantSearch, #plantLibraryFrontSearch").css("color", inactive_color);
		  var default_values = new Array();
		  $("#search, #productSearchWord, #plantSearch, #plantLibraryFrontSearch").focus(function() {
		    if (!default_values[this.id]) {
		      default_values[this.id] = this.value;
		    }
		    if (this.value == default_values[this.id]) {
		      this.value = '';
		      this.style.color = active_color;
		    }
		    $(this).blur(function() {
		      if (this.value == '') {
		        this.style.color = inactive_color;
		        this.value = default_values[this.id];
		      }
		    });
		  });
		});

// Site/Language change

        $(document).ready(function(){
            
               $("#siteChangeAdvancedContainer").hide();
        	   $("#siteChange").click(function(){
	                $("#siteChangeAdvancedContainer").slideToggle("slow");
	                $(this).toggleClass("active");
					return false;
	           });
        });

// 	Sidebar Navigation

        $( function () {
            $("#subNavList li").not(".active").find("ul:first").hide();
			$("#subNavList .arrow").css({visibility: "visible"});

		    $('#subNavList li:has(ul)').find(".arrow:first").click( function (event) {
			        if (this == event.target) {
			        	if ($(this).parent().children("ul").is(':hidden')) {
							$(this).css({backgroundPosition: '0 -17px'}).parent().children("ul").show('fast');
						} else {
							$(this).css({backgroundPosition: '0 0'}).parent().children("ul").hide('fast');
						}
					}
					return false;
			})
		    $('#subNavList li:not(:has(ul)) .arrow').css({backgroundPosition: '0 -34px', cursor: 'default'});
		});

	$(document).ready( function() {

	    $('a.external800x600').click( function() {
	        window.open( $(this).attr('href'),this,'width=800,height=600,resizable=no,toolbar=no,status=no,location=no,directories=no,fullscreen=yes' );
	        return false;
	    });

	});
