/*
* COPYRIGHT 2011 Jobvite, Inc. All rights reserved. This copyright notice is Copyright Management 
* Information under 17 USC 1202 and is included to protect this work and deter copyright infringement.  
* Removal or alteration of this Copyright Management Information without the express written permission 
* of Jobvite, Inc. is prohibited, and any such unauthorized removal or alteration will be a violation of 
* federal law.
*/
var OverlayDialogInstance = null;
var OverlayDialogInstanceMove = null;
var OverlayDialogInstances = 1;
var OverlayMenuInstance = null;
function OverlayDialogStartMove(e)
{
	var o = (window.Event ? e.target : event.srcElement);
	while (o && !o._dialog)
		o = o.parentNode;
	if (o)
	{
		OverlayDialogInstanceMove = o._dialog;
		return OverlayDialogInstanceMove.startMove(e);
	}
}
function OverlayDialogEndMove(e)
{
	if (OverlayDialogInstanceMove)
	{
		var result = OverlayDialogInstanceMove.endMove(e);
		OverlayDialogInstanceMove = null;
		return result;
	}
}
function OverlayDialogMouseMove(e)
{
	if (OverlayDialogInstanceMove)
		return OverlayDialogInstanceMove.mouseMove(e);
}

OverlayDialog = function(title, content, center)
{
	this._title = title;
	this._width = 610;
	this._content = (content ? '<tr><td' + (center ? ' align="center"' : '') + ' colspan="2">' + content + '</td></tr>' : '');
	this._buttonTitle = new Array();
	this._buttonFunction = new Array();
	this._firstTextInput = '';
	this._overlayname = '';
	this._object = null;
	this._offsetx = 0;
	this._offsety = 50;
	this._overlayx = 0;
	this._overlayy = 0;
	this._overlaytablex = 0;
	this._overlaytabley = 0;
	this._overlaysaveonresize = 0;
	this._overlaytimer = 0;
	this._overlayDisabled = null;
	this._overlayDisabled2 = null;
	this._overlayDoDisable = null;
	this._savedDialog = null;
	this._remove = true;
	this._defaultFunction = null;
	this._closeFunction = null;
	this._center = center == true;
	this._display = false;
	this._disableBackground = true;
	this._isMoving = false;
	this._id = 'overlaydialog' + OverlayDialogInstances++;
	this._bdSize = 2;
	this._bdCol = '#c6c6c6';
	this._tbdCol = '#8c8c8c';
	this._tfntCol = '#ffffff';
	this._backCol = '#feffe5';
}

