$(document).ready(function() {
	
	 $("li#login_button").mouseover(function(){
		  $("li#login_button div").show(); // flyout
		  $("li#login_button").addClass("active"); // flyout
	 });

	 $("li#login_button").mouseleave(function(){
		  $("li#login_button div").hide(); // flyout
		  $("li#login_button").removeClass("active"); // flyout
	 });

	 $("li#findstore").mouseover(function(){
		  $("li#findstore div").show(); // flyout
	 });

	 $("li#findstore").mouseout(function(){
		  $("li#findstore div").hide(); // flyout
	 });

	 $("li#search").mouseover(function(){
		  $("li#search div").show(); // flyout
	 });

	 $("li#search").mouseout(function(){
		  $("li#search div").hide(); // flyout
	 });

	 $("li#search div span").click(function(){ // close
		  $("li#search div").hide(); // flyout
	 });

     $("#paint-coatings").mouseover(function(){
          $("#paint-coatings img").attr("rel", $("#paint-coatings img").attr("src")); // save current image for mouse out (selected or not)
          $("#paint-coatings img").attr("src", "/site_media/images/general/nav_paint_hover.gif");
          $("#paint-coatings ul").show(); // flyout
      });

      $("#paint-coatings").mouseout(function(){
          $("#paint-coatings img").attr("src", $("#paint-coatings img").attr("rel"));
          $("#paint-coatings ul").hide(); // flyout
      });

     $("#windows-walls").mouseover(function(){
         $("#windows-walls img").attr("rel", $("#windows-walls img").attr("src")); // save current image for mouse out (selected or not)
         $("#windows-walls img").attr("src", "/site_media/images/general/nav_windows-walls_hover.gif");
         $("#windows-walls ul").show(); // flyout
     });

     $("#windows-walls").mouseout(function(){
         $("#windows-walls img").attr("src", $("#windows-walls img").attr("rel"));
         $("#windows-walls ul").hide(); // flyout
     });

     $("#project-pros").mouseover(function(){
         $("#project-pros img").attr("rel", $("#project-pros img").attr("src")); // save current image for mouse out (selected or not)
         $("#project-pros img").attr("src", "/site_media/images/general/nav_projectpros_hover.gif");
         $("#project-pros ul").show(); // flyout
     });

     $("#project-pros").mouseout(function(){ 
         $("#project-pros img").attr("src", $("#project-pros img").attr("rel"));
         $("#project-pros ul").hide(); // flyout
     });

	 $("div.client").hide();
	 $("div#projects > div.client:first").show();
	 $("div#client_container > div.main > img").hide();
	 $("div#client_container > div.main > img[rel='1']").show();
	 $("div.thumbnails > img").click(function(){
		  var number = $(this).attr("rel");
		  $("div#client_container > div.main > img").hide();
		  $("div#client_container > div.main > img[rel='" + number + "']").show();
	 });

	$(function() { // IE css fixes
		if ($.browser.msie && $.browser.version < 9) {  // IE 6,7,8 browser detect
		    $("#topNavigation ul li:last-child").css("border-right","none");
			$("#topNavigation ul li ul li:last-child").css("border-bottom","none");
			if ( $.browser.version < 8 ) { // IE 6,7
				var zIndexNumber = 1000; // IE 6,7 z-index fix - reverse the default z-index stacking order of the page elements 
				$('div').each(function() { // fixes z-index bug in IE7
					$(this).css('zIndex', zIndexNumber);
					// exeptions for IDs of element(s) that need to be above their predecessors
					if(/\bemail_window\b/.test(this.id)){
					    $(this).css('zIndex', zIndexNumber + 100);
					}
                    if(/\bblanket\b/.test(this.id)){
                        $(this).css('zIndex', zIndexNumber * 10);
                    }
					zIndexNumber -= 10;
				});
			}
		}
	});
	$(".flag_prof a").click(function() {
	    var r=confirm("Are you sure you want to flag this profile?");
        if (r==true) { return true;
            } else { return false;
          }
          });
    
});

