/***** TABS *****/
jQuery(document).ready(function(jQuery) {
	
	/* Accordian */
	var ti = 250;
	jQuery('.acc .more').each(function() {
		jQuery(this).attr('height',jQuery(this).height());
		jQuery(this).animate({height:0},0);
	});
	jQuery('.acc.current .more').each(function() {
		jQuery(this).animate({height:jQuery(this).attr("height")},250);
	});
	jQuery('.acc .moreLink').each(function() {
		jQuery(this).attr('height',jQuery(this).height());
	});
	jQuery('.acc.current .moreLink').each(function() {
		jQuery(this).animate({height:0},0);
	});
	
	jQuery('.acc .moreLink').click(function(e) {
		e.preventDefault();
		
		var moreDiv = jQuery(this).closest('div.acc').find('div.more');
		var moreLink = jQuery(this);
		
		if (moreDiv.height()==0) {
			
			jQuery(this).closest('div.accWrap').find('.acc .moreLink').not(moreLink).animate({height:jQuery(this).height()},ti/2);
			moreLink.animate({height:0},ti/2);
			
			jQuery(this).closest('div.accWrap').find('.acc .more').not(moreDiv).animate({height:0},ti);
			moreDiv.animate({height:moreDiv.attr("height")},ti);
			
		} else {
			/*jQuery('.staffMember .more').animate({height:0},100);
			jQuery(this).animate({height:jQuery(this).height()},100);*/
		}
	});
	
	// setup ul.tabs to work as tabs for each .pane in it's parent (sets all instances of tabs on page)
	// Find initial
	var tabIndex = jQuery("ul.tabs li.current").index();
	if (tabIndex==-1) { tabIndex=0; }
	
	jQuery("ul.tabs").tabs("> .pane", {tabs: 'a.tab', initialIndex: tabIndex});
/*	jQuery(".blockTabs").tabs(".blockTabs .pane", {tabs: '.tabLogo a'});*/
		
	/********* FANCY BOX **********/	
	/*** VIDEO POP ***/
	  jQuery(".pop").fancybox({
		'padding'      : 3,
		'width'        : 640,
		'height'       : 380,
		'transitionIn' : 'elastic',
		'transitionOut': 'elastic',
		'hideOnOverlayClick': true,
		'centerOnScroll': true,
		'type'         : 'iframe'
	  });
	/*** GENERAL FB ***/
	  jQuery(".fb").fancybox({
		'padding'      : 3,
		'transitionIn' : 'elastic',
		'transitionOut': 'elastic',
		'hideOnOverlayClick': true,
		'centerOnScroll': true
	  });
	/********* LANDING FORM **********/
	
	if (jQuery.cookie("popAdvertViewed") == 0 || jQuery.cookie("popAdvertViewed") == null) {
		jQuery.cookie("popAdvertViewed", 1, { expires: 300 });
			
		jQuery.fancybox({
			type 		 : 'iframe',
			href		 : '/LandingForm',
			padding      : 0,
			width        : 630,
			height       : 400,
			transitionIn : 'elastic',
			transitionOut : 'elastic',
			hideOnContentClick : true,
			centerOnScroll : true,
			overlayOpacity : 0.6,
			overlayColor : "#ffffff",
			titleShow : false
		});
	
	}//*/
	
});
