Array.prototype.inArray = function( item )
{
	var i = this.length;
	if ( i > 0 ) do
	{
		if ( this[ i ] == item ) return true;
	} while ( --i );
	return false;
}

function openNapKepe( id, width, height )
{
	window.open( 'kep.php?id=' + id, 'napkepe', 'location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=yes,toolbar=no,width=' + ( width + 10 ) + ',height=' + ( height + 10 ), true );
}

function showSzavazas( id )
{
	var valaszok = document.getElementsByName( 'valasz' );
	var i;
	var b = false;
	var valasz = -1;
	for ( i = 0; i < valaszok.length && !b; i++ )
	{
		if ( b = valaszok[ i ].checked == true )
		{
			valasz = valaszok[ i ].value;
		}
	}
	if ( valasz != -1 )
	{
		var height = valaszok.length * 25 + 58 + 50 + 16;
		window.open('eredmenyek.php?id=' + id + '&valasz=' + valasz ,'eredmenyek','height=' + height + ',width=500,scrollbars=no',true);
		document.getElementById( 'szavazasButton' ).disabled = true;
		document.getElementById( 'szavazasButton' ).value = "Ön már szavazott";
		document.getElementById( 'szavazasButton' ).style.width = "110px";
	}
	else
	{
		alert( "Elöször válasszon a választási lehetőségek közül!" );
	}
}

function showSzavazasEredmeny( id )
{
	var valaszok = document.getElementsByName( 'valasz' );
	var height = valaszok.length * 25 + 58 + 50 + 16;
	window.open('eredmenyek.php?id=' + id + '&valasz=-1','eredmenyek','height=' + height + ',width=500,scrollbars=no',true);
}

function openTop20()
{
	window.open( 'zene%2Dfelugro.php','Top20','height=555,width=396,scrollbars=yes',true);
}

function showAdvSearch()
{
	document.getElementById( 'advancedSearch' ).style.display = 'block';
	document.getElementById( 'searchAdv' ).style.display = 'none';
	document.getElementById( 'search-submit' ).style.display = 'none';
}
function hideAdvSearch()
{
	document.getElementById( 'advancedSearch' ).style.display = 'none';
	document.getElementById( 'searchAdv' ).style.display = 'block';
	document.getElementById( 'search-submit' ).style.display = 'block';
}

function showAdvSzotar()
{
	document.getElementById( 'advancedSzotar' ).style.display = 'block';
	document.getElementById( 'szotarAdv' ).style.display = 'none';
	document.getElementById( 'szotar-submit' ).style.display = 'none';
}
function hideAdvSzotar()
{
	document.getElementById( 'advancedSzotar' ).style.display = 'none';
	document.getElementById( 'szotarAdv' ).style.display = 'block';
	document.getElementById( 'szotar-submit' ).style.display = 'block';
}

var wordsru = new Array('ё','й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю');

function assignLanguage()
{
	var form = document.getElementById( 'szotarForm' );
	if ( wordsru.inArray( form.word.value.toLowerCase().charAt( 0 ) ) ) form.language.value = 'russian';
	else form.language.value = 'hungarian'; 
}

function openMedia()
{
	window.open('szoveg.php?page=1','Médiaajánlat','height=400,width=600',true);
}
function openImpresszum()
{
	window.open('szoveg.php?page=2','Impresszum','height=400,width=600',true);
}

function idojarasOpen( num )
{
	var i;
	if ( num != undefined )
	{
		for( i = 0; i < 4; i++ )
		{
			if ( i == num )
			{
				document.getElementById( 'idojaras' + i ).style.display = 'block';
				document.getElementById( 'idojarasLink' + i ).style.fontWeight = '700';
			}
			else
			{
				document.getElementById( 'idojaras' + i ).style.display = 'none';
				document.getElementById( 'idojarasLink' + i ).style.fontWeight = '400';
			}
		}
	}
}
