window.onload = function() {
	var h = $('main-table').getDimensions().height;
	var w = $('main-table').getDimensions().width;
	
	$('popup').setStyle({
		'width'  : '100%',  
		'display': 'none', 
		'height' : h + 'px', 
		'z-index': 0
	});
	$('fade').setStyle({
		'width'     : '100%', 
		'background': '#000000', 
		'display'   : 'block', 
		'height'    : h + 'px', 
		'z-index'   : '-1'
	});
	$('fade').setOpacity(.6);
	$('border').setStyle({
		'background': '#914f53', 
		'display' : 'block', 
		'z-index' : 0, 
		'width'   : '268px', 
		'position': 'relative', 
		'top'     : '0px'
	});
	$('border').setOpacity(.2);
	$('content').setStyle({
		'display' : 'block', 
		'z-index' : 0, 
		'width'   : '100%', 
		'position': 'absolute', 
		'top'     : '0px'
	});
	
	if (showRegistrationBox == 1) {showRegistration();} 
	if (showLoginBox == 1) {showLogin();}
	if (showRestoreBox == 1) {showRestore();}
}

function showRegistration() {
	hidePopup();
	$('popup').setStyle({'display': 'block'});
	
	$('registration').setStyle({
		'background': '#600006', 
		'display'   : 'block', 
		'z-index'   : 10, 
		'position'  : 'relative', 
		'width'     : '168px', 
		'padding'   : '20px 45px 35px 45px', 
		'text-align': 'left'
	});
	
	var h_reg = $('registration').getDimensions().height;
	var w_reg = $('registration').getDimensions().width;
	
	$('border').setStyle({
		'height': Math.round(h_reg + 5) + 'px'
	});
	
	$('content-bg').setStyle({
		'height': $('content').getDimensions().height + 'px'
	});
}

function showLogin() {
	hidePopup();
	$('popup').setStyle({'display': 'block'});
	
	$('login').setStyle({
		'background': '#600006', 
		'display'   : 'block', 
		'z-index'   : 10, 
		'position'  : 'relative', 
		'width'     : '168px', 
		'padding'   : '20px 45px 35px 45px', 
		'text-align': 'left'
	});
	
	var h_reg = $('login').getDimensions().height;
	var w_reg = $('login').getDimensions().width;
	
	$('border').setStyle({
		'height': Math.round(h_reg + 5) + 'px'
	});
	
	$('content-bg').setStyle({
		'height': $('content').getDimensions().height + 'px'
	});
}

function showRestore() {
	hidePopup();
	$('popup').setStyle({'display': 'block'});
	
	$('restore').setStyle({
		'background': '#600006', 
		'display'   : 'block', 
		'z-index'   : 10, 
		'position'  : 'relative', 
		'width'     : '168px', 
		'padding'   : '20px 45px 35px 45px', 
		'text-align': 'left'
	});
	
	var h_reg = $('restore').getDimensions().height;
	var w_reg = $('restore').getDimensions().width;
	
	$('border').setStyle({
		'height': Math.round(h_reg + 5) + 'px'
	});
	
	$('content-bg').setStyle({
		'height': $('content').getDimensions().height + 'px'
	});
}

function hidePopup(obj) {
	$('registration').setStyle({
		'display'   : 'none'
	});
	$('login').setStyle({
		'display'   : 'none'
	});
	$('restore').setStyle({
		'display'   : 'none'
	});
	$('popup').setStyle({
		'display'   : 'none'
	});
}
