
function fnValidateOrganiserLogin()
{
  if (document.getElementById('organiserICO').value.length!=8) {
		window.alert('IČO musí mít 8 znaků!');
		return false; 
	}		

	if (document.getElementById('organiserPassword').value.length<3) {
		window.alert('Přístupové heslo musí mít alespoň 3 znaky!');
		return false; 
	}		

  return postOrganiserLoginForm();
}	



function postOrganiserLoginForm(){

  var poststr="";
  var ajax = new HTTPRequest;

  poststr = "ico=" + document.getElementById("organiserICO").value.replace(/\x20/g, "%20");
  poststr = poststr + "&password=" + document.getElementById("organiserPassword").value.replace(/\x20/g, "%20"); 
  document.getElementById("organiserICO").value = '';
  document.getElementById("organiserPassword").value = '';

  //document.getElementById('mailingSubscribeForm').style.display='block';
  //document.getElementById('mailingSubscribeForm').innerHTML = "Čekejte prosím, probíhá přihlašování";
  //document.getElementById('eventMailingSubscribe').style.display='none';
  ajax.post('organisers/Login.asp',poststr,postOrganiserLoginFormResult,true);

  return false;
}

function postOrganiserLoginFormResult(r){
  if(r.readyState==4){
    cPostMailingResult =  r.responseText;
    if (cPostMailingResult.substr(0,2)=="in") {
      document.getElementById('organiserLogin').style.display='none';
      document.getElementById('organiserLoginMenu').style.display = 'block';
      window.location="eventsAdmin.asp";
    }
    else {
      document.getElementById('organiserLoginResult').innerHTML  = "chyba přihlášení - kód: " + cPostMailingResult;
      document.getElementById('organiserLoginResult').style.display = "block;"
    }
    return false;
  }
}
  
