// mooTools menu items

var myElementsEffects;
var ten='15';
var eight;
var last;

// Window size detection to make up for mooTools v1.0 inability to pass % values to CSS
// modified code from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

	function alertSize() 
	{
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) 
	  {
			//Non-IE
			myHeight = window.innerHeight;
	  } 
	  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	  {
			//IE 6+ in 'standards compliant mode'
			myHeight = document.documentElement.clientHeight;
	  } 
	  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	  {
			//IE 4 compatible
			myHeight = document.body.clientHeight;
	  }
	  
//			ten = ( 0.03 * ( myHeight - 141 ));
			eight = ( 0.87 * ( myHeight - 161 ));   
			
	 }
	 

// moo menus!

	function transHeight(option, cont, dat)
	{
		alertSize();
		if(myElementsEffects)
			myElementsEffects.stop();
		myElementsEffects = new Fx.Elements($$('.menuItem'));
		switch(option)
			{
				case 1:
					if(last==option)
					{
						break;
					}
					myElementsEffects.start({
				
						'0': {
							'height': eight,
							'background-color' : "#ffffff"
						},
						'1': {
							'height': ten,
							'background-color' : "#ffaf15"
						},
						'2': {
							'height': ten,
							'background-color' : "#ffaf15"
						}
						
					});
					$('videoDat').style.display="inline";
					$('modelDat').style.display="none";
					$('otherDat').style.display="none";

					ajaxpage(cont, dat);
					last = option;
					break;
				case 2:
					if(last==option)
					{
						break;
					}
					myElementsEffects.start({
				
						'0': {
							'height': ten,
							'background-color' : "#ffaf15"
						},
						'1': {
							'height': eight,
							'background-color' : "#ffffff"
						},
						'2': {
							'height': ten,
							'background-color' : "#ffaf15"
						}
						
					});
					$('videoDat').style.display="none";
					$('modelDat').style.display="inline";
					$('otherDat').style.display="none";

					ajaxpage(cont, dat);
					last = option;
					break
				case 3:
					if(last==option)
					{
						break;
					}
					myElementsEffects.start({
				
						'0': {
							'height': ten,
							'background-color' : '#ffaf15'
						},
						'1': {
							'height': ten,
							'background-color' : '#ffaf15'
						},
						'2': {
							'height': eight,
							'background-color' : '#ffffff'
						}
						
					});
					$('videoDat').style.display="none";
					$('modelDat').style.display="none";
					$('otherDat').style.display="inline";

					ajaxpage(cont, dat);
					last = option;
					break;
			}

		
	}

// proper AJAX functions 

function ajaxpage(url, containerid)
{
	if(containerid != 'imageSpace')
	{
		last='0';
	}
	var page_request = false;
	
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	else if (window.ActiveXObject)
	{ // if IE
		try 
		{
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e)
		{
			try
			{
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{}
		}
	}
	else
		return false
		page_request.onreadystatechange=function()
		{
			loadpage(page_request, containerid);
		}
		page_request.open('GET', url, true);
		page_request.send(null);
}
	
function loadpage(page_request, containerid)
{
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
		document.getElementById(containerid).innerHTML=page_request.responseText;
}


