
function setHightlight() {
	$('.formInput').focus(function() {
		$(this).addClass('highlight');
	}).blur( function() {
		$(this).removeClass('highlight');
	});
	//$('input:text').hint();
}
function doJson( json ) {
  // handle the json object here
}

function DoAction(gadget, target, task) {
	var strLocation = document.location + "";

	var url = 'index2.php?gadget=' + gadget + '&action=' + task;

	var imagepath = 'images/ajax-loading.gif';
	if (strLocation.indexOf('/admin/') > 0)
	{
		imagepath = "../" + imagepath;
	}

	//$("#divLoading").show("fast");
	$(target).html("<img src='"+imagepath+"'>").load(url);
	//$("#divLoading").hide("slow");
}

function DoAction2(gadget, target, task) {
	var strLocation = document.location + "";

	var url = 'index2.php?gadget=' + gadget + '&action=' + task;

	var imagepath = 'images/ajax-loading.gif';
	if (strLocation.indexOf('/admin/') > 0)
	{
		imagepath = "../" + imagepath;
	}

	//$("#divLoading").show("fast");
	$(target).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');
	});

	setHightlight();
	$('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();
		}
	})
}


