
//the following variables need to be declared in the file
//that will use the 'administration commands'
/*
var delloc = "delete_category.php"
var delmsg = "the delete confirmation message here";

var editloc = "edit_category.php";

var activeloc = "modify_catstat.php";
var activemsg = "the edit confirmation message here";
var inactivemsg = "the edit confirmation message here";

var defloc = "default.php"
var defmsg = "the make default confirmation message here";

*/

//------------------------------------------------------------
//administration commands
function edit(indx,queryvars){
	if(!editloc)return false;
	if(!queryvars){queryvars="";}
	else{queryvars = "&"+queryvars;}
	window.location = editloc + "?indx=" + indx + queryvars;
	return true;
}
function del(indx,queryvars){
	if(!delloc)return false;
	if(!queryvars){queryvars="";}
	else{queryvars = "&"+queryvars;}
	verify(delmsg,delloc + "?indx=" + indx + queryvars)
}
function activate(indx,queryvars){
	if(!activeloc)return false;
	if(!queryvars){queryvars="";}
	else{queryvars = "&"+queryvars;}
	verify(activemsg,activeloc + "?a=1&indx=" + indx + queryvars)
}
function inactivate(indx,queryvars){
	var inactiveloc = activeloc;
	if(!inactiveloc)return false;
	if(!queryvars){queryvars="";}
	else{queryvars = "&"+queryvars;}
	verify(inactivemsg,inactiveloc + "?a=0&indx=" + indx + queryvars)
}
function makedefault(indx,queryvars){
	if(!defloc)return false;
	if(!queryvars){queryvars="";}
	else{queryvars = "&"+queryvars;}
	verify(defmsg,defloc + "?indx=" + indx + queryvars)
}
function verify(msg,url){
	if(confirm(msg)){
		window.location = url;
		return true;
	}
}
//------------------------------------------------------------
//import (product/cat/brand) page(toggle destination syntax)
function toggleDest(indx){
	if(document.all){
		document.all.info0.style.display="none";
		document.all.info1.style.display="none";
		document.all.info2.style.display="none";
		document.all['info' + indx].style.display="";
	}
}
//------------------------------------------------------------
//make a dropdown item selected based on the dropdown text
function makeSelected(obj,selectedText){
	for (i=0;i<obj.length;i++) {
		if(obj.options[i].value == selectedText) {
			obj.options[i].selected = true;
		}
	}
}
//------------------------------------------------------------
//submit the form to the specified location ('NewAction')
function postTo(formObj,NewAction){
	formObj.action = NewAction;
	formObj.submit();
}
//------------------------------------------------------------
//open a window with the specified url, width and height
function openWin(url,w,h,l,t,r,allowCheck){
	//find center if left/right not specified
	if(!l) l = ((screen.Width?screen.Width:window.Width)-w)/2;
	if(!t) t = ((screen.Height?screen.Height:window.Height)-h)/2;
	if(!r || r!="yes") r = "no";
	popwin = window.open(url,"popWin",'width='+w+
	',height='+h+',left='+l+',top='+t+
	',personal=no,toolbar=no,menubar=no,scrollbars=no,'+
	'location=no,status=no,resizable='+r+',directories=no');
	if (popwin.opener == null) popwin.opener = self;
	popwin.focus();
}
//------------------------------------------------------------