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['popup-skygge'].style.height = skyggeHeight;
			document.all['popup-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['popup-item'].style.top = tempHeight;			
			document.all['popup-item'].style.left = Math.round((document.body.clientWidth/2)-skyggePopupupWidth/2);
		}
		else if(document.layers) {
			document.layers['popup-skygge'].height = document.body.scrollHeight;
			document.layers['popup-skygge'].width = document.body.scrollWidth;			
		}
		else if(document.getElementById) {
			document.getElementById('popup-skygge').style.height = document.body.scrollHeight;
			document.getElementById('popup-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('popup-item').style.top = tempHeight;			
			document.getElementById('popup-item').style.left = Math.round((document.body.clientWidth/2)-skyggePopupupWidth/2);
		}				
	}
}

function SkjulPopupFisk()
{
	if (document.all) 
	{			
		document.getElementById("popup-iframe").style.visibility="hidden";	
		document.all['popup-item'].style.visibility = "hidden";
		document.all['popup-skygge'].style.visibility = "hidden";			
		//document.getElementById("popup-iframe").src="/blank.html";
	}
	else if(document.layers) 
	{						
		document.layers["popup-iframe"].style.visibility="hide";	
		document.layers['popup-skygge'].visibility = "hide";
		document.layers['popup-item'].visibility = "hide";			
	}
	else if(document.getElementById) 
	{			
		
		document.getElementById("popup-iframe").style.visibility="hidden";	
		document.getElementById('popup-skygge').style.visibility='hidden';
		document.getElementById('popup-item').style.visibility='hidden';		
		//document.getElementById("popup-iframe").src="/blank.html";
		//document.getElementById('popup-item').innerHTML = "";
	}
	skyggeDivVisible = false;
	window.onresize = "";
}

function SetFocusOnDelay()
{
	if (frames['popup-iframe'].SetFocus)
	{
		frames['popup-iframe'].SetFocus()		
	}
	else
	{
		//alert("sorry - no focus");		
	}
	
}

