<div id="sidebar">
	<?php 
	global $post;
	if(is_archive() || is_tag())
	{
		global $wp_query;
		$current_term = $wp_query->get_queried_object();
		if($current_term->taxonomy==CUSTOM_CATEGORY_TYPE1 || is_tag())
		{
			dynamic_sidebar(6); 
		}else
		{
			dynamic_sidebar(10);
		}
	}else
	if(is_single())
	{
		if($post->post_type==CUSTOM_POST_TYPE1)
		{
			dynamic_sidebar(9); 
		}else
		{
			dynamic_sidebar(11); 
		}
	}else
	if(is_page())
	{
		dynamic_sidebar(5); 
	}else
	{
		dynamic_sidebar(7); 
	}?>
</div> <!-- sidebar right--> 