function getCoord(e,c) {
        if(e.layerX) {
            if(c=="x") return e.layerX;
            if(c=="y") return e.layerY;                        
        } else {
            try {
                if(c=="x") return e.x + document.body.scrollLeft;
                if(c=="y") return e.y + document.body.scrollTop;
            } catch(e) {
                if(c=="x") return e.x + document.documentElement.scrollLeft;
                if(c=="y") return (e.y + document.documentElement.scrollTop);
            }
        }//else                    
}//getCoord


function showTitle(e,lang) {

var pleft = (getCoord(e,'x') + 10) + "px";
var ptop = (getCoord(e,'y') + 10) + "px";

var con = new Object();
con["da"] = "Klik p&aring; billedet for st&oslash;rre foto.";
con["uk"] = "Click to view larger image.";

document.getElementById("showTitle").innerHTML = con[lang];

document.getElementById("showTitle").style.top = ptop;
document.getElementById("showTitle").style.left = pleft;
document.getElementById("showTitle").style.display = "block";

}

function hideTitle() {
    document.getElementById("showTitle").style.display = "none";
}

function showBigImage(src) {
src = src.replace(/\.jpg$/,"_large.jpg");
var parts = src.split(/\//);
var imagepath = "http://www.rais.com/Files/Billeder/Miljoefotos/Large popup/" + parts[parts.length - 1];
var dialog = centerOwner("http://www.rais.com/Files/Billeder/Miljoefotos/Large popup/" + parts[parts.length - 1],780,530,"no","no","no","yes","no","yes",0,0);

try {
var out = "<html><head><title>" + parts[parts.length - 1] + "</title></head><body style=\"margin:10px;padding:0px;\">";
out += "<img src=\"" + imagepath + "\" alt=\"\" style=\"position:absolute;top:0px;left:0px;\"></body></html>";
dialog.document.write(out);
} catch (e) {
    //void
}
}   


function centerOwner(file,width,height,sl,tl,ml,rl,ll,rsa,top,left) {

        var properties;

        if(navigator.appName == "Microsoft Internet Explorer") {
            var startY = (self.screenTop + (document.body.clientHeight/2) - (height/2)) -20;
            var startX = self.screenLeft + (document.body.clientWidth/2) - (width/2);
            properties = "width="+width+",height="+height+",left="+startX+",top="+startY+",toolbar="+tl+",status="+sl+",menubar="+ml+",location="+ll+",scrollbars="+rl+",resizable="+rsa;
        }//if

        else {
            var startX = window.screenX + (window.outerWidth/2) - (width/2);
            var startY = (window.screenY + (window.outerHeight/2) - (height/2));
            properties = "width="+width+",height="+height+",screenX="+startX+",screenY="+startY+",toolbar="+tl+",status="+sl+",menubar="+ml+",location="+ll+",scrollbars="+rl+",resizable="+rsa;
        }//else
        var myWindow = window.open(file,getName(),properties);
        return myWindow;
    }//centerOwner

    function centerScreen(file,width,height,sl,tl,ml,rl,ll,rsa,top,left) {

        var properties;
        if(navigator.appName == "Microsoft Internet Explorer") {
            var startY = (self.screen.height/2) - (height/2);
            var startX = (self.screen.width/2) - (width/2);
            properties = "width="+width+",height="+height+",left="+startX+",top="+startY+",toolbar="+tl+",status="+sl+",menubar="+ml+",location="+ll+",scrollbars="+rl+",resizable="+rsa;
        }//if

        else {
            var startX = (self.screen.width/2) - (width/2);
            var startY = (self.screen.height/2) - (height/2);
            properties = "width="+width+",height="+height+",screenX="+startX+",screenY="+startY+",toolbar="+tl+",status="+sl+",menubar="+ml+",location="+ll+",scrollbars="+rl+",resizable="+rsa;
        }//else
        var myWindow = window.open(file,getName(),properties);
    }//centerScreen

    function absoluteScreen(file,width,height,sl,tl,ml,rl,ll,rsa,top,left) {
        var properties;
        var startY = top;
        var startX = left;

        if(navigator.appName == "Microsoft Internet Explorer") {
            properties = "width="+width+",height="+height+",left="+startX+",top="+startY+",toolbar="+tl+",status="+sl+",menubar="+ml+",location="+ll+",scrollbars="+rl+",resizable="+rsa;
        }//if

        else {
            properties = "width="+width+",height="+height+",screenX="+startX+",screenY="+startY+",toolbar="+tl+",status="+sl+",menubar="+ml+",location="+ll+",scrollbars="+rl+",resizable="+rsa;
        }//else

        var myWindow = window.open(file,getName(),properties);
    }//absoluteScreen

    function defaultScreen(file,width,height,sl,tl,ml,rl,ll,rsa,top,left) {
        var properties;

        properties = "width="+width+",height="+height+",toolbar="+tl+",status="+sl+",menubar="+ml+",scrollbars="+rl+",location="+ll+",resizable="+rsa;

        var myWindow = window.open(file,getName(),properties);
    }//absoluteScreen

    function getName() {
        var now = new Date();
        var then = new Date(1976,22,10);
        return "newWindow" + (now - then);
    }

    function gotoIndex(index) {
        try {
            if(document.getElementById(index).href) {
                top.location.href = "#"+index
            } else {
                alert("Dette var sidste fundne ord");
            }
        } catch (e) {
            alert("Dette var sidste fundne ord");
        }
    }

    function hlme(mode,index) {
        if(mode) {
            document.getElementById(index).style.color = HLColorOn;
            document.getElementById(index).style.backgroundColor = HLBackgroundOn;
        } else {
            document.getElementById(index).style.color = HLColorOff;
            document.getElementById(index).style.backgroundColor = HLBackgroundOff;
        }
    }
