/*
- hides all subnav elements (there was one for each section)
- checks to see if the current URL matches a nav item
- if so, it adds a class of 'nav_active', and shows the parent UL, thereby showing the current section.
- TODO, add html examples.
*/

function side_nav(){
  // Hide all subnavigation
  jQuery('#siteNav ul').hide();

  var path = location.pathname.substring(1);
  jQuery('#siteNav a[@href$="' + path + '"]').parent().addClass('nav_active'); // check path as typed exactly
  jQuery('#siteNav a[@href$="' + path + '/"]').parent().addClass('nav_active'); // check path with an extra trailing slash added

  // show all parents
  jQuery('#siteNav li.nav_active').parents("ul").show();

//  var here = jQuery('<span class="nav_here"><img src="/page/-/wrapper/img/youarehere.png" alt=""/></span>').insertBefore('#siteNav li.nav_active a');
}

function form_swap_values(){
    swapValues = [];
    jQuery(".swap-value").each(function(i){
        swapValues[i] = jQuery(this).val();
        jQuery(this).focus(function(){
            if (jQuery(this).val() == swapValues[i]) {jQuery(this).val("");}}).blur(function(){
            if (jQuery.trim(jQuery(this).val()) == "") {jQuery(this).val(swapValues[i]);}});
    });
}   



jQuery(document).ready(function() {

  form_swap_values();

});
