<div class="temaktop"></div>
<div class="temak">

	<h2 class='forumh2'>
		<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb" style="float: left; width: auto; margin-right: 3px;"><a href="/forum/temakorok" itemprop="url"><span itemprop="title"><?=lang('forum_topics')?></span></a>
		<img src="/public/img/forum/stilus/big_arrow.png" alt="nyil" /></div>
		<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb" style="float: left; width: auto; margin-right: 3px;"><a href="/forum/temak/<?=$temakorid?>" itemprop="url"><span itemprop="title"><?=$temakorcim?></span></a>
		<img src="/public/img/forum/stilus/big_arrow.png" alt="nyil" /></div>
		<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb" style="float: left; width: auto; margin-right: 3px;"><a href="/forum/listaz/<?=$tema_id?>" itemprop="url"><span itemprop="title"><?=$temacim?></span></a></div>
	</h2>
	<div align="right"><div class="gombst forumvisszagomb" style="background: url('/public/img/forum/stilus/button_back.png'); width: 110px; float: right; cursor: pointer;" onclick="location.href='/forum/temak'"><?=lang('forum_vissza')?></div></div>
	<?if($this->phpsession->get('fuser')):?>
		<div class="gombstujhsz new_anchor">
			<?=lang('forum_ujhsz')?>
		</div>
		<br />
	<?endif;?>
	
	<div class="clear"></div>
	
	<?if($hozzaszolasok):?>
		
		<p style="margin: 0px 0px 0px 5px;"><?$this->load->view("forum/hszlapozas")?></p>
		
		<?php
		
		$i=0;
		$fuser = $this->phpsession->get('fuser');
		foreach($hozzaszolasok as $szoveg){?>
			<div class="hozzaszolas">
			
			<div style="float: left;">
				<?if($szoveg->rang == "moderator"):?>
				<img class="ikon" style="position: relative; top: 3px; margin: 0px" src="/public/img/forum/stilus/icon_small_cube.png" alt="" />
				<?endif;?>
				<strong><?=$szoveg->user?></strong>
			</div>
			<div style="float: right;">
				<?=$szoveg->datum?>
			</div>
			<div class="clear" style="height: 5px;"></div>
			
			<?if($szoveg->valasz):?>
				<p class="elozmeny">
				<?if($szoveg->valasz != "-"):?>
					<img class="ikon" style="margin-left: 0px;" src="/public/img/forum/stilus/icon_reply-on.png" alt="<?=lang('forum_valasz')?>" />
					<?=lang('forum_elozmeny')?>: <?=$szoveg->valasz?>
				<?else:?>
					<?=lang('forum_toroltelozmeny')?>
				<?endif;?>
				</p>
			<?endif;?>
			<?=$szoveg->szoveg;?>
			<?if($szoveg->kep!="NULL" && $szoveg->kep!=""):?>
				<br />
				<?if(hun()):?>
				<a href="/public/img/forum/<?=$szoveg->user_id?>/<?=$szoveg->kep?>" class="fancy" target="_blank"><img src="/public/img/forum/<?=$szoveg->user_id?>/<?=$szoveg->kep?>" alt="" /></a>
				<?else:?><a href="/public/img/forum/<?=$szoveg->user_id?>/<?=$szoveg->kep?>" target="_blank"><img src="/public/img/forum/eng/<?=$szoveg->user_id?>/<?=$szoveg->kep?>" alt="" /></a>
				<?endif;?>
			<?endif;?>
			<div class="clear"></div>
			<?if($this->phpsession->get('fuser')):?>
				<div style="float: right; width: auto;">
					<a href="/forum/valasz/<?=$szoveg->hsz_id?>" class="re_anchor" hsz_azon="<?=$szoveg->hsz_id?>">
						<img class="ikon" src="/public/img/forum/stilus/icon_reply.png" alt="<?=lang('forum_valasz')?>" />
						<?=lang('forum_valasz')?>
					</a>
				</div>
			<?endif;?>
			<?if( isset($szerk) || $fuser['user_id'] == $szoveg->user_id ):?>
				<div style="float: right; width: auto;">
				<a href="/forum/szerkeszt/<?=$szoveg->hsz_id?>" class="edit_anchor"  hsz_azon="<?=$szoveg->hsz_id?>">
					<img class="ikon" src="/public/img/forum/stilus/icon_edit.png" alt="<?=lang('forum_szerk')?>" />
					<?=lang('forum_szerk')?>
				</a>
				<a style="cursor: pointer;" onclick="if(confirm('<?=lang('forum_torlesmegerosites')?>')){window.location.href='http://<?=$_SERVER['SERVER_NAME']?>/forum/torles/<?=$szoveg->hsz_id?>'} else{};">
					<img class="ikon" src="/public/img/forum/stilus/icon_delete.png" alt="<?=lang('forum_torles')?>" />
					<?=lang('forum_torles')?>
				</a> 
				</div>
			<?endif;?>
			<div class="clear"></div>
			
			</div>
			<?
		}
		?>
		
		<p style="text-align: right;" class="lapozas"><?$this->load->view("forum/hszlapozas")?></p>
	<?endif;?>
