$(document).ready(function(){
	if($('body').attr('id') == 'dah_dar_yek'){
		var elem = "";
		var id = 0;
		$(".rss_title").click(function(){
			if(!$(this).hasClass('active_title')){
				id = $(".rss_tabs").find('a.active_title').attr('id');
				id = id.substr(7);
				elem = "#rss_content"+id;
				$(elem).hide();
				$(".rss_tabs").find('a.active_title').removeClass('active_title');
				
				$(this).addClass('active_title');
				id = $(this).attr('id');
				id = id.substr(7);
				elem = "#rss_content"+id;
				$(elem).show();
				return false;
				
			}
			return false;
		});
	} else if($('body').attr('id') == 'home'){
		var elem2= "";
		$(".tab").click(function(){
			if(!$(this).hasClass('active_tab')){
				elem2 = "#content_"+$(".tabs").find('a.active_tab').attr('id');
				$(elem2).hide();
				$(".tabs").find('a.active_tab').removeClass('active_tab');
				
				$(this).addClass('active_tab');
				elem2 = "#content_"+$(this).attr('id');
				$(elem2).show();
				return false;
				
			}
			return false;
		});
		setTimeout('refresh()', 900000);
	}
	
	settings={
		//Heights
		navHeight : 29,
		seperatorHeight : 2,
		
		//Text Colors
		navTextColorNormal :"#9E9E9E",
		navTextColorOver :"#8EC387", 
		navTextColorActive : "#318B2F",
		
		overAndActiveImgAreSame: false,
		changeTextColorOnActive : true,
		changeBgImageOnActive : true,
		changeTextColorOnOver : true,
		changeBgImageOnOver : true
	};
	$("#nav1").isNavigation(settings);
	
	settings={
		//Text Colors
		navTextColorNormal :"#1E3410",
		navTextColorOver :"#1E3410", 
		navTextColorActive : "#F6FBF4",
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : false,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : false
	};
	$("#nav2").isNavigation(settings);
	
	settings={
		//Text Colors
		navTextColorNormal :"#AEAEAE",
		navTextColorOver :"#296F27", 
		navTextColorActive : "#A0CA63",
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : false,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : false
	};
	$("#nav3").isNavigation(settings);
	
	//$("#container").tabs({remote:true});
	
	// Start Image Cycle
	$(".cycle_container").cycle({
							fx: 'fade',
							timeout: 5000,
							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"));
							}
	});
	// End Image Cycle
	
	
	
	/*----------------------- 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();
};
function refresh(){
	var sURL = unescape(window.location);
	window.location.href = sURL;
};
