sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
}; 


$(document).ready(function(){
//sliding the panel
    $("#location-wrap").hide();
    $(".view-location").click(function () {
 		$(this).toggleClass("slide");   
      $("#location-wrap").toggle();
     
    });
    $("#close").click(function () {
 		 
      $("#location-wrap").hide();
    });
    
    
    //remove the text field value on focus
    
    $('#search-field').focus (function(){
				$(this).val('');

	});
	 
    $('.inline').focus (function(){
				$(this).val('');

	});

	
 });

	/*equal height*/
jQuery.fn.vjustify=function() {
    var maxHeight=0;
    this.each(function(){
        if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
    });
    this.each(function(){
        $(this).height(maxHeight + "px");
        if (this.offsetHeight>maxHeight) {
            $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
        }
    });
};



$(document).ready(function() {
  $('.emailAddress').each(function() {
    var _email = $(this).text();
    _email = _email.replace(/\s\[@\]\s/g, '@');
    _email = _email.replace(/\s\[.\]\s/g, '.');
    if (_email!="")
      $(this).html('<a class="email" href="mailto:'+_email+'">'+_email+'</a>');
  });
});





jQuery(function($) {
	// Figure out the location based on the browser URL
	var path = location.pathname;

	// Set your homepage here, eg. /index.php or /
	var home = "/index.php";
	// Check the home link against the path and set the navigation accordingly. 
	if (path == home || path == "/") {
		// Note that the jQuery selector matches *only* the home link
		var $nav = $('#sub-nav a[@href="' + home + '"]');
	} else {
		var $nav = $('#sub-nav a[@href$="' + path + '"]');
	}

	
	// Add the active class to the current path and activate it's subnavigation
	$nav.addClass('active');
	
	// If the active class has subnavigation, show it
	$nav.parents("ul").show();
});


