/*function submitToLinks(){
  if(!document.getElementById || !document.createTextNode){return;}
  var inputs,i,newLink,newText;
  inputs=document.getElementsByTagName('input');
  for (i=0;i<inputs.length;i++){
    if(inputs[i].getAttribute('type').toLowerCase()!='submit'){continue;i++}	
	newLink=document.createElement('a');
	newText=document.createTextNode(inputs[i].getAttribute('value'));
	newLink.appendChild(newText);
	newLink.setAttribute('href','javascript:document.forms[0].submit()');
	inputs[i].parentNode.replaceChild(newLink,inputs[i]);
  }
}

function resetToLinks(){
  if(!document.getElementById || !document.createTextNode){return;}
  var inputs,i,newLink,newText;
  inputs=document.getElementsByTagName('input');
  for (i=0;i<inputs.length;i++){
    if(inputs[i].getAttribute('type').toLowerCase()!='reset'){continue;i++}	
	newLink=document.createElement('a');
	newText=document.createTextNode(inputs[i].getAttribute('value'));
	newLink.appendChild(newText);
	newLink.setAttribute('href','javascript:document.forms[0].reset()');
	inputs[i].parentNode.replaceChild(newLink,inputs[i]);
  }
}*/

/*function buttonsToLinks()
{
	submitToLinks();
	resetToLinks();
}*/

function Logout()
{
	window.location = "index.php?reason=logout";	
}

//window.onload=buttonsToLinks;

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function validateForm()
{
	var title = document.getElementById("title");
	var content = document.getElementById("content");
	var returnValue = true;
	var error = "A k&ouml;vetkezo mezo(k) kit&ouml;lt&eacute;se k&ouml;tekezo: ";
	
	if (title.value.length == 0)
	{
		error += "c&iacute;m, ";
		returnValue = false;
	}
	alert(title.value.length);
	
	if (content.value.length == 0)
	{
		error += " tartalom";
		returnValue = false;
	}
	
	error += " !";
	
	if (returnValue)
	{
		return returnValue;	
	}
	else
	{
		alert(error);
		return false;
	}
}

function ComparePasswords(name, rename)
{
	var password = document.getElementsByName(name);
	var repassword = document.getElementsByName(rename);

	if (password.value == repassword.value)
	{
		var valid = document.getElementById(rename + "V");
		valid.style.color = "#339900";
	}
	else
	{
		var valid = document.getElementById(rename + "V");
		valid.style.color = "#FF0000";
	}
}

function Validate(name)
{
	var element = document.getElementsByName(name);
	if (element.value != "" )
	{
		var valid = document.getElementById(name + "V");
		valid.style.color = "#339900";
	}
	else
	{
		var valid = document.getElementById(name + "V");
		valid.style.color = "#FF0000";
	}
}

function Submit&Uacute;ser()
{
	var username = document.getElementsByName('username');
	var password = document.getElementsByName('password');
	var repassword = document.getElementsByName('repassword');
			var passwordV = document.getElementsById('passValidate');
		var repasswordV = document.getElementsById('repassValidate');







	
	
	
	var isValid = true;

	if (password.value == "" || password.value == null  || username.value == "" || username.value == null)
	{
		passwordV.style.display = 'block';
		isValid = false;	
	}
	if (password.value != repassword.value)
	{
		repasswordV.style.display = 'block';
		isValid = false;	
	}
	
	if (isValid)
	{
		alert("&Ouml;r&#252;l&#252;nk!!!");	
	}
}

function Validate&Uacute;ser()
{
	var isValid = true;
	
	if (document.getElementsByName('username').value == "" || document.getElementsByName('username').value == null  || document.getElementsByName('password').value == ""  || document.getElementsByName('password').value == null  )
	{
		var username = document.getElementById("passValidate");
		username.style.display = 'block';
		//isValid = false; 
	}
	else
	{
		var username = document.getElementById("passValidate");
		username.style.display = 'hidden';
	}
}

function SetTextboxValue(text, id)
{
		var textbox = document.getElementById('title');
		var hidden = document.getElementById('hiddenid');
		
		textbox.value = text;
		hidden.value = id;
}




