$(document).ready(function(){
	var sitehome = 'http://www.vnsaga.com/development/ndi';
	var terms = 'terms';
	var privacy = 'privacy';
	$('#slider').animate({
		opacity: 0
	});
	$('a.back').click(function(){
			parent.history.back();
			return false;
	});
	$(window).load(function(){
		$('#slider p').anythingSlider({
			width: 960,
			height: 476,
			resizeContents: false,
			startPanel: 1,
			buildArrows: false,
			autoPlay: true,
			startStopped: false,
			pauseOnHover: false,
			stopAtEnd: false,
			easing: 'easeInOutExpo',
		});
		$('#slider').animate({
			opacity: 1
		}, 700);
	});
	$('#menu-item-63').click(function(){
		var winref = window.open(terms,'Terms | NDI Development','width=800,height=600,scrollbars=1');
		return false;
	});
	$('#menu-item-62').click(function(){
		var winref = window.open(privacy,'Terms | NDI Development','width=800,height=600,scrollbars=1');
		return false;
	});
	$('.content').find('p:last-child').css('padding-bottom','0');
	var curMap = $('.atlanta_map').attr('src');
	$('.cobb').hover(function(){
		$('.atlanta_map').attr('src',sitehome + '/wp-content/themes/ndi/images/map-cobb.gif');
	}, function(){
		$('.atlanta_map').attr('src',curMap);
	});
	$('.gwinnett').hover(function(){
		$('.atlanta_map').attr('src',sitehome + '/wp-content/themes/ndi/images/map-gwinnett.gif');
	}, function(){
		$('.atlanta_map').attr('src',curMap);
	});
	$('.dekalb').hover(function(){
		$('.atlanta_map').attr('src',sitehome + '/wp-content/themes/ndi/images/map-dekalb.gif');
	}, function(){
		$('.atlanta_map').attr('src',curMap);
	});
	$('.rockdale').hover(function(){
		$('.atlanta_map').attr('src',sitehome + '/wp-content/themes/ndi/images/map-rockdale.gif');
	}, function(){
		$('.atlanta_map').attr('src',curMap);
	});
	$('.clayton').hover(function(){
		$('.atlanta_map').attr('src',sitehome + '/wp-content/themes/ndi/images/map-clayton.gif');
	}, function(){
		$('.atlanta_map').attr('src',curMap);
	});
	$('.fulton').hover(function(){
		$('.atlanta_map').attr('src',sitehome + '/wp-content/themes/ndi/images/map-fulton.gif');
	}, function(){
		$('.atlanta_map').attr('src',curMap);
	});
	
	// Directions Gadget
	$('.gadget').find('tr:first-child').css('display','none');
	$('.gadget').find('tr:last-child').css('display','none');
	
	// FAQ
	$('#faq').find('blockquote').click(function(){
		$(this).find('p').slideToggle();
	})
	$('#faq').find('blockquote').hover(function(){
		$(this).css('background','#ABB9CA');
		$(this).css('color','#fff');
	}, function(){
		$(this).css('background','#f6f6f6');
		$(this).css('color','#222');
	})
	
	// LEASE DETAILS
	$('#subnav').find('.overview').click(function(){
		$(this).addClass('active');
		$('#subnav').find('.photos').removeClass('active');
		$('#subnav').find('.siteplan').removeClass('active');
		$('#lease-photos').css('display','none');
		$('#lease-siteplan').css('display','none');
		if($('#lease-details').css('display') == 'none') {
			$('#lease-details').css('display','block');
		}
		return false;
	});
	$('#subnav').find('.photos').click(function(){
		$(this).addClass('active');
		$('#subnav').find('.overview').removeClass('active');
		$('#subnav').find('.siteplan').removeClass('active');
		$('#lease-details').css('display','none');
		$('#lease-siteplan').css('display','none');
		if($('#lease-photos').css('display') == 'none') {
			$('#lease-photos').css('display','block');
		}
		return false;
	});
	$('#subnav').find('.siteplan').click(function(){
		$(this).addClass('active');
		$('#subnav').find('.overview').removeClass('active');
		$('#subnav').find('.photos').removeClass('active');
		$('#lease-details').css('display','none');
		$('#lease-photos').css('display','none');
		if($('#lease-siteplan').css('display') == 'none') {
			$('#lease-siteplan').css('display','block');
		}
		return false;
	});
	
	$('#photo-gallery').find('a').lightBox({
		imageLoading: 'http://www.vnsaga.com/development/ndi/wp-content/themes/ndi/images/lightbox-ico-loading.gif',
		imageBtnClose: 'http://www.vnsaga.com/development/ndi/wp-content/themes/ndi/images/lightbox-btn-close.gif',
		imageBtnPrev: 'http://www.vnsaga.com/development/ndi/wp-content/themes/ndi/images/lightbox-btn-prev.gif',
		imageBtnNext: 'http://www.vnsaga.com/development/ndi/wp-content/themes/ndi/images/lightbox-btn-next.gif',
	});
	
	$('.s-target').click(function(){
		return false;
	})
	$('.s-target').ezpz_tooltip({
		showContent: function(content) {
			content.fadeIn('fast');
		},
		hideContent: function(content) {
			content.stop(true, true).fadeOut('fast');
		}
	});
	
});
