/*
====================================================================== 
Version:       1.0													
Last Updated:	November 04, 2010
Copyright:	   (c) 2010 Joe Nyaggah. All rights reserved.				
====================================================================== 
*/
jQuery(document).ready(function($) {
								
								
	/*
	===================
	HIDE ON PAGE LOAD
	===================
	*/
	//hide all service description divs
	$('.serviceDesc, .contactForm, span.formLoading').hide();
	
	//hide header contact info
	$('ul#hiddenContact').hide();
	
	
	/*
	===================
	show contact form
	===================
	*/
	$('.showContact').click(function() {
		//toggle active link color class
		$(this).toggleClass('active');
		//removes the initial hidden class
		//starts with hidden class to prevent
		//flickering before dom is ready
		$('.formAndLoader').removeClass('hidden');
		//arbitrary loading gif
		$('span.formLoading').show().delay(500).fadeOut(400)
		//toggle form visibility
		$('.contactForm').delay(1000).slideToggle(400);
		return false;
	 });

	/*
	===================
	show/hide contact info
	===================
	*/
	//show/hide fieldsets
//	$('.showContact').click(function() {
//		$('ul.vCard').slideToggle(200);	
//		$('.topBlackBar.sayHello').slideToggle(200);
//		$(this).toggleClass('active');
//		$('ul.vCard#hiddenContact').toggleClass('hidden');
//		return false;
//	 });


	/*
	===================
	SITEWIDE BEHAVIORS
	===================
	*/
	//start out with the textarea at 50px
	$('textarea').css({ height:"50px"});
	//enlarges textarea when you click (focus)
	//and reduces it when you leave (blur)
	//just a lil extra touch of sexiness
	$('textarea').focus(function(){ 
		$(this).animate({ height:"150px"}, 500); // enlarge height 
	}).blur(function(){ 
		$(this).animate({ height:"50px"}, 500); // reduce height 
	});


	/*
	===================
	COLORBOX (lightbox)
	===================
	*/
	
	//featurelist on front page.
	$("a[rel='featurelist']").colorbox();

	/*
	===================
	NIVO slider
	===================
	*/
	$(window).load(function() {
		$('#slider').nivoSlider({
			effect:'random', //Specify sets like: 'random,fold,fade,sliceDown'
			slices:15,
			animSpeed:500,
			pauseTime:3000,
			startSlide:0, //Set starting Slide (0 index)
			directionNav:true, //Next and Prev
			directionNavHide:true, //Only show on hover
			controlNav:true, //1,2,3...
			controlNavThumbs:false, //Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, //Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', //Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			keyboardNav:true, //Use left and right arrows
			pauseOnHover:true, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:0.8, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){},
			slideshowEnd: function(){} //Triggers after all slides have been shown
		});
	});
	

	/*
	===================
	SERVICES page
	===================
	*/
	//target the first list item and add relevant active class
	$(".servicesHolder > li:first").addClass('currentListItem');
	//show first serviceDesc
	$('.serviceDesc.firstDesc').show();


	$('ul.servicesHolder li h3 a').click(function() {
		//hide all 'serviceDesc' divs
		$('ul.servicesHolder li .serviceDesc').slideUp(200);
		//add 'currentLIstItem' class to currently open list item
		$(this).parent().parents('li').addClass('currentListItem');
		//remove active link color from previous h3 a
		$('li.currentListItem').prev().removeClass('currentListItem');
		//remove active link color from next h3 a
		$('li.currentListItem').next().removeClass('currentListItem');
		//slide current list item's 'serviceDesc' div
		$(this).parent().next().slideToggle(200);	
		return false;
	 });


	/*
	===================
	TEAM page
	===================
	*/
	$('ul.teamPage li h3 a').click(function() {
		//hide all 'serviceDesc' divs
		$('ul.teamPage li .serviceDesc').slideUp(200);
		//open immediately next 'serviceDesc' div
		$(this).parent().parent().toggleClass('currentListItem');												 
		$(this).parent().next().slideToggle(200);	
		return false;
	 });
	
	
	/*
	===================
	SCROLLbar
	===================
	*/
	$(function()
	{
		$('.scroll-pane').jScrollPane(
			{
				autoReinitialise: true,
				showArrows: true,

			}
		);
	});
		
	
});//end
