﻿function ShowItem(obj)
{

var obj = document.getElementById(obj);
if(obj.style.display == "block")
    {
        obj.style.display = "none";
	    
    }
else
    {
        obj.style.display = "none";
	    obj.style.display = "block";
    }

}


function AddBASubscriber(path)
{

    var name = document.getElementById('name');
    var email = document.getElementById('email');
    var company = document.getElementById('company');
    
    var msg = "Du skal udfylde:\n\n";
    var redirect = true;
    
    if(name.value=='')
    {
        msg = msg + "- Navn\n";
        redirect=false;
    }
    if(email.value=='')
    {
        msg = msg + "- E-mail\n";
        redirect=false;
    }
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(email.value)) 
    {
        msg = msg + "- Forkert email format\n";
        redirect=false;
    }
    if(company.value=='')
    {
        msg = msg + "- Virksomhed\n";
        redirect=false;
    }

   if(redirect)
   {
    document.location.href = path + "?name="+encodeURIComponent(name.value)+"&email="+encodeURIComponent(email.value)+"&company="+encodeURIComponent(company.value);
    }
    else
    {
    alert(msg);
    }
}


function gotoEmployeeGroup(path)
{
 var selector = document.getElementById('NewsAchiveAreaFilter');
 
 if(selector)
    {
        var selected  = selector.item(selector.selectedIndex).value;
        
       document.location.href = path + "#"+selected;

				
	}
}

function gotoDepartment(path)
{
    
    var selector = document.getElementById('NewsAchiveAreaFilter');
    
    if(selector)
    {
        var selected  = selector.item(selector.selectedIndex).value;
        
       document.location.href = path + "?filter="+selected;

				
	}
}


function CasesOverviewFilter(path)
{

    
    var selector = document.getElementById('BrancheFilter');
    
    if(selector)
    {
        var selected  = selector.item(selector.selectedIndex).value;
        
        document.location.href = path + "?filter="+selected;

				
	}
}


// Preload orange hover button

function preloadhover()
	{
	img1=new Image;
	img1.src='/images/find_finans_button_hover.gif';
	img2=new Image;
	img2.src='/images/find_finans_button_fp_hover.gif';
	return true;
	}

// Orange button hover
	
function finanshover()
	{
//	alert('finanshover!');
	document.images['find_finans'].src='/images/find_finans_button_hover.gif';
	}
	
function finansout()
	{
	document.images['find_finans'].src='/images/find_finans_button.gif';
	return true;	
	}	
	
function finanshover_fp()
	{
	document.images['find_finans'].src='/images/find_finans_button_fp_hover.gif';
	return true;	
	}
	
function finansout_fp ()
	{
	document.images['find_finans'].src='/images/find_finans_button_fp.gif';
	return true;	
	}		
	
// Top navigation dropdowns
	
sfHover = function() 
	{
	var sfEls = document.getElementById("TopNavigation").getElementsByTagName("LI");
//	window.alert('sfHover');
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}	
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// Opening and closing popups on Portfolio page
// (visibility: hidden doesn't work with sIFR on Firefox and Safari!)


var activewindow="";

function openPopup(id)
{

	if(activewindow!="")
	{
	    closePopup(activewindow);
	}
	document.getElementById(id).style.left="0px";
	activewindow=id;
}





function closePopup(id)
	{
	document.getElementById(id).style.left="-9999px";
	activewindow="";
	}
function closeObjPopup()
	{
	
	document.getElementById(openwindow).style.left="-9999px";
	}	
	
function toggleFundingPopup()
{
    if(document.getElementById("fundingPopup").style.display == "none")
    {
        document.getElementById("fundingPopup").style.display = '';
    }
    else
    {
        document.getElementById("fundingPopup").style.display = "none";
    }
}