$(document).ready(function(){
						   					   
						  
 $('.slide-block').each(function(){

		var _box = $(this);
		var slide_box = _box.find('.slide-part');
		
		var btn_open_blog = _box.find('.open-blog');
		var btn_open_focus = _box.find('.open-focus');
		var btn_open_subscribe = _box.find('.open-subscribe');
		var btn_open_news = _box.find('.open-news');
		var btn_open_tagcloud = _box.find('.open-tagcloud');
		
		var btn_close = _box.find('.close');
		
		//alert("close vlaue" + btn_close);
		
		if(_box.hasClass('active')) slide_box.show();
		else slide_box.hide();

/******************************************** BLOG ***************************************************************/

		btn_open_blog.click(function(count_base){
			//alert("open function call "+count_plus);
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{		
						if(anchorTags[i].id == 'blog-right') {
						//alert(count_base); 
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}		
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{

								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'blog-right'){
						anchorTags[i].className = 'open-blog';
						anchorTags[i].title = 'open-blog';
						}					
					}
				}
				
			}

			return false;
		});
		
/******************************************** FOCUS ***************************************************************/
		
		btn_open_focus.click(function(count_base){
			//alert("open function call "+count_plus);
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'focus-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'focus-right'){
						anchorTags[i].className = 'open-focus';
						anchorTags[i].title = 'open-focus';
						}
					}
				}	
			}
			
			return false;
		});
		
		btn_close.click(function(){
			//alert("close function call "+count_minus);
			if(_box.hasClass('active')){
				_box.removeClass('active');
				slide_box.slideUp(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
					if(anchorTags[i].className == 'close')
					{
						
						if(anchorTags[i].id == 'focus-right'){
						anchorTags[i].className = 'open-blog';
						anchorTags[i].title = 'open';
						}
					}
				}
			
	
			}
			return false;
		});
		
/******************************************** SUBCRIBE ***********************************************************/
		
		btn_open_subscribe.click(function(){
							  
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'subscribe-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'subscribe-right'){
						anchorTags[i].className = 'open-subscribe';
						anchorTags[i].title = 'open-subscribe';
						}
					}
				}	
			}
			
			return false;
		});

/******************************************** NEWS ***********************************************************/
		
		btn_open_news.click(function(){
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'news-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'news-right'){
						anchorTags[i].className = 'open-news';
						anchorTags[i].title = 'open-news';
						}
					}
				}	
			}
			
			return false;
		});
		
/******************************************** NEWS ***********************************************************/
		
		btn_open_tagcloud.click(function(){
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'tagcloud-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'tagcloud-right'){
						anchorTags[i].className = 'open-tagcloud';
						anchorTags[i].title = 'open-tagcloud';
						}
					}
				}	
			}
			
			return false;
		});

/******************************************** CLOSE ***********************************************************/

		btn_close.click(function(){
			//alert("close function call "+count_minus);
			if(_box.hasClass('active')){
				_box.removeClass('active');
				slide_box.slideUp(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
					if(anchorTags[i].className == 'close')
					{
		
						if(anchorTags[i].id == 'news-right'){
						anchorTags[i].className = 'open-news';
						anchorTags[i].title = 'open';
						}
						
					}
				}
			
	
			}
			return false;
		});

			
   });
 
    $('.slide-block-active').each(function(){

		var _box = $(this);
		var slide_box = _box.find('.slide-part');
		
		var btn_open_blog = _box.find('.open-blog');
		var btn_open_focus = _box.find('.close');
		var btn_open_subscribe = _box.find('.open-subscribe');
		var btn_open_news = _box.find('.open-news');
		var btn_open_tagcloud = _box.find('.open-tagcloud');
		
		//var btn_close = _box.find('.close');
		
		//alert("close vlaue" + btn_close);
		
		if(_box.hasClass('active')) slide_box.show();
		//else slide_box.hide();

/******************************************** BLOG ***************************************************************/

		btn_open_blog.click(function(count_base){
			//alert("open function call "+count_plus);
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{		
						if(anchorTags[i].id == 'blog-right') {
						//alert(count_base); 
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}		
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{

								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'blog-right'){
						anchorTags[i].className = 'open-blog';
						anchorTags[i].title = 'open-blog';
						}					
					}
				}
				
			}

			return false;
		});
		
