/*
dependencies:
	jquery.js (http://jquery.com/)
	jquery.dimensions-1.2.js (http://plugins.jquery.com/project/dimensions)
	jquery.cluetip.js (http://plugins.learningjquery.com/cluetip/)
*/

/* set up help links */
$(document).ready(function() {
    $('a.helpTest').cluetip({
        showTitle: false,
        width: 400
    });
});
$(document).ready(function() {
    $('a.help').cluetip({
        showTitle: false,
		activation: 'click',
		closeText: '<img src="/images/b_exit.png">',
        width: 400,
		sticky: true
    });
});
// set title and alt attribute on all help images
$(document).ready(function() {
	$('img.help').each(function() {
		$(this).attr({title: "Help", alt: "Help"});
	});
});

/*  button helper code */
$(document).ready( function() {
    blurButton($('input.fancyButton'));
    blurButton($('div').find('input.formButton'));
    blurButton($('div').find('input.cautionButton'));
});
function blurButton(buttonHandle)
{
    buttonHandle.focus( function() {
        $(this).blur();
    });
}
$(document).ready( function() {
    var fdButtons = $('div').find('input.formButton');
    buttonActive(fdButtons, 'formButton', 'formButtonActive');
    var fyButtons = $('input.fancyButton');
    buttonActive(fyButtons, 'fancyButton', 'fancyButtonActive');
    var cnButtons = $('div').find('input.cautionButton');
    buttonActive(cnButtons, 'cautionButton', 'cautionButtonActive');
});
function buttonActive(buttonHandle, fromClass, toClass)
{
    if ($.browser.opera) { return; }
    buttonHandle.mousedown( function() {
        var wide = $(this).width();
        $(this).attr('width', wide + 14);
        $(this).attr('class', toClass);
    });
    buttonHandle.mouseup( function() {
        $(this).attr('class', fromClass);
    });
}




