﻿// JScript File
function onKeywordSearch(txtFieldId)
{
    var txtField = document.getElementById(txtFieldId);
    if ( txtField.value.length > 0 && txtField.value != "Keywords or item numbers" )
    {
        window.location = "/SearchResult.aspx?Keywords=" + txtField.value;
    }
}

function popUp(URL) 
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=440,height=550');");
}

function popup(sUrl, width, height) {
    // add ts to make the popup url unique
    sUrl += ((sUrl.toString().indexOf("?") != -1) ? "&" : "?") + "ts=" + (new Date()).getTime();
    // Getting rad window manager
    var oManager = GetRadWindowManager();
    // get window by name
    var oWindow = oManager.Open(sUrl, "PopupWindow");
    if (width != undefined)
        oWindow.SetWidth(width);
    if (height != undefined)
        oWindow.SetHeight(height);
    oWindow.Show();
    oWindow.Center();
}

function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}

function CloseAndRedirect(sUrl) {
    try {
        GetRadWindow().BrowserWindow.location = sUrl;
    }
    catch (e) { }
}

