	jQuery.fn.selectTab = function (){
		var tabId = $(this).attr('id');
		var contId = tabId + 'body';
		$('#' + contId).siblings().addClass('unselectedTabBody');
		$('#' + contId).removeClass('unselectedTabBody');
		$(this).siblings().removeClass('selectedTabHeader');
		this.addClass('selectedTabHeader');
		$('#' + tabId + 'body .tabtext:first').selectBody();
		$('#'+tabId+'body .tabtext:eq(0) .prevnext:eq(0)').siblings().removeClass('selectedPrevNext');
		$('#'+tabId+'body .tabtext:eq(0) .prevnext:eq(0)').addClass('selectedPrevNext');
	}
	jQuery.fn.selectBody = function (){
		$(this).siblings().addClass('unselectedTabBody');
		this.removeClass('unselectedTabBody');
	}
	
	jQuery.fn.nextTabBody = function (){
		$(this).parent().next().selectBody();
	}
	jQuery.fn.prevTabBody = function (){
		$(this).parent().prev().selectBody();
	}
	
	$(document).ready(function() {
		$('#box123 .tabtext').append("<div class='prevnextdiv'>");
		$('#box123 .tabbody').each(function(){
			tid = $(this).attr('id');
			ttcount = $('#'+tid+' .tabtext').length;
			if(ttcount>1){
				for(i=1;i<=ttcount;i++){
					$('#'+tid+' .tabtext').each(function(){
						$(this).append("<div class='prevnext'>"+i+"</div>");
					});
				}
			}
		});	
		$('#box123 .tabtext').append("</div>");
		$('#box123').css('overflow','');
		$('#box123 .tabheader:first').selectTab();
		
		$('#box123 .tabheader').click(function(){
			$(this).selectTab();
		});
		$('#box123 .tabheader').hover(function(){
				$(this).addClass('hoveredTabHeader');
			},
			function(){
				$(this).removeClass('hoveredTabHeader');
			}
		);
		$('#box123 .tabtext .prevnext').hover(function(){
				$(this).addClass('hoverPrevNext');
			},
			function(){
				$(this).removeClass('hoverPrevNext');
			}
		);
		$('#box123 .tabtext .prevnext').click(function(){
			selectedTabId = $(this).text();
			selectedTabId--;
			pid = $(this).parents('.tabbody').attr('id');
			$('#'+pid+' .tabtext:eq('+selectedTabId+')').selectBody();
			$('#'+pid+' .tabtext:eq('+selectedTabId+') .prevnext:eq('+selectedTabId+')').siblings().removeClass('selectedPrevNext');
			$('#'+pid+' .tabtext:eq('+selectedTabId+') .prevnext:eq('+selectedTabId+')').addClass('selectedPrevNext');
		});
	});
	
		//$('#box123 .tabtext:not(:first-child)').append("<div class='prevTabBody'>Önceki</div> ");
		//$('#box123 .tabtext:not(:last-child)').append(" <div class='nextTabBody'>Sonraki</div>");
		//$('#box123 .tabtext .nextTabBody').click(function(){
		//	$(this).nextTabBody();
		//})
		//$('#box123 .tabtext .prevTabBody').click(function(){
		//	$(this).prevTabBody();
		//})
