function processAjax(url) {
	if (window.XMLHttpRequest) { // Non-IE browsers
		req = new XMLHttpRequest();
		req.onreadystatechange = targetDiv;
		try {
			req.open("GET", url, true);
		} catch (e) {
			alert(e);
		}
	req.send(null);
	} else if (window.ActiveXObject) { // IE
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = targetDiv;
			req.open("GET", url, true);
			req.send();

		}
	}
}

function targetDiv() {
	if (req.readyState == 4) { // Complete
		if (req.status == 200) { // OK response
			document.getElementById("stores").innerHTML = req.responseText;
		} else {
			alert("Problem: " + req.statusText);
		}
	}
}

function openLink() {
	if (document.forms[0].varos.value != "") {
		location.href = document.forms[0].varos.value;
	} else {
		alert("Kérlek, válassz ki egy országot, majd egy várost!");
	}
}

function blurAnchors(){
  if(document.getElementsByTagName){
    var a = document.getElementsByTagName("a");
    for(var i = 0; i < a.length; i++){
      a[i].onfocus = function(){this.blur()};
    }
  }
}

function initRollover(t){
	for(i=0;i<t.length;i++){
		if(t[i].className.indexOf('btn') != -1) {
			t[i].ext = t[i].src.substring(t[i].src.lastIndexOf('.'));
			t[i].onmouseover = function() {
				this.src="images/"+this.className+"-over"+this.ext;
			};
			t[i].onmouseout = function(){
				this.src="images/"+this.className+"-out"+this.ext;
			};
		}
	}
}

function init(){
	if(!document.getElementById) return;
	var it=document.getElementsByTagName('IMG');
	initRollover(it);
	blurAnchors();
	init_bgimage();
}

function init_bgimage() {
	var pw = (pageWidth()>970 ? pageWidth():970);
	var ph = (pageHeight()>document.getElementById('footer').offsetTop+60 ? pageHeight():document.getElementById('footer').offsetTop+60);
	document.getElementById('footer-background').style.top = ''+(ph-226)+'px';
	document.getElementById('footer-background').style.left = ''+((pw/2)-300)+'px';
	document.getElementById('footer-background').style.width = ''+(285+(pw/2))+'px';
}

if (window.addEventListener) {
	window.addEventListener("load", init, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", init);
} else if (document.getElementById) {
	window.onload=init;
}

window.onresize = function(){
	init_bgimage();
}




function pageWidth() {
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight() {
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

function posLeft() {
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function posTop() {
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

function posRight() {
	return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();
}



