
/* home - image rotation */
function doHomepage() {
	$('#content_left_home').cycle({ 
		fx:			'fade',
		random:		0,		// true for random, false for sequence (not applicable to shuffle fx) 
		speed:		1500,	// speed of the transition (any valid fx speed value)
		timeout:	4000	// milliseconds between slide transitions (0 to disable auto advance) 
	 });
	$('#content_right_home').cycle({ 
		fx:			'fade',
		random:		0,		// true for random, false for sequence (not applicable to shuffle fx) 
		speed:		1500,	// speed of the transition (any valid fx speed value)
		timeout:	4000	// milliseconds between slide transitions (0 to disable auto advance) 
	 });
}

/* features - floor plans lightbox */
function doFeaturesFloorplans() {
	// Preload all rollovers
	$(".floorplans_grid img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"-active.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$(".floorplans_grid a").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/_over/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
		imgsrcON = imgsrc.replace(/.gif$/ig,"-active.gif"); // strip off extension
		$(this).children("img").attr("src", imgsrcON);
		}
		
	});
	$(".floorplans_grid a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
}


/* lifestyle - area map lightbox */
function doLifestyleAreamap() {
	$(function() {
		$('div#content_right a.areamap').lightBox();
	});
}

/* features - site plan lightbox */
function doFeaturesSiteplan() {
	$(function() {
		$('ul#subnavmenu_features li#subnavmenu3 a').lightBox();
	});
}

/* lifestyle - photo tour */
function doLifestylePhototour() {
	$(function() {
		$('#slideshow').cycle({
			fx:     'fade',
			speed:  1000,
			timeout: 0,
			pager:  '.phototour_grid',
			pagerAnchorBuilder: function(idx, slide) {
				return '.phototour_grid li:eq(' + (idx) + ') a';
			}
		});
	});
}

/* contect - directions */
function doDirections() {
	var street = document.directions_form.street.value;
	var city = document.directions_form.city.value;
	window.open('http://maps.yahoo.com/map?q1=' + street + ',' + city + '&q2=383%20Vista%20Roma%20Way%2C%20San%20Jose%2C%20CA%2095136&mag=5&ard=1#mvt=m&lat=35.737455&lon=-120.165085&mag=12&q1=' + street + '%2C' + city + '&q2=383%20Vista%20Roma%20Way%2C%20San%20Jose%2C%20CA%2095136','directions');
}

/* footer - show current year */
function showYear() {
	today=new Date(); // Initialize Date in raw form
	year=today.getYear(); // Get the year
	if(year<1000) year+=1900;
	document.write(year);
}
