// remap jQuery to $
(function($){})(window.jQuery);


/* trigger when page is ready */
$(document).ready(function (){
/*	if (window.PIE) {
        $('.sub-menu').each(function() {
            PIE.attach(this);
        });
    }  */
	 var zIndexNumber = 5500;
/*	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});  */
	// your functions go here
	$(".mission").hover(function() {
			$(this).addClass("activemission");
			$(".activemission_extra").hide();
			$(this).find(".activemission_extra").show();
		//	$.scrollTo($(this), 2500, {offset:-50});
}, function() {
	   	    $(this).removeClass("activemission");
			$(".activemission_extra").hide();
									   });
	$(".pushpin").not(".pushpin_on").hover(function() {
			$(this).find(".activelocation_extra").show();
			$(this).css('zIndex',zIndexNumber + 10);
			zIndexNumber += 10;
			}, function() {
			$(this).find(".activelocation_extra").hide(); });
	$(".pushpin_on").find(".activelocation_extra").show();
//	$(".ie7 .activelocation_extra").show();
	$("#sponsorroll").css({marginTop: 150});
	$("form input, form textarea").addPlaceholder();
	repeater = setTimeout(spin,1300);
	function spin() {
		var toplimit = 0 - $("#sponsorroll").height();
//		alert(toplimit);
		$("#sponsorroll").animate({marginTop: toplimit},35000, "linear", function() {
			$(this).css({marginTop:150});
			spin();
		 });
	}
	$(".slide_trigger").click(function() {
			if ($(this).next(".slide_content").is(":visible")) {
				$(".slide_content").slideUp();
				$(".slide_trigger").css("clear","both");
			} else {
				var offset = $(".slide_content:visible").height();
				$(".slide_content:visible").slideUp();
				$(this).next(".slide_content").slideDown('slow',function() {
				$.scrollTo($(this), 1000, {offset:-100});
																		 });
			}
			});
	$("html").ajaxComplete(function(e,xhr,settings) {
		$(".slide_trigger").unbind('click');
		$("a[href$='.pdf']").addClass("pdf");
		$("a[href$='.doc']").addClass("doc");
		$(".slide_trigger").click(function() {
			if ($(this).next(".slide_content").is(":visible")) {
				$(".slide_content").slideUp();
				$(".slide_trigger").css("clear","both");
				
			} else {
				$(".slide_content").slideUp();
				$(this).next(".slide_content").slideDown();
			}
		});	
									});
	$("a[href$='.pdf']").addClass("pdf");
	$("a[href$='.doc']").addClass("doc");
//			$(this).next(".sponsor_details").slideToggle(); });
/*	$("#event_about_btn").click(function() {
			$("#feedlinks a").removeClass("active");
			$(this).addClass("active");
			$("#event_about").show();
			$("#event_bios, #event_recap").hide();
										 });
	$("#event_bios_btn").click(function() {
			$("#feedlinks a").removeClass("active");
			$(this).addClass("active");
			$("#event_bios").show();
			$("#event_about,#event_recap").hide();
										 });
	$("#event_recap_btn").click(function() {
			$("#feedlinks a").removeClass("active");
			$(this).addClass("active");
			$("#event_recap").show();
			$("#event_bios, #event_about").hide();
										 }); */
	$("ul.tabs").tabs("div.panes > div", {
					  history: true,
					  effect:'ajax',
					  onBeforeClick: function(event, tabIndex) {
						  var myTab = this.getTabs()[tabIndex].toString();
						  if (myTab.indexOf("php")<0) {
							  window.open(this.getTabs()[tabIndex]);
							  return false;
						  } 
						  return true; 
//						  alert(this.getTabs()[tabIndex].toString());
					  }
					  });

	$("#form1").validator({inputEvent: "keyup change"});
	$("#searchform").submit(function() {
			if (!$("#searchform #s").val()) {
				return false;
			} else {
				return true;
			}
									 });
});



/* optional triggers

$(window).load(function() {
	
});

$(window).resize(function() {
	
});

*/
