/* ======================================================================================
 * Filename: theme/javascript/functions.js
 * Author: Rebecca Skeers, rebecca@webmistress.com.au, www.webmistress.com.au
 * Copyright: Rebecca Skeers
 * Date: 4 June 2010
 * Description: JavaScript functions for the Building eValuate website.
 * Visual design: Kieran Bradley, kieran@workhorse.net.au, www.workhorse.net.au
 *
 * This file may not be used for any purpose other than for the Building eValuate website 
 * and may not be copied or modified without written permission from the author.
 * ======================================================================================
 */

$(document).ready(function()
{	

	// Drop down menus for IE6
	$("#nav li").hover(
		function () 
		{
			$(this).addClass("hover");
		},
		function()
		{
			$(this).removeClass("hover");
		}
	);
	
	
	$('a.lightbox').lightBox();

	
	// Links with rel="external" open in a new window
	$("a[rel='external']").attr("target","_blank");
	
	// Print link functionality
	$("a.print").click(
		function () 
		{
			if (window.print)
				window.print();
			else
				alert("Sorry, your browser doesn't support the print feature. Use the File menu on your browser to select Print.");
			return false;	
		}
	);

	$("p > img.image-left").closest("p").css("padding","0");
	$("p > img.image-right").closest("p").css("padding","0");
	
	

	$(".form-field").each(function(index) 
	{ 
		var inputwidth = $(this).width() - $("label",this).width() - 26;
		$(".form-input input",this).css("width",inputwidth+"px");
		$(".form-input textarea",this).css("width",inputwidth+"px");
	});

	
	
});


