var clientIE = (navigator.userAgent.indexOf("MSIE") > -1);

function elemOver(el)
{
	el.className += " over";
}

function elemOut(el)
{
	el.className = el.className.replace("over", "");
}

function elemClick(page)
{
	document.location.href = '?page='+page;
}

function showSendFr()
{
	var elem = document.getElementById('idSendToFr');
	elem.style.display = (elem.style.display == '' ? 'none' : '');

	document.getElementById('idSendToFrMsg').style.display = 'none';
}

function checkform(frm)
{
	if (!frm.elements['iagree'].checked) {
		alert('Трябва да се съгласите с правилата за дарения');
		return false;
	}

	return true;
}

function btnagree()
{
	if (document.getElementById('iagreerules').checked) {
		document.location.href = '?page=donate&sub=char-donate';
	} else {
		alert('Трябва да се съгласите с правилата за дарения');
	}
}

function setPayment(theid)
{
	document.getElementById('paysite'+theid).checked = true;
}

var WindowObjectReference;
function windowCentered(strUrl, strWindowName, intWindowWidth, intWindowHeight, strWindowExtraSettings)
{
	var intWindowLeft = parseInt(screen.width - intWindowWidth) / 2;
	var intWindowTop = parseInt(screen.height - intWindowHeight) / 2;
	var strExtraSettings = 'width=' + intWindowWidth + ',height=' + intWindowHeight + ',left=' + intWindowLeft + ',top=' + intWindowTop + ',scrollbars=0,resizable=0';

	if (typeof(strWindowExtraSettings) != 'undefined') {
		strExtraSettings += ',' + strWindowExtraSettings;
	}

	WindowObjectReference = window.open(strUrl,strWindowName,strExtraSettings)

	if ((typeof(WindowObjectReference) != 'null') && typeof(WindowObjectReference.focus) == 'function') {
		WindowObjectReference.focus();
	}

	return false;
}

function popup(settings)
{
	return windowCentered(settings.url, settings.name, settings.width, settings.height);
}

function changeLanguage(path)
{
	window.location.hash='/' + path;
	window.location.reload();
}