/*
function qshow(id){
	$(document.getElementById(id)).toggle("fast");
}
*/

function is_array(input){
    return typeof(input)=='object'&&(input instanceof Array);
}


function createRequestObject()
{
   var requestObj;
   try
   {
      requestObj = new XMLHttpRequest();
   }
   catch (e)
   {
      try
      {
         requestObj = new ActiveXObject("Msxml2.XMLHTTP");
      }
      catch (e)
      {
         try
         {
            requestObj = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (e)
         {
            return false;
         }
      }
   }
   return requestObj;
}

function make_fields2(arr){
    var i;
    var e;
    var a = [];
    var l;
    var r;
    for(i in arr){
        if(arr[i] instanceof Object){
            l = encodeURIComponent(i);
            r = make_fields(arr[i]);
        }else{
            l = encodeURIComponent(i);
            r = arr[i];
        }
        e = l + '=' + encodeURIComponent(r);
        if(e != '') a[a.length] = e;
    }
    return a.join('&');
}

function make_fields(arr,d){
    var i;
    var e;
    var a = [];
    var l;
    var r;
    if(is_array(arr)){
        for(i in arr){
            if(d === undefined){
                l = encodeURIComponent(arr[i][0]);
                r = arr[i][1];
            }else{
                l = d + '[' + i + ']';
                r = arr[i];
            }
            e = make_right_part(l,r);
            if(e != '') a[a.length] = e;
        }
    }else{
        for(i in arr){
            if(d === undefined){
                l = encodeURIComponent(i);
                r = arr[i];
            }else{
                l = d + '[' + i + ']';
                r = arr[i];
            }
            e = make_right_part(l,r);
            if(e != '') a[a.length] = e;
        }
    }
    return a.join('&');
}

function make_right_part(left_part, right_part){
    if(right_part instanceof Object){
        return make_fields(right_part,left_part);
    }else if(right_part === undefined || right_part === null){
        return '';
    }else{
        return left_part + '=' + encodeURIComponent(right_part);
    }
}

function http_request(target,gets,posts,async,onreadystatechange_events){
    var xmlHttp = createRequestObject();
    var request = "GET";
    var i;
    var body = null;
    if(async == undefined) async = false;
    /*
    var s='';
    for(x in gets){
        s+=x+'='+gets[x]+'\n';
    }
    alert(s);
    */
    var getstr = make_fields(gets);
    if(getstr != '') target += '?' + getstr;
    if(posts !== undefined){
        request = "POST";
        body = make_fields(posts);
    }
    /*
    if(async){
        var par = '';
        for(i = 1; i < next_func.length; ++i){
            par += 'next_func['+i+'],';
        }
        eval('xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4){ last_http_status = xmlHttp.status; next_func[0]('+par+'xmlHttp.responseText); } };');
    }
    */

    if(async){
        if(onreadystatechange_events!=undefined && onreadystatechange_events.length>0){
            var allfuncs = '';
           for(i in onreadystatechange_events){
               while(onreadystatechange_events[i] != onreadystatechange_events[i].replace('#resp#','xmlHttp.responseText')){
                   onreadystatechange_events[i] = onreadystatechange_events[i].replace('#resp#','xmlHttp.responseText')
               }
               allfuncs += ' if(xmlHttp.readyState == ' + i + '){' + onreadystatechange_events[i] + " }\n";
           }

            eval('xmlHttp.onreadystatechange = function(){ ' + allfuncs + ' }');
        }
    }

    xmlHttp.open(request,target,async);
    if(posts != undefined){
        xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    }

    xmlHttp.send(body);
    if(!async){
        //alert(xmlHttp.responseText);
        return xmlHttp.responseText;
    }else{
        return '';
    }
}

function ft_valt(akt){
	if(document.reg_form.aktft.value!=akt){
		valasz=confirm('Elolvasta az ide tartozó információt és biztos benne, hogy '+ akt +' feladásra szerente váltani?');
		if(valasz){
			//alert('igen');
		}else{
			if(akt=='csomagos'){
				document.getElementById('jutalékos').checked='true';
			}else{
				document.getElementById('csomagos').checked='true';
			}
		}
	}
}

function qshow(id){
	if(!$(document.getElementById(id)).is(":hidden")){
		$(document.getElementById(id)).slideUp("fast");
	}else{
		$(document.getElementById(id)).slideDown("fast");
	}
}

function keplesz(i){
	//document.hirdetesfeladas_form.this.value
	//alert(this.value);
	if(this.value!="") document.getElementById('megn'+i).innerHTML="";
}

function elsodleges(){

	for (counter = 0; counter < document.hirdetesfeladas_form.pic.length; counter++)
	{
		if (document.hirdetesfeladas_form.pic[counter].checked){
			document.getElementById("r"+counter).innerHTML="(elsődleges kép)";
		}else{
			document.getElementById("r"+counter).innerHTML="";
		}
	}
}

//capthacucc
function makeRequest2(url) {
var http_request = false;
 if (window.XMLHttpRequest) { // Mozilla, Safari,...
  http_request = new XMLHttpRequest();
  if (http_request.overrideMimeType) {
   http_request.overrideMimeType('text/xml');
     // See note below about this line
  }
 } else if (window.ActiveXObject) { // IE
  try {
   http_request = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
     try {
      http_request = new ActiveXObject("Microsoft.XMLHTTP");
     } catch (e) {}
    }
  }

  if (!http_request) {
   alert('Feladtam :( Nem tudok XMLHTTP példányt létrehozni');
           return false;
  }
   http_request.onreadystatechange = function() { alertContents2(http_request); };
   http_request.open('GET', url, true);
   http_request.send(null);
}

function alertContents2(http_request) {
if (http_request.readyState == 4) {
 if (http_request.status == 200) {
   str=http_request.responseText
   if (str=="1"){
       //ellenor();
	   if(valid_reg()){
		document.reg_form.submit();
	   }
   }else{
       alert ("A beírt kód helytelen!");
   }
                   } else {
   // document.write('Ismeretlen hiba a nyertesek és az állások meghatározásakor!');
   }
}
}

//capthacucc vége

function setselect(value){
e=document.getElementById("o_"+value);
if(e)e.selected=true;
}

function romanize (num) {
	if (!+num)
		return false;
	var	digits = String(+num).split(""),
		key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
		       "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
		       "","I","II","III","IV","V","VI","VII","VIII","IX"],
		roman = "",
		i = 3;
	while (i--)
		roman = (key[+digits.pop() + (i * 10)] || "") + roman;
	return Array(+digits.join("") + 1).join("M") + roman;
}

