﻿// BB banner
function bWrite() {
	if(!window.goA)document.write('<sc'+'ript src="http://imgs.adverticum.net/scripts/gwloader.js?ord='+Math.floor(Math.random()*1000000000)+'" type="text/javascript"><\/sc'+'ript>');
}

//ajax kezdete
var xmlHttp;
var currentTime = new Date();

//type: cikkek típusa, vagy ha texttype=user, és type=3, akkor a jobot is hozzáfűzzük a névhez
function getTextFromId(id,select,texttype,type,notregistered)
{
	if (isNaN(id) && notregistered=='1')
	{
		//nem szám
		var boxLength = select.length;
				var isNew = true;
				if (boxLength != 0) {
					for (i = 0; i < boxLength; i++) {
						thisitem = select.options[i].text;
							if (thisitem == id) {
								isNew = false;
								break;
								}
						}
				} 
				if (isNew) {
					if (type=='3')
					{
						id=id + "--" + document.form.job.value;
					}
					newoption = new Option(id, id, false, false);
					select.options[boxLength] = newoption;
				}
				else
				{
					alert("Már ki van választva!");
				}
		return false;
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("A böngésző nem támogatja a HTTP Request-eket.");
		return;
	}
	var url="interface/getname.php"+"?id="+id+"&texttype="+texttype+"&type="+type+"&sid="+Math.random();
	xmlHttp.onreadystatechange=function() 
		{
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{
				if (xmlHttp.responseText=="000nincsilyen000")
				{
					alert("Nincs ilyen azonosítójú adat!");
					return;
				}
				var boxLength = select.length;
				var isNew = true;
				if (boxLength != 0) {
					for (i = 0; i < boxLength; i++) {
						thisitem = select.options[i].value;
							if (thisitem == id) {
								isNew = false;
								break;
								}
						}
				}
				if (isNew) {
					response=xmlHttp.responseText;
					if (type=='3')
					{
						id=id + "--" + document.form.job.value;
						newoption = new Option(response + "--" + document.form.job.value , id, false, false);
					}
					else
					{
						newoption = new Option(response, id, false, false);
					}
					select.options[boxLength] = newoption;
				}
				else
				{
					alert("Már ki van választva!");
				}
			}
		}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function GetXmlHttpObject()
{ 
	try {
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (ex) {
        ro = new XMLHttpRequest();
    }
    return ro;
} 

function getTextFromId2(id,select,texttype,type,notregistered) {
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("A böngésző nem támogatja a HTTP Request-eket.");
        return;
    }
    var url="interface/getmorename.php"+"?id="+id+"&texttype="+texttype+"&type="+type+"&sid="+Math.random();
    xmlHttp.onreadystatechange=function() {
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
            if (xmlHttp.responseText=="000nincsilyen000") {
                alert("Nincs ilyen azonosítójú adat!");
                return;
            }
            if (xmlHttp.status == 200) {
                var response = xmlHttp.responseXML;
                var paramList = response.getElementsByTagName('param');
                /* This will be the XHTML string to use */

                for (i = 0, il = paramList.length; i < il; i++) {
                    for (j = 0, jl = paramList[i].childNodes.length; j < jl; j++) {
                        if (paramList[i].childNodes[j].nodeName == 'id') {
                            id = paramList[i].childNodes[j].firstChild.nodeValue;
                            //alert(id);
                        }
                        if (paramList[i].childNodes[j].nodeName == 'text') 
                            text = paramList[i].childNodes[j].firstChild.nodeValue;
                        //alert(text);
                    }
                    //alert("text="+text+"id="+id);
                    newoption = new Option(text, id, false, false);
                    select.options[select.length] = newoption;
                }
            }
            else
                alert('Az adat lekérésnél probléma volt: \n' + xmlHttp.statusText);
            xmlHttp = null;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

// általános ajax hívásokra:
function ajaxRequest(url, gid) {
    try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (ex) {
        xmlHttp = new XMLHttpRequest();
    }
    if (xmlHttp==null) {
        return;
    }
    xmlHttp.onreadystatechange=function() {
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
            //alert(xmlHttp.responseText);
			document.getElementById(gid).innerHTML = xmlHttp.responseText;
			return;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}


// ajaxos calendarhoz
function calsetday(day,pid) {
    try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (ex) {
        xmlHttp = new XMLHttpRequest();
    }
    if (xmlHttp==null) {
        return;
    }
    xmlHttp.open("GET",'interface/calendar.php?setday='+day+'&setpid='+pid,true);
    xmlHttp.send(null);
}


function getTextFromId3(form,select,texttype,notregistered) {
    id=form.articleid.value;
    var table=form.linktable.options[form.linktable.selectedIndex].value;
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("A böngésző nem támogatja a HTTP Request-eket.");
        return;
    }
    var url="interface/getmorename.php"+"?id="+id+"&texttype="+texttype+"&table="+table+"&sid="+Math.random();
    xmlHttp.onreadystatechange=function() {
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
            if (xmlHttp.responseText=="000nincsilyen000") {
                alert("Nincs ilyen azonosítójú adat!");
                return;
            }
            if (xmlHttp.status == 200) {
                var response = xmlHttp.responseXML;
                var paramList = response.getElementsByTagName('param');
                /* This will be the XHTML string to use */

                for (i = 0, il = paramList.length; i < il; i++) {
                    for (j = 0, jl = paramList[i].childNodes.length; j < jl; j++) {
                        if (paramList[i].childNodes[j].nodeName == 'id') {
                            id = paramList[i].childNodes[j].firstChild.nodeValue;
                            //alert(id);
                        }
                        if (paramList[i].childNodes[j].nodeName == 'text') 
                            text = paramList[i].childNodes[j].firstChild.nodeValue;
                        //alert(text);
                    }
                    //alert("text="+text+"id="+id);
                    newoption = new Option(text, id+",'"+table+"'", false, false);
                    select.options[select.length] = newoption;
                }
            }
            else
                alert('Az adat lekérésnél probléma volt: \n' + xmlHttp.statusText);
            xmlHttp = null;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

//ajax vége


function init() 
{ 
	// naptár betöltése
	ajaxRequest('interface/calendar.php','calendar');
	/*
	// belépő formnál usernévnél álljon a kurzor
	if (document.getElementById("username")) {
		if(document.login.email.setSelectionRange)
		{
			document.login.email.focus();
			document.login.email.setSelectionRange(0,0);
		}
		else if (document.login.email.createTextRange) {
			var range = document.login.email.createTextRange();
			range.collapse(true);
			range.moveEnd('character', 0);
			range.moveStart('character', 0);
			range.select();
		}
	} */
	// az FCKeditor1 nevű textareákat cserélje le wysiwyg-esre
	var sBasePath="fckeditor/";
    var kFCKeditor = new FCKeditor( 'kitekint' ) ;
    kFCKeditor.Height = '200' ; 
    kFCKeditor.BasePath    = sBasePath ;
    kFCKeditor.ReplaceTextarea() ;
	var lFCKeditor = new FCKeditor( 'lead' ) ;
	lFCKeditor.Height = '200' ; 
	lFCKeditor.BasePath	= sBasePath ;
	lFCKeditor.ReplaceTextarea() ;
	var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
	oFCKeditor.Height = '512' ; 
	oFCKeditor.BasePath	= sBasePath ;
	oFCKeditor.ReplaceTextarea() ;
	var pFCKeditor = new FCKeditor( 'msgboard' ) ;
	pFCKeditor.BasePath	= sBasePath ;
	pFCKeditor.Width = '100%' ;
	pFCKeditor.Height = 200 ;
	pFCKeditor.ToolbarSet = 'msgBoard';
	pFCKeditor.ReplaceTextarea() ;
	var rFCKeditor = new FCKeditor( 'newsletter' ) ;
	rFCKeditor.BasePath	= sBasePath ;
	rFCKeditor.Width = '100%' ;
	rFCKeditor.Height = 600 ;
	rFCKeditor.ToolbarSet = 'msgBoard';
	rFCKeditor.ReplaceTextarea() ;
	
	// megjegyzi, hogy melyik oldalon van
	var str1 = 'http://prae.hu/prae/index.php?login=1';
	var str2 = 'http://prae.hu/prae/register2.php';
	var str3 = 'http://prae.hu/prae/lostpassword.php?action=w';
	var url1 = location.href;
	var url2 = url1.substring(0, str2.length);
	if (url1 != str1 && url1 != str3 && url2 != str2) {
		document.getElementById('savedurl').value = location.href;
	} else {
		document.getElementById('savedurl').value = 'http://prae.hu/prae/index.php';
	}
	
	// felső menü
	YAHOO.util.Event.onContentReady("productsandservices", function () {
		var ua = YAHOO.env.ua,
			oAnim;  
		function onSubmenuBeforeShow(p_sType, p_sArgs) {
			var oBody,
				oElement,
				oShadow,
				oUL;
			if (this.parent) {
				oElement = this.element;
				oShadow = oElement.lastChild;
				oShadow.style.height = "0px";
				if (oAnim && oAnim.isAnimated()) {
					oAnim.stop();
					oAnim = null;
				}
				oBody = this.body;
				if (this.parent && 
					!(this.parent instanceof YAHOO.widget.MenuBarItem)) {
					if (ua.gecko || ua.opera) {
						oBody.style.width = oBody.clientWidth + "px";
					}
					if (ua.ie == 7) {
						oElement.style.width = oElement.clientWidth + "px";
					}
				}
				oBody.style.overflow = "hidden";
				oUL = oBody.getElementsByTagName("ul")[0];
				oUL.style.marginTop = ("-" + oUL.offsetHeight + "px");
			}
		}
		function onTween(p_sType, p_aArgs, p_oShadow) {
			if (this.cfg.getProperty("iframe")) {
				this.syncIframe();
			}
			if (p_oShadow) {
				p_oShadow.style.height = this.element.offsetHeight + "px";
			}
		}
		function onAnimationComplete(p_sType, p_aArgs, p_oShadow) {
			var oBody = this.body,
				oUL = oBody.getElementsByTagName("ul")[0];
			if (p_oShadow) {
				p_oShadow.style.height = this.element.offsetHeight + "px";
			}
			oUL.style.marginTop = "";
			oBody.style.overflow = "";
			if (this.parent && 
				!(this.parent instanceof YAHOO.widget.MenuBarItem)) {
				if (ua.gecko || ua.opera) {
					oBody.style.width = "";
				}
				if (ua.ie == 7) {
					this.element.style.width = "";
				}
			}
		}

		function onSubmenuShow(p_sType, p_sArgs) {
			var oElement,
				oShadow,
				oUL;
			if (this.parent) {
				oElement = this.element;
				oShadow = oElement.lastChild;
				oUL = this.body.getElementsByTagName("ul")[0];
				oAnim = new YAHOO.util.Anim(oUL, 
					{ marginTop: { to: 0 } },
					.5, YAHOO.util.Easing.easeOut);
				oAnim.onStart.subscribe(function () {
					oShadow.style.height = "100%";
				});
				oAnim.animate();
				if (YAHOO.env.ua.ie) {
					oShadow.style.height = oElement.offsetHeight + "px";
					oAnim.onTween.subscribe(onTween, oShadow, this);
				}
				oAnim.onComplete.subscribe(onAnimationComplete, oShadow, this);
			}
		}
		var oMenuBar = new YAHOO.widget.MenuBar("productsandservices", { 
													autosubmenudisplay: true, 
													hidedelay: 350, 
													lazyload: true });
		oMenuBar.subscribe("beforeShow", onSubmenuBeforeShow);
		oMenuBar.subscribe("show", onSubmenuShow);
		oMenuBar.render(); 
	});
	// felső menü end
}

function addArticle(articles,new_article)
{
	var boxLength = articles.length;
	var newId = new_article.value;
	var newTextElement = document.getElementById(newId);
	if (newTextElement==null)
	{
		alert("Nincs ilyen cikk!");
	}
	else
	{
		var newText=newTextElement.value;
		var i;
		var isNew = true;
		if (boxLength != 0) {
			for (i = 0; i < boxLength; i++) {
				thisitem = articles.options[i].value;
					if (thisitem == newId) {
						isNew = false;
						break;
						}
				}
		} 
		if (isNew) {
			newoption = new Option(newText, newId, false, false);
			articles.options[boxLength] = newoption;
		}
		else
		{
			alert("Ez a cikk már szerepel a kiválasztottak között.");
		}
	}
}

function deleteFromSelect(select)
{
	var selectedItem = select.selectedIndex;
	select.options[selectedItem] = null;
}

function articleUp(choice)
{
	var selectedItem=choice.selectedIndex;
	if (selectedItem>0)
	{
		var st=choice.options[selectedItem].text;
		var sv=choice.options[selectedItem].value;
		choice.options[selectedItem].text=choice.options[selectedItem-1].text;
		choice.options[selectedItem].value=choice.options[selectedItem-1].value;
		choice.options[selectedItem-1].text=st;
		choice.options[selectedItem-1].value=sv;
		choice.selectedIndex=selectedItem-1;
	}
}

function articleDown(choice)
{
	var selectedItem=choice.selectedIndex;
	if (selectedItem<(choice.length-1))
	{
		var st=choice.options[selectedItem].text;
		var sv=choice.options[selectedItem].value;
		choice.options[selectedItem].text=choice.options[selectedItem+1].text;
		choice.options[selectedItem].value=choice.options[selectedItem+1].value;
		choice.options[selectedItem+1].text=st;
		choice.options[selectedItem+1].value=sv;
		choice.selectedIndex=selectedItem+1;
	}
}

function getOptionValues(choice)
{
	var listt="";
    for (i=0; i<choice.length; i++) {
        if (i==0) {
            listt = choice.options[i].value;
        } else {
            listt = listt + ",,,,," + choice.options[i].value;
        }
    }
	return listt;
}

function selectUser(available,choice,list)  
{
	var boxLength = choice.length;
	var selectedItem = available.selectedIndex;
	var selectedText = available.options[selectedItem].text;
	var selectedValue = available.options[selectedItem].value;
	var i;
	var isNew = true;
	if (boxLength != 0) {
		for (i = 0; i < boxLength; i++) {
			thisitem = choice.options[i].text;
				if (thisitem == selectedText) {
					isNew = false;
					break;
					}
			}
	} 
	if (isNew) {
		newoption = new Option(selectedText, selectedValue, false, false);
		choice.options[boxLength] = newoption;
	}
	else
	{
		alert("Ez a cikk már szerepel a kiválasztottak között.");
	}
	available.selectedIndex=-1; 
}

function selectUserSort(available,choice,list)
{
	var boxLength = choice.length;
	if (boxLength==10)
	{
		alert("10 cikket lehet csak kiválasztani");
		return false;
	}
	selectUser(available,choice,list);
}

function removeUser(available,choice,list) {
	var selectedItem = choice.selectedIndex;
	choice.options[selectedItem] = null;
	
	
	/*var boxLength = choice.length;
	arrSelected = new Array();
	var count = 0;
	for (i = 0; i < boxLength; i++) {
		if (choice.options[i].selected) {
			arrSelected[count] = choice.options[i].value;
		}
		count++;
	}
	var x;
	for (i = 0; i < boxLength; i++) {
		for (x = 0; x < arrSelected.length; x++) {
			if (choice.options[i].value == arrSelected[x]) {
				choice.options[i] = null;
			}
		}
		boxLength = choice.length;
	}*/
}

function submitDvd()
{
	if (document.form.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		document.form.title.focus();
		return false;
	}
	checked=false;
	for (i=0;i<document.form.year.length;i++ )
	{
		if (document.form.year[i].selectedIndex!=-1)
		{
			checked=true;
		}
	}
	if (!checked)
	{
		alert("Nem töltötted ki az évet!");
		document.form.quarter[0].focus();
		return false;
	}
	checked=false;
	for (i=0;i<document.form.quarter.length;i++ )
	{
		if (document.form.quarter[i].selectedIndex!=-1)
		{
			checked=true;
		}
	}
	if (!checked)
	{
		alert("Nem töltötted ki a negyedévet!");
		document.form.quarter[0].focus();
		return false;
	}
	document.form.authors_list.value=getOptionValues(document.form.authors);
	document.form.submit();
}

function submitDvdMovie()
{
	if (document.form.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		document.form.title.focus();
		return false;
	}
	document.form.authors_list.value=getOptionValues(document.form.authors);
	document.form.imprints_list.value=getOptionValues(document.form.imprints);
	document.form.submit();
}

function submitDvdMusic()
{
	if (document.form.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		document.form.title.focus();
		return false;
	}
	document.form.authors_list.value=getOptionValues(document.form.authors);
	document.form.submit();
}

function submitDvdMovieCriticism()
{
	if (document.form.FCKeditor1.value=="")
	{
		alert("Nem írt szöveget!");
		document.form.FCKeditor1.focus();
		return false;
	}
	document.form.authors_list.value=getOptionValues(document.form.authors);
	document.form.submit();
}

function submitJournal()
{
	if (document.form.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		document.form.title.focus();
		return false;
	}
	checked=false;
	for (i=0;i<document.form.year.length;i++ )
	{
		if (document.form.year[i].selectedIndex!=-1)
		{
			checked=true;
		}
	}
	if (!checked)
	{
		alert("Nem töltötted ki az évet!");
		document.form.quarter[0].focus();
		return false;
	}
	checked=false;
	for (i=0;i<document.form.quarter.length;i++ )
	{
		if (document.form.quarter[i].selectedIndex!=-1)
		{
			checked=true;
		}
	}
	if (!checked)
	{
		alert("Nem töltötted ki a negyedévet!");
		document.form.quarter[0].focus();
		return false;
	}

	document.form.submit();
}

function submitJournalArticle()
{
	if (document.form.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		document.form.title.focus();
		return false;
	}
	if (document.form.FCKeditor1.value=="")
	{
//		alert("Nem írt szöveget!");
//		document.form.FCKeditor1.focus();
//		return false;
	}
	if (document.form.page.value=="")
	{
		alert("Nem adtál meg oldalszámot!");
		document.form.page.focus();
		return false;
	}
	if (!document.form.page.value.match(/^\d+$/))
        {
          alert("Csak számot lehet az oldalszámhoz írni!");
          document.form.page.value = "";
          document.form.page.focus();
          return false;
    }
	document.form.authors_list.value=getOptionValues(document.form.authors);
	if (document.form.authors_list.value=="")
	{
		alert("Legalább egy szerzőt meg kell adni! Ha regisztrált, akkor az azonosítószámát kell beírni, ha nem regisztrált, akkor a nevét.");
		return false;
	}
//	bbstyle(-1,document.form,document.form.FCKeditor1);
	document.form.submit();
}

function submitGyoszeArticle()
{
    if (document.form.title.value=="")
    {
        alert("Nem töltötted ki a címet!");
        document.form.title.focus();
        return false;
    }
    if (document.form.FCKeditor1.value=="")
    {
//        alert("Nem írt szöveget!");
//        document.form.FCKeditor1.focus();
//        return false;
    }
    if (document.form.page.value=="")
    {
        alert("Nem adtál meg oldalszámot!");
        document.form.page.focus();
        return false;
    }
    if (!document.form.page.value.match(/^\d+$/))
        {
          alert("Csak számot lehet az oldalszámhoz írni!");
          document.form.page.value = "";
          document.form.page.focus();
          return false;
    }
    document.form.authors_list.value=getOptionValues(document.form.authors);
    if (document.form.authors_list.value=="")
    {
//        alert("Legalább egy szerzőt meg kell adni! Ha regisztrált, akkor az azonosítószámát kell beírni, ha nem regisztrált, akkor a nevét.");
//        return false;
    }
//    bbstyle(-1,document.form,document.form.FCKeditor1);
    document.form.submit();
}

function submitLazarilloArticle()
{
    if (document.form.title.value=="")
    {
        alert("Nem töltötted ki a címet!");
        document.form.title.focus();
        return false;
    }
    if (document.form.FCKeditor1.value=="")
    {
//        alert("Nem írt szöveget!");
//        document.form.FCKeditor1.focus();
//        return false;
    }
    if (document.form.page.value=="")
    {
        alert("Nem adtál meg oldalszámot!");
        document.form.page.focus();
        return false;
    }
    if (!document.form.page.value.match(/^\d+$/))
        {
          alert("Csak számot lehet az oldalszámhoz írni!");
          document.form.page.value = "";
          document.form.page.focus();
          return false;
    }
    document.form.authors_list.value=getOptionValues(document.form.authors);
    if (document.form.authors_list.value=="")
    {
//        alert("Legalább egy szerzőt meg kell adni! Ha regisztrált, akkor az azonosítószámát kell beírni, ha nem regisztrált, akkor a nevét.");
//        return false;
    }
//    bbstyle(-1,document.form,document.form.FCKeditor1);
    document.form.submit();
}


function submitSort()
{
	document.form.articles_list.value=getOptionValues(document.form.articles);
	document.form.submit();
}

function submitArticles() 
{
		if (document.form.title.value=="")
		{
			alert("Címet adni kötelező!");
		}
		else
		{
			document.form.authors_list.value=getOptionValues(document.form.authors);
			document.form.articles_list.value=getOptionValues(document.form.articles);
//			bbstyle(-1,document.form,document.form.FCKeditor1);
			document.form.submit();
		}
}

function submitForumTopic()
{
	if (document.form.title.value=="")
	{
		alert("Címet adni kötelező!");
		return false;
	}
	if (document.form.lead.value=="")
	{
//		alert("Topikleírást írni kötelező!");
//		return false;
	}
	document.form.submit();	
}

function submitForumTopicWithText()
{
	if (document.form.title.value=="")
	{
		alert("Címet adni kötelező!");
		return false;
	}
	if (document.form.lead.value=="")
	{
//		alert("Topikleírást írni kötelező!");
//		return false;
	}
	if (document.form.FCKeditor1.value=="")
	{
//		alert("Az első hozzászólást megírni kötelező!");
//		return false;
	}
	document.form.submit();	
}

function submitForumPost()
{
	if (document.form.FCKeditor1.value=="")
	{
//		alert("Hozzászólást írni kötelező!");
//		return false;
	}
	document.form.submit();	
}

function changeday(f)
{
	var yearindex=f.year.selectedIndex;
	var selyear=f.year.options[yearindex].value;
	var monthindex=f.month.selectedIndex;
	var selmonth=f.month.options[monthindex].value;
	if ((selmonth==1) || (selmonth==3) || (selmonth==5) || (selmonth==7) || (selmonth==8) || (selmonth==10) || (selmonth==12))
		daynum=31;
	else
	if ((selmonth==4) || (selmonth==6) || (selmonth==9) || (selmonth==11))
		daynum=30;
	else
	if (((selyear % 4)!=0) || (((selyear)==0) && ((selyear)!=0)))
		daynum=28;
	else
		daynum=29;
	var length=f.day.length;
	if (length==0)
	{
		for (i=1;i<=daynum ;i++ )
		{
			newDay = new Option(i, i,0);
			f.day.options[i-1] = newDay;
		}
	}
	else
	{
		if (length>daynum)
		{
			for (i=daynum;i<=length ; i++ )
			{
				f.day.options[daynum] = null;
			}
		}
		else
		{	
			
			for (i=length;i<daynum ;i++ )
			{
				newDay = new Option(i+1, i+1,0);
				f.day.options[i] = newDay;
			}
		}
	}
	f.day.selectedIndex=0;
}

function fillyear(y)
{
	actYear=currentTime.getFullYear();
	for (i=0;i<10 ;i++ )
	{
		newYear = new Option(i+actYear, i+actYear,0);
		y.options[i] = newYear;
	}
	y.selectedIndex=0;
}

function fillhour(h)
{
	for (i=0;i<24 ;i++ )
	{
		newHour = new Option(i, i,0);
		h.options[i] = newHour;
	}
	h.selectedIndex=0;
}

function fillmin(m)
{
	for (i=0;i<60 ;i++ )
	{
		newMin = new Option(i,i,0);
		m.options[i] = newMin;
	}
	m.selectedIndex=0;
}

function setselects(a,d)
{
	if (a=='m' || a=='w')
	{
		fillyear(document.form.year);
		fillhour(document.form.hour);
		fillmin(document.form.min);
		y=d.substring(0,4);
		m=d.substring(5,7);
		if (parseInt(m)==0)
		{
			//ha 0-val kezdődik a hónap
			m=d.substring(6,7);
		}
		
		
		
		da=d.substring(8,10);
		if (parseInt(da)==0)
		{
			//ha 0-val kezdődik a nap
			da=d.substring(9,10);
		}
		h=d.substring(11,13);
		if (parseInt(h)==0)
		{
			//ha 0-val kezdődik az óra
			h=d.substring(12,13);
		}
		mi=d.substring(14,16);
		if (parseInt(mi)==0)
		{
			//ha 0-val kezdődik a perc
			mi=d.substring(15,16);
		}
		document.form.year.selectedIndex=parseInt(y)-currentTime.getFullYear();
		document.form.month.selectedIndex=parseInt(m)-1;
		changeday(document.form);
		document.form.day.selectedIndex=parseInt(da)-1;
	document.form.hour.selectedIndex=parseInt(h);
		document.form.min.selectedIndex=parseInt(mi);
	}
}

function setdatescorrect(a,yearpar,monthpar,dpar)
{if (a=='m' || a=='w')
	{
		fillyear(document.form.year);
		fillhour(document.form.hour);
		fillmin(document.form.min);
		y=yearpar;
		m=monthpar;
		d=dpar;
		
		document.form.year.selectedIndex=parseInt(y)-currentTime.getFullYear();
		document.form.month.selectedIndex=parseInt(m)-1;
		document.form.check.value=0;
		changeday(document.form);
		document.form.day.selectedIndex=parseInt(d)-1;
//		document.form.hour.selectedIndex=parseInt(h);
	//	document.form.min.selectedIndex=parseInt(mi);
		
	}
}


function setselectsketto(a,d)
{
	if (a=='m' || a=='w')
	{
		fillyear(document.form.year);
		fillhour(document.form.hour);
		fillmin(document.form.min);
		y=d.substring(0,4);
		m=d.substring(5,7);
		if (parseInt(m)==0)
		{
			//ha 0-val kezdődik a hónap
			m=d.substring(5,6);
		}
		
		
		
		da=d.substring(8,10);
		if (parseInt(da)==0)
		{
			//ha 0-val kezdődik a nap
			da=d.substring(9,10);
		}
		h=d.substring(11,13);
		if (parseInt(h)==0)
		{
			//ha 0-val kezdődik az óra
			h=d.substring(12,13);
		}
		mi=d.substring(14,16);
		if (parseInt(mi)==0)
		{
			//ha 0-val kezdődik a perc
			mi=d.substring(15,16);
		}
		document.form.year.selectedIndex=parseInt(y)-currentTime.getFullYear();
		document.form.month.selectedIndex=parseInt(m)-1;
		changeday(document.form);
		document.form.day.selectedIndex=parseInt(da)-1;
		document.form.hour.selectedIndex=parseInt(h);
		document.form.min.selectedIndex=parseInt(mi);
		
	}
}

function setselectsprogramajanlo(a,d)
{
	if (a=='m')
	{
		fillyear(document.form.year);
		fillhour(document.form.hour);
		fillmin(document.form.min);
		y=d.substring(0,4);
		m=d.substring(6,8);
		if (parseInt(m)==0)
		{
			//ha 0-val kezdődik a hónap
			m=d.substring(7,8);
		}
		
		
		
		da=d.substring(10,12);
		if (parseInt(da)==0)
		{
			//ha 0-val kezdődik a nap
			da=d.substring(11,12);
		}
		h=d.substring(14,16);
		if (parseInt(h)==0)
		{
			//ha 0-val kezdődik az óra
			h=d.substring(15,16);
		}
		mi=d.substring(17,19);
		if (parseInt(mi)==0)
		{
			//ha 0-val kezdődik a perc
			mi=d.substring(18,19);
		}
		document.form.year.selectedIndex=parseInt(y)-currentTime.getFullYear();
		document.form.month.selectedIndex=parseInt(m)-1;
		changeday(document.form);
		document.form.day.selectedIndex=parseInt(da)-1;
		
		document.form.hour.selectedIndex=parseInt(h);
		document.form.min.selectedIndex=parseInt(mi);
		
	}
	else if(a=='w')
	{
		fillyear(document.form.year);
		fillhour(document.form.hour);
		fillmin(document.form.min);
		date=d.split('-');
		y=date[0];
		m=date[1];
		da=date[2];
		document.form.year.selectedIndex=parseInt(y)-currentTime.getFullYear();
		document.form.month.selectedIndex=parseInt(m)-1;
		changeday(document.form);
		document.form.day.selectedIndex=parseInt(da)-1;
	}
}




function setPortfolioSelects(a,d)
{
	if (a=='m' || a=='w')
	{
		y=document.form.year;
		actYear=currentTime.getFullYear();
		for (i=0;i<107 ;i++ )
		{
			newYear = new Option(actYear-i, actYear-i,0);
			y.options[i] = newYear;
		}
		y=d.substring(0,4);
		if (parseInt(y)!=0) //ha jó a dátum
		{
			m=d.substring(5,7);
			if (parseInt(m)==0)
			{
				//ha 0-val kezdődik a hónap
				m=d.substring(6,7);
			}
			da=d.substring(8,10);
			if (parseInt(da)==0)
			{
				//ha 0-val kezdődik a nap
				da=d.substring(9,10);
			}
			yearSelect=actYear-parseInt(y);
			monthSelect=parseInt(m)-1;
			daySelect=parseInt(da)-1;
			if (yearSelect>=0 && yearSelect<document.form.year.length)
			{
				document.form.year.selectedIndex=yearSelect;
			}
			else
			{
				document.form.year.selectedIndex=0;
			}
			if (monthSelect>=0 && monthSelect<document.form.month.length)
			{
				document.form.month.selectedIndex=monthSelect;
			}
			else
			{
				document.form.month.selectedIndex=0;
			}
			changeday(document.form);
			if (daySelect>=0 && monthSelect<document.form.month.length)
			{
				document.form.day.selectedIndex=daySelect;
			}
			else
			{
				document.form.day.selectedIndex=0;
			}
		}
		else
		{
			document.form.year.selectedIndex=0;
			document.form.month.selectedIndex=0;
			changeday(document.form);
			document.form.day.selectedIndex=0;
		}
	}
}

function getselectedtime(f)
{
	var yearindex=f.year.selectedIndex;
	var monthindex=f.month.selectedIndex;
	var dayindex=f.day.selectedIndex;
	var hourindex=f.hour.selectedIndex;
	var minindex=f.min.selectedIndex;
	var selyear=f.year.options[yearindex].value;
	var selmonth=f.month.options[monthindex].value;
	var selday=f.day.options[dayindex].value;
	var selhour=f.hour.options[hourindex].value;
	var selmin=f.min.options[minindex].value;
	f.newdate.value=selyear + "-" + selmonth + "-" + selday + " " + selhour + ":" + selmin + ":00";
}

function getselecteddate(f)
{
	var yearindex=f.year.selectedIndex;
	var monthindex=f.month.selectedIndex;
	var dayindex=f.day.selectedIndex;
	var selyear=f.year.options[yearindex].value;
	var selmonth=f.month.options[monthindex].value;
	var selday=f.day.options[dayindex].value;
	f.newdate.value=selyear + "-" + selmonth + "-" + selday;
}

function fillReg(f,y1,m1,d1)
{
	y=f.year;
	actYear=currentTime.getFullYear();
	for (i=0;i<106 ;i++ )
	{
		newYear = new Option(actYear-i, actYear-i,0);
		y.options[i] = newYear;
	}
	y.selectedIndex=actYear-y1;
    f.month.selectedIndex=m1-1;
	changeday(f);
    f.day.selectedIndex=d1-1;
}

function fillDate()
{
	y=document.form.year;
	actYear=currentTime.getFullYear();
	for (i=0;i<107 ;i++ )
	{
		newYear = new Option(actYear-i, actYear-i,0);
		y.options[i] = newYear;
	}
	y.selectedIndex=0;
	changeday(document.form);
}

function fillDate()
{
	y=document.form.year;
	actYear=currentTime.getFullYear();
	for (i=0;i<107 ;i++ )
	{
		newYear = new Option(actYear-i, actYear-i,0);
		y.options[i] = newYear;
	}
	y.selectedIndex=0;
	changeday(document.form);
}

function fillPortDate(a,d)
{
	if (a=='m')
	{
		fillyear(document.form.year);
		y=d.substring(0,4);
		m=d.substring(5,7);
		da=d.substring(8,10);
		if (parseInt(da)==0)
		{
			//ha 0-val kezdődik a nap
			da=d.substring(9,10);
		}
		document.form.year.selectedIndex=parseInt(y)-currentTime.getFullYear();
		document.form.month.selectedIndex=parseInt(m)-1;
		changeday(document.form);
		document.form.day.selectedIndex=parseInt(da)-1;
	}
}

function submitAsend(f) {
    if (f.felado.value=="") {
        alert("Nem töltötted ki a feladó nevét!");
        f.felado.focus();
        return false;
    } else if (f.feladoemail.value=="") {
        alert("Nem töltötted ki a feladó e-mail címét!");
        f.feladoemail.focus();
        return false;
    } else if (f.cimzettemail.value=="") {
        alert("Nem töltötted ki a címzett e-mail címét!");
        f.cimzettemail.focus();
        return false;
    }
    f.submit();
}

function submitInv(f) {
    if (f.addres.value=="") {
        alert("Nem töltötted ki a címzettet!");
        f.addres.focus();
        return false;
    }
    f.submit();
}

function submitProgram(f)
{
	if (document.form.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		document.form.title.focus();
		return false;
	}
	catindex=f.cat.selectedIndex;
	f.newcat.value=f.cat.options[catindex].value;
//	bbstyle(-1,document.form,document.form.FCKeditor1);
	f.submit();
}

function submitPetition(f)
{
    if (document.form.title.value=="")
    {
        alert("Nem töltötted ki a címet!");
        document.form.title.focus();
        return false;
    }
    
    
//    bbstyle(-1,document.form,document.form.FCKeditor1);
    f.submit();
}

function isEmail(x) { // regisztrációnál valid e-mail ellenőrzés
    var RegExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    var result = x.match(RegExp);
    return result;
}

function mailCheck(m) {
	if (m.value=='') {
		return false
	} else if (!isEmail(m.value)) {
		alert('Hibás e-mail formátum.');
		return false;
	}
}

function mailCheck2(f) {
	if (f.email.value=='') {
		return false
	} else if (!isEmail(f.email.value)) {
		alert('Hibás e-mail formátum.');
		return false;
	}
	f.submit;
}

function submitPetitionSend(f)
{
    if (document.form.name.value=="")
    {
        alert("Nem töltötted ki a 'Név' mezőt!");
        document.form.title.focus();
        return false;
    }
    
    if (document.form.mail.value=="")
    {
        alert("Nem töltötted ki az 'E-mail' mezőt!");
        document.form.title.focus();
        return false;
    }
    if (!isEmail(document.form.mail.value)) {
        alert("Hibás e-mail cím!");
        return false;
    }
    
    
//    bbstyle(-1,document.form,document.form.FCKeditor1);
    f.submit();
}

function submitReg(f)
{
	var msg = "";
	if (f.email.value=="") {
		alert("Nem töltötted ki az e-mail mezőt!");
		f.email.focus();
		return false;
	} else if (!isEmail(f.email.value)) {
		alert("Hibás e-mail cím!");
		f.email.focus();
		return false;
	} else if (f.nick.value=="") {
		alert("Nem töltötted ki a nick mezőt!");
		f.nick.focus();
		return false;
	} else if (f.name.value=="") {
		alert("Nem töltötted ki a név mezőt!");
		f.name.focus();
		return false;
	} else if (f.pass.value != f.passagain.value) {
		alert("A két jelszó nem egyezik!");
		f.pass.focus();
		return false;
	} else if (f.introlead.value=="") {
		alert("Nem töltötted ki a rövid bemutatkozást!");
		f.introlead.focus();
		return false;
	} 
	s=f.nick.value;
	first=s.charAt(0);
	first=first.toLowerCase();
	if ((first>="a" && first<="z") || first=="á" || first=="é" || first=="í" || first=="ó" || first=="ö" || first=="ő" || first=="ú" || first=="ü" || first=="ű")
	{
		f.submit();
	}
	else
	{
		alert("A nick csak betűvel kezdődhet!");
		f.nick.focus();
		return false;
	}
}

function submitModifyData(f)
{
	var msg = "";
    if (f.email.value=="") {
        alert("Nem töltötted ki a email mezőt!");
		f.email.focus();
        return false;
	} else if (!isEmail(document.form.email.value)) {
        alert("Hibás e-mail cím!");
		f.email.focus();
        return false;
	} else if (f.nameb.value=="") {
		alert("Nem töltötted ki a név mezőt!");
		f.name.focus();
		return false;
	}  else if (f.nameb.value.length<5) {
		alert("A teljes neved írd a név mezőbe!");
		f.name.focus();
		return false;
	} else if (f.nick.value=="") {
		alert("Nem töltötted ki a nicknév mezőt!");
		f.nick.focus();
		return false;
	} else if (f.pass.value != f.passagain.value) {
		alert("A két jelszó nem egyezik!");
		f.pass.focus();
		return false;
	} else if (f.pass.value != '' && f.passagain.value != '' && f.oldpass.value == '') {
		alert("Írd be a régi jelszavát!");
		f.oldpass.focus();
		return false;
	} else if ((f.pass.value == '' || f.passagain.value == '') && f.oldpass.value != '') {
		alert("A régi jelszót csak akkor töltsd ki, ha jelszót szerentél változtatni!");
		f.oldpass.focus();
		return false;
	} else if (f.introlead.value=="") {
		alert("Nem töltötted ki a rövid bemutatkozást!");
		f.introlead.focus();
		return false;
	} 
	f.submit();
}

function submitPort(f)
{
	if (f.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		f.title.focus();
		return false;
	}
	if (f.cats1.checked || f.cats2.checked || f.cats3.checked || f.cats4.checked || f.cats5.checked || f.cats6.checked)
	{

	}
	else
	{
		alert("Nem adtál meg kategóriát!");
		f.cats3.focus();
		return false;
	}
}

function submitRevContent(f,t,c)
{
	if (f.title.value=="")
	{
		alert("Nem töltötted ki a címet!");
		f.title.focus();
		return false;
	}
    if (t==2 && c==6) {
        if (f.tech.value=="") {
            alert("Nem töltötted ki a technikát!");
            f.tech.focus();
            return false;
        }
        if (f.psize.value=="") {
            alert("Nem töltötted ki a méretet!");
            f.psize.focus();
            return false;
        }
    }
	f.submit();
}

function submitReview(f)
{
	if (f.FCKeditor1.value=="")
	{
//		alert("Nem írt szöveget!");
//		f.FCKeditor1.focus();
//		return false;
	}
	f.submit();
}

function submitArticlesSend()
{
		if (document.form.title.value=="")
		{
			alert("Címet adni kötelező!");
		}
		else
		{
			document.form.articles_list.value=getOptionValues(document.form.articles);
			document.form.submit();
		}
}

//bbcode kezelő függvények

var imageTag = false;
var theSelection = false;

// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[img]','[/img]','[a]','[/a]','[p]','[/p]','','','','','','','[fn]','[/fn]');
imageTag = false;

function getarraysize(thearray) {
	for (i = 0; i < thearray.length; i++) {
		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
			return i;
		}
	return thearray.length;
}

function arraypush(thearray,value) {
	thearray[ getarraysize(thearray) ] = value;
}

function arraypop(thearray) {
	thearraysize = getarraysize(thearray);
	retval = thearray[thearraysize - 1];
	delete thearray[thearraysize - 1];
	return retval;
}

function bbstyle(bbnumber,f,txtarea) {

	//ha linket kezdünk
	if (bbnumber==8 && f.addbbcode8.value=="url")
	{
		f.addbbcode0.disabled=true;
		f.addbbcode2.disabled=true;
		f.addbbcode4.disabled=true;
		f.addbbcode6.disabled=true;
		f.addbbcode8.disabled=true;
		f.addbbcode10.disabled=true;
		f.addbbcode12.disabled=false;
		f.addbbcode14.disabled=true;
		f.addbbcode18.disabled=true;
		f.lock.disabled=true;
	}
	// ha linket fejezünk be
	if (bbnumber==8 && f.addbbcode8.value=="url*")
	{
		f.addbbcode0.disabled=false;
		f.addbbcode2.disabled=false;
		f.addbbcode4.disabled=false;
		f.addbbcode6.disabled=false;
		f.addbbcode8.disabled=false;
		f.addbbcode10.disabled=false;
		f.addbbcode12.disabled=true;
		f.addbbcode14.disabled=false;
		f.addbbcode18.disabled=false;
		f.lock.disabled=false;
	}
	//ha img-t kezdünk
	if (bbnumber==6 && f.addbbcode6.value=="img")
	{
		f.addbbcode0.disabled=true;
		f.addbbcode2.disabled=true;
		f.addbbcode4.disabled=true;
		f.addbbcode6.disabled=true;
		f.addbbcode8.disabled=true;
		f.addbbcode10.disabled=true;
		f.addbbcode12.disabled=true;
		f.addbbcode14.disabled=true;
		f.addbbcode16.disabled=false;
		f.addbbcode18.disabled=true;
		f.lock.disabled=true;
	}
	if (bbnumber==6 && f.addbbcode6.value=="img*")
	{
		f.addbbcode0.disabled=false;
		f.addbbcode2.disabled=false;
		f.addbbcode4.disabled=false;
		f.addbbcode6.disabled=false;
		f.addbbcode8.disabled=false;
		f.addbbcode10.disabled=false;
		f.addbbcode12.disabled=true;
		f.addbbcode14.disabled=false;
		f.addbbcode16.disabled=true;
		f.addbbcode18.disabled=false;
		f.lock.disabled=false;
	}

	//ha fn-t kezdünk

	if (bbnumber==18 && f.addbbcode18.value=="fn")
	{
		f.addbbcode0.disabled=true;
		f.addbbcode2.disabled=true;
		f.addbbcode4.disabled=true;
		f.addbbcode6.disabled=true;
		f.addbbcode8.disabled=true;
		f.addbbcode10.disabled=true;
		f.addbbcode12.disabled=true;
		f.addbbcode14.disabled=true;
		f.addbbcode16.disabled=true;
	}
	if (bbnumber==18 && f.addbbcode18.value=="fn*")
	{
		f.addbbcode0.disabled=false;
		f.addbbcode2.disabled=false;
		f.addbbcode4.disabled=false;
		f.addbbcode6.disabled=false;
		f.addbbcode8.disabled=false;
		f.addbbcode10.disabled=false;
		f.addbbcode12.disabled=true;
		f.addbbcode14.disabled=false;
		f.addbbcode16.disabled=true;
	}

	//ha mindet lezárjuk
	if (bbnumber==-1)
	{
		f.addbbcode0.disabled=false;
		f.addbbcode2.disabled=false;
		f.addbbcode4.disabled=false;
		f.addbbcode6.disabled=false;
		f.addbbcode8.disabled=false;
		f.addbbcode10.disabled=false;
		f.addbbcode12.disabled=true;
		f.addbbcode14.disabled=false;
		f.addbbcode16.disabled=true;
		f.addbbcode18.disabled=false;
	}
	txtarea.focus();
	donotinsert = false;
	theSelection = false;
	bblast = 0;

	if (bbnumber == -1) { // az összes nyitott taget bezárja
		while (bbcode[0]) {
			butnumber = arraypop(bbcode) - 1;
			txtarea.value += bbtags[butnumber + 1];
			buttext = eval('f.addbbcode' + butnumber + '.value');
			eval('f.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
		}
		imageTag = false;
		txtarea.focus();
		return;
	}

	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text; 
		if (theSelection) {
			document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
			txtarea.focus();
			theSelection = '';
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
		return;
	}
	
	for (i = 0; i < bbcode.length; i++) {
		if (bbcode[i] == bbnumber+1) {
			bblast = i;
			donotinsert = true;
		}
	}

	if (donotinsert) {	
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				txtarea.value += bbtags[butnumber + 1];
				buttext = eval('f.addbbcode' + butnumber + '.value');
				eval('f.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
				imageTag = false;
			}
			txtarea.focus();
			return;
	} else { 
	
		if (imageTag && (bbnumber != 14)) {	
			txtarea.value += bbtags[15];
			lastValue = arraypop(bbcode) - 1;
			f.addbbcode14.value = "Img";
			imageTag = false;
		}
		
		txtarea.value += bbtags[bbnumber];
		if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; 
		arraypush(bbcode,bbnumber+1);
		eval('f.addbbcode'+bbnumber+'.value += "*"');
		txtarea.focus();
		return;
	}
	storeCaret(txtarea);
}

function mozWrap(txtarea, open, close)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2) 
		selEnd = selLength;

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}

function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function writeText(f,txtarea)
{
	txtarea.value += "[text]";
	f.addbbcode8.disabled=false;
	f.addbbcode12.disabled=true;
	txtarea.focus();
}

function writeBr(f,txtarea)
{
	txtarea.value += "[br]";
	txtarea.focus();
}

function writeAlt(f,txtarea)
{
	txtarea.value += "[alt]";
	f.addbbcode6.disabled=false;
	f.addbbcode16.disabled=true;
	txtarea.focus();
}

var prev;
function addU(f,txtarea)
{
	if (f.ubutton.value=="u")
	{
		txtarea.value += "[u]";
		f.ubutton.value="u*";
		prev="u";
	}
	else
	{
		if (prev=="i")
		{
			addI(f,txtarea);
		}
		txtarea.value += "[/u]";
		f.ubutton.value="u";
		prev="u*";
	}
	txtarea.focus();
}

function addI(f,txtarea)
{
	if (f.ibutton.value=="i")
	{
		txtarea.value += "[i]";
		f.ibutton.value="i*";
		prev="i";
	}
	else
	{
		if (prev=="u")
		{
			addU(f,txtarea);
		}
		txtarea.value += "[/i]";
		f.ibutton.value="i";
		prev="i*";
	}
	txtarea.focus();
}

function closeAll(f,txtarea)
{
	if (f.ibutton.value=="i*")
	{
		addI(f,txtarea);
	}
	if (f.ubutton.value=="u*")
	{
		addU(f,txtarea);
	}
}

// writes the banner as flash if no alternative image is specified or the flash is specified and the browser has the plugin (it also does version check)
// writes the banner as image if no flash is specified or the browser doesn't have the plugin (or has the wrong version)
function drawBanner(flash, img, width, height, version, url)
{
	if (img=='' || (flash!='' && DetectFlashVer(version, 0, 0)))
	{
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + width + '" height="' + height + '">');
		document.write('<param name="movie" value="' + flash + '">');
		document.write('<param name="wmode" value="transparent">');
		document.write('<param name="quality" value="high"><param name="bgcolor" value="#FFFFFF"><param name="loop" value="true">');
		document.write('<EMBED wmode="transparent" src="' + flash + '" quality="high" bgcolor="#FFFFFF" width="' + width + '" height="' + height + '" loop="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>');
		document.write('</OBJECT>');
	}
	else
	{
		document.write('<a href="' + url + '" target="_blank"><IMG SRC="' + img + '" WIDTH="' + width + '" HEIGHT="' + height + '" usemap="#script" BORDER=0></a>');
	}
}

// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function OpenCloseBox(which) {
	// vagy sessionnel, vagy cookieval be van állítva , hogy ki vagy be vannak-e csukva a dobozok
	currCookie = getCookie('box_'+which);
	if (currCookie!=null) {
		document.cookie = 'box_'+which+'=close; expires=Thu, 17 Feb 2009 20:47:11 UTC; path=/';
	}
	if (document.getElementById( 'div_' + which + '_body').style.display == 'block') {
		document.getElementById( 'div_' + which + '_body').style.display = 'none';
		document.getElementById( 'img_' + which ).src = "images/img_" + which + "_close.gif";
		state = 'close';
		document.cookie =  'box_'+which+'=close; expires=Thu, 22 Feb 2050 20:47:11 UTC; path=/';
	}
	else {
		document.getElementById( 'div_' + which + '_body').style.display = 'block';
		document.getElementById( 'img_' + which ).src = "images/img_" + which + "_open.gif";
        state = 'open';
		document.cookie =  'box_'+which+'=open; expires=Thu, 22 Feb 2050 20:47:11 UTC; path=/';
	}
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){
    // alert ("A böngésző nem támogatja a HTTP Request-eket.");
        return;
    }
    var url="interface/setstate.php?what="+which+"&state="+state;
    xmlHttp.onreadystatechange=function() {
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
        //alert(xmlHttp.responseText);
            return;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
function NextPage() { 
	whichd = 1; 
	while(document.getElementById('div' + whichd)) {
		if(document.getElementById('div' + whichd).style.display == 'block') {
			currentd = whichd;
			nextd = whichd + 1;
			break; 
		}
		whichd++; 
	}
	if(document.getElementById('div' + nextd)) {
		document.getElementById('div' + currentd).style.display = 'none';
		document.getElementById('div' + nextd).style.display = 'block';
		nextd = nextd + 1;
		if(document.getElementById('div' + nextd) == null) {
			document.getElementById('right').style.display = 'none'; 
		} 
	}
	else {
		document.getElementById('right').style.display = 'none';
	}
	document.getElementById('left').style.display = 'inline';
}

function PrevPage() {
	whichd = 1; 
	while(document.getElementById('div' + whichd)) {
		if(document.getElementById('div' + whichd).style.display == 'block') {
			currentd = whichd;
			prevd = whichd - 1;
			break; 
		}
		whichd++; 
	}
	if(currentd == 1) {
		document.getElementById('left').style.display = 'none';
	}
	else {
		document.getElementById('div' + currentd).style.display = 'none';
		document.getElementById('div' + prevd).style.display = 'block';
		if(prev == 1) {
			document.getElementById('left').style.display = 'none'; 
		} 
	}
	document.getElementById('right').style.display = 'inline';
}

function ChangePage(divno) {
	whichd = 1; 
	while(document.getElementById('div' + whichd)) {
		if(document.getElementById('div' + whichd).style.display == 'block') {
			currentd = whichd;
			break; 
		}
		whichd++; 
	}
	if (currentd != divno && document.getElementById('div' + divno)) {
		if (currentd == 1 && divno != 1) 
			document.getElementById('left').style.display = 'inline';
		if (divno == 1) 
			document.getElementById('left').style.display = 'none';
		lastno = currentd + 1;
		if(!document.getElementById('div' + lastno)) 
			document.getElementById('right').style.display = 'inline';
		lastno = divno + 1;
		if(!document.getElementById('div' + lastno)) 
			document.getElementById('right').style.display = 'none';
		document.getElementById('div' + currentd).style.display = 'none';
		document.getElementById('div' + divno).style.display = 'block';
	}
}
function OpenPopup(theURL, x, y) {
	var h=screen.height;
	var w=screen.width;
	var features;
	var winName;
	h=((h-y)/2);
	w=((w-x)/2);
	features='width='+x+',height='+y+',left=0,top=0,resizable=yes,scrollbars=yes';
	eval(winName+"=window.open(theURL,'Referencia','"+features+"')");
	if (!OpenPopup.opener)
		OpenPopup.opener = self;
}

function OpenPopup2(theURL, x, y) {
	var h=screen.height;
	var w=screen.width;
	var features;
	var winName;
	h=((h-y)/2);
	w=((w-x)/2);
	features='width='+x+',height='+y+',left='+w+',top='+h+',resizable=yes,scrollbars=yes';
	eval(winName+"=window.open(theURL,'Referencia','"+features+"')");
	if (!OpenPopup.opener)
		OpenPopup.opener = self;
}

function modifySlide(select) {
//OpenPopup-ot meghivni a megfelelo adatokkal
	if (select.selectedIndex > -1) {
		var selItem = select.options[select.selectedIndex];
		OpenPopup('slideshow.php?action=m&slide=' + selItem.value,1030,650);
	}
	else
		alert("Nincs képsorozat kiválasztva!");
}

function DeleteTextNodes( parentNode, regex) {
	for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) {
		var oNode = parentNode.childNodes[i] ;
		if ( oNode.nodeType == 3 ) {
			var sReplaced = oNode.nodeValue.replace( regex, ' ' ) ;
			if ( oNode.nodeValue != sReplaced ) {
				oNode.nodeValue = sReplaced ;
			}
		}
		DeleteTextNodes( oNode, regex) ;
	}
}

function deleteSlide(select) {
	var selItem = select.options[select.selectedIndex];
	if (confirm('Valóban kiakarod törölni a ' + selItem.text + ' című képsorozatot?') == true) {
	//textaId id-ju textareabol kitorolni a megfelelo [slidex]-et
	oEditor = document.getElementById('FCKeditor1___Frame').contentWindow;
	DeleteTextNodes( oEditor.FCK.EditorDocument.body, '[slide' + selItem.value + ']');

	//selectbol kitorolni a megfelelo sort
		select.options[selItem.index] = null;
	//slideshow-ot meghivni a megfelelo adatokkal
		OpenPopup('slideshow.php?action=d&slide=' + selItem.value,600,200)
	}
}

function checkIns(form,sid) {
	if (form.fn.value == '') {
		alert("Nem adtál meg file nevet!");
		return false;
	}
	if (form.pt.value == '') {
		alert("Nem adtál a képnek címet!");
		return false;
	}
	form.action="slideshow.php?action=i&slide=" + sid;
	form.submit();
}

function ChangeSlideTitle(form,sid) {
	form.action="slideshow.php?action=t&slide=" + sid + "&pic=0";
	alert(form.action);
	form.submit();
}

function ChangePicTitle(form,sid) {
	if (form.pics.value == 0) {
		alert("Nincs kép kiválasztva!");
		return false;
	}
	var picid = form.pics.value;
	form.action="slideshow.php?action=t&slide="+ sid +"&pic=" + picid;
	form.submit();
}

function SetPicTitle(form) {
 	if (form.pics.selectedIndex > -1) {
 		form.pict.value = form.pics.options[form.pics.selectedIndex].text;
	}
}

function MoveUp(form,sid) {
 	if (form.pics.selectedIndex > 0) {
   	var picid = form.pics.value;
   	form.action="slideshow.php?action=p&dir=u&slide="+ sid +"&pic=" + picid;
		form.submit();
	}
}

function MoveDown(form,sid) {
 	if (form.pics.selectedIndex > -1 && form.pics.selectedIndex < form.pics.length - 1) {
   	var picid = form.pics.value;
   	form.action="slideshow.php?action=p&dir=d&slide="+ sid +"&pic=" + picid;
		form.submit();
	}
}

function DeletePic(form,sid) {
	if (form.pics.selectedIndex > 0) {
		if (confirm('Valóban kiakarod törölni a ' + form.pics.text + ' című képot?') == true) {
   		var picid = form.pics.value;
   		form.action="slideshow.php?action=d&slide="+ sid +"&pic=" + picid;
			form.submit();
		}
	}
}

function SetPersonPort(form) {
    menuopt=document.getElementById('tema_select').options[document.getElementById('tema_select').selectedIndex];
    menu=menuopt.getAttribute('menu_id');
    uid=document.getElementById('author_select'+menuopt.value).options[document.getElementById('author_select'+menuopt.value).selectedIndex].value;
    form.action="portfolio.php?menu_id=" + menu + "&uid=" + uid;
    form.submit();
}

function plusPoll(url, gid, pc) {
    document.getElementById('poll'+pc).className = 'votedivShow';
}

function pollCheck(obj) {
	if (obj.question.value=="") {
		alert("Nem töltötted ki a kérdést!");
		obj.question.focus();
		return false;
	}
	if (obj.poll1.value=="" || obj.poll2.value=="") {
		alert("Minimum két válaszlehetőséget meg kell adni!");
		obj.poll1.focus();
		return false;
	}
}

function votedelRequest(url, gid) {
	var http = false;
		if(navigator.appName == "Microsoft Internet Explorer") {
			  http = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			  http = new XMLHttpRequest();
		}		
  http.abort();
  url += '&nocache3='+Math.random();
  http.open("GET", url, true);
  
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(gid).innerHTML = http.responseText;
    }
  }
  http.send(null);
}

