// JavaScript Document

//primary nav

$(document).ready(function() {
	
$(".primaryNav li").hover(function() { //Hover over event on list item
	$(this).css({ 'background' : '#a69b70'}); //Add background color + image on hovered list item
	if (this.className == 'gray') {$(this).css({ 'background' : '#AAA'}) };
	$(this).css({ 'color' : '#000'});
	$(this).find("span").show(); //Show the subnav
} , function() { //on hover out...
	$(this).css({ 'background' : 'none'}); //Ditch the background
	$(this).css({ 'color' : '#ccc'});
	$(this).find("span").hide(); //Hide the subnav
});

//accordion
 $('.accordion .ac').hide();
 $('.accordion a.open').click(function(){
		 $(this).hide();
		 $(this).parent().children('.ac').slideDown();
 });
 $('.accordion a.close').click(function(){
		 $(this).parent().parent().parent().children('.open').show();
		 $(this).parent().parent().hide();
 });
 
 //home page tabs
 $('#tab2').hide();
 $('#tab3').hide();
 $('.tab').click(function(){
	 	 var $p = $(this).attr('name');
		 $('#tab1').hide();
		 $('#tab2').hide();
		 $('#tab3').hide();
		 $('#'+$p).show();
 });
 
 $('#cen1link').hover(function(){
	 $('#tab3').css({ 'background' : 'url(images/centerpoint1_home.jpg) no-repeat'});
 });
 
  $('#cen3link').hover(function(){
	 $('#tab3').css({ 'background' : 'url(images/centerpoint3_home.jpg) no-repeat'});
 });
 
  $('#ten1link').hover(function(){
	 $('#tab3').css({ 'background' : 'url(images/tennyson_home.jpg) no-repeat'});
 });
 
 //floor plans init
 $('div.plan').hide();
 $('div.inset').hide();
 
 $('#tertiaryNav li').click(function(e){
	  $('div.plan').hide();
	  $('#tertiaryNav li').removeClass('selected');
	  $(this).addClass('selected');
	  var $p = $(this).attr('name');
	  //alert('#'+$p);
	  $('#'+$p).show();
 });
 
 $('#insetNav span').click(function(e){
	  $('div.inset').hide();
	  $('#insetNav span').removeClass('selected');
	  $(this).addClass('selected');
	  var $p = $(this).attr('name');
	  //alert('#'+$p);
	  $('#'+$p).show();
 });
	
});