function joinarea(obj){
    document.hirdetesfeladas_form.varos.value="Budapest "+obj.value+". kerület";
}

function bpset(){
	if(document.hirdetesfeladas_form.megye.value=="Budapest"){
        var options = '';
        var roman;
        for(var i=1;i<24;i++){
            roman = romanize(i);
            options+='<option value="'+roman+'">'+roman+'</option>';
        }
        $('#varos_div').html(' <input class="regi" type="hidden" name="varos" value="Budapest I. kerület" />Budapest <select id="kerulet" class="input_select" style="height:21px; margin:2px 0px; background:white; color:black;" onchange="joinarea(this);">'+options+'</select>. kerület');
		document.hirdetesfeladas_form.varos.value="Budapest I. kerület";
        //$(document.hirdetesfeladas_form.varos).css('display','none');
        
	}else{
		$('#varos_div').html(' <input class="regi" type="text" name="varos" value="" />');
	}
}

function ax_alcats()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  
  
  xmlHttp.onreadystatechange=function()
    {
	
	if(xmlHttp.readyState==1){
	  //document.kep.style.display="inline";
	  //document.kep.src="1-0.gif";
	  //document.myForm.time.value='Loading...';
	  	//document.getElementById("tdmsg").innerHTML="loading";
	}
	
    if(xmlHttp.readyState==4)
      {
		if(xmlHttp.responseText!=""){
			//document.getElementById('jcats').innerHTML=xmlHttp.responseText;
			spl=xmlHttp.responseText.split("&#37;");
			document.getElementById('jcats_label').innerHTML="Alkategória1:<br/>";
			code="<select style=\"width:200px; background:white; color:black\" name=\"alcat1\" onchange=\"ax_alcats2()\"><option value=\"-1\">Választhat!</option>";
			for(i = 0; i < spl.length; i++){
				spl2=spl[i].split("&#35;");
					code+="<option value=\""+spl2[0]+"\">"+spl2[1]+"</option>";
			}
			code+="</select>";
			document.getElementById('jcats').style.display="inline";
			document.getElementById('jcats_label').style.display="inline";
			document.getElementById('jcats').innerHTML=code;
		}else{
			document.getElementById('jcats').style.display="none";
			document.getElementById('jcats_label').style.display="none";
			document.getElementById('jcats2').style.display="none";
			document.getElementById('jcats2_label').style.display="none";
			
			document.getElementById('jcats_label').innerHTML="";
			document.getElementById('jcats2_label').innerHTML="";
			document.getElementById('jcats').innerHTML="";
			document.getElementById('jcats2').innerHTML="";
		}
      }
    }
  xmlHttp.open("GET","ax/alcats.php?id="+document.hirdetesfeladas_form.fokategoria.value,true);
  xmlHttp.send(null);
  }

