﻿function check_login_username()
{
	var text=document.loginbox.username.value;
	if (text =="")
	{
		alert("Nem adtál meg felhasználó nevet a bejelentkezéshez!");
		document.loginbox.username.focus();
		return false;
	}
	if (document.loginbox.sender_name.value.length<3)
	{
		alert('A felhasználó neve minimum 3 karakter kell legyen a bejelentkezéskor!');
		document.loginbox.username.focus();
		document.loginbox.username.select();
		return false;
	}
	var ervenyes="0123456789öüőűqwertzuiopóúasdfghjkléáíyxcvbnmÖÜÓŰQWERTZUIOPŐÚASDFGHJKLÉÁÍYXCVBNM-._";
	for (var i=0;i<text.length;i++)
	{
		if (ervenyes.indexOf(text.charAt(i)) == -1)
		{
			alert('Érvénytelen karakterek a felhasználó névben a bejelentkezéskor!');
			document.loginbox.username.focus();
			document.loginbox.username.select();
			return false;
		}
	}
	return true;
}

function check_login_password()
{
	var text=document.loginbox.password.value;
	if (text =="")
	{
		alert("Nem adtál meg jelszót a bejelentkezéshez!");
		document.loginbox.password.focus();
		return false;
	}
	if (document.loginbox.password.value.length<3)
	{
		alert('A jelszavadnak hossza minimum 3 karakter kell legyen a bejelentkezéskor!');
		document.loginbox.password.focus();
		document.loginbox.password.select();
		return false;
	}
	return true;
}

function check_loginbox_form()
{
	return check_login_username() && check_login_password();
}

function helpbox (url,nev)
{
	window.open(url,nev,'toolbar=no,location=no,directories=no,status=no,menubar=no,resizeble=no,scrollbar=no,caption=no,width=320,height=150,dialog=yes,minimizable=no,close=no,dependent=yes');
}

function notlogin()
{
	alert('Csak bejelentkezett felhasználóknak!');
	return false;
}

function nomodule()
{
	alert('A szolgáltatás hamarosan elérhető lesz!');
	return false;
}

function show_menu_box( x )
{
	document.getElementById("menubox1").style.display = "none";
	document.getElementById("menubox2").style.display = "none";
	document.getElementById("menubox3").style.display = "none";
	document.getElementById("menubox4").style.display = "none";
	document.getElementById("menubox5").style.display = "none";
	document.getElementById("menubox6").style.display = "none";
	if ( x>0 ) document.getElementById("menubox"+x).style.display = "block";
	return true;
}

function share_facebook()
{
	u=location.href;
	t=document.title;
	pagelink = 'http://www.facebook.com/share.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t)
	sharename = 'facebookshare';
	window.open(pagelink,sharename,'toolbar=0,status=0,location=1, width=800,height=500,scrollbars=1');
	return false;
}
function share_twitter()
{
	u=location.href;
	t=document.title;
	pagelink = 'http://www.twitter.com/home/?status='+encodeURIComponent(u)+'+'+encodeURIComponent(t)
	sharename = 'twittershare';
	window.open(pagelink,sharename,'toolbar=0,status=0,location=1, width=800,height=500,scrollbars=1');
	return false;
}

function share_iwiw()
{
	u=location.href;
	t=document.title;
	pagelink = 'http://iwiw.hu/pages/share/share.jsp?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t)
	sharename = 'iwiwshare';
	window.open(pagelink,sharename,'toolbar=0,status=0,location=1, width=800,height=500,scrollbars=1');
	return false;
}
