var auroraMenuSpeed = 400;

$(document).ready(function(){
	equalHeight($(".neurri"));
	$.cookie('testcookie' , 'expanded');
	var auroramenucount = 0;
	$('.auroramenu').each(function(){
		var auroramenuitemcount = 0;
		$(this).children('li').children('ul').each(function(){
			if($.cookie('arMenu_' + auroramenucount + '_arItem_' + auroramenuitemcount) == 1){
				$(this).siblings('a').attr('onClick' , 'auroraMenuItem(\'' + auroramenucount + '\' , \'' + auroramenuitemcount + '\' , \'0\'); return false;');
				$(this).parent().children('.aurorahide').css("display","inline");
				$(this).parent().children('.aurorashow').css("display","none");
			} else {
				$(this).css("display","none");
				$(this).siblings('a').attr('onClick' , 'auroraMenuItem(\'' + auroramenucount + '\' , \'' + auroramenuitemcount + '\' , \'1\'); return false;');
				$(this).parent().children('.aurorahide').css("display","none");
				$(this).parent().children('.aurorashow').css("display","inline");
			}
			auroramenuitemcount ++;
		});
		auroramenucount ++;
	});
	/*$(".tab_content").hide(); //Hide all content
	$(".tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$(".tabs li").click(function() {

		$(".tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});*/
	$(function() {
		$('#gallery a').lightBox();
	});
});
function auroraMenuItem(menu , item , show){
    $.cookie('arMenu_' + menu + '_arItem_' + item , show);
	var auroramenucount = 0;
	$('.auroramenu').each(function(){
		if(menu == auroramenucount){	
			var auroramenuitemcount = 0;
			$(this).children('li').children('ul').each(function(){
				if(item == auroramenuitemcount){
					if(show == 1){
						$(this).slideDown(auroraMenuSpeed);
						//$(this).click(auroraMenuItemHide(menu , item));
						$(this).siblings('a').attr('onClick' , 'auroraMenuItem(\'' + menu + '\' , \'' + item + '\' , \'0\'); return false;');
						$(this).parent().children('.aurorahide').css("display","inline");
						$(this).parent().children('.aurorashow').css("display","none");
					} else {
						$(this).slideUp(auroraMenuSpeed);
						$(this).siblings('a').attr('onClick' , 'auroraMenuItem(\'' + menu + '\' , \'' + item + '\' , \'1\'); return false;');
						$(this).parent().children('.aurorahide').css("display","none");
						$(this).parent().children('.aurorashow').css("display","inline");
					}
				}
				auroramenuitemcount ++;
			});
		}
		auroramenucount ++;
	});
}

window.onload = function() {
	 setLinks();
}
function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
			$('#footer').css("margin-bottom",(tallest+60)+"px");
		}
	});
	group.height(tallest);
	
}
function setLinks() {
	if (!document.getElementsByTagName) return false;
	var links = document.getElementsByTagName("a");
	if (links.length == 0) return false;
	for (var i = 0; i < links.length; i++) {
		var relation = links[i].getAttribute("rel");
		if (relation == "external") {
			links[i].onclick = function() {
				return !window.open(this.href);
			}
		}     
	}
}
