// IE oprava menu 
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;


//LOGIN

function loginpro(success) {
	if(success) {
		Element.update('loginform','You are now logged in. Please wait.');
		window.location.href = 'index.php';
	} else {
	  Element.update('warning','Invalid login or password!');
	  Effect.Appear('warning');
		 Effect.BlindUp('warning', { delay:6 } );
		 new Effect.Shake('loginform');
		 Element.update('submitb','<input type=\"submit\" class=\"tba\" value=\"login\" />');
	}

}
 

function loginf(thisf) {

	logn = thisf.login.value;
	logp = thisf.pwd.value;

	//alert(logn+" "+logp);
	
	Element.update('submitb','One moment please...');
	
	var opt = {
		// Use POST
		method: 'post',
		postBody: 'login='+logn+'&pwd='+logp,

		onSuccess: function(t) {
			//alert(t.responseText);
			if(t.responseText==1) {
					loginpro(true);
   } else {
   		alert(t.responseText);
	   	loginpro(false);
			}
		},
		// Handle 404
		on404: function(t) {
			alert('Error 404: location "' + t.statusText + '" was not found.\n\nLogin not possible. Please contact the website administrator.');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText+'\n\nLogin not possible. Please contact the website administrator.');
		}
	}
	
	new Ajax.Request('index.php?do=login', opt);
	return false;
  
}