//Function to open pop up window
function openWin(theURL,winName,features) {
window.open(theURL,winName,features);
}


// script to write location bar.
function locationbar(){
	
// Check whether '/' exists.
if (location.href.lastIndexOf('/') !=-1)
{
	
// If it does then we ...
firstpos=location.href.lastIndexOf('/')+1;

// Find the first position (the file starts after this)
lastpos=location.href.length;

// We extract the string (the file's name).
thispage = location.href.substring(firstpos,lastpos);
}

// Get the doc title
var doctitle = document.title;

if (thispage == "default.asp"){
document.write('<span class="text_12">' + "Støberihallen Hillerøds Kulturhus" +'</span>');
}
else if (location.href == "http://www.stoeberihallen.dk/"){
document.write('<span class="text_12">' + "Støberihallen Hillerøds Kulturhus" + '</span>');
}
else if (location.href == "http://stoeberihallen.dk"){
document.write('<span class="text_12">' + "Støberihallen Hillerøds Kulturhus" + '</span>');
}
else
{
document.write('<span class="text_12">' + doctitle + '</span>');
}
}


// script to write location bar section.
function locationbar_section(){
	
// Check whether '/' exists.
if (location.href.lastIndexOf('/') !=-1)
{
	
// If it does then we ...
firstpos=location.href.lastIndexOf('/')+1;

// Find the first position (the file starts after this)
lastpos=location.href.length;

// We extract the string (the file's name).
thispage = location.href.substring(firstpos,lastpos);
}

// Get the section metaname
if (document.getElementsByName) {
var metaArray = document.getElementsByName('Section');
for (var i=0; i<metaArray.length; i++) {
var section = metaArray[i].content;
}
}

// Set location to section
if (section == "Forside"){
var relocation = "default.asp";
}
else if (section == "Kalender"){
var relocation = "calendar.asp";
}
else if (section == "Nyheder"){
var relocation = "news.asp";
}
else if (section == "Kunstudstillinger"){
var relocation = "art.asp";
}
else if (section == "Foto- Galleri"){
var relocation = "gallery.asp";
}
else if (section == "Info"){
var relocation = "info.asp";
}
else
{
var relocation = "default.asp";
}

// Get the date and weekday
var d=new Date()
var weekday=new Array("Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag")
var monthname=new Array("januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december")
var date=d.getDate() + ". " + monthname[d.getMonth()]

if (thispage == "default.asp"){
document.write('<span class="bar_tools_links">' + date +'</span>');
}
else if (location.href == "http://www.stoeberihallen.dk/"){
document.write('<span class="bar_tools_links">' + date + '</span>');
}
else if (location.href == "http://stoeberihallen.dk"){
document.write('<span class="bar_tools_links' + date + '</span>');
}
else
{
document.write('<span class="bar_tools_links"><a href="' + relocation + '">' + section + '</a></span>');
}
}


// script to open links in new windows, except for this domain.
var excludedomains=["stoeberihallen.dk"]
var auto=1

var excludedomains=excludedomains.join("|")
rexcludedomains=new RegExp(excludedomains, "i")

function dynamiclink(){
if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)
document.links[i].target="_blank"
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}

if (auto)
window.onload = dynamiclink;


// function to hide layers
function hidelayer(id) { 
active = id;
if(document.getElementById) {document.getElementById(active).style.display = 'none';}
if (document.all) { document.all[active].style.display = 'none';} 
if(document.layers){ document.layers[active].display = 'none';} 
}


// Emailscript version 5 for hiding adresses for e-mail robots
var dom_ = new Array()
dom_[0] = "com";
dom_[1] = "dk";
var hDom_ = 1;
var mt_ = "mailto:";
var sa_ = "@";
var p_ = ".";

function mailin(name, dom, tl, params)
{
	var s = eo(name,dom,tl);
	document.write('<a href="'+mt_+s+params+'">'+'<u>e-mail</u>'+'</a>');
}

function eo(name, dom, tl)
{
	var s = name+sa_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= p_+tld_[tl];
	}
	else
		s+= swapperin(dom);
	return s;
}
function swapperin(d)
{
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}


// Script that highlights selected menu item
function highlight_menu_item(cl,d)
{
	var i,ob,tA,h=document.location.href;
	if(document.getElementById){
	ob=(d)?document.getElementById(d):document;
	if(ob){
	tA=ob.getElementsByTagName('A');
	for(i=0;i<tA.length;i++){
	if(tA[i].href==h){
	tA[i].className=cl;
}}}}}