$(document).ready(function(){
	var settings = {
		navHeight : 29,
		seperatorHeight : 2,
		
		//Text Colors
		navTextColorNormal :"#143556",
		navTextColorOver :"#2F74B9", 
		navTextColorActive : "#000",
		
		//Active Image and Over Image Are The Same?
		overAndActiveImgAreSame:false,
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : true,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : true
		
	};
	$("#tnav").isNavigation(settings);
	
	/*----------------------- Start Link Page Pager -----------------------*/
	$(".link_next").click(function(){
		var i = 0;
		var activeelem = 0;
		var totalChilds = 0;
		var box_container = $(this).parent().next();
		$(box_container).children().each(function(){
			if($(this).css('display') == 'block'){
				activeelem = i;
			}
			i++;
		});
		totalChilds = i;
		i = 0;
		$(box_container).children().each(function(){
			if(i == activeelem){
				$(this).hide('fast');
				$(this).next().show('fast');
				
			}
			i++;
		});
		activeelem = 0;
		i= 0;
		$(box_container).children().each(function(){
			if($(this).css('display') == 'block'){
				activeelem = i;
			}
			i++;
		});
		if(activeelem == totalChilds-1){
			$(box_container).prev().children(".link_prev").show();
			$(box_container).prev().children(".link_next").hide();
		} else{
			$(box_container).prev().children(".link_prev").show();
		}
		fix_height();
		return false;
		
	});
	
	$(".link_prev").click(function(){
		var i = 0;
		var activeelem = 0;
		var totalChilds = 0;
		var box_container = $(this).parent().next();
		$(box_container).children().each(function(){
			if($(this).css('display') == 'block'){
				activeelem = i;
			}
			i++;
		});
		totalChilds = i;
		i = 0;
		$(box_container).children().each(function(){
			if(i == activeelem){
				$(this).hide('fast');
				$(this).prev().show('fast');
			}
			i++;
		});
		activeelem = 0;
		i= 0;
		$(box_container).children().each(function(){
			if($(this).css('display') == 'block'){
				activeelem = i;
			}
			i++;
		});
		if(activeelem == 1){
			$(box_container).prev().children(".link_prev").hide();
			$(box_container).prev().children(".link_next").show();
		} else {
			$(box_container).prev().children(".link_next").show();
		}
		fix_height();
		return false;
		
	});
	/*----------------------- End Link Page Pager -----------------------*/
	
	
});
function links_loaded(){
	fix_height();
};
function fix_height(){
	$("#container_links").balanceChildrenHeight();
};