function WriteFlash (strFile, strID, intWidth, intHeight, arParams, strAltHTML)
{
	if (navigator.userAgent.indexOf("MSIE") != -1) {
		document.write ('<object id="'+strID+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write ('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"');
		document.write ('width="'+intWidth+'"');
		document.write ('height="'+intHeight+'">');
	} else {
		document.write ('<object id="'+strID+'" data="'+strFile+'"');
		document.write ('width="'+intWidth+'"');
		document.write ('height="'+intHeight+'"');
		document.write ('type="application/x-shockwave-flash">');
	}
	if (arParams) {
		for (x in arParams) {
			keyvalue = arParams[x].split(":",2);
			document.write('<param name="' +keyvalue[0]+ '" value="' + keyvalue[1] + '" />');
		}
	}
	document.write ('<param name="movie" value="' + strFile + '" />');
	if (strAltHTML) document.write(strAltHTML);
	document.write ('</object>');
}

function confirmDelete()
{
	return confirm("Are you sure you want to delete this item?");
}

function confirmUpgrade()
{
	return confirm("Are you sure you want to upgrade your package?");
}

function $(elem)
{
	return document.getElementById(elem);
}

function go(loc)
{
	document.location.href = loc;
}

function goBack()
{
	history.back();
}

function goHide(obj)
{
	obj.style.display = 'none';
}

function goFocus(obj)
{
	obj.focus();
}

function goShow(obj)
{
	obj.style.display = 'block';
}

function goDisable(obj)
{
	obj.disabled = true;
}

function goEnable(obj)
{
	obj.disabled = false;
}

function goClearField(obj, text)
{
	if (obj.value == text) obj.value = '';
}

function goFillField(obj, text)
{
	if (obj.value == '') obj.value = text;
}

function goClearFieldBg(elem)
{
	if (elem.value == '') {
		elem.style.backgroundImage = 'none';
	}
}

function goFillFieldBg(elem, bg)
{
	if (elem.value == '') {
		elem.style.backgroundImage = 'url(' + bg + ')';
	}
}
	
function goPopup(where)
{
	window.open(where);
}

function goPopupMinimal(loc,w,h)
{
	var leftVal = (screen.width / 2) - (w/2);
	var topVal = (screen.height / 2) - (h/2);
	window.open (loc, 'new_window', 'left=' +leftVal+ ',top=' + topVal + ',toolbar=no,width=' + w + ',height=' + h + ',status=no,resizable=yes,menubar=no,location=no,scrollbars=yes');
}

function cleverDate(obj, e)
{
	key = parseInt(String.fromCharCode(e.keyCode));
	if (key >= 0 && key <= 9) {
		endChar = obj.value.substr(obj.value.length-1, obj.value.length);
		if (endChar != '/') {
			switch (obj.value.length) {
				case 2:
				case 5:
					obj.value += '/';
					break;
			}
		}
	}
}

ajaxMonitorWordCountTimer = 0;

function ajaxMonitorWordCount(text, limit, elem)
{
	if (ajaxMonitorWordCountTimer) clearTimeout(ajaxMonitorWordCountTimer);
	ajaxMonitorWordCountTimer = setTimeout
	(
	 	function()
		{
			ajax = new sack();
			ajax.method = "GET";
			ajax.setVar("c", 'ajax');
			ajax.setVar("a", 'word-count');
			ajax.setVar("text", text);
			ajax.setVar("limit", limit);
			ajax.requestFile = '/index.php';
			ajax.element = elem;
			ajax.runAJAX();
		}
		, 500
	);
}

function clearTabs(theTabs)
{
	for (i=0;i<theTabs.length;i++) {
		if ($(theTabs[i])) {
			$(theTabs[i]).className = 'shadeButton';
		}
	}
}

function clickTab(theTab, thePath, theElem)
{
	theTab.className = 'shadeButtonOn';
	$(theElem).innerHTML = '<p style="margin-top: 50px; text-align: center;"><img src="/images/ajax-loader.gif" alt="Loading..." width="28" height="28" /></p>';
	doAjaxRequest(thePath, theElem);
}

function doAjaxRequest(strUrl, elem)
{
	ajax = new sack();
	ajax.method = "GET";
	ajax.requestFile = strUrl;
	ajax.element = elem;
	ajax.runAJAX();
}