function OpenAdminTriggerEditAdministrator(RecordID, TriggerID, Width, Height)
	{
	var theURL			= AdminURL + '/support_autocheck.php?Command=EditForAdministrator&DepartmentID=' + RecordID + '&TriggerID=' + TriggerID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminTriggerEditOperator(RecordID, TriggerID, Width, Height)
	{
	var theURL			= AdminURL + '/support_autocheck.php?Command=EditForOperator&DepartmentID=' + RecordID + '&TriggerID=' + TriggerID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminTriggerEditTicketOwner(RecordID, TriggerID, Width, Height)
	{
	var theURL			= AdminURL + '/support_autocheck.php?Command=EditForTicketOwner&DepartmentID=' + RecordID + '&TriggerID=' + TriggerID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminTriggerAdministrator(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/support_autocheck.php?Command=AddForAdministrator&DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminTriggerOperator(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/support_autocheck.php?Command=AddForOperator&DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminTriggerTicketOwner(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/support_autocheck.php?Command=AddForTicketOwner&DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}


function OpenAdminEditPost(TicketID, PostID, Width, Height)
	{
	var theURL			= AdminURL + '/support_editpost.php?TicketID=' + TicketID + '&PostID=' + PostID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}


function OpenAdminPreDefinedTagList(Width, Height)
	{
	var theURL			= AdminURL + '/help_predefinedtags.php';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function SubmitDeleteDepartmentForm()
	{
	document.form1.FormCommand.value="DeleteRecords";
	document.form1.submit();
	}
	
function OpenAdminEditMailBox(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/setup_email_edit.php?MailBoxID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenAdminDefineMailBox(Width, Height)
	{
	var theURL			= AdminURL + '/setup_email_add.php';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenVisitorTicketSendEmail(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/ticket_view.php?TicketID=' + RecordID + '&Command=DisplaySendEmail';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=no,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenAdminTicketSendEmail(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/support_viewticket.php?TicketID=' + RecordID + '&Command=DisplaySendEmail';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=no,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenAdminDeptCustomFields(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/man_departments_customfields.php?DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenAdminAssignAutoresponder(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/man_departments_autoresponder.php?DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenAdminAssignOperatorToDepartments(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/man_departments_assign.php?DepartmentID=0&OperatorID=' + RecordID + '&Command=OperatorAssigns';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminAssignOperators(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/man_departments_assign.php?DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function OpenAdminDetailsDepartment(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/man_departments_edit.php?DepartmentID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function OpenAdminAddNewDepartment(Width, Height)
	{
	var theURL			= AdminURL + '/man_departments_add.php';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
function OpenAdminAddNewOperator(Width, Height)
	{
	var theURL			= AdminURL + '/man_operators_add.php';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
function OpenAdminDetailsOperator(RecordID, Width, Height)
	{
	var theURL			= AdminURL + '/man_operators_edit.php?OperatorID=' + RecordID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=0,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}




function DisplayActionMessage(PageActionMessage)
	{
	if (PageActionMessage != '')
		{
		alert(PageActionMessage);
		}
	}
	
function OpenPopUp(theURL,winName,features)
	{
	// Ex: features = 'scrollbars=yes,menubar=no,resizable=0,location=no,width=400,height=400';
	window.open(theURL,winName,features);
	}

function GenerateUniqueNumber()
	{
	date = new Date() ;
	return date.getTime() ;
	}

function CheckAllCheckboxes(ownercheckbox,targetcheckbox,formname)
	{	
	var formname  = eval('document.' + formname);
    var elts      = formname.elements[targetcheckbox];

	var elts_cnt  = elts.length;
	var do_check  = true;

	owner_checkbox = formname.elements[ownercheckbox];

	if (owner_checkbox.checked == true)
		{
		do_check = true;
		}
	else
		{
		do_check = false;
		}

	for (var i = 0; i < elts_cnt; i++)
		{
		elts[i].checked = do_check;
		} // end for
	
				
    return true;
	}
