/*------------- [ BIG BOXES ] -------------*/

	Event.observe(window, 'load', function(){
		$$('.content .box').each(function(element){
			element.insert({ top: '<div class="border-topleft"></div>' });
			element.insert({ top: '<div class="border-topright"></div>' });
			element.insert({ top: '<div class="border-bottomleft"></div>' });
			element.insert({ top: '<div class="border-bottomright"></div>' });

			element.observe('mouseover', function(){
				this.toggleClassName('hover');
			});

			element.observe('mouseout', function(){
				this.toggleClassName('hover');
			});
		});

		$$('.content .boxhome').each(function(element){
			element.insert({ top: '<div class="border-topleft"></div>' });
			element.insert({ top: '<div class="border-topright"></div>' });
			element.insert({ top: '<div class="border-bottomleft"></div>' });
			element.insert({ top: '<div class="border-bottomright"></div>' });
		});
	});


/*------------- [ MOTOR REGISTRATION FORM ] -------------*/

	Event.observe(window, 'load', function(){
		if($('motor'))
			window.motorType = $('motor').getValue();

		if(!Object.isUndefined(window.motorType)){
			if(motorType === '0'){
				$$('.mercury').each(function(element){
					element.hide();
				});
			}
			else {
				$$('.mercruiser').each(function(element){
					element.hide();
				});
			}

			if($('motor')){
				$('motor').observe('change', function(){
					if (this.getValue() != motorType) {
						motorType = this.getValue();
	
						$$('.mercury, .mercruiser').each(function(element){
							element.toggle();
						});
					}
				});
			}
		}
	});


/*------------- [ PARTS CATALOG FORM ] -------------*/

	Event.observe(window, 'load', function(){
		/*** HP/SER SELECTS  ***/

		if($('product-list')) {
			$('product-list').observe('change', function(){
				if(this.getValue() != ""){
					this.up('tr').next('tr').show();
				}
				
				if(this.getValue() == ""){
					this.up('tr').next('tr').hide();
				}
				
				this.up('tr').next('tr',1).hide();
				$('block-listing').hide();
				
			});
		}

		if($('model-list')) {
			$('model-list').observe('change', function(){
				if(this.getValue() != ""){
					this.up('tr').next('tr').show();
				}
				
				if(this.getValue() == ""){
					this.up('tr').next('tr').hide();
				}
	
				$('block-listing').hide();
			});
		}

		if($('serialrange-list')) {
			$('serialrange-list').observe('change', function(){
				if(this.getValue() != ""){
					$('block-listing').show();
				}
				
				if(this.getValue() == ""){
					$('block-listing').hide();
				}
			});
		}


		/*** YEAR/HP SELECTS  ***/

		if($('productline-list')) {
			$('productline-list').observe('change', function(){
				if(this.getValue() != ""){
					this.up('tr').next('tr').show(); // year-list
				}
				
				if(this.getValue() == ""){
					this.up('tr').next('tr').hide(); // year-list
				}

				this.up('tr').next('tr',1).hide(); // hp-list
				this.up('tr').next('tr',2).hide(); // modelversion-list
				$('block-listing').hide();
			});
		}

		if($('year-list')) {
			$('year-list').observe('change', function(){
				if(this.getValue() != ""){
					this.up('tr').next('tr').show(); // hp-list
				}
				
				if(this.getValue() == ""){
					this.up('tr').next('tr').hide(); // hp-list
				}

				this.up('tr').next('tr',1).hide(); // modelversion-list
				$('block-listing').hide();
			});
		}

		if($('hp-list')) {
			$('hp-list').observe('change', function(){
				if(this.getValue() != ""){
					this.up('tr').next('tr').show(); // modelversion-list
				}
				
				if(this.getValue() == ""){
					this.up('tr').next('tr').hide(); // modelversion-list
				}

				$('block-listing').hide();

			});
		}

		if($('modelversion-list')) {
			$('modelversion-list').observe('change', function(){
				if(this.getValue() != ""){
					$('block-listing').show();
				}
				
				if(this.getValue() == ""){
					$('block-listing').hide();
				}
			});
		}

	});