$(document).ready(function(){
	$('.m_read').bind('click',function(){$('.l_read').css('display','block');$('.l_comm').css('display','none');$('.m_comm').removeClass('mid_head');$('.m_read').addClass('mid_head');});
	$('.m_comm').bind('click',function(){$('.l_read').css('display','none');$('.l_comm').css('display','block');$('.m_read').removeClass('mid_head');$('.m_comm').addClass('mid_head');});
	$('.search').bind('mouseover',function(){if($('.search').val()=='Search'){$('.search').val('');}});
	$('.search').bind('mouseout',function(){if($('.search').val().length==0){$('.search').val('Search');}});
	
	$('.comm_cat').bind('click',function(){
		var c_id=$(this).attr('c_id');
		
		$('.comm_cat').removeClass('comm_cat_on');
		$('.tab_cat').css('display','none');
		$(this).addClass('comm_cat_on');
		$('.cat_'+c_id).css('display','');
	});
	
});
var start=1,max,inter;

$(document).ready(function(){
	$('.top_small').bind('mouseover',function(){
		$(this).children('.cover').addClass('cover_on2');
	});
	$('.top_small').bind('mouseout',function(){
		$(this).children('.cover').removeClass('cover_on2');
	});
	$('.top_small').bind('click',function(){
		var c_big,c_st;
		clearInterval(inter);
		c_st=$(this).attr('c_big');
		c_big='c_big_'+c_st;
		
		$('.'+c_big).css('left','+680px');
		$('.'+c_big).css({'zIndex':1300,opacity:0});
		$('.'+c_big).animate({left:20+'px',opacity:1},600,function(){
			$('.curr').not('.'+c_big).css('zIndex',1200);
			$('.'+c_big).css('zIndex',1205);
		});
		$('.top_small .cover').removeClass('cover_on');
		$(this).children('.cover').addClass('cover_on');
		start=parseInt(c_st)+1;
		inter=setInterval('move_big();',5000);
	});
	$('.search').bind('keyup',function(event){
		if(event.keyCode==13 && $(this).val().length>=3){
			window.location='/?x=0&y=0&s='+encodeURIComponent($(this).val());
		}else if(event.keyCode==13 && $(this).val().length>0 && $(this).val().length<3){
			alert('You need to enter at least 3 characters.');
		}
	});
	inter=setInterval('move_big();',5000);
});
function move_big(){
	max=$('.top_small').size();
	if(start>max-1){start=0;}
	$('.small_'+start).trigger('click');
}
