<script type="text/javascript">
jQuery(document).ready(function($){
    //open and close events for the lists
    $('.open-closer').click(function(){
        $(this).parent('div').next().toggle();
    });
	
    $('.open-closer-allin').click(function(){
        $('.registrations').fadeIn();
        $('.events').fadeIn();
    });
    
    $('.open-closer-allout').click(function(){
        $('.registrations').fadeOut();
        $('.events').fadeOut();
    });
	
	$('.hozzaadgomb').click(function(){
		var elem = $('input:radio[name=objidesgyarto]:checked').val();
		if( typeof elem == 'undefined' ){
			alert("Válasszon ki egy elemet vagy lépjen vissza!");
		}else{
			$('#feltolt').submit();
		}
    });
});

</script>


<style type="text/css">
ul.main_events, ul.events, ul.registrations{
    list-style-type: none;
    padding: 0px;
}

ul.main_events, ul.events{
    margin: 0px 0px 0px 20px;
}

ul.registrations{
    margin: 5px 0px 5px 40px;
}

li.main_event{
    font-weight: bold;
}

li.main_event, li.event{
    color: white;
    clear: both;
	list-style-type: none !important;
}

ul.events, ul.registrations{
    display: none;
}

li.main_event span.open-closer, span.main_event_name{
    font-size: 14px !important;
}

span.event_name{
    margin: 0px 10px 0px 0px;
}

span.open-closer, span.open-closer-all, span.open-closer-allout, span.open-closer-allin{
    margin-right: 10px;
    color: white;
    cursor: pointer;
}

span.open-closer-space-holder{
    margin-right: 10px;
    color: white;
}

div.col_szint1{
	width: 190px;
}

div.col_szint2{
	width: 180px;
}

div.col_szint3{
	width: 192px;
}

.col_fajlok{
	border-bottom: 1px solid #333;
	list-style-type: none !important;
}

.feltoltelonezeti{
	padding-left: 15px;
}

.feher{
	color: white;
}
</style>


<a style="color: rgb(221, 136, 0); text-decoration: none; float: right;" href="javascript:history.go(-1);">
	<b><?=lang('back')?></b>
	<img src="/public/img/link_arrow.png" style="margin: 0;" />
</a>

<?if( hun() || eng() ):?><h2>Hozzáfűzés már létező elemhez</h2>
<form action="/collection/uploadhozzaadsubmit/#ujsubmit" id="feltolt" method="post">
<input type="hidden" name="fajl"    value="<?=$fajl?>" />
<input type="hidden" name="eredeti" value="<?=$eredeti?>" />

<span class="feher">Programverzió: </span>
<select name="prverzio">
	<option value="2012" <?if($prver=="2012"):?>selected="selected"<?endif;?>>2012</option>
	<option value="2013" <?if($prver=="2013"):?>selected="selected"<?endif;?>>2013</option>
</select>

<?if(count($azonoscimuek)>0):?>
	<div class="feher">
	<br />Válassza ki, melyik elemhez fűzi hozzá:<br /><br />
	<?foreach($azonoscimuek as $objektum):?>
		<input type="radio" name="objidesgyarto" value="<?=$objektum["objid"]."#".$objektum["dir"]?>" />
		<?=$objektum["gyarto"]?> > <?=$objektum["kategoria"]?> > <?=$objektum["nev"]?><br />
		<img class="feltoltelonezeti" src="/public/img/collection/<?=$objektum["dir"]?>/<?=$objektum["objid"]?>/zz_small.jpg" />
	<?endforeach;?>
	<input type="button" class="hozzaadgomb" value="Feltöltés" style="background: url('/public/img/collection/button_upload.png') no-repeat; width: 120px; height: 32px; border: 0px none; padding-bottom: 3px; padding-left: 25px; font-weight: bold; text-align: left;" />
	</div>
	<br />
	<h2>Másik elem választása</h2>
<?endif;?>

<p align="right">
	Mindet
	<span class="open-closer-allin" style="margin-left: 10px;">kinyit</span> / <span class="open-closer-allout">bezár</span>
</p>
<ul class="main_events">
    <?foreach($tipusok as $tipus):?>
    <li class="main_event">
        <div class="col_szint1">
        <span class="open-closer">+ <?=$tipus->name?></span>
        <span class="main_event_dates">(<?=$tipus->darab?>)</span>
        </div>
		<ul class="events">
			<?if($tipus->kategoria):?>
			<?foreach($tipus->kategoria as $kategoria):?>
			<li class="event">
				<div class="col_szint2">
				<?if($kategoria->fajl):?>
				<span class="open-closer">+</span>
				<?else:?>
				<span class="open-closer-space-holder">+</span>
				<?endif;?>
				<span class="event_name open-closer"><? if(hun()) print $kategoria->nev_hun; else print $kategoria->nev_eng; ?></span>
				<span class="event_date">(<?=$kategoria->darab?>)</span>
				</div>
				<?if($kategoria->fajl):?>
				<ul class="registrations">
					<?foreach($kategoria->fajl as $fajl):?>
					<li class="col_fajlok">
						<div class="col_szint3">
						<input type="radio" name="objidesgyarto" value="<?=$fajl->o_id."#".$tipus->dir?>" id="zz<?=$fajl->o_id?>" />
						<label for="zz<?=$fajl->o_id?>">
						<span class="feher"><?=$fajl->title_eng?></span><br />
						<img class="feltoltelonezeti" src="/public/img/collection/<?=$tipus->dir?>/<?=$fajl->o_id?>/zz_small.jpg" />
						</label>
						</div>
					</li>
					<?endforeach;?>
				</ul>
				<?endif;?>
			</li>
			<?endforeach;?>
			<?endif;?>
		</ul>
    </li>
    <?endforeach;?>
</ul>
<input type="button" class="hozzaadgomb" value="Feltöltés" style="background: url('/public/img/collection/button_upload.png') no-repeat; width: 120px; height: 32px; border: 0px none; padding-bottom: 3px; padding-left: 25px; font-weight: bold; text-align: left; float: right;" />
<br class="clear" />
<br />
</form>

<?endif;?>
