function DeleteConfirmDirect(ButtonID, ButtonValue, FormID, Message)
	{
	var Result = confirm(Message);
			
	if (Result == true)
		{
		document.getElementById(ButtonID).value = ButtonValue;
		document.getElementById(FormID).submit();
		}

	return;
	}
	
function DeleteConfirm(ArrayOptions, OptionListID, ButtonID, ButtonValue, FormID, Message)
	{
	var IsOptionCorrect = false;
	
	for (TMPCounter = 0; TMPCounter < ArrayOptions.length; TMPCounter++)
		{
		if (document.getElementById(OptionListID).value == ArrayOptions[TMPCounter])
			{
			IsOptionCorrect = true;
			
			var Result = confirm(Message);
			
			if (Result == true)
				{
				document.getElementById(ButtonID).value = ButtonValue;
				document.getElementById(FormID).submit();
				}
			}
		}

	if ((IsOptionCorrect == false) && (Result == null))
		{
		document.getElementById(ButtonID).value = ButtonValue;
		document.getElementById(FormID).submit();
		}
		
	return;
	}

function CompareCharacterSets(PageCharacterSet, SelectedCharacterSet, ErrorMessage)
	{
	var OriginalSelectedCharacterSet = SelectedCharacterSet.value;
		SelectedCharacterSet = OriginalSelectedCharacterSet.substring(0, OriginalSelectedCharacterSet.length - 5);

	if (PageCharacterSet != SelectedCharacterSet)
		{
		var Result = confirm(ErrorMessage);

		if (Result == true)
			{
			window.location = window.location.href + '?&' + 'ChangeCharSetTo=' + OriginalSelectedCharacterSet;
			}
		}
	}
function SystemEmailLinkClickedMembers(AutoResponderID, EmailID, Link, LinkName)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './stat_clickedmemberhistory.php?AutoResponderID=' + AutoResponderID + '&EmailID=' + EmailID + '&Link=' + Link + '&LinkName=' + LinkName;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function SystemEmailClickMemberClicks(AutoResponderID, EmailID, MemberID, EmailAddress)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './stat_linkhistory.php?AutoResponderID=' + AutoResponderID + '&EmailID=' + EmailID + '&MemberID=' + MemberID + '&EmailAddress=' + EmailAddress;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function SystemEmailMemberOpenHistory(AutoResponderID, EmailID, MemberID, EmailAddress)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './stat_openhistory.php?AutoResponderID=' + AutoResponderID + '&EmailID=' + EmailID + '&MemberID=' + MemberID + '&EmailAddress=' + EmailAddress;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function SetTimerForSendLimitTracker(Seconds)
	{
	makeRequest('./connector.php', 'FormValue_Action=RetrieveSendLimitStats', 'SuccessSendLimitTracker');			
	
	setTimeout("SetTimerForSendLimitTracker(" + Seconds + ")", Seconds * 1000);
	}

function SuccessSendLimitTracker(ResultContent)
	{
	var XMLDoc = ResultContent.documentElement;
	var xRows = XMLDoc.getElementsByTagName('Entry');

	var TotalQuota				= xRows[0].childNodes[0].firstChild.nodeValue;	
	var TotalQuotaInterval		= xRows[0].childNodes[1].firstChild.nodeValue;	
	var TotalUsedQuota			= xRows[0].childNodes[2].firstChild.nodeValue;	
	var TotalUsedPercentQuota	= xRows[0].childNodes[3].firstChild.nodeValue;	
	var AllowedDays				= xRows[0].childNodes[4].firstChild.nodeValue;	
	var AllowedStartHour		= xRows[0].childNodes[5].firstChild.nodeValue;	
	var AllowedFinishHour		= xRows[0].childNodes[6].firstChild.nodeValue;	

	if (document.getElementById('TotalQuotaAmount') != null)
		{
		document.getElementById('TotalQuota').firstChild.nodeValue = TotalQuota;
		document.getElementById('TotalQuotaInterval').firstChild.nodeValue = TotalQuotaInterval;
		document.getElementById('TotalUsedQuota').firstChild.nodeValue = TotalUsedQuota;
		document.getElementById('TotalUsedPercentQuota').firstChild.nodeValue = TotalUsedPercentQuota;
		}

	if (document.getElementById('TotalQuotaTime') != null)
		{
		document.getElementById('AllowedDays').firstChild.nodeValue = AllowedDays;
		document.getElementById('AllowedStartHour').firstChild.nodeValue = AllowedStartHour;
		document.getElementById('AllowedFinishHour').firstChild.nodeValue = AllowedFinishHour;
		}

	return;
	}

