/* New Window for External Links - Kevin Yank - http://blogs.sitepoint.com/standards-compliant-world/
===================================================== */
function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
window.onload = externalLinks;


/* Slideshow
===================================================== */

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

/* ---------------------------------------------
http://adipalaz.com/experiments/jquery/generated_tabs.html
Requires: jQuery v1.3+
When using this script, please keep this notice intact.
===================================================== */

(function($) {
$.fn.gTabs = function(options) {
    var defaults = {
		section : 'div', // the container element of the individual sections
		head : 'h3', // the section heading
		prefix : 'section', // the prefix of the hash
		def : 1, // the section to be shown by default
		hideHead : 'true' // whether to show or to hide the section headings
	};
	var o = $.extend({}, defaults, options);
    
	return this.each(function() {
		var container = $(this),
			prefixLength = o.prefix.length,
			num = location.hash.slice(prefixLength + 1) || o.def;
        
		// insert 'ul' before the the element that contains the sections:
		container.before('<ul id="tabs"></ul>');

		// the 'link text' in each tab is generated using the heading of the corresponding section:
		container.find('>' + o.section).each(function(i){
			$('#tabs').append('<li><a class="tab" href="#' + o.prefix + (i+1) + '">' + $(this).prev(o.head).text() + '</a></li>');
			if(o.hideHead) $(this).prev(o.head).hide();
		});
        
		// hide all sections except the current(or default) one, and add class='active' to the current(or default) tab:
		container.find('>' + o.section + ':not(:eq(' + (num -1) + '))').hide().end()
		.prev('#tabs').find('a:eq(' + (num -1) + ')').addClass('active');

		$('#tabs a').click(function(thisTab) {
        	var thisTab = $(this).closest('#tabs').find('a').index(this);
			$(this).addClass('active').parent().siblings('li').find('a.active').removeClass('active');
			$(this).closest('#tabs').next(container).find('>' + o.section + ':eq(' + thisTab + ')').fadeIn(400).siblings(o.section + ':visible').hide();
		});
	});
};
})(jQuery);

/*********************
//* jQuery Drop Line Menu- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last updated: May 9th, 11'
//* Menu available at DD CSS Library: http://www.dynamicdrive.com/style/csslibrary/item/jquery_drop_line_menu/
*********************/


/*
var droplinemenu={

arrowimage: {classname: 'downarrowclass', src: 'http://adamwilsondesign.com/development/concord/wp-content/themes/concord/images/down.png', leftpadding: 5}, //customize down arrow image
animateduration: {over: 100, out: 500}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={h:$curobj.find('a:eq(0)').outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			if (!this.istopheader)
				$subul.css({left:0, top:this._dimensions.h})
			var $innerheader=$curobj.children('a').eq(0)
			$innerheader=($innerheader.children().eq(0).is('span'))? $innerheader.children().eq(0) : $innerheader //if header contains inner SPAN, use that
			$innerheader.append(
				'<img src="'+ droplinemenu.arrowimage.src
				+'" class="' + droplinemenu.arrowimage.classname
				+ '" style="border:0;padding-left: '+droplinemenu.arrowimage.leftpadding+'px" />' // 
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						if (this.istopheader)
							$targetul.css({left: $mainmenu.position().left, top: $mainmenu.position().top+this._dimensions.h})
						if (document.all && !window.XMLHttpRequest) //detect IE6 or less, fix issue with overflow
							$mainmenu.find('ul').css({overflow: (this.istopheader)? 'hidden' : 'visible'})
						$targetul.dequeue().slideDown(droplinemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.dequeue().slideUp(droplinemenu.animateduration.out)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible', width:$mainmenu.width()})
	}) //end document.ready
}
} */
