$(document).ready(function() {
	
	// compliant new window code
	$('a[rel="external"]').attr('target', '_blank');
	//$('#addFav').jFav();
		
	// header promo panel
	$('#promo-slideshow').after('<div id="promo-slideshow-nav"></div>').cycle({ 
		fx:     'fade', 
		speed:  1000, 
		timeout: 4000, 
		pager:  '#promo-slideshow-nav',
		pause: 1 
	});
	
		// header promo panel
	$('#pages-slideshow').after('<div id="pages-slideshow-nav"></div>').cycle({ 
		fx:     'fade', 
		speed:  1000, 
		timeout: 4000, 
		next:   '#next2', 
    	prev:   '#prev2', 
		pause: 1 
	});
	
	// fancybox
	$("a.fancy-image").fancybox();
	
	// disbles right-click on images
	$('img').bind("contextmenu", function(e){ return false; });
	
	// video section tabs
	$(".video-list-tabs li a").click(function(){
		$(".video-list-tabs li a").removeClass('selected'); // kill selected tab state
		$("ul.video-list").hide(); // hide all video thumbs
		$(this).addClass('selected'); // highlight current tab
		var current_video_section = $(this).attr('href'); // grab the section to show
		$("ul#"+current_video_section).fadeIn('fast'); // show the current section
		return false;
	});
	
	// form placeholder text removal
	$('form input').focus(function(){
		if($(this).val() == "Email Address"){
			$(this).val('');
		}
	});
	
	if($('.specialTrack').length > 0){
		$('.specialTrack').click(function(){
			s=s_gi(s_account);
			s.linkTrackVars='prop26,eVar8';
			specialName = $(this).attr('rel');
			s.prop26=specialName.toLowerCase();
			s.eVar8 = s.prop26;
			s.tl(this, 'o', specialName.toLowerCase());
		
		});
	 }
	 if($('.building').length > 0 ){
		$('.item-list').hide();
		$('.building').prepend('<a href="#" class="expand">+</a>'); 
		$('.expand').click(function(){
			$(this).parent('h2').next('ul').toggle();
			if($(this).parent('h2').next('ul').css('display') == "block"){
				$(this).html('-');
			}
			else{
				$(this).html('+');
			}
		return false;
		});
		$(".building").hover(function (){
				$(this).css("text-decoration", "underline");
			},function(){
				$(this).css("text-decoration", "none");
			}
		);

		$('.building').click(function(){
			$(this).next('ul').toggle();
			if($(this).next('ul').css('display') == "block"){
				$(this).children().html('-');
			}
			else{
				$(this).children().html('+');
			}
		return false;
		});
	 }
		
});
