	var val1 = "";
	var val2 = "";
	
	var karpatok = new Array('129', '128', '134', '88');
    var kapcsolo = 0;
	
	function in_array(the_needle, the_haystack)
	{
        var the_hay = the_haystack.toString();
        if(the_hay == ''){
            return false;
        }
        var the_pattern = new RegExp(the_needle, 'g');
        var matched = the_pattern.test(the_haystack);
        return matched;
	}
	
	function GetIrsz(irsz) 
	{
		//location.href="/bir/loadirsz.php?irsz=2541";
		if(document.getElementById('country_code').value == 90)
		{
			AjaxRequest.get(
			  {
			  	'url':'/bir/loadirsz.php'
			    ,'parameters':{ 'irsz':irsz }
			    ,'onSuccess':function(req) { document.getElementById('varos').value = req.responseText; }
			  }
			);
		}
	}
	
	function GetIrsz1(irsz) 
	{
		var form = document.forms['upload.offer'];
		AjaxRequest.get(
		  {
		  	'url':'/bir/loadirsz.php'
		    ,'parameters':{ 'irsz':irsz }
		    ,'onSuccess':function(req) { 
		    	form.mvaros.value = req.responseText;
		    }
		  }
		);
	}
	function GetIrsz2(irsz) 
	{
		var form = document.forms['upload.offer'];
		AjaxRequest.get(
		  {
		  	'url':'/bir/loadirsz.php'
		    ,'parameters':{ 'irsz':irsz }
		    ,'onSuccess':function(req) { 
		    	form.hvaros.value = req.responseText;
		    }
		  }
		);
	}
	
	function CheckLogin() 
	{
		var form = document.forms['ugyfellogin'];
		var name = form.username.value;
		var pass = form.password.value;
		AjaxRequest.get(
		  {
		  	'url':'/bir/loginCheck.php'
		    ,'parameters':{ 'name':name, 'pass':pass }
		    ,'onSuccess':function(req) { 
		    	alert( req.responseText );
		    }
		  }
		);
	}
	
	function SearchCode(exclude)
	{
		var value = document.getElementById('searchcode').value;
		AjaxRequest.get(
		  {
		  	'url':'/bir/searchcode.php'
		    ,'parameters':{ 'searchcode':value, 'exclude':exclude }
		    ,'onSuccess':function(req) { 
		    	eval( req.responseText );
		    }
		  }
		);
	}
	
	function SearchName(exclude)
	{
		var value = document.getElementById('searchname').value;
		AjaxRequest.get(
		  {
		  	'url':'/bir/searchname.php'
		    ,'parameters':{ 'searchname':value, 'exclude':exclude }
		    ,'onSuccess':function(req) { 
		    	eval( req.responseText );
		    }
		  }
		);
	}
	
	function addAmounts()
	{
		var form = document.forms["upload.offer"];
		val1 = form.amounti.value;
		val2 = form.amounts.value;
		form.amount.value = val1 - val2;
		/*var MIN = innoMin;
		var MAX = innoMax;
		var szamolj = false;
		if(in_array(form.innocountry.value, karpatok))
		{
			MIN = innoMinK;
			MAX = innoMaxK;
		}
		val1 = form.amounti.value;
		val2 = form.amount2.value;*/
		/*if(MAX == 0)
		{
			if(val1 >= MIN) szamolj = true;
		}
		else
		{
			if((val1 >= MIN) && (val1 <= MAX)) szamolj = true;
		}
		if(szamolj) form.amounts.value = Math.round(val1 * 49 / 100);
			else form.amounts.value = 0;*/
	}
	
	function isNumberKey(evt)
    {
		var charCode = (evt.which) ? evt.which : event.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57))
			return false;

		return true;

    }
	function showig(mi)
	{
		if(mi == 1) document.getElementById("igenyel_id").style.visibility = "visible";
			else document.getElementById("igenyel_id").style.visibility = "hidden";
	}
	
	function showhatarontul(value)
	{
		var state = "block";
		var state2 = "none";
		if(value == 90)
		{
			state = "none";
			state2 = "block";
		}
		document.getElementById('hatarontul').style.display = state;
		document.getElementById('magyarvalaszto').style.display = state;
		if(state == "block") showig(1);
			else showig(0);
		document.getElementById('magyarpartner').style.display = state2;
	}
	
	function showHideAct(value)
	{
		if(value)
		{
			document.getElementById('act_code').value = 0;
			document.getElementById('act_code').disabled = true;
            kapcsolo = 1;
            document.getElementById('kapcsolo').value = 1;
		}
		else
		{
			document.getElementById('act_code').disabled = false;
            kapcsolo = 0;
            document.getElementById('kapcsolo').value = 0;
		}
	}