var skyggeDivVisible = false;
var skyggeMinWidth = 0;
var skyggeMinHeight = 0;
var skyggePopupupWidth = 0;
var skyggePopupupHeight = 0;
	
function WindowResizedPopupFisk()
{		
	if (skyggeDivVisible)
	{
		if (document.all) 
		{
			skyggeHeight = document.body.scrollHeight;
			if (document.body.clientHeight>skyggeHeight)
				skyggeHeight = document.body.clientHeight;
			document.all['skygge'].style.height = skyggeHeight;
			document.all['skygge'].style.width = document.body.scrollWidth;
			tempHeight = Math.round((document.body.clientHeight/2)-skyggePopupupHeight/2);
			if (tempHeight-100>0)
				tempHeight = tempHeight-100;
			if (tempHeight<0)
				tempHeight = 0;
			tempHeight = tempHeight + document.body.scrollTop;
			document.all['popupFisk'].style.top = tempHeight;			
			document.all['popupFisk'].style.left = Math.round((document.body.clientWidth/2)-skyggePopupupWidth/2);
		}
		else if(document.layers) {
			document.layers['skygge'].height = document.body.scrollHeight;
			document.layers['skygge'].width = document.body.scrollWidth;			
		}
		else if(document.getElementById) {
			document.getElementById('skygge').style.height = document.body.scrollHeight;
			document.getElementById('skygge').style.width = document.body.scrollWidth;
			tempHeight = Math.round((document.body.clientHeight/2)-skyggePopupupHeight/2);			
			if (tempHeight-100>0)
				tempHeight = tempHeight-100;			
			if (tempHeight<0)
				tempHeight = 0;
			tempHeight = tempHeight + document.body.scrollTop;	
			document.getElementById('popupFisk').style.top = tempHeight;			
			document.getElementById('popupFisk').style.left = Math.round((document.body.clientWidth/2)-skyggePopupupWidth/2);
		}				
	}
}

function SkjulPopupFisk()
{
	if (document.all) 
	{			
		document.getElementById("iframeFiske").style.visibility="hidden";	
		document.all['popupFisk'].style.visibility = "hidden";
		document.all['skygge'].style.visibility = "hidden";			
		document.getElementById("iframeFiske").src="/blank.html";
	}
	else if(document.layers) 
	{						
		document.layers["iframeFiske"].style.visibility="hide";	
		document.layers['skygge'].visibility = "hide";
		document.layers['popupFisk'].visibility = "hide";			
	}
	else if(document.getElementById) 
	{			
		
		document.getElementById("iframeFiske").style.visibility="hidden";	
		document.getElementById('skygge').style.visibility='hidden';
		document.getElementById('popupFisk').style.visibility='hidden';		
		document.getElementById("iframeFiske").src="/blank.html";
		//document.getElementById('popupFisk').innerHTML = "";
	}
	skyggeDivVisible = false;
	window.onresize = "";
}

function SetFocusOnDelay()
{
	if (frames['iframeFiske'].SetFocus)
	{
		frames['iframeFiske'].SetFocus()		
	}
	else
	{
		//alert("sorry - no focus");		
	}
	
}

function VisPopupFiskTrue()
{	
	document.getElementById("iframeFiske").style.visibility="visible";	
	if (frames['iframeFiske'].SetFocus)
	{	
		frames['iframeFiske'].SetFocus(); 		
	}
	else
	{		
		setTimeout(SetFocusOnDelay,1000);		
	}	
}

function 	VisPopupFisk(tSti, tWidth, tHeight)
{
		VisPopupFiskPrivate(tSti, tWidth, tHeight, true)
}

function 	VisPopupFiskNotTransparent(tSti, tWidth, tHeight)
{
		VisPopupFiskPrivate(tSti, tWidth, tHeight, false)
}

function 	VisPopupFiskPrivate(tSti, tWidth, tHeight, tTransparency)
{	
	tTransparent = "";
	if(tTransparency == true){
		tTransparent = "allowTransparency";
	}
	//tSti = "/blank.html";
	skyggePopupupWidth = tWidth;
	skyggePopupupHeight = tHeight;
	iframeFound = false;
	if (document.getElementById('iframeFiske')==null)
	{		
		iframeFound = false;
	}
	else
	{
		iframeFound = true;				
	}
	
	tStiHtml = "<iframe name=iframeFiske id=iframeFiske "+tTransparent+" src=\""+tSti+"\" width=\""+tWidth+"\" height=\""+tHeight+"\" marginwidth=0 marginheight=0 frameborder=0 style=\"visibility: hidden;\"></iframe>";			
	if (document.all) 
	{
		document.all['popupFisk'].innerHTML = tStiHtml;	
		skyggeHeight = document.body.scrollHeight;
		if (document.body.clientHeight>skyggeHeight)
			skyggeHeight = document.body.clientHeight;
		document.all['skygge'].style.height = skyggeHeight;
		document.all['skygge'].style.width = document.body.scrollWidth;
		tempHeight = Math.round((document.body.clientHeight/2)-tHeight/2);
		if (tempHeight-100>0)
			tempHeight = tempHeight-100;
		if (tempHeight<0)
			tempHeight = 0;
		tempHeight = tempHeight + document.body.scrollTop;
		document.all['popupFisk'].style.top = tempHeight;
		document.all['popupFisk'].style.height = tHeight;
		document.all['popupFisk'].style.width = tWidth;
		document.all['popupFisk'].style.left = Math.round((document.body.clientWidth/2)-tWidth/2);
		document.all['skygge'].style.visibility = "visible";
		document.all['popupFisk'].style.visibility = "visible";
	}
	else if(document.layers) 
	{	
		document.layers['popupFisk'].innerHTML = tStiHtml;		
		document.layers['skygge'].height = document.body.scrollHeight;
		document.layers['skygge'].width = document.body.scrollWidth;
		document.layers['popupFisk'].height = tHeight;
		document.layers['popupFisk'].width = tWidth;
		document.layers['popupFisk'].left = Math.round((document.body.clientWidth/2)-tWidth/2);
		document.layers['skygge'].visibility = "show";
		document.layers['popupFisk'].visibility = "show";
	}
	else if(document.getElementById) 
	{		
		if (iframeFound)
		{
			document.getElementById('iframeFiske').width=tWidth;
			document.getElementById('iframeFiske').height=tHeight;			
			document.getElementById('iframeFiske').src=tSti;			
		}
		else
			document.getElementById('popupFisk').innerHTML = tStiHtml;
		document.getElementById('skygge').style.height = document.body.scrollHeight;
		document.getElementById('skygge').style.width = document.body.scrollWidth;
		tempHeight = Math.round((document.body.clientHeight/2)-tHeight/2);			
		if (tempHeight-100>0)
			tempHeight = tempHeight-100;			
		if (tempHeight<0)
			tempHeight = 0;
		tempHeight = tempHeight + document.body.scrollTop;					
		document.getElementById('popupFisk').style.top = tempHeight;
		document.getElementById('popupFisk').style.height = tHeight;
		document.getElementById('popupFisk').style.width = tWidth;
		document.getElementById('popupFisk').style.left = Math.round((document.body.clientWidth/2)-tWidth/2);
		document.getElementById('skygge').style.visibility='visible';
		document.getElementById('popupFisk').style.visibility='visible';		
	}	
	skyggeDivVisible = true
	window.onresize=WindowResizedPopupFisk;
	setTimeout(VisPopupFiskTrue,100);	
}
