var pageName = "";
var linkArr = new Array();
linkArr[0] = "";
linkArr[1] = "<div style='float:left;height:20px;width:96px'></div><a href='aboutus.htm' title='About us'>About us</a><a href='ourcustomers.htm' title='What our customers say'>What our customers say</a>";
linkArr[2] = "<div style='float:left;height:20px;width:242px'></div><a href='cimotorhomescarioca.htm' title='Ci Motorhomes Carioca'>Ci Carioca</a><a href='cimotorhomescusona.htm' title='Ci Motorhomes Cusona'>Ci Cusona</a><a href='tributemotorhomes.htm' title='Tribute Motorhomes'>Tribute Motorhomes</a><a href='karmannmobil.htm' title='Karmann Mobil Motorhomes'>Karmann Mobil Motorhomes</a>";
linkArr[3] = "";
linkArr[4] = "";
linkArr[5] = "";
linkArr[6] = "";
linkArr[7] = "";
linkArr[8] = "<div style='float:left;height:20px;width:514px'></div><a href='contact.php?contactType=1' title='General Enquiries'>General Enquiries</a><a href='contact.php?contactType=2' title='Workshop Request'>Workshop Request</a><a href='contact.php?contactType=3' title='Parts Request'>Parts Request</a><a href='findus.htm' title='Find us'>Find us</a>";

var totalOffers = 7;
var offerHeight = 93;
var scrollTop = (totalOffers - 4) *  offerHeight;
scrollTop = scrollTop + 120;
if (BrowserDetect.browser == "Explorer") {
	scrollTop = scrollTop + 23;
}

window.addEvent('domready', function(){

	var myFx = new Fx.Tween('scrollContent',{duration: '16000',transition: Fx.Transitions.linear});
	var myFx2 = new Fx.Tween('scrollContent',{duration: '0',transition: Fx.Transitions.linear});
	var marginN = "-" + scrollTop + "px";
	myFx.start('margin-top', marginN);

	myFx.addEvent('onComplete', function(e){
		//alert("finished the 1st tween");
		myFx2.start('margin-top', '-12px');
	});


	myFx2.addEvent('onComplete', function(e){
		//alert("finished the 2nd tween");
		myFx.start('margin-top', marginN);
	});

	$('submitButton').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			this.src = "images/home/submitb.jpg";
		},
		'mouseleave': function(){
			this.src = "images/home/submita.jpg";
		},
		'click': function(){}		
	});

	$('caresalesButton').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			this.src = "images/home/gccarsalesb.jpg";
		},
		'mouseleave': function(){
			this.src = "images/home/gccarsalesa.jpg";
		}
	});

	$('contactButton').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			this.src = "images/home/contactusb.jpg";
		},
		'mouseleave': function(){
			this.src = "images/home/contactusa.jpg";
		},
		'click': function(){
			window.location = "http://www.geoffcox.co.uk/contact.php?contactType=1";
		}		
	});


	$('m1').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '33px');
		},
		'mouseleave': function(){}
	});

	$('m4').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '33px');
		},
		'mouseleave': function(){}
	});

	$('m5').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '33px');
		},
		'mouseleave': function(){}
	});

	$('m6').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '33px');
		},
		'mouseleave': function(){}
	});

	$('m7').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '33px');
		},
		'mouseleave': function(){}
	});

	$('m8').addEvents({		
		'mouseenter': function(){
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '33px');
		},
		'mouseleave': function(){}
	});
	$('mSubNav').addEvents({
			'mouseleave': function(){
				// Resets the tween and changes the element back to its original size
				$('mSubNav').set('html','');
				$('navHolder').set('tween', {}).tween('height', '33px');
			}
		});

	$('navHolder').addEvents({		
		'mouseleave': function(){
				// Resets the tween and changes the element back to its original size
				//$('mSubNav').set('html','');
				$('navHolder').set('tween', {}).tween('height', '33px');
			}
	});


	$('m2').addEvents({
		'mouseenter': function(){
			$('mSubNav').set('html',linkArr[1]);
	
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '78px');

		},
		'mouseleave': function(){
			// Resets the tween and changes the element back to its original size
			//$('mSubNav').set('html','');
		}
	});

	$('m3').addEvents({
		'mouseenter': function(){
			$('mSubNav').set('html',linkArr[2]);
	
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '78px');

		},
		'mouseleave': function(){
			// Resets the tween and changes the element back to its original size
			//$('mSubNav').set('html','');
		}
	});

	$('m9').addEvents({
		'mouseenter': function(){
			$('mSubNav').set('html',linkArr[8]);
	
			// Always sets the duration of the tween to 1000 ms and a bouncing transition
			// And then tweens the height of the element
			$('navHolder').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '78px');

		},
		'mouseleave': function(){
			// Resets the tween and changes the element back to its original size
			//$('mSubNav').set('html','');
		}
	});
});	