// All screens
TopMargin = 40
LeftMargin = 20
RightMargin = 20

// Screen Saver
CentreMarginHalf = 5
CentreMargin = 1 + (2 * CentreMarginHalf)				// Line width is 1
LineMargin = 160																// Reduces the length of the cross lines

// Footer
FootNoteMargin = 60


// Foot Note
// =========
footNoteHeight = 80			// height alloted for displaying the footnote

function InitPageItems()
{
	MainMenuWidth = $('#MainMenu').width()
	LogoMenuMaxWidth = Math.max(MainMenuWidth, $('#Logo').width())
	
	var LogoTop = 60
	var LogoMenuMargin = 20
	$('#Logo,#LogoFade').css( {top : LogoTop + 'px' } )
	$('#MainMenu').css( {top: LogoTop + $('#Logo').height() + LogoMenuMargin + 'px' })
	$('#MainMenu img').css({opacity:0.4})
										.bind('mouseover', function(event) {
											$(event.target).stop()
																		 .fadeTo('slow', 1)	
										})
										.bind('mouseout', function() {
											if ( ! this.IsSelected )
												$(this)
															 .fadeTo('slow', 0.4)	
										})
	FootRightWidth = $('#footRight').width()
	PositionPageItems()
}

function MenuSelected(li)
{
	$('#MainMenu img').each( function()	{
											if (this.IsSelected) {
												$(this).stop()
															 .fadeTo('normal', 0.4)
												this.IsSelected = false
											}
										})
	$('img', $(li))[0].IsSelected = true
}

function PositionPageItems()
{
	var WindowWidth = GetWindowWidth()
	var logo = $('#Logo')
	var left = WindowWidth - logo.width() - RightMargin + 'px'
	logo.css({left : left, 'z-index' : 1})
			.show()
			.animate({opacity:0}, {duration:9000}, function(){ $(this).hide() })
	$('#LogoFade').css( {left : left, 'z-index' : 0} )
								.show()
	$('#MainMenu').css( { left : WindowWidth - MainMenuWidth - RightMargin + 'px' } )
								.show('slow')
	$('#footLeft').css({left : LeftMargin + 'px',
											top : GetWindowHeight() - Math.floor((footNoteHeight*3)/4) + 'px'})
								.show('slow')
	$('#footRight').css({left : WindowWidth - FootRightWidth - RightMargin + 'px',
											 top : GetWindowHeight() - Math.floor((footNoteHeight*3)/4) + 'px'})
								 .show('slow')
}

// Set the minimum page size (See lib.js)
MinWindowWidth = 600
MinWindowHeight = 500
ReDrawFunc = 'PositionPageItems()'

// Screen Saver
// ============
ScreenSaver = new _ScreenSaver()

// Pre Load all the thumbnails (so the user will not have to wait, later)
for (var idx in Categories)
	ImageSet.LoadThumbs( idx )

