///
///
///
/****************************************************/
//document.oncontextmenu = function() { return false; }
/****************************************************/
// Global variables
var T = true;
var F = false;
function ExecuteRefreshMethod()
{
location.reload(true);
}
function SendRefreshMethod()
{
if ($.browser.msie && $.browser.version == 6)
{
alert('If things are slowing down, please refresh this page after you have saved any changes.');
return;
}
Message.Show({ Type: MessageType.Info, Message: 'Are things slowing down? Please REFRESH after you have saved any changes.' });
}
// Informat the parent (if there is one), that the page has been loaded
$(document).ready(
function()
{
if (window.parent.MainWindow != null)
{
window.parent.MainWindow.Loaded();
}
// Create a timer that displays every 20 minutes inside child windows
if (window.top != window)
{
setInterval(SendRefreshMethod, 1200000);
//20mins
}
}
);
var Misc =
{
// Allows text to be inserted where the cursor is or where something is highlighted
InsertText: function(ctl, myValue) {
var c = $Get(ctl);
//IE support
if (document.all) {
c.focus();
var sel = document.selection.createRange().duplicate();
sel.text = myValue;
c.focus();
}
//MOZILLA/NETSCAPE support
else if (c.selectionStart || c.selectionStart == 0) {
var startPos = c.selectionStart;
var endPos = c.selectionEnd;
c.value = c.value.substring(0, startPos) + myValue + c.value.substring(endPos, c.value.length);
c.focus();
} else {
c.value += myValue;
c.focus();
}
},
WrapIFrame: function(div, iframeClass) {
if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) {
var parent = $(div);
parent.append("");
}
},
SetEnterKey: function(box, btn) {
Misc.KeyToBtn(box, 13, btn);
},
KeyToBtn: function(box, key, btn) {
if ($('input[id*=' + box + ']').length == 1) {
$('input[id*=' + box + ']').live("keypress",
function(e) {
if (e.keyCode == key) {
$('button[id*=' + btn + ']').click();
}
}
);
}
else if ($('select[id*=' + box + ']').length == 1) {
$('select[id*=' + box + ']').live("keypress",
function(e) {
if (e.keyCode == key) {
$('button[id*=' + btn + ']').click();
}
}
);
}
}
};
var Wait = {
OriginalTop: 0,
BodyWidth: 400,
BodyHeight: 60,
Show: function() {
var $body = $('div.wait div.body');
var $wait = $('div.wait');
var $overlay = $('div.wait div.overlay');
var docWidth = $(document).width();
var docHeight = $(document).height();
if (Wait.OriginalTop == 0) {
Wait.OriginalTop = parseInt(body.css('top'));
}
var top = parseInt($(document).scrollTop());
$overlay.css('top', top);
$overlay.css({ width: $(document).width(), height: $(document).height() });
$body.css({ left: docWidth / 2 - Wait.BodyWidth / 2, top: docHeight / 2 - Wait.BodyHeight / 2 });
$body.css('top', top + Wait.OriginalTop);
$wait.show();
},
Hide: function() {
$('.wait').hide();
}
};
var Box =
{
Destroy: function(boxname) {
var x = $(boxname);
x.find('iframe').attr('src', '');
x.hide();
}
};
function AdjustGroupBox(gbname, useOverlay, absolute, autocenter, iframe) {
var box = (gbname.charAt(0) == '#' || gbname.charAt(0) == '.') ? gbname : "#" + gbname;
var top = parseInt($(document).scrollTop());
var gbox = null;
if (iframe == null) { iframe = false; }
if (useOverlay) {
if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6)
{
var w = $(document).width();
var h = $(document).height();
// drop downs ignore the zorder in IE6
var ie6frame = $(box).children(".ie6groupboxframe");
if (ie6frame.length == 0)
{
$(box).append("");
}
else
{
ie6frame.css({ width: $(document).width(), heigth: $(document).height() });
}
// ie6 doesn't support fixed positioning
$(box).children("div:first").css({ position: "absolute", left: "0px", right: "0px", width: w, height: h });
}
gbox = $(box + ' div:eq(1)');
}
else {
gbox = $(box);
}
if (autocenter) {
var width = gbox.outerWidth();
var height = gbox.outerHeight();
var wheight = $(window).height();
if (wheight > 580) { wheight = 580; }
if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) {
// ie doesn't support fix position
gbox.css({ position: "absolute", top: top + ($(window).height() - height) / 2, left: ($(window).width() - width) / 2 });
}
else {
var top = (wheight - height) / 2;
gbox.css({ top: (top >= 3 ? top : 3), left: ($(window).width() - width) / 2 });
}
}
else if (absolute && top != 0) {
var btop = parseInt(gbox.css('top'));
var newTop = top + btop;
gbox.css('top', newTop);
}
if (iframe) {
gbox.find("iframe").css({ width: gbox.innerWidth() - 2, height: gbox.innerHeight() - gbox.children("div:visible").outerHeight() - 1 });
}
}
Window_Defaults = {
Url: '', // The URL
Name: '', // The window name
Width: 800, // Base window size
Height: 600, // Base window height,
UseRoot: true, // Are we in the root directory?
GoBack: false, // Should we go back when showing the window?
UseScrollbar: false, // Should a scrollbar be visible?
UseStatusbar: true, // Should a statusbar be visible?
BasicWindow: false, // Just open a basic window with no arguments
CheckPopups: true, // Check for Popup status?
Resizable: false,
IsPMC: false,
CenterWindow: true
};
var Window = {
Open: function(settings) {
settings = $.extend({}, Window_Defaults, settings);
//center the new window
var left = "";
var top = "";
if (settings.Width && settings.Height && Window_Defaults.CenterWindow) {
left = ",left=" + ((screen.availWidth / 2) - (settings.Width / 2));
top = ",top=" + ((screen.availHeight / 2) - (settings.Height / 2));
}
// In IE 6, never resize
settings.Resizable = !($.browser.msie && parseInt($.browser.version) == 6);
if (settings.Url == '') {
alert('URL not provided in settings; cannot open window');
return;
}
if (settings.Name == '') {
alert('Window name not provided; cannot open window');
return;
}
var StatusBarText = settings.UseStatusbar ? ",statusbar" : "";
var ScrollBarText = settings.UseScrollbar ? ",scrollbars" : "";
if (settings.BasicWindow == true) {
var PopupWindow = window.open(settings.Url, settings.Name);
}
else if (settings.Resizable == true) {
var PopupWindow = window.open(settings.Url, settings.Name, "resizable=yes,width=" + settings.Width + ",height=" + settings.Height + StatusBarText + ScrollBarText + left + top);
}
else {
var PopupWindow = window.open(settings.Url, settings.Name, "width=" + settings.Width + ",height=" + settings.Height + StatusBarText + ScrollBarText + left + top);
}
if (settings.CheckPopups == true) {
if (PopupWindow != null) {
if (settings.GoBack == true || settings.BasicWindow == true) {
PopupWindow.opener.history.go(-1);
}
return;
}
if (settings.UseRoot == true) {
var pup = "Popup.aspx?url=" + settings.Url;
}
else {
if (settings.IsPMC) {
var pup = "../Popup.aspx?url=" + settings.Url;
}
else {
var pup = "../Popup.aspx?url=Manager/" + settings.Url;
}
}
location.href = pup;
}
},
OpenJSA: function() {
Window.Open({ Url: "https://www.performancetrackonline.com?product=jt&key=" + $Get('hfGUID').value, Name: 'JSA', Width: 1000, Height: 700, Resizable: true });
},
OpenIT: function() {
Window.Open({ Url: "https://www.performancetrackonline.com?product=it&key=" + $Get('hfGUID').value, Name: 'IT', Width: 1000, Height: 700, Resizable: true });
},
OpenTT: function() {
Window.Open({ Url: "https://www.performancetrackonline.com?product=tt&key=" + $Get('hfGUID').value, Name: 'TT', Width: 1000, Height: 700, Resizable: true });
},
OpenCOI: function() {
Window.Open({ Url: "https://www.coitrack.com?guid=" + $Get('hfGUID').value, Name: 'COI' });
},
CloseActive: function() {
if (!window.opener) {
window.opener = self;
}
window.close();
}
}
function $Get(ctl) {
if (typeof (ctl) == "string") {
return document.getElementById(ctl);
}
else {
return ctl;
}
}
var Show =
{
FadeIn: 0,
SlideIn: 1,
Show: 2,
FadeOut: 3,
SlideOut: 4,
Hide: 5,
Action: function(tag, type, focus) {
switch (type) {
case Show.FadeIn:
Display.Show('#' + tag, focus);
break;
case Show.SlideIn:
Display.SlideDown('#' + tag, focus);
break;
case Show.Show:
if (focus == null) {
$('#' + tag).show();
}
else {
$('#' + tag).show(function() { Element.Focus(focus); });
}
break;
case Show.FadeOut:
Display.Hide('#' + tag);
break;
case Show.SlideOut:
Display.SlideUp('#' + tag);
break;
case Show.Hide:
$('#' + tag).hide();
break;
}
}
};
var Display = {
zIndex: function(ctl, zi) {
if (zi == null) {
$(ctl).css("zIndex", "10000");
}
else {
$(ctl).css("zIndex", zi);
}
},
Status: function(ctl, setTo) {
if (setTo == null) {
return $(ctl).css("display");
}
else {
$(ctl).css("display", setTo);
}
},
Show: function(ctl, fcs) {
if (fcs == null) {
$(ctl).show();
} else {
$(ctl).show();
Element.Focus(fcs);
}
},
Hide: function(ctl) {
$(ctl).hide();
},
HideShow: function(hide, show) {
//$(hide).fadeOut('slow', function() { $(show).fadeIn('slow'); });
$(hide).hide();
$(show).show();
},
SlideUp: function(ctl) {
$(ctl).slideUp('slow');
//$(ctl).hide();
},
SlideDown: function(ctl, fcs) {
if (fcs == null) {
$(ctl).slideDown('slow');
}
else {
$(ctl).slideDown('slow', function() { Element.Select(fcs); });
}
},
Visible: function(ctl, status) {
if (status == true) {
$(ctl).css("visibility", "visible");
}
else {
$(ctl).css("visibility", "hidden");
}
},
IsHidden: function(ctl) {
return (Display.Status(ctl) == 'none');
},
Toggle: function(ctl, type) {
$(val).toggle();
},
Dialog: function(ctl) {
//$(ctl).fadeIn('slow', function() { AdjustGroupBox(ctl, true, false, true, false); });
Display.Show(ctl);
AdjustGroupBox(ctl, true, false, true, false);
},
Highlight: function() {
$("input[type=button], input[type=submit]").
hover(function() { $(this).addClass('ButtonHover'); },
function() { $(this).removeClass('ButtonHover'); }).
addClass('Button');
$("input[type=text], input[type=password], textarea").
focus(function() { $(this).addClass('TextFocus'); }).
blur(function() { $(this).removeClass('TextFocus'); }).
addClass('Text');
$("select").addClass("ddLook");
},
HighlightOne: function(ctl) {
var jq = $('#' + ctl);
if (jq.attr('type') == 'button' || jq.attr('type') == 'submit') {
jq.hover(function() {
$(this).addClass('ButtonHover');
}, function() {
$(this).removeClass('ButtonHover');
}).addClass('Button');
}
else {
jq.focus(function() {
$(this).addClass('TextFocus');
}).blur(function() {
$(this).removeClass('TextFocus');
}).addClass('Text');
}
},
Swap: function(hide, show, event) {
$(hide).slideUp('slow', function() { $(show).slideDown('slow', function() { if (event != null) { eval(event); } }); });
},
// Hide all of whatever a selector returns
HideAll: function(stor) {
var sel = $(stor);
sel.css('display', 'none');
},
ShowAll: function(stor) {
var sel = $(stor);
sel.css('display', '');
},
ProcessErrors: function() {
$('.ev').focus(
function() {
var t = $(this);
if (t.attr('ev') != undefined) {
t.val(t.attr('ev'));
t.removeAttr('ev');
}
t.removeClass('ev');
}
);
}
};
function $OnRowClick(gname, ctl) {
$('#' + gname + ' tr').each(function() { $(this).removeClass('ClickRow') });
$(ctl).addClass('ClickRow');
}
function $OnRowClick2(tbl, ctl){
tbl.find('tr.MainRow, tr.AltRow').removeClass('ClickRow');
$(ctl).addClass('ClickRow');
}
var secondSingle = false;
function $OnRowClickSingle(tbl, ctl) {
if ( secondSingle ) {
secondSingle = false;
return;
}
tbl.find('tr.MainRow, tr.AltRow').removeClass('ClickRow');
$(ctl).addClass('ClickRow');
secondSingle = true;
$(ctl).find('input[type=radio]:first').trigger('click');
}
var secondMultiple = false;
function $OnRowClickMultiple(tbl, ctl) {
if (secondMultiple) {
secondMultiple = false;
return;
}
$(ctl).toggleClass('ClickRow');
secondMultiple = true;
$(ctl).find('input[type=checkbox]:first').trigger('click');
}
function $ApplyClicked(ctl) {
if ($(ctl).find('input[type=checkbox]:first').attr('checked') || $(ctl).find('input[type=radio]:first').attr('checked'))
{
$(ctl).addClass('ClickRow');
}
}
var SGV_MouseDownRow;
function $SetHover(row) {
$(row).hover(
function() {
$( this ).addClass( 'HoverRow' );
},
function() {
$( this ).removeClass( 'HoverRow' );
}
);
$(row).mouseup(
function() {
$( SGV_MouseDownRow ).removeClass( 'MouseDownRow' );
if ( this == SGV_MouseDownRow ) {
$( SGV_MouseDownRow ).addClass( 'HoverRow' );
}
}
).mousedown(
function() {
SGV_MouseDownRow = this;
$(this).removeClass('HoverRow');
$(this).addClass('MouseDownRow');
}
);
}
function $FormatGridBasic(ctl) {
$FormatGrid2($('#' + ctl), -1, true, true, false);
}
function $FormatGrid(ctl, expire, border, hover, click) {
$FormatGrid2($('#' + ctl), expire, border, hover, click);
}
function $FormatGrid2(tbl, expire, border, hover, click)
{
var cls = "MainRow";
var othercls = "AltRow";
var tempcls = "";
tbl.addClass('GridView');
tbl.attr({ border: 0, rules: 'none' });
if (border == false) {
tbl.css('border', 'none');
}
var rows = $('tr', tbl);
if (rows.length <= 1) {
return;
}
$(rows.get(0)).addClass('HeaderRow');
for (var i = 1; i < rows.length; i++)
{
var row = rows.get(i);
var rd = $(row);
//Footer element
if ($('table', rd).length > 0)
{
$(rd).addClass('FooterRow');
$('table', rd).each(function() { $SetHover(this); });
return;
}
//hover
if (hover){
$SetHover(row);
}
//click
if (new String(click) == 'true') {
rd.click(function() { $OnRowClick2(tbl, this); });
}
//single row selection (radio buttoins)
else if (click == 1) {
rd.click(function() { $OnRowClickSingle(tbl, this); });
}
//multiple row selection (checkboxes)
else if (click == 2) {
rd.click(function() { $OnRowClickMultiple(tbl, this); });
}
if (click == 1 || click == 2) {
$ApplyClicked(rd);
}
//expiration
if (expire > -1) {
var date = new Date(row.cells[expire].innerHTML);
var now = new Date();
if (date < now)
{
rd.addClass('ExpiringRow');
continue;
}
}
rd.addClass(cls);
tempcls = cls;
cls = othercls;
othercls = tempcls;
}
}
// JQUERY Plugin - Evaluates whether the passed in fields are empty. If all are empty,
// returns true, otherwise returns false
$.fn.isEmpty = function() {
var isempty = true;
this.each(
function() {
if (this.value.length != 0) {
isempty = false;
}
}
);
return isempty;
}
jQuery.fn.bgiframe = function() {
// This is only for IE6
if (!(jQuery.browser.msie && typeof XMLHttpRequest == 'function')) return this;
return this.each(function() {
var html = '