function CampaignBandwidth(CampaignID)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './campaign_bandwidth.php?CampaignID=' + CampaignID;
	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 CampaignSpamRating(CampaignID)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './campaign_spamrating.php?CampaignID=' + CampaignID;
	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 MemberOpenHistory(CampaignID, CampaignStatisticsID, MemberID, EmailAddress)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './campaign_tracker_openhistory.php?CampaignID=' + CampaignID + '&CampaignStatisticsID=' + CampaignStatisticsID + '&MemberID=' + MemberID + '&EmailAddress=' + EmailAddress;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function ManageAutoResponderAttachments(AutoResponderID)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './autoresponder_popup_attachments.php?AutoResponderID=' + AutoResponderID;
	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 LinkClickedMembers(CampaignID, CampaignStatisticsID, Link, LinkName)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './campaign_tracker_clickedmemberhistory.php?CampaignID=' + CampaignID + '&CampaignStatisticsID=' + CampaignStatisticsID + '&Link=' + Link + '&LinkName=' + LinkName;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function NewsReader(NewsID)
	{
	var Width			= 550;
	var Height			= 350;
	var theURL			= './news_reader.php?NewsID=' + NewsID;
	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 CreateLabel(FormID, Message1)
	{
	var NewLabelName = prompt(Message1, '');

	if ((NewLabelName != null) && (NewLabelName != ''))
		{
		document.getElementById('FormValue_AddNewLabel').value = NewLabelName;
		document.getElementById(FormID).submit();
//		window.location.href = './campaign_browse.php?NewLabelName=' + NewLabelName + '&SelectedCampaigns=' + SelectedCampaigns;
		}
	
	return;
	}
	
function RemoveLabel()
	{
	}
	
function FollowUpIntervalCalculator()
	{
	var Width			= 550;
	var Height			= 350;
	var theURL			= './help_followupinterval.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 ForceReturnPathPopUp()
	{
	var Width			= 550;
	var Height			= 350;
	var theURL			= './help_forcereturnpath.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 EstimatedRecipients(CampaignID)
	{
	var Width			= 400;
	var Height			= 400;
	var ReSizeable		= 0;
	var ScrollBars		= 'yes';
	var theURL			= './campaign_popup_estimate.php?CampaignID=' + CampaignID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=' + ScrollBars + ',menubar=no,resizable=' + ReSizeable + ',location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function ShowHideItem(WhichID, Ignore)
	{
	if (Ignore == false)
		{
		Item = document.getElementById(WhichID);
	
		if (Item.style.display == 'none')
			{
			Item.style.display = '';
			}
		else if (Item.style.display == '')
			{
			Item.style.display = 'none';
			}
		else
			{
			Item.style.display = 'none';
			}
		}
	}

function ShowHideItemBasedOnClick(WhichID, Display)
	{
	Item = document.getElementById(WhichID);

	if (Display == true)
		{
		Item.style.display = '';
		}
	else if (Display == false)
		{
		Item.style.display = 'none';
		}
	else
		{
		Item.style.display = 'none';
		}
	}
	
function SkinPreview()
	{
	var Width			= 650;
	var Height			= 400;
	var theURL			= './help_skinpreview.php';
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}

function QuickHelpPopUp(WhichModule)
	{
	var Width			= 500;
	var Height			= 400;
	var theURL			= './help_quick.php?Module=' + WhichModule;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function HelpPopUpIntegration()
	{
	var Width			= 400;
	var Height			= 350;
	var theURL			= './help_integration.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 PreviewURL(URL)
	{
	var Width			= 600;
	var Height			= 400;
	var theURL			= URL;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function EmbedObjectPopUp()
	{
	var Width			= 400;
	var Height			= 350;
	var theURL			= './help_embedobject.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 ShowProcessMessage(LogID)
	{
	var Width			= 350;
	var Height			= 300;
	var theURL			= './stat_process_log_popup.php?LogID=' + LogID;
	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 ClickMemberClicks(CampaignID, CampaignStatisticsID, MemberID, EmailAddress)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './campaign_tracker_linkhistory.php?CampaignID=' + CampaignID + '&CampaignStatisticsID=' + CampaignStatisticsID + '&MemberID=' + MemberID + '&EmailAddress=' + EmailAddress;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function PreviewCampaign(CampaignID, Method)
	{
	if (Method == 'Email')
		{
		var Width			= 400;
		var Height			= 400;
		var ReSizeable		= 0;
		var ScrollBars		= 'yes';
		}
	else if (Method == 'Browser')
		{
		var Width			= 700;
		var Height			= 450;
		var ReSizeable		= 1;
		var ScrollBars		= 'yes';
		}
	var theURL			= './campaign_popup_preview.php?Method=' + Method + '&CampaignID=' + CampaignID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=' + ScrollBars + ',menubar=no,resizable=' + ReSizeable + ',location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function DisplayPureTemplate(TemplateID, CampaignID)
	{
	var Width			= 700;
	var Height			= 450;
	var theURL			= './campaign_popup_template.php?CampaignID=' + CampaignID + '&TemplateID=' + TemplateID;
	var CurrentDate 	= new Date();
		CurrentDate 	= CurrentDate.getTime();
	var winName 		= CurrentDate;
	var features 		= 'scrollbars=yes,menubar=no,resizable=1,location=no,width=' + Width + ',height=' + Height + '';
	OpenPopUp(theURL, winName, features);
	}
	
function ManageCampaignAttachments(CampaignID)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './campaign_popup_attachments.php?CampaignID=' + CampaignID;
	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 CalculateEstimatedRecipients(CampaignID)
	{
	var Width			= 400;
	var Height			= 400;
	var theURL			= './help_sendrules_recipients.php?CampaignID=' + CampaignID;
	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 ReadSendRulesInFactSheetStyle(CampaignID)
	{
	var Width			= 400;
	var Height			= 400;
	var theURL			= './help_sendrules_factsheet.php?CampaignID=' + CampaignID;
	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 CMSPopUp()
	{
	var Width			= 550;
	var Height			= 350;
	var theURL			= './help_cmstemplate.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 AutoResponderPopUp(AutoResponderID)
	{
	var Width			= 450;
	var Height			= 450;
	var theURL			= './autoresponder_preview.php?AutoResponderID=' + AutoResponderID;
	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 PersonalizationPopUp()
	{
	var Width			= 550;
	var Height			= 350;
	var theURL			= './help_personalize.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 ChangeColor(What, BackColor)
	{
	What.style.backgroundColor = BackColor;
	}

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];

	if (elts != null)
		{
		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;
			}
	
		if (elts_cnt != null)
			{
			for (var i = 0; i < elts_cnt; i++)
				{
				elts[i].checked = do_check;
				} // end for
			}
		else
			{
			elts.checked = do_check;
			}
		}
    return true;
	}

// Ajax Engine - START
function makeRequest(url, params, onLoadFunction) {

        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { alertContents(http_request, onLoadFunction); };
        http_request.open('POST', url, true);
		http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http_request.send(params);

    }

    function alertContents(http_request, onLoadFunction) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                eval(onLoadFunction+'(http_request.responseXML)');
            } else {
                alert('An error occured while trying to connect to your server. Click OK to continue.');
            }
        }

    }
// Ajax Engine - FINISH