/******************************************** FOCUS ***************************************************************/
		
		btn_open_focus.click(function(count_base){
			//alert("open function call "+count_plus);
			if(!_box.hasClass('active')){
				//alert("active");
				_box.addClass('active');
				slide_box.slideUp(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'focus-right') {
						anchorTags[i].className = 'open-focus';
						anchorTags[i].title = 'open-focus';
						}		
				}
					
			}
			
			else{
			    
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						//alert(anchorTags[i].className);
						
				if(anchorTags[i].className == 'open-focus')
						{
								if(_box.hasClass('active'))
								{
								
								_box.removeClass('active');
								slide_box.slideDown(300);}
								
						if(anchorTags[i].id == 'focus-right'){
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}
					}
				}	
			}
			
			return false;
		});
		
		/*btn_close.click(function(){
			//alert("close function call "+count_minus);
			if(_box.hasClass('active')){
				_box.removeClass('active');
				slide_box.slideUp(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
					if(anchorTags[i].className == 'close')
					{
						
						if(anchorTags[i].id == 'focus-right'){
						anchorTags[i].className = 'open-blog';
						anchorTags[i].title = 'open';
						}
					}
				}
			
	
			}
			return false;
		});*/
		
/******************************************** SUBCRIBE ***********************************************************/
		
		btn_open_subscribe.click(function(){
							  
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'subscribe-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'subscribe-right'){
						anchorTags[i].className = 'open-subscribe';
						anchorTags[i].title = 'open-subscribe';
						}
					}
				}	
			}
			
			return false;
		});

/******************************************** NEWS ***********************************************************/
		
		btn_open_news.click(function(){
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'news-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'news-right'){
						anchorTags[i].className = 'open-news';
						anchorTags[i].title = 'open-news';
						}
					}
				}	
			}
			
			return false;
		});
		
/******************************************** NEWS ***********************************************************/
		
		btn_open_tagcloud.click(function(){
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
						if(anchorTags[i].id == 'tagcloud-right') {
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						}		
				}
					
			}
			
			else{
			
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				
				{
				if(anchorTags[i].className == 'close')
						{
								if(_box.hasClass('active')){
								_box.removeClass('active');
								slide_box.slideUp(300);}
								
						if(anchorTags[i].id == 'tagcloud-right'){
						anchorTags[i].className = 'open-tagcloud';
						anchorTags[i].title = 'open-tagcloud';
						}
					}
				}	
			}
			
			return false;
		});

/******************************************** CLOSE ***********************************************************/

		/*btn_close.click(function(){
			alert("close function call");
			if(_box.hasClass('active')){
				_box.removeClass('active');
				slide_box.slideUp(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
					if(anchorTags[i].className == 'close')
					{
		
						if(anchorTags[i].id == 'news-right'){
						anchorTags[i].className = 'open-news';
						anchorTags[i].title = 'open';
						}
						
					}
				}
			
	
			}
			return false;
		});*/

			
   });
	
});


/*
function slide_parts_open(count_plus,count_minus){
	
$(document).ready(function(){
   $('.slide-block').each(function(){
		var _box = $(this);
		var slide_box = _box.find('.slide-part');
		
		var btn_open = _box.find('.open');

		if(_box.hasClass('active')) slide_box.show();
		else slide_box.hide();
		
		
		
		btn_open.click(function(){
			//alert("open function call "+count_plus);
			if(!_box.hasClass('active')){
				_box.addClass('active');
				slide_box.slideDown(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
					if(anchorTags[i].className == 'open')
					{
						//alert(anchorTags[i].id); 
						//alert(anchorTags[i].className);
						//var returnVar = document.getElementById("focus"); 
						
						if(anchorTags[i].id == 'focus-right'){
						anchorTags[i].className = 'close';
						anchorTags[i].title = 'close';
						count_plus++;
						slide_parts_close();
						
						}	
					}
				}
					
			}
			return false;
		});
		
   });
});
}

function slide_parts_close(count_plus,count_minus){
	
$(document).ready(function(){
   $('.slide-block').each(function(){
		var _box = $(this);
		var slide_box = _box.find('.slide-part');
		
		var btn_open = _box.find('.open');
		var btn_close = _box.find('.close');
		
		if(_box.hasClass('active')) slide_box.show();
		else slide_box.hide();
		
		btn_close.click(function(){
			//alert("close function call "+count_minus);
			if(_box.hasClass('active')){
				_box.removeClass('active');
				slide_box.slideUp(300);
				
				var anchorTags = document.getElementsByTagName("a");
				for (var i = 0; i < anchorTags.length ; i++)
				{
					if(anchorTags[i].className == 'close')
					{
						//alert(anchorTags[i].id); 
						//alert(anchorTags[i].className);
						
						//var returnVar = document.getElementById("focus"); 
						
						if(anchorTags[i].id == 'focus-right'){
						anchorTags[i].className = 'open';
						anchorTags[i].title = 'open';
						count_minus++;
						}

						
					}
				}
			
			}
			return false;
		});
		
   });
});
}*/

