$(function() {
// Sample usage of jquery.flash plugin - remove if not needed
	/*	If given the following markup:

	<div id="masthead">
		<img src="images/mastheads/flash-alt.jpg" alt="" /><br />
	</div>
	
	you would use the following to replace the alternate content:
*/
	$("body.home div#masthead").flash(
		{src:"flash/homepage.swf",
		 width:548,
		 height:309,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"});

	$('dl#virtual-tours a').click(function() {
	    var popUp = window.open(this.href, '', 'width=695,height=400');
	    return false;
	});
	
	$('div#floorplans a').click(function() {
	    var popUp = window.open(this.href, '', 'width=695,height=400');
	    return false;
	});
	


// Sample sifr usage - remove if not needed
	/**/
	// intPadding array order is: left, top, right, bottom - must match css for corresponding element
	$('div#content h1').sifr(
		{ strSWF: 'flash/century-gothic.swf', strColor: '#6989AC', strWmode: 'transparent', intPadding: [0, 0, 0, 0]  },
		{ expressInstall: true }
	);
	$('div#content h2').sifr(
		{ strSWF: 'flash/century-gothic.swf', strColor: '#010101', strWmode: 'transparent', intPadding: [0, 0, 0, 0]  },
		{ expressInstall: true }
	);
	$('div#content h3').sifr(
		{ strSWF: 'flash/century-gothic.swf', strColor: '#5B5B5B', strWmode: 'transparent', intPadding: [0, 0, 0, 0]  },
		{ expressInstall: true }
	);
	$('body.home div#push ul#rotate-push-list h2').sifr(
		{ strSWF: 'flash/century-gothic.swf', strColor: '#5B5B5B', strWmode: 'transparent', intPadding: [0, 13, 0, 8], strFlashVars: 'textalign=center&'  },
		{ expressInstall: true }
	);
	$('div#push ul#push-marketing h2').sifr(
		{ strSWF: 'flash/century-gothic.swf', strColor: '#010101', strWmode: 'transparent', intPadding: [0, 13, 0, 8]  },
		{ expressInstall: true }
	);
	$('div#push ul#rotate-push-list h2').sifr(
		{ strSWF: 'flash/century-gothic.swf', strColor: '#010101', strWmode: 'transparent', intPadding: [0, 13, 0, 8] },
		{ expressInstall: true }
	);
	
	
//code to rotate push marketing

	var count = $('ul#rotate-push-list li').size();
	var rand = Math.floor(Math.random()*count);
	
	$('ul#rotate-push-list li').not(':eq('+rand+')').hide();
	$('ul#rotate-push-list li:eq('+rand+')').addClass('current');
	$('.link-refresh a').click(function() {
		setTimeout(function() {
			$('div#push-loading img').attr("src", 'images/layout/ajax-loader.gif?random=' + new Date().getTime())
		}, 500);
		var h = $('div#push-loading').parent().height(); //ie6 won't fill the push box by default
		$('div#push-loading').addClass('loading').height(h);
		var nextItem = ($('ul#rotate-push-list li.current').next().html()) ? $('ul#rotate-push-list li.current').next() : $('ul#rotate-push-list li:eq(0)');
		$('ul#rotate-push-list li.current').removeClass('current').fadeOut('slow', function() {nextItem.addClass('current').fadeIn('slow', function() {$('div#push-loading').removeClass('loading')});})
		clearTimeout();
		return false;
	});


// Adds hover class for IE and animation for drop down nav - remove if not needed
	 $("ul#nav-primary li").hover(
        function(){ $("ul", this).show(); }, 
        function() { 
		$("ul", this).hide();  
		} 
    );
    if (document.all) {
        $("ul#nav-primary li").hoverClass("sfhover");
		$("ul#nav-primary li ul li").hoverClass("over");
		
    }
	/*
	$("ul#nav-primary li").hover(
        function(){ $("ul", this).fadeIn("fast"); }, 
        function() { } 
    );
    if (document.all) {
        $("ul#nav-primary li").hoverClass("over");
		$("ul#nav-primary li ul li").hoverClass("over");
    }
	*/
	$("blockquote > p:last").addClass("bottom-quote");
});


// Function to add/remove "over" class for drop down nav - remove if not needed
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});

};   