</div>
	
<div class="temakbottom"></div>


<?
	$tomb = $this->phpsession->get('fuser');
?>
<?if($tomb):?>

<script type="text/javascript">

jQuery(document).ready(function($){
	var hszek_object = {
		getAllMainEvents: function(){
			return <?=$hszek_json?>;
		},
		getMainEventByID: function(event_main_id){
			var main_events = this.getAllMainEvents();
			var len = main_events.length;
			
			for(var i = 0; i < len; i++){
				if(main_events[i].hsz_id == event_main_id){
					return main_events[i];
				}
			}
			
			return false;
		}
	};
	
	$('#hsz_szerk_dialog').dialog({
		autoOpen: false,
		modal: true,
		width: 560
	});
	
	$('#new_hsz_dialog').dialog({
		autoOpen: false,
		modal: true,
		width: 560
	});
	
	
	// hozzászólás szerkesztés
	$('.edit_anchor').click(function(){
		//populate the dialog
		var con = $('#modositas_form');
		var hozzaszolas = hszek_object.getMainEventByID($(this).attr('hsz_azon'));
		
		$('#hszid', con).val($(this).attr('hsz_azon'));
		$('#hsz', con).val(hozzaszolas.szoveg);
		
		//open the dialog
		$('#hsz_szerk_dialog').dialog('open');
		$('div.ui-dialog-titlebar').css({'display': 'none'});
		$('div..ui-widget-content').css({'background': 'none'});
		$('div..ui-widget-content').css({'border': 'none'});
		$('div..ui-icon').css({'background': 'none'});
		
	/*	if( $('#semmiszerk').css('display') != 'none' ){
			CKEDITOR.replace( 'hsz', {
				sharedSpaces :
				{
					top : 'topSpace',
					bottom : 'bottomSpace'
				},
				height: '350px'
			} );
			
			$('#semmiszerk').css({ 'display': 'none' });
		}
		
		var oEditor = CKEDITOR.instances.hsz;
		oEditor.setData(hozzaszolas.szoveg);
		*/
		return false;
	});
	
	
	// új hozzászólás
	$('.new_anchor').click(function(){
		var con = $('#uj_form');
		
		$('#valasz', con).val('');
		$('#new_hsz_dialog').dialog('open');
		$('div.ui-dialog-titlebar').css({'display': 'none'});
		$('div..ui-widget-content').css({'background': 'none'});
		$('div..ui-widget-content').css({'border': 'none'});
		$('div..ui-icon').css({'background': 'none'});
		
	/*	if( $('#semmiuj').css('display') != 'none' ){
			CKEDITOR.replace( 'hszuj', {
				sharedSpaces :
				{
					top : 'topSpace',
					bottom : 'bottomSpace'
				},
				height: '350px'
			} );
			
			$('#semmiuj').css({ 'display': 'none' });
		}
		
		var oEditor = CKEDITOR.instances.hszuj;
		oEditor.setData("");
		*/
		return false;
	});
	
	// válasz hozzászólás
	$('.re_anchor').click(function(){
		var con = $('#uj_form');
		
		$('#valasz', con).val($(this).attr('hsz_azon'));
		
		$('#new_hsz_dialog').dialog('open');
		$('div.ui-dialog-titlebar').css({'display': 'none'});
		$('div..ui-widget-content').css({'background': 'none'});
		$('div..ui-widget-content').css({'border': 'none'});
		$('div..ui-icon').css({'background': 'none'});
		
	/*	if( $('#semmiuj').css('display') != 'none' ){
			CKEDITOR.replace( 'hszuj', {
				sharedSpaces :
				{
					top : 'topSpace',
					bottom : 'bottomSpace'
				},
				height: '350px'
			} );
			
			$('#semmiuj').css({ 'display': 'none' });
		}
		
		var oEditor = CKEDITOR.instances.hszuj;
		oEditor.setData("");
		*/
		return false;
	});
	
	
	$('.bezargomb').click(function(){
		$('#new_hsz_dialog').dialog('close');
		$('#hsz_szerk_dialog').dialog('close');
		return false;
	});
	
	
	/* hogy ne leptessen ki*/
	idozito = setTimeout(function(){menjel();},60000);
	function menjel(){
		var url = "/other/semmi";
		jQuery('#semmidiv').load(url, function(response, status, xhr){
				//alert("ok");
			});
		
		idozito = setTimeout(function(){menjel();},180000);
	}
});

