var errorstr = '';

///////////////////////////////////////////////////////////////////////////////
$(document).ready(function(){
	if(window.AntiSpam_mailto) AntiSpam_mailto();
	$('input[type=text]:not(.typetext)').addClass('typetext');
	$('input[type=checkbox]:not(.typecheckbox)').addClass('typecheckbox');
	$('input[type=radio]:not(.typeradio)').addClass('typeradio');
	$('input[type=file]:not(.typefile)').addClass('typefile');
	$('input[type=submit]:not(.typesubmit)').addClass('typesubmit');
	if($().TextAreaResizer) $('textarea.resizable:not(.processed)').TextAreaResizer();

	if($().lightbox) $('a[rel*=lightbox]').lightbox({
		fileLoadingImage : 'res/jquery/lightbox/loading.gif',
		fileBottomNavCloseImage : 'res/jquery/lightbox/close.gif',
		overlayOpacity : 0.8,
		borderSize : 10,
		displayTitle: true,
		strings : {
			prevLinkTitle: 'Előző kép',
			nextLinkTitle: 'Következő kép',
			prevLinkText:  '&laquo; Előző',
			nextLinkText:  'Következő &raquo;',
			closeTitle: 'Bezár',
			image: 'Kép ',
			of: ' / '
			},
		fitToScreen: true// resize images if they are bigger than window
		});

	if(window.customOnLoad_doc) customOnLoad_doc();
	if(window.errorstr) setTimeout('alert(errorstr);', 100);
	});

///////////////////////////////////////////////////////////////////////////////
function AntiSpam_mailto(){
	$("span[class='email']").each(function(){
		var mailtoVal = $(this).html().replace('[KUKAC]', '@').replace('[PONT]', '.');
		var titleVal = $(this).attr('title').replace('[KUKAC]', '@').replace('[PONT]', '.');
		if(!titleVal) titleVal = mailtoVal;
		var s = mailtoVal.match(/subject=([^&]*)/);
		if(s) mailtoVal = mailtoVal.replace(/(subject=)([^&]*)/, '$1'+escape(s[1]));
		$(this).replaceWith('<a href="mailto:'+mailtoVal+'" class="email">'+titleVal+'</a>')
		});
	}

function showKeywords(categoryid)
{
	var selectBox = document.getElementById('kategoriaselect');
	for (var i = 0; i < selectBox.options.length; i++) {
            var cat = selectBox.options[i].value;
			if (cat!=''){
				document.getElementById("keyword"+cat).style.display = 'none';
			}
        }
	
	if (categoryid!=''){
		document.getElementById("keyword"+categoryid).style.display = 'block';
		document.getElementById('keywordtext').style.display = 'block';
	}else{
		document.getElementById('keywordtext').style.display = 'none';
	}

}

