
	$(document).ready(function(){

		// set search bar opacity
		//$(".searchbar").css("opacity","0.70");
		// fades seachbar in and out on hover
		$(".searchbar").mouseover(function() {
			$(this).stop().fadeTo("fast", 1.00);
		}).mouseout(function() {
			$(this).stop().fadeTo(1200, 0.70);
		});
			
		$("#nav li.dropdown a").click(function(event) {
			$("#nav li.dropdown").toggleClass("show");
			if (ie > 0 && ie <= 8) {
				$("#header").css('z-index', '1000'); // fix for IE
			}
			$("#nav .dropdown ul").toggle();
		    event.stopPropagation();
		});

		// fixes background issue in IE
		if (ie > 0 && ie <= 8) {
			$("#nav li.dropdown").toggle(
				  function () {
					$(this).css('background-color', '#999999');
				  },
				  function () {
					$(this).css('background-color', 'transparent');
				  }
			 );
		}
		
		$("#nav .dropdown ul").click(function(event) {
			event.stopPropagation();
		});

		$('body').click(function() {
			$("#nav li.dropdown").removeClass("show");
			$("#nav .dropdown ul").hide();
		});
		
		// brings pop over to front and shows it
		$('.box-invite').click(function(){
			$('#pop-over-wrap').css('z-index', '200');
			$('#pop-over-wrap').show();		
		});
		
		// sends pop over back and hides
		$('.close').click(function(){
			$('#pop-over-wrap').css('z-index', '-200');
			$('#pop-over-wrap').hide();		
		});
		
		
		//shows and hides items in dropdown side menus
		$('.box.dropdown h2 a').click(function(){
			$(this).parents().next("div:first").toggle();
		});
		update_scroll_arrow();

		// custom dropdown box
		$(document).bind('click', function(e) {
			var $clicked = $(e.target);
			if (! $clicked.parents().hasClass("dropdownbox"))
				$(".dropdownbox-content ul").hide();
		});

	});

function make_dropdown(o, updated) {
	// custom dropdown box
	$(".dropdownbox-label a", o).click(function() {
		$(".dropdownbox-content ul", o).toggle();
	});
	$(".dropdownbox-content ul li a", o).click(function() {
		var text = $(this).html();
		$(".dropdownbox-label a span", o).html(text);
		$(".dropdownbox-content ul", o).hide();
		//var dd = $(this).parent().parent().parent().parent();
		var newVal = o.find(".dropdownbox-label a span.value").html();
		$("input[type=hidden]", o).val(newVal);
		if (updated) {
			updated(newVal);
		}
	});
}

function update_scroll_arrow() {
		// set landing page arrow opacity
		$(".scroll-arrow").css("opacity","0.50");
		// arrow seachbar in and out on hover
		$(".scroll-arrow").mouseover(function() {
			$(this).stop().fadeTo("fast", 1.00);})
			.mouseout(function() {
			$(this).stop().fadeTo(500, 0.50);});
		
}
