// Initializes User Scripts:

$(document).ready(function() {
	startMenu();
	if (document.getElementById('layerContainer')) {
		divHeightStart();
	}
	if (document.getElementById('supportColumn')) {
		divSupportHeightStart();
	}
	$("a#BPTOC").click(function() {
		$("ul#catalogBPTOC").slideToggle("normal");
		if ($("a#BPTOC img").attr("src") == "/collapse-plus.gif") {
			$("a#BPTOC img").attr({
				src: "/collapse-minus.gif",
				alt: "[-]"
			});
		} else {
			$("a#BPTOC img").attr({
				src: "/collapse-plus.gif",
				alt: "[+]"
			});
		}
	});
	$("a#RTOC").click(function() {
		$("ul#catalogRTOC").slideToggle("normal");
		if ($("a#RTOC img").attr("src") == "/collapse-plus.gif") {
			$("a#RTOC img").attr({
				src: "/collapse-minus.gif",
				alt: "[-]"
			});
		} else {
			$("a#RTOC img").attr({
				src: "/collapse-plus.gif",
				alt: "[+]"
			});
		}
	});
	// Initialize Pixelsilk Email This URL Plugin:
	//$('#emailFriendLink').emailUrl();

	// Kludge: if menu item text contains "Company", make width so that it's 1-column
	$("#siteMenu ul li:contains('Company') ul").css({
		'min-width': '190px',
		'width': 'auto',
		'padding-right': '20px'
	});
});

function adjustHeight() {
	var rtColHeight = $("#rightColumn").height();
	rtColHeight -= 2;
	$("#layerContainer").height(rtColHeight);
	$("#descriptionLayer").height(rtColHeight);
	$("#featuresLayer").height(rtColHeight);
	$("#imagesLayer").height(rtColHeight);
	$("#demoLayer").height(rtColHeight);
}
function divHeightStart() {
	adjustHeight();
	document.body.onresize = adjustHeight;
	window.onresize = adjustHeight;
}
function adjustSupportHeight() {
	var rtColHeight = $("#rightColumn").height();
	rtColHeight -= 2;
	$("#supportColumn").height(rtColHeight);
}
function divSupportHeightStart() {
	adjustSupportHeight();
	document.body.onresize = adjustSupportHeight;
	window.onresize = adjustSupportHeight;
}

