function menuMalarky(){
	$("#mainMenyProper li a span").css({ 'opacity': "0.0", 'display': "block" });
	$("#mainMenyProper li a span").hover(function(){$(this).fadeTo(50, 1.0);}, function(){$(this).fadeTo(300, 0.0);} );
	$("#tabbyMenu li:not(.selected) a img").hover(function(){$(this).animate({opacity : '1'}, 200);}, function(){$(this).animate({opacity : '.75'}, 300);} );
	}

function replaceHeading(){
	$(".replaceWithArcher").each(function (){
		content = $(this).text();
		$(this).flashembed({
			//flashembed vars
			src: "/assets/flash/hRep_prlArcher.swf",
			version: [9, 0], //required to prevent replacement on mobiles
			wmode: "transparent",
			width: "100%",
			height: "100%",
			scale: "noscale",
			salign: "lt" }, {
			//vars to flash file
			headingText: encodeURIComponent(content),
			headingColor: "0x262216",
			headingSize: 30,
			headingLetterSpacing: 0,
			headingOffsetX: -3,
			headingOffsetY: 0 });
		});
	$(".replaceWithArcherSm").each(function (){
		content = $(this).text();
		$(this).flashembed({
			//flashembed vars
			src: "/assets/flash/hRep_prlArcher.swf",
			version: [9, 0], //required to prevent replacement on mobiles
			wmode: "transparent",
			width: "100%",
			height: "100%",
			scale: "noscale",
			salign: "lt" }, {
			//vars to flash file
			headingText: encodeURIComponent(content),
			headingColor: "0x73716a",
			headingSize: 20,
			headingLetterSpacing: -1,
			headingOffsetX: -2,
			headingOffsetY: 0 });
		});
	$(".errors h2").each(function (){
		content = $(this).text();
		$(this).css({height: "25px"});
		$(this).flashembed({
			//flashembed vars
			src: "/assets/flash/hRep_prlArcher.swf",
			version: [9, 0], //required to prevent replacement on mobiles
			wmode: "transparent",
			width: "100%",
			height: "100%",
			scale: "noscale",
			salign: "lt" }, {
			//vars to flash file
			headingText: encodeURIComponent(content),
			headingColor: "0xffffff",
			headingSize: 20,
			headingLetterSpacing: -1,
			headingOffsetX: -2,
			headingOffsetY: 0 });
		});
	}

function miscHoveryButt(){
	$("a.hoveryOpacityButt img").hover(function(){$(this).animate({opacity : '1'}, 200);}, function(){$(this).stop(true,false).animate({opacity : '.85'}, 300);} );
	}


function collapseHidden() {
	$(".collapseMe").hide();
	$(".collapseMe").each(function () {
		if ($(this).prev().is("ul, ol")) {
			var linkPrefixE = '<li class="expandButton">';
			var linkSuffixE = '</li>';
			var insideAhrefE = '';
			var linkPrefixC = '<li class="collapseButton">';
			var linkSuffixC = '</li>';
			var insideAhrefC = '';
			}
		else {
			var linkPrefixE = ' ';
			var linkSuffixE = '';
			var insideAhrefE = ' class="expandButton"';
			var linkPrefixC = ' ';
			var linkSuffixC = '';
			var insideAhrefC = ' class="collapseButton"';
			}
		
		var titleExpand = $(this).attr('title');
		
		if (!titleExpand) titleExpand = 'Tell me more &raquo;';
		
		$(this).prev().append(linkPrefixE+'<a href="javascript:void(0)"'+insideAhrefE+'>'+titleExpand+'</a>'+linkSuffixE);
		$(this).prev().append(linkPrefixC+'<a href="javascript:void(0)"'+insideAhrefC+'>Hide &laquo;</a>'+linkSuffixC);

		$(this).removeAttr('title');
		});
	}

function expandHidden() {
	$(".expandButton").click(function (){ 
		$(this).fadeOut(100, function (){
			$(this).parents().next(".collapseMe").slideDown(300, function(){ 
				$(this).css({ 'display': "block" });
				/* 
				  because internet explorers work in mysterious ways... Table contained in the .collapseMe blinks and disappears
				  when the animation finishes--unless opacity is forced--but forced opacity breaks font anti-alliasing when on 
				  normal text blocks, causing weird black artifacts around some letters.
				*/
				if ($.browser.msie && parseInt ($.browser.version) == 7 && $(this).children("table").length > 0) $(this).css({"opacity" : "1.0"});
				});
			$(this).next(".collapseButton").fadeIn(100);
			});		
		});
	}

function collapseExpanded() {
	$(".collapseButton").click(function (){ 
		$(this).fadeOut(100, function (){
			$(this).parents().next(".collapseMe").slideUp(300);
			$(this).prev(".expandButton").fadeIn(100);
			});		
		});
	}



$(document).ready(function(){
	menuMalarky();
	replaceHeading();
	miscHoveryButt();
	$('#gallerySlideSling a.slideLinky').lightBox({ overlayBgColor: '#2d2023', overlayOpacity: 0.8});
	
	collapseHidden();
	expandHidden();
	collapseExpanded();
	
});