// main script document for Belfirin

function showmenu (idcko)
{

character=document.getElementById("character1").style;
belfirin=document.getElementById("belfirin1").style;
witchwood=document.getElementById("witchwood1").style;
ministry=document.getElementById("ministry1").style;
secretary=document.getElementById("secretary1").style;

if(idcko != "character1")
{
if(character.display == "block") 
{
character.display = "none";
}
}

if(idcko != "belfirin1")
{
if(belfirin.display == "block") 
{
belfirin.display = "none";
}
}

if(idcko != "witchwood1")
{
if(witchwood.display == "block") 
{
witchwood.display = "none";
}
}

if(idcko != "ministry1")
{
if(ministry.display == "block") 
{
ministry.display = "none";
}
}

if(idcko != "secretary1")
{
if(secretary.display == "block") 
{
secretary.display = "none";
}
}


menu=document.getElementById(idcko).style;
menu.display=(menu.display == "block")?"none":"block";

}

function login()
{
logform=document.getElementById('logform1').style;
logform.display='block';
main=document.getElementById('main1').style;
main.display='none';
regform=document.getElementById('regform1').style;
regform.display='none';
}

function closelogin()
{
logform=document.getElementById('logform1').style;
logform.display='none';
main=document.getElementById('main1').style;
main.display='block';
document.loginform.nick.value='';
document.loginform.pass.value='';
}

function registration()
{
regform=document.getElementById('regform1').style;
regform.display='block';
main=document.getElementById('main1').style;
main.display='none';
logform=document.getElementById('logform1').style;
logform.display='none';
}

function closeregistration()
{
regform=document.getElementById('regform1').style;
regform.display='none';
main=document.getElementById('main1').style;
main.display='block';
document.registrationform.regnick.value='';
document.registrationform.regpass.value='';
document.registrationform.regcheck.value='';
document.registrationform.regname.value='';
}

function checkregistration()
{
if (document.registrationform.regnick.value.length<6)
{
alert('Nick musí mať minimálne šesť znakov!');
return false;
}

if (document.registrationform.regpass.value.length<6)
{
alert('Heslo musí mať minimálne šesť znakov!');
return false;
}

if (document.registrationform.regemail.value=='')
{
alert('Nevyplnili ste email!');
return false;
}

if (document.registrationform.regwhy.value=='')
{
alert('Nevyplnili ste dôvod registrácie!');
return false;
}

if (document.registrationform.regword.value=='')
{
alert('Nevyplnili ste otázku!');
return false;
}

if (document.registrationform.regcharacter.value=='')
{
alert('Nevyplnili ste dôvod opis postavy!');
return false;
}

if (document.registrationform.regpass.value!==document.registrationform.regcheck.value)
{
alert('Heslo sa nezhoduje!');
return false;
}

}

function showhide(idcko)
{
object=document.getElementById(idcko).style;
object.display=(object.display == "block")?"none":"block";
}

function showelement(idcko) {
object=document.getElementById(idcko).style;
object.display='block';
}

function checkchange()
{
if (document.passchange.newpass.value!==document.passchange.checknew.value)
{
alert ('Heslo sa nezhoduje!');
return false;
}
if (document.passchange.newpass.value=='')
{
alert ('Nevyplnili ste položku formulára!')
return false;
}
if (document.passchange.checknew.value=='')
{
alert ('Nevyplnili ste položku formulára!')
return false;
}
if (document.passchange.oldpass.value=='')
{
alert ('Nevyplnili ste položku formulára!')
return false;
}
}

function deletecheck()
{

go = confirm('Naozaj chcete zmazať dotyčného žiaka? Po zmazaní už nie je cesty späť!');

if(go) return true;
if(!go) return false;

}

function addannoucheck()
{
if (document.addannouncement.announame.value=='')
{
alert ('Nevyplnili ste názov oznamu!')
return false;
}
if (document.addannouncement.announame.value>50)
{
alert ('Názov oznamu nesmie mať viac ako 50 znakov!')
return false;
}
if (document.addannouncement.annoutext.value=='')
{
alert ('Nevyplnili ste text oznamu!')
return false;
}

}

function dis_smile(smile)

{

document.clubform.post.value = document.clubform.post.value + '(' + smile + ')';

}

function dis_add(what)

{

document.clubform.post.value = document.clubform.post.value + what;

}

function profile_add(what)

{

document.profilechange.profile.value = document.profilechange.profile.value + what;

}


function post_reply(id)
{

inbox = document.getElementById('rec1').style;
inbox.display = 'none';

newpost = document.getElementById('new1').style;
newpost.display = 'block';

document.postform.toid.value = id;

}

function chat_color(color)
{

form = document.getElementById(1).style;
form.color = color;

document.sendform.color.value = color;


}
function chat_bold(hodnota)
{
form = document.getElementById(1).style;
form.fontWeight = hodnota;
document.sendform.fontWeight.value = hodnota;
}
function chat_italic(hodnota)
{
form = document.getElementById(1).style;
form.fontStyle = hodnota;
document.sendform.fontStyle.value = hodnota;
}
function chat_underline(hodnota)
{
form = document.getElementById(1).style;
form.textDecoration = hodnota;
document.sendform.textDecoration.value = hodnota;
}
function chat_normal(hodnota)
{
form = document.getElementById(1).style;
form.fontWeight = hodnota;
form.fontStyle = hodnota;
form.textDecoration = "none";

document.sendform.fontWeight.value = hodnota;
document.sendform.fontStyle.value = hodnota;
document.sendform.textDecoration.value = "none";
}
function history_chat(chat)
{

window.open('./history.php?chat=' + chat, 'História', 'width=600,height=600');

}

function showuser(name, style)
{
window.open('./showuser.php?name=' + name + '&style=' + style, 'Profil', 'width=300,height=400');

}

function new_rp(id)
{

window.open('./rp.php?msg=' + id, 'RP' + id, 'width=300,height=400');
}
function new_kuzlo(chat)
{

window.open('./kuzla.php?chat=' + chat, 'KUZLA', 'width=300,height=400,scrollbars=1');
}

function open_duel(id, chat)
{

window.open('./duelant/backend.php?duel=' + id + '&chat=' + chat, 'duel' + id, 'width=300,height=400');
}

function write_rp(name)
{
window.open('./rp.php?to=' + name, 'RP', 'width=300,height=400');
}

function addthing(thing)
{

document.sendform.add_text.value = document.sendform.add_text.value + thing;

}

function houses()
{
window.open('./houses.php', 'Obytná štvrť', 'width=850,height=1000');
}
