/* lang choose */
chLang = function(lang) {
	
	new Ajax.Request(base_url + "/public_main.php", {
		method: 'get',
		parameters: {lang: lang, ajax_stop: "1"},
		onComplete: function(){ document.location.reload(); }
	});
}

/* selection add/remove */
selection_do = function(act,id) {
	
	new Ajax.Request(base_url + "/public_main.php", {
		method: 'get',
		parameters: {
			selection_ajax: 1,
			action: act,
			modell_id: id },
		onComplete: function() {
			//document.location.reload();
		},
		onSuccess : function(tr) {
			var resp = tr.responseText || "Nincs válasz! / No response!";
			
			if(resp == "1")
				document.location.reload();
			else if(resp == "2")
				alert("Megtelt a lista! / The list is full!");
			else
				alert("Hiba!");
		}
	});
}

/* select height */
styleSelect_itemHeight = 13;


/* Valtokep * /
var Valtokep = Class.create();

Valtokep.prototype = {
  initialize: function(arr,tag,src,cht) {
    this.src = src;
	this.img = arr;
	this.tag = tag;
	this.cht = cht*1000;
	this.pnt = 0;
  },
  start: function() {
	var t = this;
	t.chImg();
	window.setTimeout(function(){t.start();}, this.cht);
  },
  chImg: function() {
  	if(this.img.length <= this.pnt)
		this.pnt = 0;
	
	$(this.tag).src = this.src + '/' + this.img[this.pnt++];
  }
};
/* /Valtokep */

/* main menu func * /
menu_over = function(o) {
	
	var tags = o.getElementsByTagName("img"); 
	
	tags[0].src = tags[0].src.replace(/1.jpg/, "2.jpg");
}

menu_out = function(o) {
	
	var tags = o.getElementsByTagName("img");
	
	tags[0].src = tags[0].src.replace(/2.jpg/, "1.jpg");
}

menu_click = function(o) {
	
	var menutags = $("menu").getElementsByTagName("img");
	
	for(var i = 0; i < menutags.length; i += 2) {
		
		menutags[i].src = menutags[i].src.replace(/3.jpg/, "1.jpg");
		menutags[i+1].src = menutags[i+1].src.replace(/_1.jpg/, ".jpg");
	}
	
	
	var tags = o.getElementsByTagName("img");
	
	tags[0].src = tags[0].src.replace(/2.jpg/, "3.jpg");
	tags[1].src = tags[1].src.replace(/.jpg/, "_1.jpg");
}
/* /main menu func */

/*
loadPage = function(url) {
	
	parent.setLoading(true);
	
	setTimeout('document.location.href = base_url + "/" + "'+ url +'";', 300);
	//document.location.href = base_url + "/" + url;
	
	return false;
}*/

