/*
Site:          worldhum.com
File:          functions_wh.js
Created:       Oct 27 2008
Last Modified: Dec 09 2008
===========================================================
Extra functions used sitewide.
===========================================================
ryan masuga, masugadesign.com :: ryan@masugadesign.com
=========================================================== */
$(document).ready( function(){

//alert("loaded");

/* ==> Superfish dropdowns */
if (jQuery.browser.msie) {
		$("#navTopLevel")
		.superfish({
			//animation : { opacity:"show",height:"show" },
			speed:       1,
			autoArrows:  false,
			dropShadows: false,
			disableHI	: true,
			delay		: 0,
			onShow		: function(){
			  $(this).siblings("a").addClass('active');
			},
		  onHide		: function(){
		    $(this).siblings("a").removeClass('active');
		  }
		})
		.find(">li:has(ul.drop)") 
			.mouseover(function(){
				$("ul", this).bgIframe({opacity:false});     
		})
		.find("a")
		.focus(function(){
			$("ul", $("#navTopLevel>li:has(ul.drop)")).bgIframe({opacity:false});    						
		});
	} else {
		$("#navTopLevel")
		.superfish({
			// animation: { opacity:"show" },
			speed:       1,
			autoArrows:  false,
			dropShadows: false,
			//disableHI	: true,
			delay		: 0,
			onShow		: function(){
			  $(this).siblings("a").addClass('active');
			},
		  onHide		: function(){
		    $(this).siblings("a").removeClass('active');
		  }
		});
	}

// http://www.vancelucas.com/article/fixing-ie7-z-index-issues-with-jquery/
// WAY important fix for IE7 - funbars were overlapping
	var zIndexNumber = 1000;
	$(".funbar .funbarLinks li.shareDrop").each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});

$(".funbarLinks")
		.superfish({
			// animation: { opacity:"show" },
			speed:       1,
			autoArrows:  false,
			dropShadows: false,
			disableHI	: true,
			delay		: 0,
			onShow		: function(){$(this).siblings("a").addClass('active');},
		  onHide		: function(){$(this).siblings("a").removeClass('active');}
		});

	$("a[@rel='external']").click(function() {
		return !window.open($(this).attr("href"));
	});

// the print links are to open in new windows
$("#content a.fbPrint").attr("target","_blank");

// auto open external links in new windows (no need for rel="external" here)
$("a[@href^=http]").each(
    function(){
            if(this.href.indexOf(location.hostname) == -1) {
        $(this).attr('target', '_blank');
      }
    }
  )

// sets automatically with the following, but flashes the content
// $("div.captioned").imgcaption();



});