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();
}

if (window.addEventListener) {
	window.addEventListener("load", init, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", init);
} else if (document.getElementById) {
	window.onload=init;
}
