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

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

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 clearField(obj, text)
{
	if (obj.value == text) obj.value = '';
}

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

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 loadTable(id, srt)
{
	ajax = new sack();
	ajax.method = "GET";
	ajax.setVar("id", id);
	ajax.setVar("sort", srt);
	ajax.requestFile = '/en/ajax/loadTable.php';
	ajax.element = 'dataTable';
	ajax.onLoading = function ()
	{
		$('loadingText').style.display = 'block';
	};
	ajax.onLoaded = function ()
	{
		$('loadingText').style.display = 'none';
	};
	ajax.runAJAX();
}

function useBillingAddress(checkBox, deliveryAddressBox)
{
	if (checkBox.checked) {
		goHide(deliveryAddressBox);
	} else {
		goShow(deliveryAddressBox);
	}
}

function acceptTerms(checkBox, btnSubmit)
{
	if (checkBox.checked) {
		if (btnSubmit) goEnable(btnSubmit);
	} else {
		if (btnSubmit) goDisable(btnSubmit);
	}
}