$(document).ready(function(){
	
	$("#top_menu").superfish({
		autoArrows	: false,
		dropShadows:	false
	});
	
	settings={
		//Heights
		navHeight : 49,
		seperatorHeight : 2,
		//Text Colors
		navTextColorNormal :"#696969",
		navTextColorOver :"#5E7DB2", 
		navTextColorActive : "#325693",
		
		//Active Image and Over Image Are The Same?
		overAndActiveImgAreSame:false,
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : true,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgImageOnOver : true
	};
	$("#nav1").isNavigation(settings);
	$("#nav4").isNavigation(settings);
	
	settings={
		//Text Colors
		navTextColorNormal :"#505285",
		navTextColorActive : "#0F16A5",
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgImageOnActive : false,

		//Over Operations
		changeTextDecorationOnOver : true,
		changeBgImageOnOver : false
	};
	$("#nav2").isNavigation(settings);
	
	settings={
		//Heights
		navHeight : 20,
		seperatorHeight : 2,
		
		//Text Colors
		navTextColorNormal :"#4F4F4F",
		navTextColorOver :"#3F3E39", 
		navTextColorActive : "#E9E9E1",
		
		//Background Colors
		navBgColorNormal : "#FFF",
		navBgColorOver : "#DBD6C3",
		navBgColorActive : "#ABA58B",
		
		//Active Image and Over Image Are The Same?
		overAndActiveImgAreSame:false,
		
		//Active Operations
		changeTextColorOnActive : true,
		changeBgColorOnActive : true,
		changeBgImageOnActive : true,
		
		//Over Operations
		changeTextColorOnOver : true,
		changeBgColorOnOver : true,
		changeBgImageOnOver : true
	};
	$("#nav3").isNavigation(settings);
	
	//----------------------- Start Image Cycle -------------------------
	$(".cycle_container").cycle({
							fx: 'fade',
							speed: 500,
							timeout: 5000,
							after:function(){
								$(".cycle_title").html($(this).find("img").attr("alt"));
							}
	});
	//------------------------ 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 home_loaded(){
	var elements= new Array();
	elements[0]="#box1";
	elements[1]="#box2";
	elements[2]="#box3";
	elements[3]="#box4";
	
	$.balanceElementHeight(elements);
	
};
	
function inner_loaded(){
	$(".page_body").balanceChildrenHeight();	
};

function links_loaded(){
	fix_height();
};
function fix_height(){
	$("#container_links").balanceChildrenHeight();
};
function album_loaded(){
	$(".page_body").balanceChildrenHeight();
	$("#r_box").height($(".page_body").height()-37);
};