</script>

<script type="text/javascript">
window.onload = function()
{
	var oFCKeditor2 = new FCKeditor( 'hsz' ) ;
	oFCKeditor2.BasePath = "/public/editor/" ;
	oFCKeditor2.Height="350";
	oFCKeditor2.ToolbarSet="forum_ujhsz";
	oFCKeditor2.ReplaceTextarea() ;
	
	var oFCKeditor = new FCKeditor( 'hszuj' ) ;
	oFCKeditor.BasePath = "/public/editor/" ;
	oFCKeditor.Height="350";
	oFCKeditor.ToolbarSet="forum_ujhsz";
	oFCKeditor.ReplaceTextarea() ;
}
</script>


<div id="hsz_szerk_dialog" style="display: none;">
	<div class="forumpopuptop"></div>
	<div class="forumpopup">
	<h2><?=lang('forum_szerk')?></h2>
		<form action="/forum/szerkeszt" method="post" id="modositas_form">
			<input type="hidden" name="szerk" id="szerk" value="true" />
			<input type="hidden" name="hszid" id="hszid" value="" />
			<b><?if(hun()):?>Új szöveg<?else:?>New text<?endif;?>: </b><br />
			<textarea rows="10" cols="60" name="hsz" id="hsz" /></textarea><br />
			<?if( isset($kep) && $kep ):?>
			<b><?=lang('forum_kepki')?></b><input type="checkbox" name="kepki" id="kepki"><br />
			<input type="hidden" name="kep" id="kep" value="<?=$kep?>" />
			<img src="<?=$kep?>"><br />
			<?endif;?>
			<div style="text-align: right; margin-top: 10px;">
			<input type="submit" value="OK" class="ngomb" style="width: 120px; background: url('/public/img/forum/stilus/button_normal.png');" />
			<button class="bezargomb megsem" class="megsem" style="width: 120px; background: url('/public/img/forum/stilus/button_grey.png');">
				<?=lang('forum_megsem')?>
			</button>
			</div>
		</form>
	</div>
	<div class="forumpopupbottom"></div>
</div>

<script type="text/javascript" src="/public/ckeditor/ckeditor.js"></script>


<div id="new_hsz_dialog" style="display: none;">
	<div class="forumpopuptop"></div>
	<div class="forumpopup">
		<h2><?=lang('forum_ujhsz')?></h2>
		<form action="/forum/ujhsz" enctype="multipart/form-data" method="post" id="uj_form">
		<input type="hidden" name="hozzaad" id="hozzaad" value="true" />
		<input type="hidden" name="valasz" id="valasz" value="" />
		<input type="hidden" name="MAX_FILE_SIZE" value="10485760"/>
		<b><?if(hun()):?>Szöveg<?else:?>Text<?endif;?>: </b><br />
		<textarea rows="10" cols="60" name="hszuj" id="hszuj" /></textarea><br />
		<br /><b><?if(hun()):?>Kép hozzáadása<?else:?>Image<?endif;?>:</b> <input type="file" name="fkep" id="fkep">(Max. 10MB)<br />
		<div style="text-align: right; margin-top: 10px;">
		<input type="submit" value="OK" class="ngomb" style="width: 120px; background: url('/public/img/forum/stilus/button_normal.png');" />
		<button class="bezargomb megsem" class="megsem" style="width: 120px; background: url('/public/img/forum/stilus/button_grey.png');">
			<?=lang('forum_megsem')?>
		</button>
		</div>
		</form>
	</div>
	<div class="forumpopupbottom"></div>
</div>


<div id="bottomSpace" style="display: none;"></div>
<div id="semmiuj"></div>
<div id="semmire"></div>
<div id="semmiszerk"></div>
<div id="semmidiv" style="display: none;"></div>

<?endif;?>
