﻿function CopyAll(body) {
    try {
        var objBody = document.getElementById(body);
        var objRange;
        
        objBody.focus();
        objBody.select();
        objRange = objBody.createTextRange();
        objRange.execCommand("Copy"); }
    catch (e) { }
}

function CountCharacters(body, counter, limit) {
    try {
        if (document.getElementById(body).value.length > limit)
            document.getElementById(body).value = document.getElementById(body).value.substring(0, limit);
        
        document.getElementById(counter).value = limit - document.getElementById(body).value.length; }
    catch (e) { }
}

function Redirect(URL) {
    try {
        alert('Please note that you\'re being taken away from our website.');
        window.location = URL;
    }
    catch (e) {
    }
}

function ShowNHide(control)
{
    try
    {
        var objStyle = document.getElementById(control).style;
        
        if (objStyle.display == 'none')
        {
            objStyle.display = 'block';
        }
        else
        {
            objStyle.display = 'none';
        }
    }
    catch (e)
    {
    }
}

function ShowProgress(id, source, status)
{
    try
    {
        document.getElementById(id).innerHTML = '<img height="16" src="' + source + '" width="16" /> <font class="status">' + status + '</font>';
    }
    catch (e)
    {
    }
}

function SkipError() {
    return true;
}

window.onerror = SkipError;

