//---------------------------------------------------------------------------------------------
//---- GLOBAL JAVASCRIPT
jQuery(document).ready(function(){ 
														
	jQuery('#promo').innerfade({ 
		animationtype: 'fade',
		speed: 1000,
		timeout: 6000,
		type: 'sequence'
	});
	

		jQuery(".tab1").click(function(){											
			jQuery("#promo li").stop();
			clearTimeout(t);
			jQuery("#promo li").css({display:"none"});
			jQuery("#promo li").animate({opacity:"1"},0);
			jQuery("#promo li.slide1").css({display:"block"});
			jQuery(".tab").css({marginLeft:"-7px"},500);
			jQuery(this).css({marginLeft:"-2px"},500);
		});
		jQuery(".tab2").click(function(){											
			jQuery("#promo li").stop();
			clearTimeout(t);
			jQuery("#promo li").css({display:"none"});
			jQuery("#promo li").animate({opacity:"1"},0);
			jQuery("#promo li.slide2").css({display:"block"});
			jQuery(".tab").css({marginLeft:"-7px"},500);
			jQuery(this).css({marginLeft:"-2px"},500);
		});
		
	
	
	//INSTANTIATE LIGHTBOX
	$(function() {
		$('a.LBLink').lightBox();
		$('.mapLightbox a').lightBox();
	})
	
	
	//NAV MENU ROLLOVER FADE
	$(function () {
	//IF (IE6) EXIT			
	if ($.browser.msie && $.browser.version < 7) return;
		if ($.browser.msie)
		{
			$('.nav ul li a').append("<div class='ieHover'></div>")
			$('.nav ul li a').each(function () {
				var $div = $('> div.ieHover',this).css('opacity', 0);
				$(this).children('div').height($(this).outerHeight()-5).width($(this).outerWidth()-5);
				$(this).removeClass("navLink");
				$(this).hover(function () {
					$div.stop().fadeTo(250, .3);
					}, function () {
					$div.stop().fadeTo(650, 0);
				});
			});
		} else{
			$('.nav ul li a').append("<div class='hover'></div>")
			$('.nav ul li a').each(function () {
				var $div = $('> div.hover',this).css('opacity', 0);
				$(this).children('div').height($(this).outerHeight()-4).width($(this).outerWidth()-5);
				$(this).removeClass("navLink");
				$(this).hover(function () {
					$div.stop().fadeTo(250, 1);
					}, function () {
					$div.stop().fadeTo(650, 0);
				});
			});
		}
	});
	
	
	
	//OFFERING LINK ONCLICK/HOVER ANIMATIONS
	
	var servButton = jQuery(".services .left ul li");
	var servButtonActive = jQuery(".services .left ul li.active");
	var servButtonInactive = jQuery(".services .left ul li.inactive");
	var servDesc = jQuery(".services .right ul li");
	var hoverOpacity = ".7";
	var inactiveOpacity = ".5";
	var activeOpacity = "1";
	var fadeSpeed = "180"
	
	servDesc.css({'position':'absolute','width':'620px', 'display':'none'});

	servButton.each(function(i){
	$(this).animate({opacity:inactiveOpacity},0);
		jQuery(this).bind ("click",function(){
			/*$('.rotatorOuter').slideUp(1000, function(){
				$('.subNav').slideDown(400);*/
				servDesc.eq(i).siblings().fadeOut(fadeSpeed, function () {
				servDesc.eq(i).fadeIn(fadeSpeed);
				/*});*/
			});
			$(this).siblings('li').animate({opacity:inactiveOpacity},fadeSpeed).addClass("inactive").removeClass("active");
			jQuery(this).animate({opacity:activeOpacity},fadeSpeed).addClass("active").removeClass("inactive");
		});
	});
	
	//servButtonInactive.hover(function(){
		//jQuery(this).animate({opacity:hoverOpacity},fadeSpeed);						 
	 //},function(){
		//jQuery(this).animate({opacity:inactiveOpacity},fadeSpeed);
	//});
	
	jQuery('.services .left ul li:first').click();
	

	//PORTFOLIO 'SEE MORE' BUTTONS
	$('span.seeMore').click(function(){
		if ($(this).text() == 'see more'){
			$(this).parents('.floater').prev('.wrapBottom').animate({height:'260px'}, 500);
			$(this).text('see less');
			$(this).css({'background-position':'right -36px'});
		}
		else{
			$(this).parents('.floater').prev('.wrapBottom').animate({height:'165px'}, 500);
			$(this).text('see more');
			$(this).css({'background-position':'right top'});
		}
	});

});

jQuery.fn.delay = function(time,func){
	return this.each(function(){
		setTimeout(func,time);
	});
};
