/*///////////
allows clearing of inputs after clicking
///////////*/

function clearwidgit(elem){
	elem.value="";
}

/*///////////
open lightbox through flash
///////////*/

var vid_id;
function openLightbox(video) {
	$("#modal-content").modal({
		overlayId: 'modal-overlay',
		containerId: 'modal-container',
		opacity:80, 
		overlayClose:true,
		minWidth:593,
		minHeight:515,
		onShow:function(){
			showFlash(video);
		}
	});
}

/*///////////
js pseudo hover for mini navs
///////////*/

sfHover = function() {
	var sfEls = document.getElementById("navigation").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);

/*///////////
jquery pseudo hover for search by letter
///////////*/

$(function() {
	$('#find-by-letter').hover(function(){
		   $(this).addClass('sfhover');
	}, function() {
		   $(this).removeClass('sfhover');
	});
});

/*///////////
for pager js found on homepage
///////////*/

function attachSwitcher() {
	if (document.getElementById("tabs-head") && document.getElementById("thrive-content") && document.getElementById("tabs-head")){
		var activetab = document.getElementById("thrive");
		var activetabcontent = document.getElementById("thrive-content");
		var tabButtons = document.getElementById("tabs-head").getElementsByTagName("a");
		for (var i=0; i<tabButtons.length; i++) {
			tabButtons[i].onclick=function() {
				oldtab = activetab;
				activetab = this;
				oldtabcontent = activetabcontent;
				activetabcontent = document.getElementById(this.id+"-content");
				oldtab.className=activetab.className.replace(new RegExp(" selected\\b"), "");
				this.className+=" selected";
				oldtabcontent.className+="hidden";
				activetabcontent.className=activetabcontent.className.replace(new RegExp("hidden\\b"), "");
			}
		}
	}
}

/*///////////
for pager js found on innerpages
///////////*/

/*first instance*/
function attachSwitcher1() {
	if (document.getElementById("tab-1")){
		var activetab = document.getElementById("tab-1");
		var activetabcontent = document.getElementById("tab-1-content");
		var tabButtons = document.getElementById("tabs-head").getElementsByTagName("a");
		for (var i=0; i<tabButtons.length; i++) {
			tabButtons[i].onclick=function() {
				oldtab = activetab;
				activetab = this;
				oldtabcontent = activetabcontent;
				activetabcontent = document.getElementById(this.id+"-content");
				oldtab.className=activetab.className.replace(new RegExp(" selected\\b"), "");
				this.className+=" selected";
				oldtabcontent.className+=" hidden";
				activetabcontent.className=activetabcontent.className.replace(new RegExp("hidden\\b"), "");
			}
		}
	}
}
/*second instance*/
function attachSwitcher2() {
	if (document.getElementById("tab2-1")){
		var activetab = document.getElementById("tab2-1");
		var activetabcontent = document.getElementById("tab2-1-content");
		var tabButtons = document.getElementById("tabs2-head").getElementsByTagName("a");
		for (var i=0; i<tabButtons.length; i++) {
			tabButtons[i].onclick=function() {
				oldtab = activetab;
				activetab = this;
				oldtabcontent = activetabcontent;
				activetabcontent = document.getElementById(this.id+"-content");
				oldtab.className=activetab.className.replace(new RegExp(" selected\\b"), "");
				this.className+=" selected";
				oldtabcontent.className+=" hidden";
				activetabcontent.className=activetabcontent.className.replace(new RegExp("hidden\\b"), "");
			}
		}
	}
}
window.onload = function() {
	attachSwitcher();
	attachSwitcher1();
	attachSwitcher2();
}

/*doc ready*/

$(document).ready(function() {

/*///////////
slider for join us
///////////*/
	$(".fadeNext").click(function(){   
		$(this).next().fadeSliderToggle()
		 return false;
	})	

/*///////////
homepage callout expand+contract 
///////////*/
	
	$(".toggle_container_open").show();
	$(".toggle_container").hide();
 
	$("h6.trigger").toggle(function(){
		$(this).addClass("active"); 
		}, function () {
		$(this).removeClass("active");
	}); 
	$("h6.trigger_open").toggle(function(){
		$(this).addClass("active"); 
		}, function () {
		$(this).removeClass("active");
	});
	
	$("h6.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow,");
	});
	$("h6.trigger_open").click(function(){
		$(this).next(".toggle_container_open").slideToggle("slow,");
	});

/*///////////
join callout expand+contract
///////////*/
	
	$(".toggle_container_open").show();
	$(".toggle_container").hide();
 
	$("a.trigger").toggle(function(){
		$(this).addClass("active"); 
		}, function () {
		$(this).removeClass("active");
	}); 
	$("a.trigger_open").toggle(function(){
		$(this).addClass("active"); 
		}, function () {
		$(this).removeClass("active");
	});
	
	$("a.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow,");
	});
	$("a.trigger_open").click(function(){
		$(this).next(".toggle_container_open").slideToggle("slow,");
	});

});		
