//Front end Java Script File



/* <[CDATA[ */
var button_one 		= new Image();
var button_two 		= new Image();
var button_three 	= new Image();
var button_four		= new Image();

var button_five 	= new Image();
var button_six 		= new Image();
var button_seven 	= new Image();
var button_eight	= new Image();

button_one.src 		= 	'/_images/left-bottom-menu/button_joan_miro_up.png';
button_two.src 		= 	'/_images/left-bottom-menu/button_over_tapas_up.png';
button_three.src 	=	'/_images/left-bottom-menu/button_kunst_in_miro_up.png';
button_four.src 	=	'/_images/left-bottom-menu/button_dansen_in_miro_up.png';

button_five.src 	= 	'/_images/left-bottom-menu/button_joan_miro_down.png';
button_six.src 		=	'/_images/left-bottom-menu/button_over_tapas_down.png';
button_seven.src 	=	'/_images/left-bottom-menu/button_kunst_in_miro_down.png';
button_eight.src 	=	'/_images/left-bottom-menu/button_dansen_in_miro_down.png';

/* ]]> */



// Scroller JS	
var mainHeight;
var mainInnerHeight;
var difHeight;
var getScroll
var loop;
var marginTop;
var mouseUpCount;
var mouseDownCount;
var topClear;
var bottomClear;

function geTOnload()
	{
	// Custom scrollbar to appear only when JS is enabled
	document.getElementById("content_inner_main").style.overflow = "hidden";
	document.getElementById("content_scroll_buttons").style.display = "block";
	// End
	mainHeight = document.getElementById('content_inner_main').clientHeight;
	mainInnerHeight = document.getElementById('content').clientHeight;
	difHeight = mainInnerHeight - mainHeight;
	marginTop = document.getElementById('content').style.marginTop;
	marginTop = marginTop.replace( "px", "" );
		if(marginTop == 5)
		{
		document.getElementById('top').style.backgroundImage = "url(_images/top-arrow-hide.png)";
		}
		if(mainInnerHeight <= mainHeight)
		{
		document.getElementById('bottom').style.backgroundImage = "url(_images/bottom-arrow-hide.png)";
		}
	}
	window.onload = geTOnload;
	
	window.addEvent('domready', function(){
		$('lbCaption').addEvent('click', function(){
			print();
		});
	});

function mouseDownTop()
	{
	mainHeight = document.getElementById('content_inner_main').clientHeight;
	mainInnerHeight = document.getElementById('content').clientHeight;
	difHeight = mainInnerHeight - mainHeight;
	marginTop = document.getElementById('content').style.marginTop;
	marginTop = marginTop.replace( "px", "" );
		for(mouseUpCount = 0; mouseUpCount <= difHeight; mouseUpCount++)
			{
				if(marginTop.replace("-", "") <= difHeight)
				{
					if(marginTop < 0)
					{
					marginTop = marginTop.replace("-", "");
					}
					getScroll = document.getElementById('content').style.marginTop = -(parseInt(marginTop) + 5)+"px";
					topClear = setTimeout("mouseDownTop()",30);
					return marginTop;
				}
				else
				{
				document.getElementById('bottom').style.backgroundImage = "url(_images/bottom-arrow-hide.png)";
				document.getElementById('top').style.backgroundImage = "url(_images/top-arrow.png)";
				}
			}
	}

function mouseUpTop()
	{
	clearTimeout(topClear);
	}

function mouseDownBottom()
	{
	mainHeight = document.getElementById('content_inner_main').clientHeight;
	mainInnerHeight = document.getElementById('content').clientHeight;
	difHeight = mainInnerHeight - mainHeight;
	marginTop = document.getElementById('content').style.marginTop;
	marginTop = marginTop.replace( "px", "" );
		for(mouseDownCount = 0; mouseDownCount <= 0; mouseDownCount++)
			{
				if(marginTop <= 0)
				{
					if(marginTop == 0)
					{
					document.getElementById('top').style.backgroundImage = "url(_images/top-arrow-hide.png)";
					document.getElementById('bottom').style.backgroundImage = "url(_images/bottom-arrow.png)";
					}
					getScroll = document.getElementById('content').style.marginTop = (parseInt(marginTop) + 5)+"px";
					bottomClear = setTimeout("mouseDownBottom()",30);
					return marginTop;
				}
			}
	}

function mouseUpBottom()
	{
	clearTimeout(bottomClear);
	}

	
//End of Scroll Js

function displayMenuHoverTitles(elementDbId,currentElemDbId){
	if(document.getElementById("leftBottomMenuText_"+currentElemDbId)){
		//alert(currentElemDbId);
		document.getElementById("leftBottomMenuText_"+currentElemDbId).style.display = "none";
	}

	if(document.getElementById("leftBottomMenuText_"+elementDbId)){
		document.getElementById("leftBottomMenuText_"+elementDbId).style.display = "block";
	}

}

function hideMenuHoverTitles(elementDbId,currentElemDbId){
	
	if(document.getElementById("leftBottomMenuText_"+elementDbId)){
		document.getElementById("leftBottomMenuText_"+elementDbId).style.display = "none";
	}
	
	if(document.getElementById("leftBottomMenuText_"+currentElemDbId)){
		document.getElementById("leftBottomMenuText_"+currentElemDbId).style.display = "block";
	}

}