$(function(){
	$('.togglea  a').bind('click',function(){
		$(this).parent().next().toggle();
	});
	$('.tab li').bind('mouseover',function(){
		if($(this).attr('class')=='close'){
			$(this).removeClass('close');
			$(this).addClass('move');			
		}
	});
	$('.tab li').bind('mouseout',function(){
		if($(this).attr('class')=='move'){
			$(this).removeClass('move');
			$(this).addClass('close');			
		}
	});
	$('.headtag').bind('click',function(){
		$.each($('.text'),function(i,o){
			$(o).hide();
		})
		$('.tab li').removeClass();
		$('.tab li').addClass('close');
		$('#'+$(this).attr('rel')).show();
		$(this).parent().addClass('on');
		$(this).parent().removeClass('close');
		if($(this).attr('rel')=='dual_view'){
			$('#footer').css('top','750px') ;
		}else{
			$('#footer').attr('style','') ;
		}
		$('#nextpage').attr('rel',$(this).attr('id'));
		$('#prevpage').attr('rel',$(this).attr('id'));
		$('#nextpage').show();
		$('#prevpage').show();
		if(Number($('#nextpage').attr('rel'))==1){
			$('#prevpage').hide();
		}
		if(Number($('#nextpage').attr('rel'))==11){
			$('#nextpage').hide();
		}
		location.href="#";
	});
	$('#nextpage').bind('click',function(){
		o = $('#prevpage');
		if($(this).attr('rel')==''||$(this).attr('rel')=='undefined'){
			$(this).attr('rel','2');
			$(o).attr('rel','2');
		}else{
			
			if(Number($(this).attr('rel'))<11){
				$(this).attr('rel',Number($(this).attr('rel'))+1);
				$(o).attr('rel',Number($(this).attr('rel'))+1);
			}
		}
		$('#'+$(this).attr('rel')).click();
	});
	$('#prevpage').bind('click',function(){
		o = $('#nextpage');
		if($(this).attr('rel')==''||$(this).attr('rel')=='undefined'){
			$(this).attr('rel','2');
			$(o).attr('rel','2');
		}else{
			
			if (Number($(this).attr('rel')) > 1) {
				$(this).attr('rel', Number($(this).attr('rel')) - 1);
				$(o).attr('rel', Number($(this).attr('rel')) - 1);
			}	
		}
		$('#'+$(this).attr('rel')).click();
	});
})