function VisPopupFiskTrue()
{	
	document.getElementById("popup-iframe").style.visibility="visible";	
	if (frames['popup-iframe'].SetFocus)
	{	
		frames['popup-iframe'].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="allowTransparency"';
	}
	//tSti = "/blank.html";
	skyggePopupupWidth = tWidth;
	skyggePopupupHeight = tHeight;
	iframeFound = false;
	if (document.getElementById('popup-iframe')==null)
	{		
		iframeFound = false;
	}
	else
	{
		iframeFound = true;				
	}
	
	tStiHtml = "<iframe name=popup-iframe id=popup-iframe "+tTransparent+" src=\""+tSti+"\" width=\""+tWidth+"\" height=\""+tHeight+"\" marginwidth=0 marginheight=0 frameborder=0 style=\"visibility: hidden;\"></iframe>";			
	if (document.all) 
	{
		document.all['popup-item'].innerHTML = tStiHtml;	
		skyggeHeight = document.body.scrollHeight;
		if (document.body.clientHeight>skyggeHeight)
			skyggeHeight = document.body.clientHeight;
		document.all['popup-skygge'].style.height = skyggeHeight;
		document.all['popup-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['popup-item'].style.top = tempHeight;
		document.all['popup-item'].style.height = tHeight;
		document.all['popup-item'].style.width = tWidth;
		document.all['popup-item'].style.left = Math.round((document.body.clientWidth/2)-tWidth/2);
		document.all['popup-skygge'].style.visibility = "visible";
		document.all['popup-item'].style.visibility = "visible";
	}
	else if(document.layers) 
	{	
		document.layers['popup-item'].innerHTML = tStiHtml;		
		document.layers['popup-skygge'].height = document.body.scrollHeight;
		document.layers['popup-skygge'].width = document.body.scrollWidth;
		document.layers['popup-item'].height = tHeight;
		document.layers['popup-item'].width = tWidth;
		document.layers['popup-item'].left = Math.round((document.body.clientWidth/2)-tWidth/2);
		document.layers['popup-skygge'].visibility = "show";
		document.layers['popup-item'].visibility = "show";
	}
	else if(document.getElementById) 
	{		
		if (iframeFound)
		{
			document.getElementById('popup-iframe').width=tWidth;
			document.getElementById('popup-iframe').height=tHeight;			
			document.getElementById('popup-iframe').src=tSti;			
		}
		else
			document.getElementById('popup-item').innerHTML = tStiHtml;
		document.getElementById('popup-skygge').style.height = document.body.scrollHeight;
		document.getElementById('popup-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('popup-item').style.top = tempHeight;
		document.getElementById('popup-item').style.height = tHeight;
		document.getElementById('popup-item').style.width = tWidth;
		document.getElementById('popup-item').style.left = Math.round((document.body.clientWidth/2)-tWidth/2);
		document.getElementById('popup-skygge').style.visibility='visible';
		document.getElementById('popup-item').style.visibility='visible';		
	}	
	skyggeDivVisible = true
	window.onresize=WindowResizedPopupFisk;
	setTimeout(VisPopupFiskTrue,100);	
}
// ################################################### Fra anden fil ######################################### \\
flashRed = 255;
flashGreen = 255;
flashBlue = 255;

flashRedEnd = 62;
flashGreenEnd = 84;
flashBlueEnd = 104;
function FlashLoginMenu(){
	document.getElementById("tdLoginMenu").style.backgroundColor="rgb("+flashRed+","+flashGreen+","+flashBlue+")";
	if (flashRed == flashRedEnd && flashGreen == flashGreenEnd && flashBlue == flashBlueEnd){			
	}else{
		if (flashRed != flashRedEnd)
			flashRed--;
		if (flashRed != flashRedEnd)
			flashRed--;
		if (flashRed != flashRedEnd)
			flashRed--;

		if (flashGreen != flashGreenEnd)
			flashGreen--;
		if (flashGreen != flashGreenEnd)
			flashGreen--;
		if (flashGreen != flashGreenEnd)
			flashGreen--;

		if (flashBlue != flashBlueEnd)
			flashBlue--;
		if (flashBlue != flashBlueEnd)
			flashBlue--;
		if (flashBlue != flashBlueEnd)
			flashBlue--;
		setTimeout(FlashLoginMenu,1)
	}
}

function GalleryFisk(tSecID, tFiID){
	VisPopupFisk("/galleri.php?gap_id="+tFiID+"&g_sec_id="+tSecID, 700, 650);		
}
	
function tipenvenPopup(){	
	titel = document.title;
	newurl = document.location;
	VisPopupFisk('/tipenven.php?newurl=' + newurl + '&titel=' + titel, 362, 325);

}
function newsletterPopup(){
	//VisPopupFisk("/newsletter.php", 362, 250);
	VisPopupFisk("/newsletter.php", 350, 110);
}
function loginPopup(){
	VisPopupFiskNotTransparent("/login.php", 362, 325);		
}
function opretPopup(){
	VisPopupFisk("/opretbruger.php", 362, 325);			
}
function glemtPopup(){
	VisPopupFisk("/glemtlogin.php", 362, 325);				
}
function popFoto(tImg, tWidth,tHeight){
	popWidth=tWidth;
	popHeight=tHeight;
	//hvis tWidth>clientwidth saa skal winduet vaere mindre og det samme med hojden			
	useScrollbars="yes";
	if (popWidth<screen.availWidth && popWidth<screen.availHeight){			
		useScrollbars="yes";
	}else{
		popWidth=screen.availWidth;
		popWidth=screen.availHeight;
		useScrollbars="yes";
	}
	surl = '/u/show_img.php?img=../'+tImg+'&imgWidth='+tWidth+'&imgHeight='+tHeight;
	WindowXOffset = screen.width/2 - popWidth/2;
	WindowYOffset = screen.height/2 - popHeight/2 - 40;
	if(WindowYOffset < 0){
		WindowYOffset = 0;
	}
	window.open(surl,"Foto", "left=" + WindowXOffset + ",top=" + WindowYOffset + ",WIDTH="+popWidth+",HEIGHT="+popHeight+",menubar=no,location=no,toolbar=no,status=yes,scrollbars="+useScrollbars+",resizable=yes");
}

function PopupFiskFoto(tImg, tWidth, tHeight){		
		wndWidth = parseInt(tWidth)+12
		wndHeight = parseInt(tHeight)+12
		//alert("/vis-foto-fisk.php?img="+tImg+"&img-w="+tWidth+"&img-h="+tHeight);
		VisPopupFiskNotTransparent("/vis-foto-fisk.php?img="+tImg+"&img-w="+tWidth+"&img-h="+tHeight, wndWidth, wndHeight);		
	}