// látogatási statisztika
function visitstat(aid, type, cat) {
	var http = false;
		if(navigator.appName == "Microsoft Internet Explorer") {
			  http = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			  http = new XMLHttpRequest();
		}		
  http.abort();
  http.open("GET", 'visitstat.php?aid='+aid+'&type='+type+'&cat='+cat, true);
  http.send(null);
}

function buttonAdd(gid, aid, news, vid) {
	document.getElementById(gid).innerHTML+="<input type=\"button\" name=\"voteMod\" value=\"szerkeszt\" onClick=\"OpenPopup2('vote.php?action=m&news="+news+"&aid="+aid+"',530,350)\" />";
	document.getElementById(gid).innerHTML+="<input type=\"button\" name=\"voteDel\" value=\"töröl\" onClick=\"if (confirm('Törlés?')) votedelRequest('vote.php?action=d&aid="+aid+"&news="+news+"&vid="+vid+"','poll');\" />";
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name) {
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	    { 
	    c_start=c_start + c_name.length+1; 
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    } 
	  }
	return "";
}

function pollRequest(vid, obj, url, gid) {
	if (getCookie("PraePoll"+vid)!="") {
		alert("Már szavazott!");
		return false;
	} else {
		var pollId = 0;
		for (i = 0; i < obj.polls.length; i++) {
			if (obj.polls[i].checked) pollId = obj.polls[i].value;
		}
		if (pollId==0) return false;
		setCookie("PraePoll"+vid,vid,1);
		if (getCookie("PraePoll"+vid)=="") {
			alert("Engedélyezze a böngészőjében a cookie-kat!"); return false;
		}
		var http = false;
		if(navigator.appName == "Microsoft Internet Explorer") {
			  http = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			  http = new XMLHttpRequest();
		}	
		http.abort();
		url += '&nocache3='+Math.random()+'&pollId='+pollId;
		http.open("GET", url, true);
		
		http.onreadystatechange=function() {
		  if(http.readyState == 4) {
		    document.getElementById(gid).innerHTML = http.responseText;
		  }
		}
		http.send(null);
	}
}

