<div id="sidebar" class="col-right">

<?php
$posttype = get_post_type();
if(is_home() || $posttype == "posts-srb" || $posttype == "posts-hun" || $posttype == "posts-eng") {
?>
<div class="widget">
<?php
if($_COOKIE['betontrendlanguage'] == "hungarian") {
$taxonomy = 'fokategoriak';
$widgettitle = "Főkategóriák";
} elseif($_COOKIE['betontrendlanguage'] == "english") {
$taxonomy = 'main-categories';
$widgettitle = "Main Categories";
} else {
$taxonomy = 'glavne-kategorije';
$widgettitle = "Glavne Kategorije";
}
?>
<h2 class="widgettitle"><?php echo $widgettitle; ?></h2>
<div class="widgetcontent">

<ul id="categories">
<?php
$args = array( 
'taxonomy' => $taxonomy,
'title_li' => ''
);
wp_list_categories( $args );
?>
</ul>


</div>
</div>

<div class="widget">
	<?php
	$language = $_GET['l'];
		if($_COOKIE['betontrendlanguage'] == "hungarian") {
			$post_type = 'posts-hun';
			$widgettitle = "Legfrisebb Híreink";
		} elseif($_COOKIE['betontrendlanguage'] == "english") {
			$post_type = 'posts-eng';
			$widgettitle = "Latest News";
		} else {
			$post_type = 'posts-srb';
			$widgettitle = "Poslednji Vesti";
		}
?>

<h2 class="widgettitle"><?php echo $widgettitle; ?></h2>   
	<div class="widgetcontent">
		<ul>
			<?php
			query_posts('post_type=' . $post_type . '&posts_per_page=1');
				if ( have_posts() ) : while ( have_posts() ) : the_post();
				echo "<li><a href=\"" . get_permalink($post->ID) . "\">" .  get_the_title() . "</a></li>";

				endwhile;
				endif;
			?>
		</ul>
	</div>
</div>

<?php } ?>


<?php
$posttype = get_post_type();
$the_slug = $post->post_name;
if($posttype == "products-srb" || $posttype == "products-hun" || $posttype == "products-eng" || $the_slug == "products" || $the_slug == "proizvodi" || $the_slug == "termekek") {
?>
<div class="widget">
<?php
if($_COOKIE['betontrendlanguage'] == "hungarian") {
$taxonomy = 'termek-kategoriak';
$widgettitle = "Termék kategóriák";
} elseif($_COOKIE['betontrendlanguage'] == "english") {
$taxonomy = 'product-categories';
$widgettitle = "Product Categories";
} else {
$taxonomy = 'kategorije-proizvoda';
$widgettitle = "Kategorije Proizvoda";
}
$args = array(
	'hide_empty'	=> 0,
	'hierarchical'	=> 1
);
$tax_terms = get_terms($taxonomy, $args);
?>
<h2 class="widgettitle"><?php echo $widgettitle; ?></h2>
<div class="widgetcontent">

<ul id="categories">
<?php
$args = array( 
'taxonomy' => $taxonomy,
'title_li' => ''
);
wp_list_categories( $args );
?>
</ul>


</div>
</div>

<div class="widget">
	<?php
	$language = $_GET['l'];
		if($_COOKIE['betontrendlanguage'] == "hungarian") {
			$post_type = 'products-hun';
			$widgettitle = "Legfrisebb Termékeink";
		} elseif($_COOKIE['betontrendlanguage'] == "english") {
			$post_type = 'products-eng';
			$widgettitle = "Latest Products";
		} else {
			$post_type = 'products-srb';
			$widgettitle = "Poslednji Proizvodi";
		}
?>

<h2 class="widgettitle"><?php echo $widgettitle; ?></h2>   
	<div class="widgetcontent">
		<ul>
			<?php
			query_posts('post_type=' . $post_type . '&posts_per_page=1');
				if ( have_posts() ) : while ( have_posts() ) : the_post();
				echo "<li><a href=\"" . get_permalink($post->ID) . "\">" .  get_the_title() . "</a></li>";

				endwhile;
				endif;
			?>
		</ul>
	</div>
</div>

<?php } ?>


</div>

<div class="clear"></div>
