﻿// JScript File

// opens a window
// url: the url to open
// heihgt: window height
// width: window width
// features: window features
// xpos: x- position of window
// ypos: y- position of window
function OpenWindow(url, title, width, height, features, xpos, ypos)
{
	if(xpos==0)
	    xpos = (window.screen.width - width) / 2;
    if(ypos==0)
        ypos = (window.screen.height - height) / 2;
    if (height == 0)
        height = window.screen.height - 100;
	if(width==0)
		width = 680;

	features = features+'top='+ypos+',left='+xpos+',width='+width+',height='+height;

	popup = window.open(url, title, features);
	popup.focus();
}

// no browser toolbar, scrollbar whatsoever
function OpenWindowPlain(url, title, width, height, xpos, ypos)
{
    OpenWindow(url, title, width, height, 'history=no,scrollbars=no,status=no,toolbar=no,location=no,resizable=no,menubar=no,directories=no', xpos, ypos);
}

// scrollable and resizeable window
function OpenWindowScrollable(url, title, width, height, xpos, ypos)
{
    OpenWindow(url, title, width + 5, height, 'history=no,scrollbars=yes,status=no,toolbar=no,location=no,resizable=yes,menubar=no,directories=no', xpos, ypos);
}

function OpenPrint(url)
{
    OpenWindow(url, 'Print', 750, 0, 'history=no,scrollbars=yes,status=no,toolbar=no,location=no,resizable=yes,menubar=yes,directories=no', 0, 0);
}

function OpenIpix(url)
{
    OpenWindowPlain(url, 'IPix', 320, 240, 0, 0);
}

function OpenPxm(url)
{
    OpenWindowPlain(url, 'Pxm', 400, 300, 0, 0);
}

function OpenGallery(url)
{
    OpenWindowScrollable(url, 'Gallery', 822, 880, 0, 0);
}

function OpenToolboxItem(name, url)
{
// windows.resizeBy(...)
    if (name == 'map')
        OpenWindowScrollable(url, 'module', 660, 680, 0, 0);
    else if (name == 'mortgage')
        OpenWindowScrollable(url, 'module', 640, 770, 0, 0);
    else if (name == 'tax')
        OpenWindowScrollable(url, 'module', 640, 500, 0, 0);
    else if (name == 'direction')
        OpenWindowScrollable(url, 'module', 640, 680, 0, 0);
    else if (name == 'gate24' || name == 'ikea')
        OpenNewWindow(url, 'module', 880, 600, 0, 0);        
    else if (name == 'climate' || name == 'immocaution' || name == 'insurance' || name == 'tv' || name == 'safetyinstructions' || name == 'deposit')
        document.location.href = url;
    else
        OpenWindowScrollable(url, 'module', 800, 600, 0, 0);
}

function OpenPano(url)
{
    OpenWindowPlain(url, 'Pano', 600, 300, 0, 0);
}

function OpenNewWindow(url, title)
{
	popup = window.open(url, title);
	popup.focus();
}

function ShowHideInfo(info_box) {
    var control = document.getElementById(info_box);
    if (control.style.display == 'inline')
        control.style.display = 'none';
    else
        control.style.display = 'inline';
}

