<!--
/**************
JSCRIPTS.JS

Contains the javascripts used throughout the program
**************/


//////////////////////////////// GLOBAL FUNCTIONS (functions used for all or more than one of the modules)

// OPEN HELP FILES
function openHelp() {
	window.open("http://www.shopaltona.com/provisioner/admin/docs/index.html", "mainHelpWin", "width=650,height=520");
}

// CONFIRMS AN ACTION BEFORE EXECUTING (eg.: deleting something)
function confirmAction(question, action) {
	if (confirm(question)) {
		document.location = action;
	}
}

// CONFIRMS ACTION THEN SUBMITS A FORM RATHER THAN REDIRECTS TO ANOTHER LOCATION
function confirmActionSubmitForm(question, formName, formActQueryStr) {
	if (confirm(question)) {
		document[formName].action += formActQueryStr;
		document[formName].submit();
	}
}

function openForm(filename) {
	window.open(filename, "formWin", "width=600,height=500,scrollbars,status");
}

function openWindow(url, w, h) {
	window.open(url, "myWin", "width=" + w + ",height=" + h + ",scrollbars");
}

// Opens window with an image in it
function openImageWin(ImageFilePath, w, h) {
	if (typeof(w) == "number")
		w = (w + 30);
	if (typeof(h) == "number")
		h = (h + 40);

	window.open(ImageFilePath, "ImageWin", "width=" + w + ",height=" + h);
}


// OPENS CALENDAR
function openCalendar(year, month, day, numSrcCallBacks, yearFormElmnt, monthFormElmnt, dayFormElmnt, formName) {
	var srcStepBacks = "";
	for (i=0;i<numSrcCallBacks;i++) {
		srcStepBacks += "../";
	}

	window.open(srcStepBacks + "admin/global/calendar.php?year=" + year + "&month=" + month + "&day=" + day + "&yearFormElmnt=" + yearFormElmnt + "&monthFormElmnt=" + monthFormElmnt + "&dayFormElmnt=" + dayFormElmnt + "&formName=" + formName, "calendarWin", "width=300,height=320");
}

// INSERTS HTML TAGS INTO TEXTAREAS
function insertTag(tag, close, formAndFormField) {
	if (!close || close == "") {
		closingTag = "</" + tag + ">";
	}
	else if (close == "none") {
		closingTag = "";
	}
	else {
		closingTag = "</" + close + ">";
	}
	formAndFormField.value += "<" + tag + ">" + closingTag;
	formAndFormField.focus();
}

// OPENS THE TAGS HELP FILE
function openTagsHelp(num_srcStepBacks) {
	window.open("http://secure2.pdcweb.net/~bepp/php/script_products/provisioner_web_root/provisioner/admin/docs/tags_help.html", "helpwin", "width=400,height=500,scrollbars");
}


//////////////////////////////// FUNCTIONS FOR: biz-dir

// OPENS THE CATEGORY MANAGER WINDOW TO PERFORM A CATEGORY ACTION
function openCategoryMgr(ListingID) {
	window.open("manage_categories.php?ListingID=" + ListingID, "catWin", "width=370,height=350");
}
// -->
