﻿$(document).ready(function(){
  initBehaviour2(); 
});

function initBehaviour2()
{
  initStopFlicker(); 
  initActAsLinkHover();
  initButtonHover();
  initSmoothScroll();
  initFormEnhancements();
  initNavigation();   
  initSearchBox(); 
} // initBehaviour()

function initStopFlicker()
{
  try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {}
} // initStopFlicker()

function initActAsLinkHover()
{
  $(".actAsLink").hover(
    function(){ $(this).css("text-decoration", "none"); }, // over
    function(){ $(this).css("text-decoration", "underline"); } // out
  );
  if($.browser.opera) { $("label.actAsLink").one("click", function(){ $(this).find("input").trigger("click"); }); }
} // initActAsLinkHover()

function initButtonHover()
{
  $(".btnHover").hover(
    function(){ $(this).css("background-position", "left bottom"); }, // over
    function(){ $(this).css("background-position", "left top"); } // out
  );
} // initButtonHover()

function initSmoothScroll()
{
	$("a[href*=#]").click(function(){
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) 
		{
			var target = $(this.hash);
			target = target.length && target || $("[name=" + this.hash.slice(1) +"]");
			if (target.length) 
			{
        var targetOffset = target.offset().top;
        $("html,body") .animate({scrollTop: targetOffset}, "slow");
        return false;
			}
		}
	});
} // initSmoothScroll()

function initFormEnhancements()
{
  if($.browser.msie)
  {
    $("input.txt").focus(function(){ /* Insert Focus State */ }).blur(function(){ /* Remove Focus State */ });
    $("textarea.txt").focus(function(){ /* Insert Focus State */ }).blur(function(){ /* Remove Focus State */ });
    $("select.ddl").focus(function(){ /* Insert Focus State */ }).blur(function(){ /* Insert Focus State */ });
  }
} // initFormEnhancements()

function initNavigation()
{
 $("div.navigation ul li:not(.menu1077)").hover(
    function(){ $(this).find("div.subnavWrapper").css("visibility", "visible"); $(this).find("a:first").addClass("hover"); }, // over
    function(){ $(this).find("div.subnavWrapper").css("visibility", "hidden"); $(this).find("a:first").removeClass("hover"); }

  );
} // initNavigation();

function initSearchBox()
{
  $("input.txtSearchPod").focus(function() {
    var value = $(this).val();
    if (value == "Search our site...") { $(this).val(""); }
  });
  
  $("input.txtSearchPod").blur(function() {
    var value = $(this).val();
    if (value == "") { $(this).val("Search our site..."); }    
  });
};




