﻿$(document).ready(function () {

	//Tab Content
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	//On Click Event
	$("ul.tabs li").click(function () {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).toggle(); //Fade in the active ID content
		return false;
	});


	//Fly Out Panel
	$(".trigger").click(function () {
		$(".panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$(".closePanel").click(function () {
		$(".panel").hide();
		$(".trigger").removeClass("active");
		return false;
	});


	/*
	jquery.twitter.js v1.0
	Last updated: 26 October 2008

	Created by Damien du Toit
	http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter

	Licensed under a Creative Commons Attribution-Non-Commercial 3.0 Unported License
	http://creativecommons.org/licenses/by-nc/3.0/
	*/

	$.fn.getTwitter = function (options) {
		var o = $.extend({}, $.fn.getTwitter.defaults, options);

		// hide container element
		$(this).hide();

		// add heading to container element
		if (o.showHeading) {
			$(this).append('<h2>' + o.headingText + '</h2>');
		}

		// add twitter list to container element
		$(this).append('<ul id="twitter_update_list"><li></li></ul>');

		// hide twitter list
		$("ul#twitter_update_list").hide();

		// add preLoader to container element
		var pl = $('<p id="' + o.preloaderId + '">' + o.loaderText + '</p>');
		$(this).append(pl);

		// add Twitter profile link to container element
		if (o.showProfileLink) {
			$(this).append('<a id="profileLink" href="http://twitter.com/' + o.userName + '">Follow us on twitter</a>');
		}

		// show container element
		$(this).show();

		$.getScript("http://api.twitter.com/javascripts/blogger.js");
		$.getScript("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + o.userName + "&count=" + o.numTweets + "&include_rts=true&callback=twitterCallback2", function () {
			// remove preLoader from container element
			$(pl).remove();

			// show twitter list
			if (o.slideIn) {
				$("ul#twitter_update_list").slideDown(1000);
			}
			else {
				$("ul#twitter_update_list").show();
			}

			// give first list item a special class
			$("ul#twitter_update_list li:first").addClass("firstTweet");

			// give last list item a special class
			$("ul#twitter_update_list li:last").addClass("lastTweet");
		});
	};

	// plugin defaults
	$.fn.getTwitter.defaults = {
		userName: null,
		numTweets: 5,
		preloaderId: "preloader",
		loaderText: "Loading tweets...",
		slideIn: false,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true
	};
});

function fbs_click() {
	u = location.href;
	t = document.title;
	window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
	return false; 
}
function twitter_click() {
	u = location.href;
	t = document.title;
	window.open('http://twitter.com/share?url=' + encodeURIComponent(u) + '&text=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436'); 
	return false;
}


$(function () {
	$('a.mclThumb').hover(function () {
		$(this).find('span').animate({ top: '40px' }, { queue: false, duration: 250 });
	}, function () {
		$(this).find('span').animate({ top: '90px' }, { queue: false, duration: 250 });
	});
});

$(document).ready(function () {
	if ($.client.os == "Windows") {
		$("body").css('font-family', 'Trebuchet MS,sans-serif');
		$("body").css('font-size', '13px');
		$("body").css('line-height', '19px');
	}
});

//specify random links below. You can have as many as you want
var randomlinks = new Array()

randomlinks[0] = "http://oursaviorschurch.com/MyChangedLife/Bertrands/"
randomlinks[1] = "http://oursaviorschurch.com/MyChangedLife/Buchanans/"
randomlinks[2] = "http://oursaviorschurch.com/MyChangedLife/CamilleComeaux/"
randomlinks[3] = "http://oursaviorschurch.com/MyChangedLife/Carrolls/"
randomlinks[4] = "http://oursaviorschurch.com/MyChangedLife/Connells/"
randomlinks[5] = "http://oursaviorschurch.com/MyChangedLife/Meches/"
randomlinks[6] = "http://oursaviorschurch.com/MyChangedLife/MikeMartins/"
randomlinks[8] = "http://oursaviorschurch.com/MyChangedLife/Perrys/"
randomlinks[9] = "http://oursaviorschurch.com/MyChangedLife/Rawlings/"
randomlinks[10] = "http://oursaviorschurch.com/MyChangedLife/Stroderd/"
randomlinks[11] = "http://oursaviorschurch.com/MyChangedLife/Connells/ConnellPt2.aspx"
randomlinks[12] = "http://oursaviorschurch.com/MyChangedLife/Simons/"
randomlinks[13] = "http://oursaviorschurch.com/MyChangedLife/Guidrys/"

function randomlink() {
	window.location = randomlinks[Math.floor(Math.random() * randomlinks.length)]
}
