﻿if (window.location.toString().indexOf('/Preview/') > -1)
    window.focus();

function PreviewPage(pagepath) {
    var popup = window.open(pagepath, 'Preview');
    popup.focus();
    return false;
}

function CheckFileName(s, e) {
    var filename = s.GetValue();
    if (filename != null) {
        s.SetValue(filename.replace(/\.aspx|\s/ig, '').replace(/[^a-zA-Z 0-9 _]+/g, '').replace(' ', ''));
    }
}

function ClearText(TextBoxID, DefaultText) {
    var CurrentText = document.getElementById(TextBoxID).value;
    if (CurrentText == DefaultText) {
        document.getElementById(TextBoxID).value = '';
        document.getElementById(TextBoxID).focus();
    }
}

function FillText(TextBoxID, DefaultText) {
    var CurrentText = document.getElementById(TextBoxID).value;
    if (CurrentText == '')
        document.getElementById(TextBoxID).value = DefaultText;
}

