﻿function gotoArchives(catID, itemID, notifyMe, action) {
	var frmAF = document.aspnetForm;
	var qs = window.location.search;
	var actionTaken = '' ;
	if (action)
		actionTaken = action + '?ARC=Y' + (qs == null || qs == '' ? '' : '&' + qs.substr(1));
	else
		actionTaken = window.location.protocol + "//" + window.location.host + window.location.pathname +
		'?ARC=Y' + (qs == null || qs == '' ? '' : '&' + qs.substr(1));
	
	frmAF.action = actionTaken;
	frmAF.strPage.value = "Archive";
	frmAF.intArchMainCatID.value = catID;
	frmAF.intArchMainItemID.value = itemID;
	frmAF.ysnNotifyMe.value = (notifyMe ? 1 : 0);
	frmAF.submit();
}

function archivedSort(reqSort) {
	var frmAF = document.aspnetForm;
	var lastSort = frmAF.txtArchSort.value;
	var lastSortDir = frmAF.txtArchAsc.value;

	frmAF.txtArchAsc.value = (lastSort != reqSort ? 1 : (lastSortDir == 1 ? 0 : 1));
	frmAF.txtArchSort.value = reqSort;
	asyncPostBack('sort', 'Archive');
}

function archVariablesInit(onlyThisCat, onlyThisItem) {
	var frmAF = document.aspnetForm;
	frmAF.strPage.value = 'Archive';
	frmAF.intArchMainCatID.value = onlyThisCat;
	frmAF.intArchMainItemID.value = onlyThisItem;
}
