$(document).ready(function(){
	
	$(".cycle_container").cycle({
				fx: 'fade',
				timeout: 4000,
				next:'#cycle_next',
				prev:'#cycle_prev',
				after:function(){
					$(".cycle_title>a").html($(this).find("img").attr("alt"));
					$(".cycle_title>a").attr("href",$(this).find("a").attr("href"));
				}
	});
	
	$(".b_khabar_vijeh").hover(function(){
		$(this).find(".bolet_vijeh2").attr('src','/fa/img/bolet_o.gif');
	},
	function(){
		$(this).find(".bolet_vijeh2").attr('src','/fa/img/bolet_n.gif');
	});
	
	$(".tpl5").hover(function(){
		$(this).children('img').attr('src','/fa/img/dot_o.gif');
	},function(){
		$(this).children('img').attr('src','/fa/img/dot.gif');
	});

	$(".tpl15").hover(function(){
		$(this).children('img').attr('src','/fa/img/bolet_tab_o.gif');
	},function(){
		$(this).children('img').attr('src','/fa/img/bolet_tab.gif');
	});

	$(".tpl6").hover(function(){
		$(this).find('.bolet_ax').attr('src','/fa/img/bolet_ax_o.gif');
		$(this).find('.pic3').css({borderColor: '#D97379'});
	},function(){
		$(this).find('.bolet_ax').attr('src','/fa/img/bolet_ax.gif');
		$(this).find('.pic3').css({borderColor: '#ABABAB'});
	});
	/*
	$("#your_choice").click(function(){
		$(this).addClass('active_tab');
		$("#most_visited").removeClass('active_tab');
		$("#most_visited_content").hide();
		$("#your_choice_content").show();
		return false;
	});
	$("#most_visited").click(function(){
		$(this).addClass('active_tab');
		$("#your_choice").removeClass('active_tab');
		$("#your_choice_content").hide();
		$("#most_visited_content").show();
		return false;
	});
	*/
	
	var settings1 ={
		navHeight : 32,
		seperatorHeight : 2,
		
		//Text Colors
		navTextColorNormal :"#000",
		navTextColorOver :"#5A5A5A", 
		navTextColorActive : "#FFF",
		
		//Active Image and Over Image Are The Same?
		overAndActiveImgAreSame:false,
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : true,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : true
	};
	$("#nav1").isNavigation(settings1);
	
	var settings2={
		
		//Text Colors
		navTextColorNormal :"#727272",
		navTextColorOver :"#DCA6AA", 
		navTextColorActive : "#F42026",
		
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : false,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : false
	};
	
	$("#nav2").isNavigation(settings2);
	var settings3={
		
		//Text Colors
		navTextColorNormal :"#575757",
		navTextColorOver :"#B80F0F", 
		navTextColorActive : "#000",
		
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : false,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : false
	};
	
	$("#nav3").isNavigation(settings3);
	/*----------------------- 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();
};