function dynamic_bubble(h)
{
	// GETS THE HEIGHT OF THE TEXT AREA
	if (document.getElementById('text_content'))
	{
		var content_height = document.getElementById('text_content').offsetHeight;
		if(typeof(h) != "function")
		{
			content_height = h;
		}
		// IS IT THE LARGE OR SMALL BUBBLE THAT IS ON THE PAGE
		var bubble = document.getElementById('small_bubble') || document.getElementById('large_bubble');

		// THE BUBBLES TOTAL HEIGHT IS SET TO THE TEXT AREA + THE HEIGHT OF THE TOP AND BOTTOM PICS
		
		
		// THE MIDDLE AREA IS GIVING A HEIGHT SO THE PIC CAN REPEAT IT SELF TO FIT THE TEXT AREA
		if(content_height  < 186 && content_height > 60 )
		{
			document.getElementById('bubble_bg').style.height = (content_height-(48))+'px';
			document.getElementById('text_content').style.height = content_height + 'px';
			bubble.style.height = (content_height+20+20)+'px';
		}
		else if(content_height < 60 )
		{
			content_height = 60;
			document.getElementById('bubble_bg').style.height = (content_height-(48))+'px';
			document.getElementById('text_content').style.height = 60 + 'px';	
			bubble.style.height = (content_height+20+20)+'px';
		}
		else if (content_height  > 185 )
		{
			document.getElementById('bubble_bg').style.height = 140 + 'px';
			document.getElementById('text_content').style.height = 186 + 'px';	
			bubble.style.height = (180+28+20)+'px';
		}

		if(!location.hash || pageType != 'kc_visning') bubble.style.visibility = 'visible';
	}
}


function show_cheese(cheese_id)
{
    if(cheese_id)
    {
        // Hide all cheeses
        var arr_cheese	= getElementsByClassName('cheese','div');
        if(arr_cheese.length > 0)
        {
            for(var i=0; i<arr_cheese.length; i++)
            {
                arr_cheese[i].style.display	= 'none';
            }
        }
        // Show the selected cheese
        if($('cheese_'+cheese_id))
        {
            $('cheese_'+cheese_id).style.display	= 'block';
			dynamic_bubble($('cheese_'+cheese_id).offsetHeight);
        }
    }
}

function hover_menu()
{
	var mouseOverTimeout;
	var arr_menu	= getElementsByClassName('menu_elm','div',$('footer'));
	//var arr_menu_span = getElementsByClassName('menu_elm','span',$('footer'));
	//for (var i = 0, n = arr_menu_span.length; i < n; i++ )
	//{
		//if (arr_menu_span[i].className.indexOf('inactive') != -1)
		//{
			if(arr_menu.length > 0)
			{
				for(var i=0; i<arr_menu.length; i++)
				{
					arr_menu[i].__i = i;
					arr_menu[i].onmouseover	= function()
					{
						var myWidth;
						if (this.__width)
						{
							myWidth = this.__width;
						}
						else
						{
							myWidth = this.style.width || this.offsetWidth;
							this.__width = parseInt(myWidth);
						}
						if (navigator.appVersion.indexOf('MSIE 6') != -1 && this.__i == 0)
						{
							this.style.marginLeft	= '3px';
						}
						else
						{
							this.style.marginLeft	= '0px';
						}
						this.style.width = (this.__width+5)+'px';
		//				this.parentNode.style.paddingRight	= '59px';
						clearTimeout(mouseOverTimeout);
						mouseOverTimeout = setTimeout(function(){
							_clickPlayback.playClickSound();
						}, 100);
					}
					arr_menu[i].onmouseout	= function()
					{
						//var myWidth = this.style.width || this.offsetWidth-5;
						this.style.marginLeft	= '5px';
						this.style.width = (this.__width)+'px';
						//this.parentNode.style.paddingRight	= '54px';
					}
				}
			}
		//}
	//}	
}



// Add "onLoad events"
jQuery(document).ready(hover_menu);
jQuery(document).ready(dynamic_bubble);