var BigRotator;
var SmallRotator;

document.observe('dom:loaded', function()
{
	BigRotator = new Rotator($('featured'));
	if($$('#featured_wrapper ul li').length > 1)
	{
		// More than one image in rotator, so show the arrows
		$$('.previous_button')[0].show();
		$$('.next_button')[0].show();
	}
	SmallRotator = new Rotator($('featured_small'), { itemsPerFrame: 4, duration: 0.2, autoRotate: false });
	$$('#right_content a').each(function(el) { MyWindow.attach(el, function() { Cufon.replace('.right_side h1'); }); });
	$$('#video_link').each(function(el) { MyWindow.attach(el) });
	$$('#navi li').invoke('observe', 'mouseenter', openSubMenu);
	$$('#navi li').invoke('observe', 'mouseleave', closeSubMenu);
	$$('.cse-branding-bottom').each(function(e){ e.setStyle({ background: 'none' }) });
	$$('.cse-branding-bottom input[type=submit]').each(function(e){ e.value = ''; });
	new Validation('contact_form', {useTitles : true});
});

openSubMenu = function() {
	if(this.down('ul')) {
		this.down('ul').addClassName('open');
		this.down('ul').show();
	}
}

closeSubMenu = function() {
	if(this.down('ul')) {
		this.down('ul').removeClassName('open');
		this.down('ul').hide();
	}
}
