﻿/****************************************************************************************	
	[GLOBAL JQUERY FUNCTIONS]
*****************************************************************************************/

// Enable Forms to be Submitted via ENTER key
var AreaSelector = "#wrapper fieldset,#main-content";
var ButtonSelector = "input[type='submit'],input[type='image'],button";
$(document).ready(function() {
jQuery.each($(AreaSelector), function() {
        $(this).keypress(function(e) {
            if (e.which == 13 && e.target.type != 'textarea') {
                var arrItems = $(this).find(ButtonSelector);
                if (arrItems.length > 0) {
                    $(this).find(ButtonSelector)[0].click();
                } else {
                    eval($(this).find(".btn-submit")[0].href);
                }
                return false;
            }
        });
    });
});


// Clear text input values
var swap_text_boxes = [];
$(document).ready(function() {
    jQuery.each($("input[type='text'].autoclear"), function() {
        swap_text_boxes[$(this).attr('id')] = $(this).attr('value');
        $(this).bind('focus', function() {
            if ($(this).val() == swap_text_boxes[$(this).attr('id')]) {
                $(this).val('');
            }
        });
        $(this).bind('blur', function() {
            if ($(this).val() == '') {
                $(this).val(swap_text_boxes[$(this).attr('id')]);
            }
        }); 
    });
});

// CSS Advanced Selectors

// Mimicking the :hover Pseudo-class in IE6
/*$(document).ready(function () {
	var li = $('table td');
  		li.mouseover(function () {
    	$(this).addClass('hover');
  	});
  		li.mouseout(function () {
    	$(this).removeClass('hover');
  	});
});*/