function ax_alcats2()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  
  
  xmlHttp.onreadystatechange=function()
    {
	
	if(xmlHttp.readyState==1){
	  //document.kep.style.display="inline";
	  //document.kep.src="1-0.gif";
	  //document.myForm.time.value='Loading...';
	  	//document.getElementById("tdmsg").innerHTML="loading";
	}
	
    if(xmlHttp.readyState==4)
      {
		if(xmlHttp.responseText!=""){
			//document.getElementById('jcats').innerHTML=xmlHttp.responseText;
			spl=xmlHttp.responseText.split("&#37;");
			document.getElementById('jcats2_label').innerHTML="<br/>Alkategória2:<br/>";
			code="<select style=\"width:200px; background:white; color:black\" name=\"alcat2\"><option value=\"-1\">Választhat!</option>";
			for(i = 0; i < spl.length; i++){
				spl2=spl[i].split("&#35;");
					code+="<option value=\""+spl2[0]+"\">"+spl2[1]+"</option>";
			}
			code+="</select>";
			document.getElementById('jcats2').style.display="inline";
			document.getElementById('jcats2_label').style.display="inline";
			document.getElementById('jcats2').innerHTML=code;
		}else{
			document.getElementById('jcats2').style.display="none";
			document.getElementById('jcats2_label').style.display="none";
			
			document.getElementById('jcats2_label').innerHTML="";
			document.getElementById('jcats2').innerHTML="";
		}
      }
    }
  xmlHttp.open("GET","ax/alcats.php?id="+document.hirdetesfeladas_form.alcat1.value,true);
  xmlHttp.send(null);
  }
  
 
function valid_hird(){
	ok=true;
	if(document.hirdetesfeladas_form.focim.value==""){
		alert("Nem töltötte ki a főcím mezőt!");
		ok=false;
	}
	
	if(document.hirdetesfeladas_form.fokategoria.value=="-1"){
		alert("Kérjük válasszon kategóriát!");
		ok=false;
	}
	
	if(document.hirdetesfeladas_form.megye.value==""){
		alert("Nem választott megyét!");
		ok=false;
	}
	
	if(document.hirdetesfeladas_form.varos.value==""){
		alert("Nem töltötte ki a Város/község mezőt!");
		ok=false;
	}
	
	if(!IsNumber(document.hirdetesfeladas_form.min_periodus.value)){
		alert("Kérjük az időegység mezőbe csak számjegyeket írjon!");
		ok=false;
	}
	
	if(!IsNumber(document.hirdetesfeladas_form.db.value)){
		alert("Kérjük az darabszám mezőbe csak számjegyeket írjon!");
		ok=false;
	}
	
	if(IsNumber(document.hirdetesfeladas_form.db.value) && (document.hirdetesfeladas_form.db.value=='' || document.hirdetesfeladas_form.db.value<=0)){
		alert("Kérjük nullánál nagyobb darabszámot adjon meg!");
		ok=false;
	}
	
	if(!IsNumber(document.hirdetesfeladas_form.berletidij.value)){
		alert("Kérjük a bérletidíj mezőbe csak számjegyeket írjon!");
		ok=false;
	}
	

	if(document.hirdetesfeladas_form.userftype.value='jutalékos' && (document.hirdetesfeladas_form.berletidij.value=='' || document.hirdetesfeladas_form.berletidij.value=='0')){
		alert("Jutalékos feladás esetén a bérleti díj mező kitöltése kötelező!");
		ok=false;
	}
		
	//ha minden ok

	if(ok){
		document.hirdetesfeladas_form.elkuld_btn.style.display="none";
		document.getElementById("feltoltes").style.visibility="visible";
		//document.getElementById('gombcella').innerHTML='<img src="img/loading.gif" /> <b>Feltöltés</b>';
	}
	
	return ok;
}


