// JavaScript Document
var initialGuests = 0;
var initialMinistries = 0;
var initialWeekend = 0;

//Initialize and start Image Rotator
$(document).ready(function(){
						   
	//Image Rotator
	$('#cycler').cycle({
	    fx:     'fade', 
	    timeout: 5000,
		pause: 1
	});
						   
	//Allows Non-Javascript Users to Scroll through choices		
	$("#slides").css( {overflow:"hidden"});			   
	$("#featureNav_guests").css( {overflow:"hidden"});
	$("#featureNav_ministries").css( {overflow:"hidden"});
	$("#featureNav_weekend").css( {overflow:"hidden"});
	
	menuRollovers();

});

//3Nav Menu Rollovers
function menuRollovers(){
	$("#menu_guests").hover(function() {$(this).css( {backgroundPosition:"0px -104px"});},function () {$(this).css( {backgroundPosition:"0px 0px"});});
	$("#menu_ministries").hover(function() {$(this).css( {backgroundPosition:"-300px -104px"});},function () {$(this).css( {backgroundPosition:"-300px 0px"});});
	$("#menu_weekend").hover(function() {$(this).css( {backgroundPosition:"-600px -104px"});},function () {$(this).css( {backgroundPosition:"-600px 0px"});});
}

//3Nav Menu Highlights
function menuHighlight(){
	$("#menu_guests").css( {backgroundPosition:"0px 0px"});
	$("#menu_ministries").css( {backgroundPosition:"-300px 0px"});
	$("#menu_weekend").css( {backgroundPosition:"-600px 0px"});
}

//Show Arrows	
function showArrows(){
	$("#arrow_left").show();
	$("#arrow_right").show();
	$("#arrow_left").hover(function() {$(this).css( {backgroundPosition:"0px -40px"});},function () {$(this).css( {backgroundPosition:"0px 0px"});});
	$("#arrow_right").hover(function() {$(this).css( {backgroundPosition:"0px -40px"});},function () {$(this).css( {backgroundPosition:"0px 0px"});});
}

//Reveals Guests 3Nav
function showGuests(){
	if(initialGuests == 0){$("#guests").load("/feature_guests.html");};
	initialGuests = 1;
	$("#cycler").hide();
	$("#weekend").hide();
	$("#ministries").hide();
	$("#guests").show();
	$("#featureNav_guests").trigger( 'goto', [ 0 ] );
	$("#slides").css("z-index", "40");
	$("#featureNav_weekend").css("z-index", "40");
	$("#featureNav_ministries").css("z-index", "40");
	$("#featureNav_guests").css("z-index", "50");
	showArrows();
	menuHighlight();
	$("#menu_guests").css( {backgroundPosition:"0px -104px"});
	menuRollovers();
	$("#menu_guests").hover(function() {$(this).css( {backgroundPosition:"0px -104px"});},function () {$(this).css( {backgroundPosition:"0px -104px"});});
}
//Reveals Ministries 3Nav
function showMinistries(){
	if(initialMinistries == 0){$("#ministries").load("/feature_ministries.html");};
	initialMinistries = 1;
	$("#cycler").hide();
	$("#weekend").hide();
	$("#guests").hide();
	$("#ministries").show();
	$("#featureNav_ministries").trigger( 'goto', [ 0 ] );
	$("#slides").css("z-index", "40");
	$("#featureNav_weekend").css("z-index", "40");
	$("#featureNav_ministries").css("z-index", "50");
	$("#featureNav_guests").css("z-index", "40");
	showArrows();
	menuHighlight();
	$("#menu_ministries").css( {backgroundPosition:"-300px -104px"});
	menuRollovers();
	$("#menu_ministries").hover(function() {$(this).css( {backgroundPosition:"-300px -104px"});},function () {$(this).css( {backgroundPosition:"-300px -104px"});});
}
//Reveals Weekend 3Nav
function showWeekend(){
	if(initialWeekend == 0){$("#weekend").load("/feature_weekend.html");};
	initialWeekend = 1;
	$("#cycler").hide();
	$("#ministries").hide();
	$("#guests").hide();
	$("#weekend").show();
	$("#featureNav_weekend").trigger( 'goto', [ 0 ] );
	$("#slides").css("z-index", "40");
	$("#featureNav_weekend").css("z-index", "50");
	$("#featureNav_ministries").css("z-index", "40");
	$("#featureNav_guests").css("z-index", "40");
	showArrows();
	menuHighlight();
	$("#menu_weekend").css( {backgroundPosition:"-600px -104px"});
	menuRollovers();
	$("#menu_weekend").hover(function() {$(this).css( {backgroundPosition:"-600px -104px"});},function () {$(this).css( {backgroundPosition:"-600px -104px"});});
}

//Show 3Nav Menu
function showMenu(){
	document.write('<ul id="featureNav_menu"><li id="menu_guests" onclick="showGuests();" title="First Time Guests">First Time Guests</li><li id="menu_ministries" onclick="showMinistries();" title="Ministries @ SVCC">Ministries</li><li id="menu_weekend" onclick="showWeekend();" title="Weekend Experience">Weekend Experience</li></ul>');
}
	
