﻿// JScript File

//General javascript functions

function OnError(message, context) {
    alert('An unhandled exception has occurred:\n' + message);
}

function RemoveCurrencyPound(value)
{
    return value.replace(/£/,'');    
}

function FormatCurrencyPound(value)
{
    return "£" + Math.round(value);
}

function RTrim(argvalue)
{
    while (1) 
    {
        if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
            break;
        argvalue = argvalue.substring(0, argvalue.length - 1);
    }

    return argvalue;
}

function LTrim(argvalue)
{
    while (1) 
    {
        if (argvalue.substring(0, 1) != " ")
            break;
        argvalue = argvalue.substring(1, argvalue.length);
    }

    return argvalue;
}

function PopMeUp2(theUrl, width, height){
    PopUpWindow(theUrl, width, height, 'no', 'no', 'no', 'yes', 'no');
}

function PopMeUp(theUrl){
    PopUpWindow(theUrl, 545, 400, 'no', 'no', 'no', 'yes', 'no');
}

function PopUpWindow(url, width, height, toolbar, location, menubar, scrollbars, resizeable)
{
    window.open(url,'info','toolbar=' + toolbar + ',location=' + location + ',directories=no,status=no,menubar=' + menubar + ',scrollbars=' + scrollbars + ',resizable=' + resizeable + ',width=' + width + ',height=' + height + ',top=100,left=100');
}

function PopUpWindowTab(url, target)
{
    var newWindow = window.open(url, target);
    newWindow.focus();
}