/*
function csomagv_start(){
	alert("fut:"+document.csomagvasarlas.pipa.length);
	
	for (i=0; i<document.csomagvasarlas.pipa.length; i++){
		if (document.csomagvasarlas.pipa[][i].checked){
			return true;
		}	
	}
	alert("Nincs kiválasztott csomag!");
	return false;
}
*/

function csform(){
	ok=true;
	if(document.csomagvasarlas.sz_nev.value==""){
		alert("Nem töltötte ki a Számlázási név mezőt!");
		ok=false;
	}
	
	if(document.csomagvasarlas.sz_cim.value==""){
		alert("Nem töltötte ki a Számlázási cím mezőt!");
		ok=false;
	}
	
	return ok;
}

function isksend(){
	ok=true;
	
	if(document.kform.nev.value==""){
		alert("Nem adott meg nevet!");
		ok=false;
	}
	
	if(document.kform.mail.value==""){
		alert("Nem adott meg e-mail címet!");
		ok=false;
	}
	
	if(document.kform.message.value==""){
		alert("Nem írt semmit!");
		ok=false;
	}
	
	if(document.kform.mail.value!=""){
		if(!emailCheck(document.kform.mail.value)){
			alert("Kérjük ellenőrizze az e-mail címet!");
			ok=false;
		}
	}
	
	return ok;
}

function valid_reg(milyen){
	ok=true;

	if(!emailCheck(document.reg_form.mail.value)){
		alert("Kérjük ellenőrizze az e-mail címet!");
		ok=false;
	}
	
	if(document.reg_form.mail2 && document.reg_form.mail.value!=document.reg_form.mail2.value){
		alert("A két e-mail cím nem egyezik!");
		ok=false;
	}
	
	if(document.reg_form.action.value!="edit"){
		if(document.reg_form.pass1.value != document.reg_form.pass2.value){
			if(document.reg_form.pass1.value==""){
				//alert("Nem adott meg jelszót!");
			}else{
				alert("A két jelszó nem egyezik!");
			}
			ok=false;
		}
	}else{ 
		if(document.reg_form.old_pass.value!=""){
			if(document.reg_form.pass1.value != document.reg_form.pass2.value || (document.reg_form.pass1.value=="")){
				if(document.reg_form.pass1.value==""){
					//alert("Nem adott meg jelszót!");
                    //ok=false;
				}else{
					alert("A két jelszó nem egyezik!");
                    ok=false;
				}
			}
		}
	}

    //$_POST['vezetekzenv']=='' || $_POST['keresztnev']=='' || $_POST['tel']=='' || $_POST['sz_nev']=='' || $_POST['sz_cim']==''
    var must_fill = '';
    if(document.reg_form.vezeteknev.value==""){
        must_fill += 'A vezetéknév megadása kötelező!\n';
        ok=false;
    }

    if(document.reg_form.keresztnev.value==""){
        must_fill += 'A keresztnév megadása kötelező\n';
        ok=false;
    }

    if(document.reg_form.tel.value==""){
        must_fill += 'Telefonszám megadása kötelező!\n';
        ok=false;
    }

    if(document.reg_form.sz_nev.value==""){
        must_fill += 'A számlázási név megadása kötelező!\n';
        ok=false;
    }

    if(document.reg_form.sz_cim.value==""){
        must_fill += 'A számlázási cím megadása kötelező!\n';
        ok=false;
    }

    if(must_fill!=''){
        alert(must_fill);
    }

	if(document.reg_form.action.value!="edit" && document.reg_form.action.value!="admin_edit" && document.reg_form.action.value!="admin_create" && !document.reg_form.regfelt.checked){
		alert('A továbblépéshez fogadja el a regisztrációs feltételeket!');
		ok=false;
	}
	
	if(document.getElementById("tdmsg").innerHTML!=""){
			alert("Ez az e-mail cím már regisztrálva van!");
			ok=false;
	}
/*
	if(!ax_freemail()){
		alert("Ez az e-mail cím már regisztrálva van!");
		ok=false;
	}
*/
	return ok;
}

