/*
Version: 0.0.6
Updated: Monday, 07.01.2008 @ 20:29
------------------------------------------------------------*/    

$(document).ready(function() {

    // arranges input text behavior
    $("input:text").hint();

    //set home location for logo
    $("#logo").click(function () { 
      window.location.href = ("smartsite.net?id=PRC_HOME")
    });
    
    //Set the content_column to equal height with padding as the sidebar
    $("#sidebar, #content_column, #sidenav").equalizeCols();
    
    //enables rel="external" to work properly
    $("a[@rel='external']").click(function() { window.open($(this).href); return false; });

    //enable effects of the main top navigation area
    $("ul#main_navigation > li > a > img").hover(
      function () {
        $(this).css("top", -37);
      }, 
      function () {
        $(this).css("top", 0);
      }
    );
    
	// Add a value to each sidenav:
	$("#navigator > li > div + ul").attr("slide", "down");
	
	// Collapse everything 
	$("#navigator > li > div").find("+ ul").slideUp(1).attr("slide", "up");
	
	// Expand or collapse:
	$("#navigator > li > div").click(function() {
    
        $("#navigator > li > div").removeClass('active');
        $(this).addClass('active');
    
		// Collapse open sidenavs:
        $("#navigator > li > div").find("+ ul").fadeOut(300).slideUp(100).attr("slide", "up");
		
        // Expand this sidenav:
		$(this).find("+ ul").slideToggle("slow");
	});
    
	// Make sure the selected menu item is slided down
	$("#navigator > li > div.selected + ul").slideToggle("slow");
    
    //navigation div hover effect
    $("#navigator > li > div").hover(
      function () {
          $(this).addClass("mouseover");
      },
      function () {
          $(this).removeClass("mouseover");
      }
    );
    
    //navigation div hover effect
    $("button").hover(
      function () {
          $(this).addClass("button_hover");
      },
      function () {
          $(this).removeClass("button_hover");
      }
    );
     
    //Set action_block's action     
    $(this).actionBlock(".action_block");
    
    // Perspective Container
        //hide slide-in by default
        $(".perspective_container > div.readmore > a#slide-in").hide();
        
        //toggle slide-out | slide-in
        $(".readmore > a").click(function() {
            //$(".perspective_container > div.information_area > p.hide").slideToggle("fast");
            $(".perspective_container > div.information_area > div.hide").slideToggle("fast");
		$(".perspective_container > div.readmore > a").toggle();
            
        });
    
      //style type=file of input element
      $("input.file").stylefile({ 
          image: "images/browse.gif",
          imageheight : 20,
          imagewidth : 75,
          width : 274
      });
    
    
});



/* 
    =customized functions 
*/
jQuery.fn.actionBlock = function(hover_id)
{
	return this.each(
		function()
		{
            $(hover_id).hover(
              function () {
                  $(this).addClass("action_block_active");
                  $(this).find(".action_block_heading").addClass("action_block_heading_hover");
				  $(this).find(".action_block_list, .action_block_more").show(150);
                  
              },
              function () {
                  $(this).removeClass("action_block_active");
                  $(this).find(".action_block_heading").removeClass("action_block_heading_hover");
				  $(this).find(".action_block_list, .action_block_more").hide(10);
              }
            );
		}
	)
}
