
function highlightField() {
	$('input.formField, textarea.formField, select.formField').focus(function(){
		$(this).addClass('formField_active');
	}).blur(function(){
		$(this).removeClass('formField_active');
	});
}

function doJson( json ) {
  // handle the json object here
}

function DoAction(gadget, target, task) {
	var strLocation = document.location + "";

	var url = 'index2.php?ys=' + gadget + '&action=' + task;
	var imagepath = 'images/ajax-loading.gif';
	if (strLocation.indexOf('/admin/') > 0)
	{
		imagepath = "../" + imagepath;
		//url = 'administrator/' + url;
	}

	//$("#divLoading").show("fast");
	$(target).html("<img src='"+imagepath+"'>").load(url);
	//$("#divLoading").hide("slow");
}

//load the script when the DOM is ready
$(document).ready(function() {

	$('a').click(function() {
		this.blur();
	});

	$('.topMenuLink').hover(function() {
		$(this).addClass('topMenu-pretty-hover');
	}, function() {
		$(this).removeClass('topMenu-pretty-hover');
	});

	highlightField();
	$('input:text').hint();
});


jQuery.fn.hint = function() {
	return this.each(function(){
		var t = $(this); // get jQuery version of 'this'
		var title = t.attr('title'); // get it once since it won't change

		if (title) { // only apply logic if the element has the attribute

			// on focus, set value to blank if current value matches title attr
			t.focus(function(){
				if (t.val() == title) {
				  t.val('');
				  t.removeClass('blur');
				}
			})

			// on blur, set value to title attr if text is blank
			t.blur(function(){
				if (t.val() == '') {
				  t.val(title);
				  t.addClass('blur');
				}
			})

			// now change all inputs to title
			t.blur();
		}
	})
}


function stripeMe() {
	$(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
	$(".stripeMe tr:even").addClass("alt");
}
