﻿/****************************************************************************************	
	[GLOBAL JQUERY FUNCTIONS]
*****************************************************************************************/

// Enable Enter Key for Search Image Button
$(document).ready(function() {
    var $btn = $('.btn-submit');
    var $form = $btn.parents('#toolbar fieldset');
    $form.keypress(function(e) {
        if (e.which == 13 && e.target.type != 'textarea') {
            if ($btn[0].type == 'submit' || $btn[0].type == 'image') {
                $btn[0].click();
            } else {
                eval($btn[0].href);
            }
            return false;
        }
    });
});

// Clear text input values
var swap_text_boxes = []; 
function init_swap_text_boxes(){
  $('input.clear-txt').each(function() {
    swap_text_boxes[$(this).attr('id')] = $(this).attr('value');
  });
  $('input.clear-txt').bind('focus', function() {
    if($(this).val() == swap_text_boxes[$(this).attr('id')]) {
      $(this).val('');
    }
  });
  $('input.clear-txt').bind('blur', function() {
    if($(this).val() == '') {
      $(this).val(swap_text_boxes[$(this).attr('id')]);
    }
  });
} 
$(document).ready(function(){init_swap_text_boxes();});

// CSS Advanced Selectors
