var tidligerey		= 0;
var tidligerefull	= '';

function fokusimage(id,width,height,url,full) {
	var billed = document.createElement('img');
		billed.id = 'fokus';
		
		billed.setAttribute('src','/billed/' + id + '/' + width + 'x' + height + '/' + url);
	
		billed.setAttribute('width',width);
		billed.setAttribute('height',height);
	
		billed.style['width']	= width + 'px';
		billed.style['height']	= height + 'px';
		billed.style['cursor']	= 'pointer';
		
		billed.onclick = document.getElementById('fokus').onclick;
		
		document.getElementById('fokus_ramme').removeChild(document.getElementById('fokus'));
		
		document.getElementById('fokus_ramme').appendChild(billed);
	
	tidligerefull = full;
}

function showimage(url) {
	if (url == '') url = tidligerefull;
	
	tidligerey = getBody().scrollTop;
	
	document.getElementById('top').style['visibility'] = 'hidden';
	
	var flash = document.getElementsByTagName('object');
	
	for(i=0;i<flash.length;i++) {
		flash[i].style['visibility'] = 'hidden';
	}
	
	var background = document.createElement('div');
		background.setAttribute('id','image_background');
		
		background.style['position']		= 'absolute';
		background.style['left']			= '0px';
		background.style['top']				= '0px';
		background.style['backgroundColor']	= '#000000';
		background.style['width']			= document.body.scrollWidth + 'px'; //((document.documentElement)? document.documentElement.scrollWidth : document.body.scrollWidth) + 'px';
		background.style['height']			= document.body.scrollHeight * 2 + 25 + 'px'; //((document.documentElement)? document.documentElement.scrollHeight : document.body.scrollHeight) + 'px';
		background.style['filter']			= 'alpha(opacity=80)';
		background.style['opacity']			= '.8';
		
		background.onclick					= removeimage;
		
		document.body.appendChild(background);
	
	var container = document.createElement('div');
		container.setAttribute('id','image_container');
		
		container.style['position']			= 'absolute';
		container.style['left']				= '0px';
		container.style['top']				= getBody().scrollTop + 20 + 'px';
		container.style['width']			= '100%';
		container.style['textAlign']		= 'center';
		container.style['backgroundColor']	= 'transparent';
		
		var content = document.createElement('span');
			content.style['margin']				= '0px auto';
			content.style['border']				= '2px solid #000000';
			content.style['backgroundColor']	= '#FFFFFF';
			
			var image = document.createElement('img');
				image.setAttribute('src',url);
				image.setAttribute('alt',text_click_to_close);
				
				image.style['cursor']		= 'hand';
				
				image.onclick = removeimage;
				
				content.appendChild(image);
			
			container.appendChild(content);
			
		document.body.appendChild(container);
		
	setTimeout('tilpas()',20);
}

function tilpas() {
	document.getElementById('image_background').style['width']	= document.body.scrollWidth + 'px';
	document.getElementById('image_background').style['height']	= document.body.scrollHeight * 2 + 25 + 'px';
}

function removeimage() {
	window.scrollTo(0,tidligerey);
	document.body.removeChild(document.getElementById('image_background'));
	document.body.removeChild(document.getElementById('image_container'));
	
	var flash = document.getElementsByTagName('object');
	
	for(i=0;i<flash.length;i++) {
		flash[i].style['visibility'] = 'visible';
	}
	
	document.getElementById('top').style['visibility'] = 'visible';
}