$(document).ready(
	function()
	{
		
		
		// Activate Lightbox for the Photo Gallery
		$('#gallery a').lightBox();
		
		
		// Show Toggle Buttons
		$("a.toggle").css("display","block");
		$("a.toggle").addClass('toggleplus');

		// Hide all togglable elements.
		$(".togglable").hide();

		// Toggle Function
		$('a.toggle').click(function()
			{
				$(this).toggleClass('toggleplus');
				$(this).parent('h4').next('div.togglable').slideToggle('fast');
				return false;
			}
		);

		// Toggle h4 as well...
		$('h4.togglename').css("cursor","pointer");
		$('h4.togglename').click(function()
			{
				$(this).children('a.toggle').toggleClass('toggleplus');
				$(this).next('div.togglable').slideToggle('fast');
				return false;
			}
		);

		//Toggle Poster Content on For___ Pages
		$(".postercontent").width('0');
		$('#forposter h2 a').toggle(function()
			{
				$(".postercontent").animate({ 
		        width: "250px"}, 500 );
				return false;
			}, function()
			{
				$(".postercontent").animate({ 
		        width: "0"}, 300 );
				return false;
			}
		);

		// Zebra Tables
		$("tr:nth-child(odd)").addClass("odd");


		// Product page tabbing.
		var newtabitems = "";
		$('.dltype').each(function(){
			tabid = $(this).attr('id');
			tabname = tabid;
			switch (tabid){
			case "TechnicalInformation":
			tabname = "Technical";
			break;
			case "DetailedDrawings":
			tabname = "Drawings"
			break;
			case "AttachmentPatterns":
			tabname = "Attachment Patterns";
			break;
			}
			
			newtabitems += '<li><a href="#'+ tabid +'">'+tabname+'</a></li>';
		});
		$('ul#prodtabber').children('li:first').after(newtabitems);
		$('#pnlProduct .panelcontainer:not(:first)').hide();
		$('ul#prodtabber a:first').addClass('active');
		$('ul#prodtabber a').click(function() {
			$('.panelcontainer').hide();
			$('ul#prodtabber a').removeClass('active');
			$(this).addClass('active');
			var lp = $(this).attr("href");
			$(lp).fadeIn('fast');
			return false;
		});


	}
);