document.observe('dom:loaded', function() {
	
	
	function checkWallpaper() {
		if (typeof(adtype) != 'undefined') {
			if (adtype == 'wallpaper') {
				$('leaderboard').setStyle({
					'width': '820px',
					textAlign: 'right',
				});
			}
			if (adtype == 'expwallpaper') {
				$('leaderboard').setStyle({
					'width': '980px',
					textAlign: 'right',
				});
				
				var height = parseInt($('leaderboard').getHeight()) - parseInt(3);
				$('metaContainer').setStyle({
					'top': height.toString() + 'px',
				});
			}
		}
		if (typeof(bgcolor) != 'undefined' && bgcolor != null) {
			$('bodyContainerOuter').setStyle({
				'background': bgcolor,
			});
		}
		if (typeof(bgimage) != 'undefined' && bgimage != null) {
			$('bodyContainerOuter').setStyle({
				'background-image':  'url(' + bgimage + ')',
				'background-repeat': 'repeat-x',
				});
		}
		if (typeof(adclick) != 'undefined' && adclick != null) {
			var body = $(document.body);
			body.observe('click', function(event) {
				if (event.target.id == 'bodyContainerOuter' || event.target.id == 'bodyContainerOuter2') {
					window.open(adclick);
					return false;
				}
			});
		}
	}
	
	checkWallpaper();
	
});
