function startSubmitMouseListener(){
	$(document).ready(function(){	
		$(":submit").mouseover(function(e){
			var oThis = $(this);			
			var start = oThis.attr("class").lastIndexOf(" ");
			start = start == -1 ? 0 : start;
			var orgClass = oThis.attr("class").substr(start);
			oThis.addClass(orgClass+"Hover");
		}).mouseout(function(e){
			var oThis = $(this);
			var orgClass = oThis.attr("class").substr(0, oThis.attr("class").lastIndexOf(" ", oThis.attr("class").lastIndexOf(" ")));
			oThis.attr("class", orgClass);
		});
	});
}

startSubmitMouseListener();

function setDefaultValue(selector, defValue){
	$(selector).each(function(){
		if($.trim(this.value) == ""){
			this.value = defValue;
		}
	});

	$(selector).focus(function(){
		if($.trim(this.value) == defValue){
			this.value = "";
		}
	});

	$(selector).blur(function(){
		if($.trim(this.value) == ""){
			this.value = defValue;
		}
	});
}
var Loader = null;
var isLoading = false;

/**
 * Loader ajaxowy podczepiony pod kursor
 */
function ajaxLoader(selector){
	if(Loader == null){
		if(document.captureElements){
			document.captureEvents(Event.MOUSEMOVE);
		}
		selector = selector ? selector : "#ajaxLoader";
		Loader = $(selector);
		
		Loader.css("position", "absolute");
		Loader.css("display", "none");
	}

    if(isLoading){
    	isLoading = false;
    	Loader.css("display", "none");
    	document.onmousemove = null;
    }else{
    	isLoading = true;
    	Loader.css("display", "");

    	document.onmousemove = function(e){
        	var x = typeof event !== "undefined" ? event.clientX + document.body.scrollLeft : e.pageX;
        	var y = typeof event !== "undefined" ? event.clientY + document.body.scrollTop : e.pageY;

    		Loader.css("top", y + 20);
    		Loader.css("left", x + 20);
    	};
    }
}