function submitFriendSearch(form) {
    if (form.name.value != "" || form.nick.value != "" || form.email.value != "" || form.ageFrom.value != "" || form.ageTo.value != "") {
        form.submit();
    }    
    else
        alert("A kereséshez ki kell tölteni a név, nicknév, e-mail vagy év mezök egyikét!");
}

function userDelConfirm() {
	return confirm("Biztosan törölni akarod magad? Ha igennel válaszolsz, akkor a későbbiekben nem tudod továbbírni az általad indított blogo(ka)t, nem tudod a portfóliódat berendezni, nem tudsz hozzászólni a PRAE.HU általános művészeti portálon megjelent anyagokhoz. Töröljük az adatlapodat és a portfóliódat, de nem töröljük a blogodat és a hozzászólásaidat, kommentjeidet.\nPRAE.HU\nszerkesztőség");
}

function EmptyEditor(parentNode, isEmpty) {
    var i = 0;
    while (i < parentNode.childNodes.length && isEmpty) {
        var oNode = parentNode.childNodes[i] ;
        var pattern = /\S/g;
        var str = oNode.nodeValue;
        if ( oNode.nodeType == 3 && str.match(pattern) != null) 
            isEmpty = false;
        else if ( oNode.nodeType == 1 && oNode.nodeName == "IMG" ) 
            isEmpty = false;
        else
            isEmpty = EmptyEditor( oNode, isEmpty);
        i++;
    }
    return isEmpty;
}

