var linkArr = new Array();
linkArr[0] = "<div style='float:left;height:60px;width:68px'></div><a href='about.htm' title='About us'>about us</a><a href='vision.htm' title='Our vision'>our vision</a><a href='team.htm' title='the team'>the team</a><a href='partners.htm' title='partners'>partners</a><a href='associates.htm' title='associates'>associates</a><a href='CSR.htm' title='csr'>CSR</a><a href='environment.htm' title='environment'>environment</a>";
linkArr[1] = "<div style='float:left;height:60px;width:147px'></div><a href='lcs.htm' title='lighting control'>lighting control</a><a href='energymanagement.htm' title='energy management'>energy management</a><a href='buildingcontrol.htm' title='building control'>building control</a><a href='technical.htm' title='technical services'>technical services</a>";
linkArr[2] = "<div style='float:left;height:60px;width:309px'></div><a href='wembley.htm' title='Wembley'>Wembley Stadium</a><a href='warburtons.htm' title='Warbutons'>Warbutons</a><a href='ricohstadium.htm' title='Ricoh Arena'>Ricoh Arena</a><a href='nhstreatmentcentre.htm' title='NHS Treatment Centre'>NHS Treatment Centre</a>";
linkArr[3] = "";


var tmpArray = new Array();
tmpArray[0] = "news1.htm";
tmpArray[1] = "news2.htm";
tmpArray[2] = "ISO.htm";
tmpArray[3] = "news3.html";
tmpArray[4] = "news4.html";

var totalArticles = 5;

window.addEvent('domready', function(){
$('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
			
			$('nav').set('tween', {
				duration: 2000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '41px');
		},
		'mouseleave': function(){
					// Resets the tween and changes the element back to its original size
					//$('mSubNav').set('html','');
		}
	});

	
	$('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
			$('nav').set('tween', {
				duration: 2000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '41px');
		},
		'mouseleave': function(){
					// Resets the tween and changes the element back to its original size
					//$('mSubNav').set('html','');
		}
	});
	$('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
			$('nav').set('tween', {
				duration: 2000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '41px');
		},
		'mouseleave': function(){
					// Resets the tween and changes the element back to its original size
					//$('mSubNav').set('html','');
		}		
	});

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

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

	$('m3').addEvents({		
		'mouseenter': function(){
			//$('mSubNav').set('display','block');
			$('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
			$('nav').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '91px');

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

	$('m4').addEvents({		
		'mouseenter': function(){
			//$('mSubNav').set('display','block');
			$('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
			$('nav').set('tween', {
				duration: 1000,
				transition: Fx.Transitions.Quad.easeOut // This could have been also 'bounce:out'
			}).tween('height', '91px');

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

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

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

	$('link1').addEvents({		
		'click': function(){
				turnOffArticles();
				//$('newsitem').set('html',$('news1').get('html'));
				callxmlHttp(0);
				$('intro1').className = "selected";
		}
	});

	$('link2').addEvents({		
		'click': function(){
				turnOffArticles();
				//$('newsitem').set('html',$('news2').get('html'));
				callxmlHttp(1);
				$('intro2').className = "selected";
			}
	});
		
	$('link3').addEvents({		
		'click': function(){
				turnOffArticles();
				//$('newsitem').set('html',$('news2').get('html'));
				callxmlHttp(2);
				$('intro3').className = "selected";
			}
	});		
	
	$('link4').addEvents({		
		'click': function(){
				turnOffArticles();
				//$('newsitem').set('html',$('news3').get('html'));
				callxmlHttp(3);
				$('intro4').className = "selected";
			}
	});		
	
	$('link5').addEvents({		
		'click': function(){
				turnOffArticles();
				//$('newsitem').set('html',$('news3').get('html'));
				callxmlHttp(4);
				$('intro5').className = "selected";
			}
	});		
		
});


var theArray = new Array();
var nPage = new Number();

function callxmlHttp(n) {
      var xmlHttp;
      try
        {    
          // Firefox, Opera 8.0+, Safari    
          xmlHttp=new XMLHttpRequest();    
        }
      catch (e)
        {
          // Internet Explorer    
        	  try
            {      
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
            }
          catch (e)
            {      
             try
              {        
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
              }
             catch (e)
              {        
                alert("Your browser does not support AJAX!");
              }
            } 
        }


      xmlHttp.onreadystatechange=function()
        {
          if(xmlHttp.readyState==4) {
				theArray[2] = xmlHttp.responseText;
				$('story').set('html', '');
				$('story').set('html', theArray[2]);
			}
        }

	xmlHttp.open("GET",tmpArray[n],true);
	xmlHttp.send();
}

function turnOffArticles () {
	for (var n = 1; n <= totalArticles; n++) {
		var thisIntro = "intro" + n;
		$(thisIntro).className = "normal";
	}
}