OverlayDialog.prototype = 
{
    get_title : function()
    {
        return this._title;
    },

    set_title : function(value)
    {
        this._title = value;
    },
    
    set_center : function(value)
    {
        this._center = value;
    },

    get_width : function()
    {
        return this._width;
    },

    set_width : function(value)
    {
        this._width = value;
    },
    
    set_object : function(value)
    {
        this._object = value;
    },
    
    set_offsetx : function(value)
    {
        this._offsetx = value;
    },
    
    set_offsety : function(value)
    {
        this._offsety = value;
    },
    
    set_defaultFunction : function(value)
    {
        this._defaultFunction = value;
    },
    
    set_closeFunction : function(value)
    {
        this._closeFunction = value;
    },
    
    set_disableBackground : function(value)
    {
        this._disableBackground = value;
      },
    
    set_backgroundColor : function(value)
    {
    	this._backCol = value;
	},
    
    addRow : function(row)
    {
		this._content += row;
	},
	
    addRowSpace : function()
    {
		this._content += '<tr><td colspan="2"><img src="../images2/spix.gif" width="5" height="5"></td></tr>';
	},
	
    addRowDots : function()
    {
		this._content += '<tr class="rowdots"><td colspan="2"><img src="../images2/spix.gif" width="5" height="5"></td></tr>';
	},
	
    addAlert : function(id)
    {
		this._content +=
			'<tr><td colspan="2">' +
			'<div id="div' + id + '" style="display:none;">' +
			'<table cellSpacing="0" cellPadding="0" width="100%" height="26" border="0">' +
			'<tr><td valign="top">' +
			'<table cellSpacing="0" cellPadding="0" width="100%" border="0">' +
			'<tr>' +
			'<td width="5" valign="top"><IMG height="3" src="../images2/alert_top_left1.gif" width="5"></td>' +
			'<td background="../images2/alert_top1.gif"><IMG height="3" src="../images2/spix.gif" width="99%"></td>' +
			'<td width="5" valign="top"><IMG height="3" src="../images2/alert_top_right1.gif" width="5"></td>' +
			'</tr>' +
			'<tr>' +
			'<td width="5" background="../images2/alert_left.gif"><IMG height="2" src="../images2/alert_top_left2.gif" width="5"></td>' +
			'<td rowspan="2" background="../images2/alert_bg.gif">' +
			'<table cellSpacing="0" cellPadding="0" width="100%" border="0">' +
			'<tr>' +
			'<td valign="top" width="16" style="padding-top: 1px;"><img src="../images2/alert.gif" width="16" height="16"></td>' +
			'<td valign="top" width="5"><img src="../images2/spix.gif" width="5" height="16"></td>' +
			'<td style="color=#cc3333;font-weight: bold;"><span id="' + id + '"></span></td>' +
			'</tr>' +
			'</table>' +
			'</td>' +
			'<td width="5" background="../images2/alert_right.gif"><IMG height="2" src="../images2/alert_top_right2.gif" width="5"></td>' +
			'</tr>' +
			'<tr>' +
			'<td background="../images2/alert_left.gif" width="5" valign="bottom"><IMG height="2" src="../images2/alert_bottom_left2.gif" width="5"></td>' +
			'<td background="../images2/alert_right.gif" width="5" valign="bottom"><IMG height="2" src="../images2/alert_bottom_right2.gif" width="5"></td>' +
			'</tr>' +
			'<tr>' +
			'<td width="5"><IMG height="3" src="../images2/alert_bottom_left1.gif" width="5"></td>' +
			'<td background="../images2/alert_bottom1.gif"><IMG height="3" src="../images2/spix.gif" width="99%"></td>' +
			'<td width="5"><IMG height="3" src="../images2/alert_bottom_right1.gif" width="5"></td>' +
			'</tr>' +
			'</table>' +
			'</td></tr></table>' +
			'</div>' +
			'</td></tr>' +
			'<tr><td><img src="../images2/spix.gif" width="5" height="5"></td></tr>';
    },
    
    addTextInput : function(title, id)
    {
		this._content +=
			'<tr><td>' + title + ':&nbsp;</td><td><input id="' + id + '" type="text" value="" style="width: 100%;"/></td></tr>' +
			'<tr><td colspan="2"><img src="../images2/spix.gif" width="5" height="5"></td></tr>';
		if (this._firstTextInput.length == 0)
			this._firstTextInput = id;
    },
    
    addButton : function(title, f)
    {
		this._buttonTitle[this._buttonTitle.length] = title;
		this._buttonFunction[this._buttonFunction.length] = f;
    },
    
    addCancel : function()
    {
		this.addButton('Cancel', 'OverlayDialogInstance.close()');
	},
    
	displayAt : function(o, offsetx, offsety)
	{
		this._object = o;
		this._offsetx = offsetx;
		this._offsety = offsety;
		display();
	},
	
	display : function(o)
	{
		this._object = o;
		var defaultFunction = this._defaultFunction;
		var closeFunction = this._closeFunction;
		if (defaultFunction == null)
			defaultFunction = this._buttonFunction[this._buttonFunction.length - 1];
		if (defaultFunction == null)
			defaultFunction = 'if (OverlayDialogInstance) OverlayDialogInstance.close()';
		if (closeFunction == null)
			closeFunction = 'OverlayDialogInstance.close()';
		var s =
			'<form onsubmit="' + defaultFunction + '; return false;"><table cellSpacing="0" cellPadding="0" width="' + this._width + '" border="0" class="jv-noBgColor"><tr height="' + this._bdSize + '"><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td  style=" background-color: ' + this._bdCol + '; color: #4d4d4d" ><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="99%"></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr>'
			+ '<tr><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d" height="25"><IMG  src="../images2/spix.gif" width="' + this._bdSize + '" height="25"></td><td  style=" background-color: ' + this._bdCol + '; color: #4d4d4d" ><table cellpadding="0" cellspacing="0" width="100%" class="jv-dialogTop"><tr style="background-color: ' + this._tbdCol + ';color:' + this._tfntCol + '"><td  width="19"><IMG height="25" src="../images2/spix.gif" width="19"></td><td id="' + this._id + 'Move"  style="font-size: 16px; font-weight: bold; cursor: move;" >'+ this._title + '</td>'
			+ '<td align="right"><a href="javascript:' + closeFunction + '" class="jv-closeIcon"><img src="../images2/dialog-close-gray.gif" border="0" width="16" height="16">&nbsp;</a></td><td><IMG height="25" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr></table></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG  src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr>' 
			+ '<tr><td style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="99%" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td class="jv-dialogBody" style="padding: 14px 14px 14px 14px; background-color: ' + this._backCol + '; color: #4d4d4d">'
			+ '<table cellpadding="0" cellspacing="0" width="100%"><tr class="jv-noSpace"><td colspan="2"><img src="../images2/spix.gif" width="5" height="5"></td></tr>' 
			+ '<tr><td colspan="2"><table cellSpacing="0" cellPadding="" width="100%" border="0"><tr><td class="jv-noSpace"><img src="../images2/spix.gif" width="5" height="1" /></td><td><table cellSpacing="0" cellPadding="" width="100%" border="0" style="color:#404040">' 
				+ this._content +	'</table></td><td class="jv-noSpace"><img src="../images2/spix.gif" width="5"></td></tr></table></td></tr>';
		if (this._buttonTitle.length > 0)
		{
			if (this._buttonTitle.length == 1 || this._center)
			{
				s += '<tr><td align="center" colspan="2"><table cellpadding="0" cellspacing="0"><tr>';
					
				for (var i = 0; i < this._buttonTitle.length; i++)
				{
					if (i > 0)
						s += '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
					s +=
						'<td>' +
						'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + this._buttonFunction[i] + '">' +
						'<tr>' +
						'<td class="jv-button-greyLeft"><img src="../images2/primarybutton_left.gif" border="0"></td>' +
						'<td class="primary jv-button-greyCenter">' + this._buttonTitle[i] + '</td>' +
						'<td class="jv-button-greyRight"><img src="../images2/primarybutton_right.gif" border="0"></td>' +
						'</tr>' +
						'</table>' +
						'</td>';
				}
				
				s += '</tr></table></td></tr>';
			}
			else
			{
				s += '<tr><td colspan="2" align="right"><table cellpadding="0" cellspacing="0"><tr>';
					
				for (var i = 0; i < this._buttonTitle.length; i++)
				{
					if (i == 1)
						s += '<td width="5"><img src="../images2/spix.gif" width="5" height="5"></td>';
					else if (i > 0)
						s += '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
					s +=
						'<td>' +
						'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + this._buttonFunction[i] + '">' +
						'<tr>' +
						'<td class="jv-button-greyLeft"><img src="../images2/primarybutton_left.gif" border="0"></td>' +
						'<td class="primary jv-button-greyCenter">' + this._buttonTitle[i] + '</td>' +
						'<td class="jv-button-greyRight"><img src="../images2/primarybutton_right.gif" border="0"></td>' +
						'</tr>' +
						'</table>' +
						'</td>';
				}
				
				s += '</tr></table></td></tr>';
			}
		}
		s += '</table></td><td style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="99%" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr><tr height="' + this._bdSize + '"><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td class="jv-dialog-bottom" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="99%"></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr></table>';
		s += '<input type="image" src="../images2/spix.gif" style="width: 1px; height: 1px"></form>'
		this.displayContent(s);
		var o = document.getElementById(this._id + 'Move');
		if (o)
		{
			o.onmousedown = OverlayDialogStartMove;
			o.onmouseup = OverlayDialogEndMove;
		}
	},
	displayReportDialog : function(o)
	{
		this._object = o;
		var defaultFunction = this._defaultFunction;
		var closeFunction = this._closeFunction;
		if (defaultFunction == null)
			defaultFunction = this._buttonFunction[this._buttonFunction.length - 1];
		if (defaultFunction == null)
			defaultFunction = 'if (OverlayDialogInstance) OverlayDialogInstance.close()';
		if (closeFunction == null)
			closeFunction = 'OverlayDialogInstance.close()';
		var s =
			'<form onsubmit="' + defaultFunction + '; return false;"><table cellSpacing="0" cellPadding="0" width="' + this._width + '" border="0" class="jv-noBgColor"><tr height="' + this._bdSize + '"><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td  style=" background-color: ' + this._bdCol + '; color: #4d4d4d" ><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="99%"></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr>'
			+ '<tr><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d" height="25"><IMG  src="../images2/spix.gif" width="' + this._bdSize + '" height="25"></td><td  style=" background-color: ' + this._bdCol + '; color: #4d4d4d" ><table cellpadding="0" cellspacing="0" width="100%" class="jv-dialogTop"><tr style="background-color: ' + this._tbdCol + ';color:' + this._tfntCol + '"><td  width="19"><IMG height="25" src="../images2/spix.gif" width="19"></td><td id="' + this._id + 'Move"  style="font-size: 16px; font-weight: bold; cursor: move;" >'+ this._title + '</td>'
			+ '<td align="right"></td><td><IMG height="25" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr></table></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG  src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr>' 
			+ '<tr height="' + this._bdSize + '"><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td  style=" background-color: ' + this._bdCol + '; color: #4d4d4d" ><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="99%"></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr>'
			+ '<tr><td style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="99%" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td style="padding: 14px 14px 14px 14px; background-color: ' + this._backCol + '; color: #4d4d4d">'
			+ '<table cellpadding="0" cellspacing="0" width="100%"><tr><td colspan="2"><img src="../images2/spix.gif" width="5" height="5"></td></tr>' 
			+ '<tr><td colspan="2"><table cellSpacing="0" cellPadding="" width="100%" border="0"><tr><td ><img src="../images2/spix.gif" width="5" height="1" /></td><td><table cellSpacing="0" cellPadding="" width="100%" border="0" style="color:#404040">' 
				+ this._content +	'</table></td><td><img src="../images2/spix.gif" width="5"></td></tr></table></td></tr>';
		if (this._buttonTitle.length > 0)
		{
			if (this._buttonTitle.length == 1 || this._center)
			{
				s += '<tr><td align="center" colspan="2"><table cellpadding="0" cellspacing="0"><tr>';
					
				for (var i = 0; i < this._buttonTitle.length; i++)
				{
					if (i > 0)
						s += '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
					s +=
						'<td>' +
						'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + this._buttonFunction[i] + '">' +
						'<tr>' +
						'<td><img src="../images2/primarybutton_left.gif" border="0"></td>' +
						'<td class="primary">' + this._buttonTitle[i] + '</td>' +
						'<td><img src="../images2/primarybutton_right.gif" border="0"></td>' +
						'</tr>' +
						'</table>' +
						'</td>';
				}
				
				s += '</tr></table></td></tr>';
			}
			else
			{
				s += '<tr><td colspan="2"><table cellpadding="0" cellspacing="0" width="100%"><tr>';
					
				for (var i = 0; i < this._buttonTitle.length; i++)
				{
					if (i == 1)
						s += '<td width="99%"><img src="../images2/spix.gif" width="5" height="5"></td>';
					else if (i > 0)
						s += '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
					s +=
						'<td>' +
						'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + this._buttonFunction[i] + '">' +
						'<tr>' +
						'<td><img src="../images2/primarybutton_left.gif" border="0"></td>' +
						'<td class="primary">' + this._buttonTitle[i] + '</td>' +
						'<td><img src="../images2/primarybutton_right.gif" border="0"></td>' +
						'</tr>' +
						'</table>' +
						'</td>';
				}
				
				s += '</tr></table></td></tr>';
			}
		}
		s += '</table></td><td style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="99%" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr><tr height="' + this._bdSize + '"><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td><td style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="99%"></td><td width="' + this._bdSize + '" style=" background-color: ' + this._bdCol + '; color: #4d4d4d"><IMG height="' + this._bdSize + '" src="../images2/spix.gif" width="' + this._bdSize + '"></td></tr></table>';
		s += '<input type="image" src="../images2/spix.gif" style="width: 1px; height: 1px"></form>'
		this.displayContent(s);
		var o = document.getElementById(this._id + 'Move');
		if (o)
		{
			o.onmousedown = OverlayDialogStartMove;
			o.onmouseup = OverlayDialogEndMove;
		}
	},
	displayMenu : function(o)
	{
		this.displayMenu2(o,false);
	},
	displayModeless : function(o)
	{
		this.displayMenu2(o,true);
	},
	displayMenu2 : function(o,showCloseButton)
	{
		this._object = o;
		this._disableBackground = false;
		var defaultFunction = this._defaultFunction;
		var closeFunction = this._closeFunction;
		if (defaultFunction == null)
			defaultFunction = this._buttonFunction[this._buttonFunction.length - 1];
		if (defaultFunction == null)
			defaultFunction = 'if (OverlayMenuInstance) OverlayMenuInstance.close()';
		if (closeFunction == null)
			closeFunction = 'if (OverlayMenuInstance) OverlayMenuInstance.close()';
		s = '<form onsubmit="' + defaultFunction + '; return false;">'
			+ '<table cellspacing="0" cellpadding="0" width="' + this._width + '" border="0"><tr><td>'
			+ '<table cellspacing="0" cellpadding="0" width="100%" border="0" style="border: solid 2px #999999;">'
			+ '<tr>'
			+ '<td style="background-color: ' + this._tbdCol + '; color: #4d4d4d; padding: 1px 1px 1px 5px;">'
			+ '<table cellpadding="0" cellspacing="0" width="100%">'
			+ '<tr style="background-color: ' + this._tbdCol + '; color: ' + this._tfntCol + '">'
			+ (showCloseButton ? '' : '<td width="19" style="padding: 3px 3px 3px 3px;"><a href="javascript:toggleContent(\'' + this._id + '\')"><img id="' + this._id + 'Image" src="../images2/collapse_icon.gif" border="0"></a></td>')
			+ '<td id="' + this._id + 'Move" align="left" style="color:#ffffff; font-size: 16px; font-weight: bold; cursor: move; line-height:30px;">'
			+ this._title
			+ '</td>'
			+ (showCloseButton ? '<td width="20" style="padding: 5px 10px 5px 3px;" align="right"><a href="javascript:' + closeFunction + '" class="jv-closeIcon"><img src="../images2/dialog-close-gray.gif" border="0" width="16" height="16"></a></td>' : '')
			+ '</tr>'
			+ '</table>'
			+ '</td>'
			+ '</tr>'
			+ '</table>'
			+ '<div id="' + this._id + 'Content">'
			+ '<table cellspacing="0" cellpadding="0" width="100%" border="0" style="border-left: solid 2px #999999; border-right: solid 2px #999999; border-bottom: solid 2px #999999; background-color: White;">'
			+ '<tr>'
			+ '<td style="background-color: #ffffff; color: #4d4d4d; padding: 5px 5px 5px 5px;">'
			+ '<table cellspacing="0" cellpadding="0" width="100%" border="0">'
			+ this._content
			+ '</table>'
			+ '</td>'
			+ '</tr>';
		if (this._buttonTitle.length > 0)
		{
			if (this._buttonTitle.length == 1 || this._center)
			{
				s += '<tr><td align="center" colspan="2"><table cellpadding="0" cellspacing="0"><tr>';
					
				for (var i = 0; i < this._buttonTitle.length; i++)
				{
					if (i > 0)
						s += '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
					s +=
						'<td>' +
						'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + this._buttonFunction[i] + '">' +
						'<tr>' +
						'<td><img src="../images2/primarybutton_left.gif" border="0"></td>' +
						'<td class="primary">' + this._buttonTitle[i] + '</td>' +
						'<td><img src="../images2/primarybutton_right.gif" border="0"></td>' +
						'</tr>' +
						'</table>' +
						'</td>';
				}
				
				s += '</tr></table></td></tr>';
			}
			else
			{
				s += '<tr><td colspan="2"><table cellpadding="0" cellspacing="0" width="100%"><tr>';
					
				for (var i = 0; i < this._buttonTitle.length; i++)
				{
					if (i == 1)
						s += '<td width="99%"><img src="../images2/spix.gif" width="5" height="5"></td>';
					else if (i > 0)
						s += '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
					s +=
						'<td>' +
						'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + this._buttonFunction[i] + '">' +
						'<tr>' +
						'<td><img src="../images2/primarybutton_left.gif" border="0"></td>' +
						'<td class="primary">' + this._buttonTitle[i] + '</td>' +
						'<td><img src="../images2/primarybutton_right.gif" border="0"></td>' +
						'</tr>' +
						'</table>' +
						'</td>';
				}
				
				s += '</tr></table></td></tr>';
			}
		}
		s += '</table>'
			+ '</div>'
			+ '</td></tr>'
			+ '</table>'
			+ '</form>'
		this.displayContent(s);
		var o = document.getElementById(this._id + 'Move');
		if (o)
		{
			o.onmousedown = OverlayDialogStartMove;
			o.onmouseup = OverlayDialogEndMove;
		}
		OverlayMenuInstance = OverlayDialogInstance;
		OverlayDialogInstance = this._savedDialog;
	},
	displayContent : function(s)
	{
		this._savedDialog = OverlayDialogInstance;
		if (this._savedDialog)
			document.getElementById(this._savedDialog._id).style.display = 'none';
		OverlayDialogInstance = this;
		var e = document.createElement('div');
		e._dialog = this;
		e.innerHTML = s;
		e.id = this._id;
		e.className = 'popupcss';
		document.body.appendChild(e);
		this.overlayOpen(this._id, this._object, this._offsetx, this._offsety);
		if (this._firstTextInput.length != 0)
			document.getElementById(this._firstTextInput).focus();
	},
	displayObject : function(id)
	{
		this._id = id;
		this._savedDialog = OverlayDialogInstance;
		if (this._savedDialog)
			document.getElementById(this._savedDialog._id).style.display = 'none';
		OverlayDialogInstance = this;
		this._remove = false;
		this.overlayOpen(id, this._object, this._offsetx, this._offsety);
	},
	calculatePosition : function(o)
	{
		this._overlayx += o.offsetLeft;
		this._overlayy += o.offsetTop;
		if (o.offsetParent)
			this.calculatePosition(o.offsetParent);
	},
	calculateTablePosition : function(o)
	{
		this._overlaytablex += o.offsetLeft;
		this._overlaytabley += o.offsetTop;
		if (o.offsetParent)
			this.calculateTablePosition(o.offsetParent);
	},
	overlayOpen : function(name, o, offsetx, offsety)
	{
		var d = document.getElementById(name);
		var maintable = document.getElementById('maintable');
		if (maintable.clientHeight == 0 && maintable.firstChild)
			maintable = maintable.firstChild;
		this._overlaytablex = 0;
		this._overlaytabley = 0;
		this.disableDropDown();
		if (o)
		{
			if (o.clientWidth)
			{
				this._overlayx = offsetx + o.clientWidth / 2;
				this._overlayy = offsety + o.clientHeight;
			}
		}
		else
		{
			this._overlayx = offsetx + maintable.offsetLeft + maintable.clientWidth / 2 + document.body.scrollLeft;
			this._overlayy = offsety + document.body.scrollTop;
		}
		this.calculateTablePosition(maintable);
		this._overlayname = name;
		if (o)
			this.calculatePosition(o);
		if (this._savedDialog == null && this._disableBackground)
		{
			var o = document.createElement('div');
			o.innerHTML = '<table id="popupalltable"><tr><td>&nbsp;</td></tr></table>'
			o.id = 'overlayall';
			o.className = 'popupcssall';
			document.body.appendChild(o);
			o.style.top = this._overlaytabley + 'px';
			o.style.left = this._overlaytablex + 'px';
			o = document.getElementById('popupalltable');
			o.style.height = maintable.clientHeight + 'px';
			o.style.width = maintable.clientWidth + 'px';
			document.body.style.backgroundColor = '#666666';
		}
		d.style.display = 'inline';
		var w = d.clientWidth;
		var h = d.clientHeight;
		var ww = window.innerWidth;
		if (!ww)
			ww = document.body.clientWidth;
		var hh = window.innerHeight;
		if (!hh)
			hh = document.body.clientHeight;
		if (hh > 100)
		{
			var scrollTop = document.documentElement.scrollTop;
			if (!scrollTop)
				scrollTop = document.body.scrollTop;
			var scrollLeft = document.documentElement.scrollLeft;
			if (!scrollLeft)
				scrollLeft = document.body.scrollLeft;
			this._overlayx -= w / 2;
			if (this._overlayx + w > ww + scrollLeft)
				this._overlayx = ww + scrollLeft - w;
			if (this._overlayx < scrollLeft)
				this._overlayx = scrollLeft;
			if (this._overlayy + h > hh + scrollTop)
				this._overlayy = hh + scrollTop - h;
			if (this._overlayy < scrollTop)
				this._overlayy = scrollTop;
		}
		d.style.left = this._overlayx + 'px';
		d.style.top = this._overlayy + 'px';
		if (typeof(document.body.onresize) == 'object')
		{
			this._overlaysaveonresize = document.body.onresize;
			document.body.onresize = this.overlayonresize;
		}
		else
			this._overlaytimer = window.setInterval(this.overlayonresize, 1000);
		this._display = true;
		track();
	},
	overlayonresize : function()
	{
		if (OverlayDialogInstance)
			OverlayDialogInstance.overlayonresize2();
	},
	overlayonresize2 : function()
	{
		if (!this._display)
			return;
		var maintable = document.getElementById('maintable');
		if (maintable.clientHeight == 0 && maintable.firstChild)
			maintable = maintable.firstChild;
		var x = this._overlaytablex;
		this._overlaytablex = 0;
		this._overlaytabley = 0;
		this.calculateTablePosition(maintable);
		var offset = x - this._overlaytablex;
		if (offset)
		{
			var o = document.getElementById('overlayall');
			if (o)
			{
				o.style.left = this._overlaytablex + 'px';
				
				o = document.getElementById(this._overlayname);
				this._overlayx -= offset;
				if (this._overlayx + o.clientWidth > document.documentElement.clientWidth)
					this._overlayx = document.documentElement.clientWidth - o.clientWidth;
				if (this._overlayx < document.documentElement.scrollLeft)
					this._overlayx = document.documentElement.scrollLeft;
				if (this._overlayx < 0)
					this._overlayx = 0;
				o.style.left = this._overlayx + 'px';
			}
		}
	},
	disableDropDown : function()
	{
		if (!this._overlayDoDisable)
		{
			try
			{
				this._overlayDoDisable = 1;
				if (window.clientInformation)
				{
					var s = window.clientInformation.userAgent;
					var p = s.indexOf('MSIE');
					if (p != -1)
					{
						isIE = true;
						s = s.substring(p + 5);
						p = s.indexOf('.');
						if (p != -1 && (s.substring(0, p) - 0) < 7)
							this._overlayDoDisable = 2;
					}
				}
			}
			catch (e)
			{
			}
		}
		if (this._overlayDoDisable == 2)
		{
			this._overlayDisabled = new Array();
			this._overlayDisabled2 = new Array();
			var dropDowns = document.getElementsByTagName('SELECT');
			for (var i = 0; i < dropDowns.length; i++)
			{
				this._overlayDisabled[this._overlayDisabled.length] = dropDowns[i];
				this._overlayDisabled2[this._overlayDisabled2.length] = dropDowns[i].style.visibility;
				dropDowns[i].style.visibility = 'hidden';
			}
		}
	},
	enableDropDown : function()
	{
		if (this._overlayDisabled)
		{
			for (var i = 0; i < this._overlayDisabled.length; i++)
				this._overlayDisabled[i].style.visibility = this._overlayDisabled2[i];
			this._overlayDisabled = null;
			this._overlayDisabled2 = null;
		}
		if (this._overlaytimer)
			window.clearInterval(this._overlaytimer);
		else if (this._overlaysaveonresize)
			document.body.onresize = this._overlaysaveonresize;
	},
	close : function()
	{
		this._display = false;
		var o = document.getElementById(this._id);
		if (o)
		{
			if (this._remove)
				o.parentNode.removeChild(o);
			else
				o.style.display = 'none';
		}
		if (this._savedDialog && document.getElementById(this._savedDialog._id))
			document.getElementById(this._savedDialog._id).style.display = 'inline';
		else
		{
			var o = document.getElementById('overlayall');
			if (o)
				o.parentNode.removeChild(o);
			o = document.getElementById('browserall');
			if (o)
				o.parentNode.removeChild(o);
			document.body.style.backgroundColor = '#cccccc';
		}
		this.enableDropDown();
		if (OverlayDialogInstance == this)
			OverlayDialogInstance = this._savedDialog;
		if (OverlayMenuInstance == this)
			OverlayMenuInstance = this._savedDialog;
		track();
	},
	startMove : function(e)
	{
		var scrollLeft = document.documentElement.scrollLeft;
		if (!scrollLeft)
			scrollLeft = document.body.scrollLeft;
		var scrollTop = document.documentElement.scrollTop;
		if (!scrollTop)
			scrollTop = document.body.scrollTop;
		this._offsetx = this._overlayx - scrollLeft - _x;
		this._offsety = this._overlayy - scrollTop - _y;
		this._isMoving = true;
		addMouseMoveListener(OverlayDialogMouseMove);
		return false;
	},
	endMove : function(e)
	{
		removeMouseMoveListener(OverlayDialogMouseMove);
		this._isMoving = false;
		return false;
	},
	mouseMove : function()
	{
		if (this._isMoving)
		{
			var scrollLeft = document.documentElement.scrollLeft;
			if (!scrollLeft)
				scrollLeft = document.body.scrollLeft;
			var scrollTop = document.documentElement.scrollTop;
			if (!scrollTop)
				scrollTop = document.body.scrollTop;
			var hh = window.innerHeight;
			if (!hh)
				hh = document.body.clientHeight;
			var o = document.getElementById(this._id).style;
			this._overlayx = scrollLeft + _x + this._offsetx;
			this._overlayy = scrollTop + _y + this._offsety;
			o.left = this._overlayx + 'px';
			o.top = this._overlayy + 'px';
			if (_y > hh - 20)
				window.scrollBy(0, _y - hh + 20);
			else if (_y < 20)
				window.scrollBy(0, _y - 20);
			return false;
		}
		return true;
	}
}
function addButton(name, f)
{
	return '<td>' +
		'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + f + '">' +
		'<tr>' +
		'<td><img src="../images2/primarybutton_left.gif" border="0"></td>' +
		'<td class="primary">' + name + '</td>' +
		'<td><img src="../images2/primarybutton_right.gif" border="0"></td>' +
		'</tr>' +
		'</table>' +
		'</td>';
}
function addButton2(name, f)
{
	return '<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + f + '">' +
		'<tr>' +
		'<td><img src="../images2/primarybutton_left.gif" border="0"></td>' +
		'<td class="primary">' + name + '</td>' +
		'<td><img src="../images2/primarybutton_right.gif" border="0"></td>' +
		'</tr>' +
		'</table>';
}
function addSecondaryButton(name, f)
{
	return '<td>' +
		'<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + f + '">' +
		'<tr>' +
		'<td><img src="../images2/secondarybutton_left.gif" border="0"></td>' +
		'<td class="secondary">' + name + '</td>' +
		'<td><img src="../images2/secondarybutton_right.gif" border="0"></td>' +
		'</tr>' +
		'</table>' +
		'</td>';
}
function addSecondaryButton2(name, f)
{
	return '<table class="button" cellpadding="0" cellspacing="0" border="0" onclick="' + f + '">' +
		'<tr>' +
		'<td><img src="../images2/secondarybutton_left.gif" border="0"></td>' +
		'<td class="secondary">' + name + '</td>' +
		'<td><img src="../images2/secondarybutton_right.gif" border="0"></td>' +
		'</tr>' +
		'</table>';
}
function addSkinnyButton(name, f)
{
	return '<td>' +
		'<table cellSpacing="0" cellPadding="0" border="0" style="cursor: pointer;" onclick="' + f + '"><tr><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td><td colspan="3" bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td></tr><tr><td><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="3"><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td><img src="../images2/spix.gif" width="1" height="1" /></td></tr><tr><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="3" bgcolor="#ffffff" style="color: #333333; padding-left: 15px; padding-right: 15px; line-height: 14px;">' + name + '</td><td><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td></tr><tr><td><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="3"><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td><img src="../images2/spix.gif" width="1" height="1" /></td></tr><tr><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td><td colspan="3" bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td></tr></table>' +
		'</td>';
}
function addSkinnyButton2(name, f)
{
	return '<table cellSpacing="0" cellPadding="0" border="0" style="cursor: pointer;" onclick="' + f + '"><tr><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td><td colspan="3" bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td></tr><tr><td><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="3"><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td><img src="../images2/spix.gif" width="1" height="1" /></td></tr><tr><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="3" bgcolor="#ffffff" style="color: #333333; padding-left: 15px; padding-right: 15px; line-height: 14px;">' + name + '</td><td><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td></tr><tr><td><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="3"><img src="../images2/spix.gif" width="1" height="1" /></td><td bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td><img src="../images2/spix.gif" width="1" height="1" /></td></tr><tr><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td><td colspan="3" bgcolor="#666666"><img src="../images2/spix.gif" width="1" height="1" /></td><td colspan="2"><img src="../images2/spix.gif" width="2" height="1" /></td></tr></table>';
}
function addButtonSpace()
{
	return '<td><img src="../images2/spix.gif" width="5" height="5"></td>';
}
function whatsThis(o, title, text, offsetx, offsety, width)
{
	var d = new OverlayDialog(title, text);
	d.set_width(width);
	d.display(o, offsetx, offsety);
}
function confirmMessage(o, message, offsetx, offsety)
{
	var d = new OverlayDialog('Confirmation', message, true);
	d.set_width(610);
	d.addRowSpace();
	d.addButton('OK', 'OverlayDialogInstance.close()');
	d.display(o, offsetx, offsety);
}
function confirmDialog(message)
{
	var d = new OverlayDialog('Confirmation', message, true);
	d.set_width(610);
	d.addRowSpace();
	d.addButton('OK', 'OverlayDialogInstance.close()');
	d.display(null, 0, 100);
}
function confirmCommandDialog(o, f, command, id, message, offsetx, offsety)
{
	var d = new OverlayDialog('Confirmation', message, true);
	d.set_width(610);
	if (f)
		d.overlayfunction = f;
	if (command)
		d.confirmName = command;
	if (id)
		d.confirmId = id;
	d.addRowSpace();
	d.addButton('No', 'OverlayDialogInstance.close()');
	d.addButton('Yes', 'confirmCommandYes()');
	d.display(o, offsetx, offsety);
}
function confirmCommand(o, command, id, message, offsetx, offsety)
{
	confirmCommandDialog(o, null, command, id, message, offsetx, offsety);
}
function confirmFunction(o, f, message, offsetx, offsety)
{
	confirmCommandDialog(o, f, null, null, message, offsetx, offsety);
}
function confirmDelete(o, message, id)
{
	confirmCommandDialog(o, null, 'delete', id, message, 0, 0);
}
function confirmOfflineReportDialog(o, f, command, id, message, offsetx, offsety)
{
	var d = new OverlayDialog('Email Report', message, true);
	d.set_width(610);
	if (f)
		d.overlayfunction = f;
	if (command)
		d.confirmName = command;
	if (id)
		d.confirmId = id;
	d.addRowSpace();
	
	d.addButton('Cancel', 'cancelOfflineReportYes()');
	d.addButton('Send Report by Email', 'confirmOfflineReportYes()');
	
	d.displayReportDialog(o, offsetx, offsety);
}
function cancelOfflineReportYes()
{
    if(OverlayDialogInstance != null)
    {
        OverlayDialogInstance.close();
    }
	submitValue('offlinereportcancel', 0);
}
function confirmOfflineReportYes()
{
    if(OverlayDialogInstance != null)
    {
        OverlayDialogInstance.close();
    }
	submitValue('offlinereport', 0);
}
function confirmOfflineGo()
{
	submitValue('offline', 0);
}
function confirmOfflineReport()
{
    confirmOfflineReportDialog(null, confirmOfflineGo, '', '', 'The report you have requested is a large report that will take some time to process. Please click on Send Report by Email below to be emailed a link to download the report or you may cancel and not run the report.  The email should arrive in about 10 minutes though if it\'s a very large report, it may take up to an hour.', 0, 100);
}
function confirmExit()
{
	confirmCommandDialog(null, confirmExitGo, '', '', 'Are you sure you want to exit?', 0, 100);
}
function confirmExitGo()
{
	submitValue('exit', 0);
}
function confirmDelete2(o, list, message)
{
	var c = document.getElementById(list + 'SelectCount');
	if (c && c.innerHTML - 0 > 0)
		confirmCommandDialog(o, null, 'delete', 0, message, 0, 0);
	else
	{
 		var f = document.getElementById('Form1');
		var d = document.getElementById('PageData');
		if (d == null)
			d = f.PageData;
		if (f)
		{
			if (d)
				d.value += 'delete|0|';
			f.submit();
		}
	}
}
function confirmDelete3(o, message, offsetx, offsety)
{
	confirmCommandDialog(o, null, 'delete', 0, message, offsetx, offsety);
}
function confirmDelete4(o, message, id, offsetx, offsety)
{
	confirmCommandDialog(o, null, 'delete', id, message, offsetx, offsety);
}
function confirmCommandYes()
{
	if (!OverlayDialogInstance)
		return;
	if (typeof(OverlayDialogInstance.overlayfunction) == 'function')
	{
		OverlayDialogInstance.overlayfunction();
		if (OverlayDialogInstance)
    		OverlayDialogInstance.overlayfunction = null;
	}
	else if (OverlayDialogInstance.confirmName)
	{
 		var f = document.getElementById('Form1');
		var d = document.getElementById('PageData');
		if (d == null)
			d = f.PageData;
		if (f)
		{
			if (d)
				d.value += OverlayDialogInstance.confirmName + '|' + OverlayDialogInstance.confirmId + '|';
			f.submit();
		}
	}
	if (OverlayDialogInstance)
    	OverlayDialogInstance.close();
}
function overlayDisable(name)
{
	var o = document.getElementById(name);
	var d = document.getElementById(name + 'Div');
	if (d)
	{
		d.className = 'disableOverlay';
		var t = document.getElementById(name + 'Table');
		t.style.height = o.clientHeight;
		t.style.width = o.clientWidth;
		d.style.display = 'inline';
	}
}
function overlayEnable(name)
{
	var d = document.getElementById(name + 'Div');
	var t = document.getElementById(name + 'Table');
	if (d)
	{
		t.style.height = 0;
		t.style.width = 0;
		d.style.display = 'none';
	}
}
function toggleContent(id)
{
	var o = document.getElementById(id + 'Image');
	var s = document.getElementById(id + 'Content');
	if (o) 
	{
		if (o.src.indexOf('expand_icon.gif') != -1) 
		{
			s.style.display = 'block';
			o.src = '../images2/collapse_icon.gif';
		}
		else 
		{
			s.style.display = 'none';
			o.src = '../images2/expand_icon.gif';
		}
	}
}
