if ((window.navigator.userAgent.indexOf("Firefox") != -1) || (window.navigator.userAgent.indexOf("MSIE") != -1) || (window.navigator.userAgent.indexOf("SV1") != -1)) {
	var aw = screen.availWidth;
	var ah = screen.availHeight;
}

function fileBrowserCallBack(field_name, url, type, win) {
	blehwindow = win;
	openWin('filebrowser','../../../../../atk/tools/fman/filebrowser.php?type=' + type + '&field_name=' + field_name,600,500,0,1);
}

function urlConvertCallBack(url, node, on_save) {
	return url;
}

function fillImage(field_name,url) {
	blehwindow.document.forms[0].elements[field_name].value = url;
}

function openWin(winName, urlLoc, w, h, showStatus, isViewer) {
	l = (aw - w)/2;
	t = (ah - h)/2;
	features  = "toolbar=no";      // yes|no 
	features += ",location=no";    // yes|no 
	features += ",directories=no"; // yes|no 
	features += ",status=" + (showStatus?"yes":"no");  // yes|no 
	features += ",menubar=no";     // yes|no 
	features += ",scrollbars=" + (isViewer?"yes":"no");   // auto|yes|no 
	features += ",resizable=" + (isViewer?"yes":"no");   // yes|no 
	features += ",dependent";      // close the parent, close the popup, omit if you want otherwise 
	features += ",height=" + h;
	features += ",width=" + w;
	features += ",left=" + l;
	features += ",top=" + t;
	winName = winName.replace(/[^a-z]/gi,"_");
	return window.open(urlLoc,winName,features);
}

function confirmSubmit(vMessage) {
	if (!vMessage) vMessage = "This action will remove this record permanently.";
	return confirm("WARNING!\n\n" + vMessage + "\n\nDo you wish to continue?");
}

function getSub(object){document.frmCatalogue.action = object.options[object.selectedIndex].value;}

function Choose(id, id2, img, img2) {
	if ( id == "src" || id == "href" ) {
		window.opener.fillImage(id,img);
	}
	else {
		window.opener.$(id).value = img;
		if (id2 != "") {
			window.opener.$(id2).value = img2;
		}
	}
	window.close();
}

function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

