// Ajaxifying forms
$.fn.ajaxify = function () {
    var $form = this;
    var $div = this.closest("div");
    $form.ajaxForm({
    	target: $div,
    	success: function() { 
            $div.fadeIn('slow');
            $("form.ajaxified").ajaxify(); 
        }
    });
}
var LIGHTBOX_OPTIONS = {
    imageLoading:			RESOURCES_PATH+'/images/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
    imageBtnPrev:			RESOURCES_PATH+'/images/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
    imageBtnNext:			RESOURCES_PATH+'/images/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
    imageBtnClose:			RESOURCES_PATH+'/images/lightbox/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
    imageBlank:				RESOURCES_PATH+'/images/lightbox/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
    nothing: null
};

$(function () {
    /* Lightbox */
    $('a.lightBox').lightBox(LIGHTBOX_OPTIONS);

    $("form.ajaxified").ajaxify(); 
    
    $("form.searchForm input[type=text]")
        .focus(function () {
            if (this.value.match(/Search the site/)) {
                this.value = '';
                $(this).css({ color: '#000' });
            }
        })
        .blur(function () {
            if (this.value.match(/^\s*$/)) {
                this.value = 'Search the site';
                $(this).css({ color: null });
            }
        })
    ;
});