function IsEmpty(form) {
    oEditor = document.getElementById('lead___Frame').contentWindow;
    if (EmptyEditor( oEditor.FCK.EditorDocument.body, true)) 
        alert('Ures');
    else
        alert('Nem ures');
}

function submitMsgText(obj) {
	var ret = true;
    oEditor = document.getElementById('msgboard___Frame').contentWindow;
    if (EmptyEditor( oEditor.FCK.EditorDocument.body, true)) {
		alert("Azért írj valamit!");
		return false;
	} else obj.submit();
}

function newsletterCheck(obj) {
	var ret = true;
    oEditor = document.getElementById('newsletter___Frame').contentWindow;
    if (EmptyEditor( oEditor.FCK.EditorDocument.body, true)) {
		alert("Üres a szöveg mező!");
		return false;
	} else if (!isEmail(obj.sendermail.value)) {
		alert("Rossz az e-mail formátum a feladó mezőben!");
		obj.sendermail.focus();
		return false;
	} else if (obj.sendername.value=="") {
		alert("Üres a feladó név mező!");
		obj.sendername.focus();
		return false;
	} else if (obj.subject.value=="") {
		alert("Üres a tárgy mező!");
		obj.subject.focus();
		return false;
	} else if (obj.addresses.value=="") {
		alert("Nincs megadva címzett!");
		obj.addresses.focus();
		return false;
	} else obj.submit();
}