	// IE6 background-image flicker issue
	try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {}
	
	var pos = 1;
	var brands_visible = 0;
	var scroll_height = 218;
	var scroll_width = 134;
	
	var cloud_x, cloud_y, cloud_min_x, cloud_min_y, cloud_max_x, cloud_min_y, direction, speed;
		
	cloud_x			= 670;
	cloud_min_y 	= 10;
	cloud_max_y		= cloud_min_y + 10;
	speed			= 1.5;
	
	var cloud_x2, cloud_y2, cloud_min_x2, cloud_min_y2, cloud_max_x2, cloud_min_y2, direction2, speed2;
	cloud_x2		= 450;
	cloud_min_y2 	= 15;
	cloud_max_y2	= 20;
	speed2			= 2;
	
	function cloud_down() {
		new Effect.Move('cloud', {
			x: cloud_x, y: cloud_max_y, mode: 'absolute',
			duration: speed,
			afterFinish: function() {
				cloud_up();
			}
		});
	}
	
	function cloud_up() {
		new Effect.Move('cloud', {
			x: cloud_x, y: cloud_min_y, mode: 'absolute',
			duration: speed,
			afterFinish: function() {
				cloud_down();
			}
		});
	}
	
	function cloud_small_down() {
		new Effect.Move('cloud_small', {
			x: cloud_x2, y: cloud_max_y2, mode: 'absolute',
			duration: speed2,
			afterFinish: function() {
				cloud_small_up();
			}
		});
	}
	
	function cloud_small_up() {
		new Effect.Move('cloud_small', {
			x: cloud_x2, y: cloud_min_y2, mode: 'absolute',
			duration: speed2,
			afterFinish: function() {
				cloud_small_down();
			}
		});
	}
	
	function show_brands() {
		if (brands_visible) {
			new Effect.MoveBy('brands_content', -(scroll_height), 0 , {
				duration: 0.3, 
				transition: Effect.Transitions.sinoidal,
				afterFinish: function() {
					$('brands_nav').style.top = '-500px';
				}	
			});
			
			if ($('home_heroes')) new Effect.Opacity('home_heroes', { from: .15, to: 1, duration: .4 });
			else if ($('hero_image')) new Effect.Opacity('hero_image', { from: .15, to: 1, duration: .4 });
			
			brands_visible = 0;	
		} else {
			$('brands_nav').style.top = '0px';
			new Effect.MoveBy('brands_content', scroll_height, 0 , {duration: 0.3,  transition: Effect.Transitions.sinoidal});

			if ($('home_heroes')) new Effect.Opacity('home_heroes', { from: 1, to: .15, duration: .4 });
			else if ($('hero_image')) new Effect.Opacity('hero_image', { from: 1, to: .15, duration: .4 });			
			
			brands_visible = 1;	
		}
	}
	
	function brands_back() {
		if (pos > 1) {
			new Effect.MoveBy('brands_scroller', 0, scroll_width , {duration: 0.2,  transition: Effect.Transitions.sinoidal});
			pos--;
		}
		check_arrows();
	}
	
	function brands_next() {
		if (pos < brands) {
			new Effect.MoveBy('brands_scroller', 0, -scroll_width , {duration: 0.2,  transition: Effect.Transitions.sinoidal});
			pos++;
		}
		check_arrows();
	}
	
	function check_arrows() {
		if (pos == brands) $('arrow_right').className = 'brands_right_arrow_disabled';
		else $('arrow_right').className = 'brands_right_arrow';
		if (pos == 1) $('arrow_left').className = 'brands_left_arrow_disabled';
		else $('arrow_left').className = 'brands_left_arrow';
	}
	
	window.onload = function() {
		// brand navigation roll overs
		$$('#brands_scroller div .brand_nav_image').each(function(x) {
			x.onmouseover = function() { this.className = 'brand_nav_image_hover'; }
			x.onmouseout = function() { this.className = 'brand_nav_image'; }
		});
		
		// begin cloud movement
		if ($('cloud')) {
			cloud_down();
			cloud_small_up();
		}
		
		if ($('home_heroes')) {
			setTimeout("slide_show()", 3000);
			current_image = $$('#home_heroes div')[0];
		}
		
		// text field highlight effect
		text_fields = $$('.text_field');
		if (text_fields.length) {
			text_fields.each(function(x) {
				if (x.className == 'text_field') {
					x.onfocus = function() { this.className = 'text_field_focus'; }
					x.onblur = function() { this.className = 'text_field'; }
				}
			});
			$(error_field).activate();
		}
	};
	
	function slide_show() {
		next = ($(current_image).next() || $('home_heroes').firstDescendant());
		new Effect.Fade(current_image, {
			duration: .6
		});
		new Effect.Appear(next, {
			duration: .6,
			afterFinish: function() {
				current_image = next.readAttribute('id');
				setTimeout("slide_show()", 3000);
			}
		});
	}