var oWinFrameOrgTop = null;
var oWin = null;
var oWinHeading = null;
var oWinFrame = null;
var oWinFrameSrc = "";
var oWrapper = null;
var oTextPanelContent = null;
var iMinTop = 0;

function openBrWindow( theURL, theName, props ) {
var winObj = null;
if ( isPopup ) winObj = parent;
else winObj = window;
var docObj = winObj.document;

fileName = theURL;

if (fileName.indexOf("/") != -1) fileName = fileName.slice(fileName.lastIndexOf("/") + 1, fileName.length);

var width = "";
var height = "";

if ( oWinFrame == null ) {
if ( isPopup ) {
theURL = location.href.slice(0, location.href.lastIndexOf("/")+1) + theURL;
}
oWin = docObj.getElementById("PopWin");
oWinFrame = docObj.getElementById("PopWinFrm");
oWinHeading = docObj.getElementById("PopHeading");
oWrapper = docObj.getElementById("Wrapper");
oTextPanelContent = docObj.getElementById("TextPanelContent");
}

width = fileName.slice(0, fileName.indexOf("x"));
width = parseInt(width);
if ( isNaN(width) ) width = 500;

height = fileName.slice(fileName.indexOf("x") + 1, fileName.indexOf("_"));
height = parseInt(height);
if ( isNaN(height) ) height = 300;

if ( oWinFrameOrgTop == null ) oWinFrameOrgTop = oWinFrame.offsetTop;

oWinFrame.style.width = width + "px";
oWinFrame.style.height = height + "px";
oWinFrame.style.visibility = "hidden";
winObj.oWinFrameSrc = theURL;

oWin.style.width = width + (isIE ? 2 : 0) + "px";
oWin.style.display = "block";

iMinTop = oTextPanelContent.offsetTop + ( browser.isIE ? oWrapper.offsetTop : 0 );

var startTop = docObj.body.scrollTop + 20;
startTop = ( startTop > iMinTop ? startTop : iMinTop );

oWin.style.top = startTop;
oWin.style.left = oWrapper.offsetLeft + 12;

if ( isSv )
oWinHeading.innerHTML = "Laddar information ...";
else
oWinHeading.innerHTML = "Loading ...";
winObj.setTimeout("setPopupSrc();", 100);
}

function setPopupSrc()
{
oWinFrame.src = oWinFrameSrc;
window.setTimeout("checkPopupLoaded();", 100);
}

function checkPopupLoaded()
{
if(oWinFrame.readyState && (oWinFrame.readyState == "uninitialized" || oWinFrame.readyState == "loading") ) {
window.setTimeout("checkPopupLoaded();", 100);
return;
}
oWinFrame.style.visibility = "visible";
if (oWinFrame.contentWindow && oWinFrame.contentWindow.docrubrik)
{
oWinHeading.innerHTML = oWinFrame.contentWindow.docrubrik;
}
else
{
oWinHeading.innerHTML = "";
}
}

function onClosePopup()
{
oWin.style.display = "none";
}

// Determine browser and version.

function Browser() {

var ua, s, i;

this.isIE    = false;
this.isNS    = false;
this.version = null;

ua = navigator.userAgent;

s = "MSIE";
if ((i = ua.indexOf(s)) >= 0) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

// Treat any other "Gecko" browser as NS 6.1.

s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}
}

var browser = new Browser();