function valid_reg2(){
	ok=true;

	if(!emailCheck(document.reg_form.mail.value)){
		alert("Kérjük ellenőrizze az e-mail címet!");
		ok=false;
	}
	
	if(document.reg_form.mail.value!=document.reg_form.mail2.value){
		alert("A két e-mail cím nem egyezik!");
		ok=false;
	}
	
	if(document.reg_form.pass1.value != document.reg_form.pass2.value || document.reg_form.pass1.value==""){
		if(document.reg_form.pass1.value==""){
			alert("Nem adott meg jelszót!");
		}else{
			alert("A két jelszó nem egyezik!");
		}
		ok=false;
	}
	
	if(document.getElementById("tdmsg").innerHTML!=""){
			alert("Ez az e-mail cím már regisztrálva van!");
			ok=false;
	}
	
	if(document.reg_form.action.value!="edit" && document.reg_form.action.value!="admin_edit" && document.reg_form.action.value!="admin_create" && !document.reg_form.regfelt.checked){
		alert('A továbblépéshez fogadja el a regisztrációs feltételeket!');
		ok=false;
	}
	
/*
	if(!ax_freemail()){
		alert("Ez az e-mail cím már regisztrálva van!");
		ok=false;
	}
*/	
	return ok;
}

function freemailc(){
	if(document.reg_form.action.value!="edit" && document.reg_form.action.value!="admin_edit"){
		ax_freemail();
	}
}

function emailCheck (emailStr) {
	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */

	var checkTLD=1;

	/* The following is the list of known TLDs that an e-mail address must
	end with. */

	var
	knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */

	var emailPat=/^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address.
	These characters include ( ) < > @ , ; : \ " . [ ] */

	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a
	username or domainname.  It really states which chars aren't allowed.*/

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of
	non-special characters.) */

	var atom=validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */

	var word="(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	/* Finally, let's start trying to figure out if the supplied address is
	valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {

	/* Too many/few @'s or something; basically, this address doesn't
	even fit the general mould of a valid e-mail address. */

	//alert("Helytelen email cím! (valaki@valahol.hu)");
	return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings(0-127).

	for (i=0; i<user.length; i++) {
	if (user.charCodeAt(i)>127) {
	//alert("Helytelen karakter az email címben!");
	return false;
	}
	}
	for (i=0; i<domain.length; i++) {
	if (domain.charCodeAt(i)>127) {
	//alert("Helytelen karakter az email címben!");
	return false;
	}
	}

	// See if "user" is valid

	if (user.match(userPat)==null) {

	// user is not valid

	//alert("Helytelen karakter az email címben!");
	return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {

	// this is an IP address

	for (var i=1;i<=4;i++) {
	if (IPArray[i]>255) {
	//alert("Helytelen email cím!");
	return false;
	}
	}
	return true;
	}

	// Domain is symbolic name.  Check if it's valid.

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	//alert("Helytelen karakter az email címben!");
	return false;
	}
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding
	the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 &&
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	//alert("Az email cím vége egy valós országkód kell legyen! (pl: .hu ,.com)");
	return false;
	}

	// Make sure there's a host name preceding the domain.

	if (len<2) {
	//alert("Helytelen email cím!");
	return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function ax_freemail()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  
  
  xmlHttp.onreadystatechange=function()
    {
	
	if(xmlHttp.readyState==1){
	  //document.kep.style.display="inline";
	  //document.kep.src="1-0.gif";
	  //document.myForm.time.value='Loading...';
	  	//document.getElementById("tdmsg").innerHTML="loading";
	}
	
    if(xmlHttp.readyState==4)
      {
	  //document.kep.style.display="none";
	  //document.kep.src="";
      //alert(xmlHttp.responseText);
		if(xmlHttp.responseText=="ok"){
				document.getElementById("tdmsg").innerHTML="";
				//document.reg_form.btn.value="regisztráció";
				//document.reg_form.btn.style.background="red";
				//alert("ok");
				//return true;
		}else{
			//alert("nem ok");
			//return false;
			document.getElementById("tdmsg").innerHTML="e-mail cím foglalt!";
				//document.reg_form.btn.style.background="";
				//document.reg_form.btn.value="e-mail foglalt!!";
		}
      }
    }
  xmlHttp.open("GET","ax/mailcheck.php?mail="+document.reg_form.mail.value,true);
  xmlHttp.send(null);
  }
  
  function IsNumber(sText)

{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

   
   function vdate(d1,d2){
	if(d1<=d2){
		return true;
	}else{
		alert('Ellenőrizze a dátumokat!');
		return false;
	}
   }
