function loading() {
	var tmp = document.getElementById("loadinglayer");
	tmp.style.top = getDocumentHeight()/2 - 75;
    tmp.style.left = getDocumentWidth()/2 - 150;
	tmp.style.visibility = "visible";
}
function preloadImage(path) { 
	var image = new Image(); 
	image.src = path; 
	return image; 
}
function getDocumentHeight() {   
	return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
}
function getDocumentWidth() {   
	return (document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
}
function price(period, month) {
	var discount = 1;
	var total = document.getElementById("total");
	var choice = period.options[period.selectedIndex].value;
	
	if (choice == "3") discount = 0.95;
	if (choice == "6") discount = 0.90;
	if (choice == "9") discount = 0.85;
	if (choice == "12") discount = 0.80;
	
	var price = choice * month * discount;
	var priceRu = price * 29;
	
	total.innerHTML = price.toFixed(2)+" ó.å. ("+priceRu.toFixed(2)+" ðóá.)";
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function checkCookie(number) {
	var autoupdate = getCookie("update_"+number);
	if (autoupdate == null) autoupdate = "false";
	var input = document.getElementById("update_"+number);
	if (autoupdate == "true" && input) input.checked = true;
	if (autoupdate == "true") changeupdate(input, number);
}

function getFrameHeight() {
	return (document.body.clientHeight < document.body.offsetHeight)?document.body.clientHeight:document.body.offsetHeight;
}

function getDocumentHeight() {
	return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;
}

function getBodyScrollTop() {
	return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}

function getDocumentWidth() {
	return (document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
}

function checknumbers(event) {
	var key = event.charCode ? event.charCode : event.keyCode;
	if (((key < 48) || (key > 57)) && (key != 8) && (key != 46)) return false;
}