var homeSlideShowIx = -1;
var homeSlideShowFolder = '../images/slideshow3_1300pxWide/';
var homeSlidShow = [
{image:'C-Main Lobby-DSC_2972_Ray.jpg',title:'Main Lobby'},
{image:'C-Private Cliend Booths-DSC_2997Ray.jpg',title:'Private Client Booths'},
{image:'DSC_2843-1ray.jpg',title:'Commercial Test Kitchen'},
{image:'DSC_2851-1ray.jpg',title:'Commercial Test Kitchen'},
{image:'DSC_2859ray.jpg',title:'Residential Kitchen'},
{image:'DSC_2880Ray.jpg',title:'CLT Room'},
{image:'DSC_2910-1ray.jpg',title:' Client Lounge'},
{image:'DSC_2921ray.jpg',title:'Observation Room'},
{image:'DSC_2929ray.jpg',title:'Focus Group Room'},
{image:'DSC_2942ray.jpg',title:'Second Waiting Area'},
{image:'DSC_2951_RAY_focus_logo.jpg',title:'State of the Art Technology'}];

function homeLoadAllImagesIntoHiddenDiv(){
	//doing this has the effect of preloading the images
	var result='';
	for(var i=0, len=homeSlidShow.length;i<len; i++){
		result += '<img src="'+ homeSlideShowFolder + homeSlidShow[i].image  +'">\n\t';			
	}	
	result = '<div style="display:none">' + result + '</div>';
	document.writeln(result);
}
homeLoadAllImagesIntoHiddenDiv();

function homeSlideShow(){
	if (homeSlideShowIx==(homeSlidShow.length-1))
		homeSlideShowIx = 0;
	else 
		homeSlideShowIx++;
		
	$('#mainbody').css('background-image', 'url("' + homeSlideShowFolder + homeSlidShow[homeSlideShowIx].image + '")').css('background-repeat','no-repeat').css('background-position','center center');	
	$('#imageTitle').html(homeSlidShow[homeSlideShowIx].title);
	
	//align the technology image to the right
	if (homeSlidShow[homeSlideShowIx].image === 'DSC_2951_RAY_focus_logo.jpg'){ $('#mainbody').css('background-position','top right')}
}


var cfuse = (cfuse)? cfuse:{};
cfuse.home={
	_interval:null,
	fadeTo:function(color){
		if (color=='black') {
			$('#fader').css('background-image', 'url(../images/blackGradientBG.png)').css('color', 'white');
			$('#fader h1').css('color','white').css('border-bottom-color', 'white');
		}
		else if (color=='blue') {
			$('#fader').css('background-image', 'url(../images/blueGradientBG.png)').css('color', '#fff');
			$('#fader h1').css('color','#fff').css('border-bottom-color', 'white');;
		} else if (color=='white') {
			$('#fader').css('background-image', 'url(../images/whiteGradientBG.png)').css('color', 'black');
			$('#fader h1').css('color','#505050').css('border-bottom-color', '#505050');;
		} else if (color=='none')  {
			$('#fader').css('background-image', '').css('color', 'black');
			$('#fader h1').css('color','#505050').css('border-bottom-color', '#505050');;;
		}
		return false;
	},
	slideShow:function(state){
		clearInterval(_interval);
		if (state=='on') {
			_interval=setInterval(homeSlideShow, 3000);
		} else if (state=='off') {
			$('#mainbody').css('background-image', 'url("../images/slideshow3_1300pxWide/C-Main Lobby-DSC_2972_Ray.jpg")');
		}
		return false;
	}
	};

$(document).ready(function() {
    /*$('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});*/
	
	//$('#mainbody').css('background-image', 'url("../images/slideshow3_1045pxWide/C-Main Lobby-DSC_2972_Ray.jpg")');
	homeSlideShow();
	_interval=setInterval(homeSlideShow, 3000);
});
