// JavaScript Document
window.addEvent('domready',function(e){
								
	$$('.divider').each(function(itm,idx,arr){
		var maxH=0;
		myDivs=itm.getElements('div.footerbox');
		for(var n=0; n<myDivs.length; n++){
			var myH=$(myDivs[n]).getHeight().toInt();
			maxH=(maxH >= myH)? maxH : myH;	
		}
		for(var n=0; n<myDivs.length; n++){
			myDivs[n].setStyle('height',maxH-28+"px");
		}
		
	});
	
	
/*	footerBoxes();*/
//	startSlideShow();
});

function footerBoxes(){
	$$('.footerbox').each(function(itm,idx,a){
		var w=itm.getWidth().toInt();
		var h=itm.getHeight().toInt();
		w=(w%2) ? (w+3)/2 : (w+2)/2;
		h=(h%2) ? (h+3)/2 : (h+2)/2;
		var topleft =	 new Element('div', {'class': 'tl'});
		var topright =	 new Element('div', {'class': 'tr'});
		var bottomleft =	 new Element('div', {'class': 'bl'});
		var bottomright =	 new Element('div', {'class': 'br'});
		bottomright.setStyles({'height':h+"px",'width':w+"px"}).inject(itm,'top');
		bottomleft.setStyles({'height':h+"px",'width':w+"px"}).inject(itm,'top');
		topright.setStyles({'height':h+"px",'width':w+"px"}).inject(itm,'top');
		topleft.setStyles({'height':h+"px",'width':w+"px"}).inject(itm,'top');
	});
	
}



var mySlides,newslide;

var startSlideShow=function(){
	var img0=new Element('img',{'src':'_gfx/homeimages/home01.jpg','width':'704px','height':'364px','alt':'why citrusleaf?'});
	var img1=new Element('img',{'src':'_gfx/homeimages/home02.jpg','width':'704px','height':'364px','alt':'why citrusleaf?'});
	var img2=new Element('img',{'src':'_gfx/homeimages/home03.jpg','width':'704px','height':'364px','alt':'why citrusleaf?'});
	$('fg').empty();
	advSlide.periodical(7000);
	mySlides=[img1,img2,img0];
}
var advSlide=function(){
	if(newslide){newslide.inject($('bg').empty());}
	newslide=mySlides.shift();
	mySlides.push(newslide);
	newslide.inject($('fg').setStyle('opacity','0').empty());
	$('fg').set('tween',{'duration':'1500'});
	$('fg').tween('opacity',1);
}


