jQuery(document).ready(function () {
  jQuery.ajaxSetup({async: false});
  jQuery.getScript("/wp-content/themes/OCON/jquery.cycle.min.js", function() {
    jQuery('#slideshow').cycle({ 
      fx:    'fade', 
      pause:  1 
    });
  });
  jQuery.ajaxSetup({async: true});
});

jQuery(document).ready(function() {
	jQuery(".pageid-1030 .bios").addClass("js");
	jQuery("a.bioloader").fancybox({
		'type'			: 	'inline',
		'autoDimensions': 	false,
		'scrolling'		: 	'no'
	});
});

/* tweaks for default form contents in the sidebar search and 
newsletter sign-up form */
jQuery(document).ready(function() {
  jQuery("#s").attr("value", 'SEARCH').focus(function(){
    if(jQuery(this).val()=="SEARCH") {
      jQuery(this).val("");
    }
  }).blur(function(){
    if(jQuery(this).val()=="") {
      jQuery(this).val("SEARCH");
    }
  });
  jQuery("#text-4 input:text").attr("value", 'you@youremail.com').focus(function(){
    if(jQuery(this).val()=="you@youremail.com") {
      jQuery(this).val("");
    }
  }).blur(function(){
    if(jQuery(this).val()=="") {
      jQuery(this).val("you@youremail.com");
    }
  });
});

// Navigation effects
jQuery(document).ready(function() {
  jQuery("#menu-item-1286 a:first, #menu-item-1299 a:first").click(function() {
    return false;
  });
});

//Fades subnavs in and out
jQuery(document).ready(function() {
  if(!(jQuery("#menu-item-1286").hasClass("current_page_parent current-page-ancestor") || jQuery("#menu-item-1286").hasClass("current-page-ancestor"))) {
		jQuery("#menu-item-1286").hover(
			function() {
				jQuery("#menu-item-1286 .sub-menu").fadeIn();
			},
			function() {
				jQuery("#menu-item-1286 .sub-menu").fadeOut();
			}
		);
  };
	
	if(!(jQuery("#menu-item-1299").hasClass("current_page_parent") || jQuery("#menu-item-1299").hasClass("current-page-ancestor"))) {
		jQuery("#menu-item-1299").hover(
			function() {
				jQuery("#menu-item-1299 .sub-menu").fadeIn();
			},
			function() {
				jQuery("#menu-item-1299 .sub-menu").fadeOut();
			}
		);
	};
  
  /* protection against overlapping sub-navigation elements */
  if(jQuery(".menu-item").hasClass("current_page_parent") || jQuery(".menu-item").hasClass("current-page-ancestor")) {
    jQuery(".sub-menu").parent().not(".current_page_parent, .current-page-ancestor").hover(
      function() {
        jQuery(".current_page_parent .sub-menu, .current-page-ancestor .sub-menu").fadeTo("fast", 0.25);
      },
      function() {
        jQuery(".current_page_parent .sub-menu, .current-page-ancestor .sub-menu").fadeTo("fast", 1.0);
      }
    );
  };
});
// END :: Fades subnavs in and out


