<!--

	//================================================================================================
	// VARIABLES DECLARATION
	//================================================================================================	
	var opencenterpromo = false, openDistributors = false, openContactUs = false, openTradeLogin = false;
	var flagLatestNews = true;
	
	
		
	
	//================================================================================================
	// LAYOUT FUNCTIONS 
	//================================================================================================			
	function resetMenuPositions()
	{
		var w = window.getWidth() / 2 - 490;
		$('randomharvestContainer').setStyle('left', (w + 65) + 'px');

		// $('container_centerpromo').setStyle('left', (w + 150) + 'px');				
		// $('container_distributors').setStyle('left', (w + 285) + 'px');				
		// $('container_tradelogin').setStyle('left', (w + 400) + 'px');				
		// $('container_contactus').setStyle('left', (w + 480) + 'px');				

		$('millicentgroveContainer').setStyle('left', (w + 185) + 'px');
		$('container_centerpromo').setStyle('left', (w + 265) + 'px');				
		$('container_distributors').setStyle('left', (w + 400) + 'px');				
		$('container_tradelogin').setStyle('left', (w + 515) + 'px');				
		$('container_contactus').setStyle('left', (w + 595) + 'px');				
		//$('container_latest_news').setStyle('left', (w + 775) + 'px');				
	}
	
	function showLatestNews(show)
	{
		var top = (show ? '0px' : '-170px');
		
		if (flagLatestNews)
		{
			flagLatestNews	= false;
			new Fx.Morph('container_latest_news').start( {'top' : top } ).chain(function() {
				flagLatestNews = true;
			}); 
		}
	}
	
	function showProduct(id)
	{
		new Fx.Scroll('scrollable_product_details').toElement('product_' + id);		
	}	
	
	function showDistributor(id)
	{
		new Fx.Scroll('scrollable_distributors').toElement('distributor_' + id);		
	}		
	
	function showcenterpromo()
	{
		if (!opencenterpromo)
		{
			hideDistributors();
			hideTradeLogin();
			hideContactUs();
			
			$('container_centerpromo').setStyle('display', 'block');	
		}
		opencenterpromo = true;
	}	
	
	function hidecenterpromo()
	{
		if (opencenterpromo)
		{
			$('container_centerpromo').setStyle('display', 'none');	
		}
		opencenterpromo = false;
	}	

	function togglecenterpromo()
	{
		if (opencenterpromo)
		{
			hidecenterpromo();
		}
		else
		{
			showcenterpromo();
		}
	}
	
	function showDistributors()
	{
		if (!openDistributors)
		{
			hidecenterpromo();
			hideTradeLogin();
			hideContactUs();
			
			$('container_distributors').setStyle('display', 'block');	
		}
		openDistributors = true;
	}	
	
	function hideDistributors()
	{
		if (openDistributors)
		{
			$('container_distributors').setStyle('display', 'none');	
		}
		openDistributors = false;
	}	

	function toggleDistributors()
	{
		if (openDistributors)
		{
			hideDistributors();
		}
		else
		{
			showDistributors();
		}
	}	
	
	function showTradeLogin()
	{
		if (!openTradeLogin)
		{
			hidecenterpromo();
			hideDistributors();
			hideContactUs();
			
			$('container_tradelogin').setStyle('display', 'block');	
		}
		openTradeLogin = true;
	}	
	
	function hideTradeLogin()
	{
		if (openTradeLogin)
		{
			$('container_tradelogin').setStyle('display', 'none');	
		}
		openTradeLogin = false;
	}	

	function toggleTradeLogin()
	{
		if (openTradeLogin)
		{
			hideTradeLogin();
		}
		else
		{
			showTradeLogin();
		}
	}	
	
	function showContactUs()
	{
		if (!openContactUs)
		{
			hidecenterpromo();
			hideTradeLogin();
			hideDistributors();
			
			$('container_contactus').setStyle('display', 'block');	
		}
		openContactUs = true;
	}	
	
	function hideContactUs()
	{
		if (openContactUs)
		{
			$('container_contactus').setStyle('display', 'none');	
		}
		openContactUs = false;
	}	

	function toggleContactUs()
	{
		if (openContactUs)
		{
			hideContactUs();
		}
		else
		{
			showContactUs();
		}
	}	
	
	function setSiFRColor()
	{
		var c = "#333333";
		if ($chk($('rh_head')))
		{
			c = $('rh_head').getStyle('color');
		}
		applySiFR(c);
	}
	
	//================================================================================================
	// EVENTS FUNCTIONS
	//================================================================================================		
	function setupActions()
	{
		if ($chk($('container_latest_news')))
		{
			$("container_latest_news").addEvents({
				
				'mouseover' : function(e) {
					showLatestNews(true);
				},
			
				'mouseout' : function(e) {
					showLatestNews(false);
				}
				
			});	
		}
	}	
	
	function setupScrollbars()
	{
		if ($chk($('product_area_scroller')))
		{
			makeScrollbar( $('scrollable_product_thumbs'), $('product_scroller'), $('scroller_handle'), true );
		}				
	}	
	
	function $E(tag,el){return $(el||document).getElement(tag)}
	
	kina={
		doc:{x:0,y:0},
		fix:
			function()
			{				
				if(kina.bg.complete&&(db.offsetWidth!=kina.doc.x||db.offsetHeight!=kina.doc.y||kina.fix.src!=kina.bg.src))
				{
					var bg=kina.bg.getSize();
					kina.doc={x:db.offsetWidth,y:db.offsetHeight};
					kina.fix.src==kina.bg.src||$extend(kina.fix,{p:bg.x/bg.y,src:kina.bg.src});
					kina.bg.setStyles({width:(bg.y=kina.doc.x>(bg.x=Math.round(kina.doc.y*kina.fix.p)))?kina.doc.x:bg.x,height:bg.y?Math.round(kina.doc.x/kina.fix.p):kina.doc.y})			
				}								
			}
	}	
	
	//================================================================================================
	// START THIS WHEN PAGE DOM READY
	//================================================================================================		
	window.addEvents({
	
		'domready' : function(e) {
			setSiFRColor();
			setupScrollbars();
			//setupActions();
			//showLatestNews(false);
			
			resetMenuPositions();
			
			if ($chk($('bg')))
			{
				$extend
				(
					kina,{bg:$E('img',$E('#bg',db=$(document.body))),timer:setInterval(kina.fix,100),menu:$('menu')}
				);			
			}
		},
		
		'resize' : function() {
			resetMenuPositions();
		}
		
	});
	

//-->