﻿var objFaqWindow;

function OpenFaqComplete(language) {
    OpenFaq("", language);
}

function OpenFaq(anchor, language) {
    if (typeof objFaqWindow == 'object') {
        objFaqWindow.close();
    }

    //var strUrl = "http://relationsintelligence.com/home/information/faq-" + language + ".aspx";
    var strUrl = "http://relationsintelligence.com/home/information/faq.aspx";

    if (anchor != "") {
        strUrl = strUrl + "#" + anchor;
    }

    objFaqWindow = createReferencedWindow(objFaqWindow, strUrl, 800, 580, ',scrollbars=1,resizable=yes')
}

function OpenPasswordRequestWindow(url) 
{
    window.open(url, 'ResetPassword', 'status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=0, scrollbars=0, height=730, width=550');
}

// This create window function show know be used since it is the most flexible one //
// Look for properties here : http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/open_0.asp //
function createReferencedWindow(objWindow, strUrl, intWidth, intHeight, strProperties) {
    if (typeof objWindow == 'undefined' || objWindow.closed) {
        if (strProperties.length > 0) { strProperties = ',' + strProperties }
        objWindow = window.open(strUrl, '', 'top=' + (screen.availHeight - intHeight) / 2 + ',left=' + (screen.availWidth - intWidth) / 2 + ',width=' + intWidth + ',height=' + intHeight + strProperties);
    }
    else if (objWindow.document.location.href.slice(objWindow.document.location.href.length - strUrl.length, objWindow.document.location.href.length) != strUrl) {
        objWindow.close();
        if (strProperties.length > 0) { strProperties = ',' + strProperties }
        objWindow = window.open(strUrl, '', 'top=' + (screen.availHeight - intHeight) / 2 + ',left=' + (screen.availWidth - intWidth) / 2 + ',width=' + intWidth + ',height=' + intHeight + strProperties);
    }
    else {
        objWindow.focus();
    }
    return objWindow;
}


function createWindow(fil, overskrift, w, h, intScrollbarType) {
    var strScrollbarCode

    if (!intScrollbarType)
        strScrollbarCode = 'yes'
    else if (intScrollbarType == 1)
        strScrollbarCode = 'yes'
    else if (intScrollbarType == 2)
        strScrollbarCode = 'no'

    var centerX = (screen.availWidth - w) / 2;
    var centerY = (screen.availHeight - h) / 2;
    var aWindow = window.open(fil, overskrift, 'scrollbars=' + strScrollbarCode + ',width=' + w + ',height=' + h + ',top=' + centerY + ',left=' + centerX + '');
}


function createWindowResize(fil, overskrift, w, h, intScrollbarType) {
    var strScrollbarCode

    if (!intScrollbarType)
        strScrollbarCode = 'yes'
    else if (intScrollbarType == 1)
        strScrollbarCode = 'yes'
    else if (intScrollbarType == 2)
        strScrollbarCode = 'no'
    else if (intScrollbarType == 3)
        strScrollbarCode = 'auto'

    var centerX = (screen.availWidth - w) / 2;
    var centerY = (screen.availHeight - h) / 2;

    var aWindow = window.open(fil, overskrift, 'scrollbars=' + strScrollbarCode + ',width=' + w + ',height=' + h + ',top=' + centerY + ',left=' + centerX + ',resizable=yes');
    return aWindow
}


function OpenWindow(p_url) {
    var width = 750;
    var height = 480;
    var w = 480, h = 340;

    if (document.all || document.layers) {
        w = screen.availWidth;
        h = screen.availHeight;
    }

    var leftPos = (w - width) / 2, topPos = (h - height) / 2;
    win_help = window.open(p_url, 10, "width=" + width + ",Height=" + height + ",scrollbars=no,resizable=no,menubar=no,top=" + topPos + ",left=" + leftPos)
}