(function(jQuery){$.utils={};$.utils.dimensions={mouse:function(e,offset){return({top:e.pageY+offset,left:e.pageX+offset});},window:function(){return({centerX:$(window).width()/2,centerY:$(window).height()/2});},anchor:function(anchor,target,options){var offset=$(anchor).offset();var coords={};switch(options.position){case"bottom left":coords={top:offset.top+$(anchor).height(),left:offset.left};break;case"bottom right":coords={top:offset.top+$(anchor).height(),left:(offset.left-$(target).width())+$(anchor).width()};break;default:coords={top:offset.top,left:offset.left};break;};return({top:coords.top+options.margin.top,left:coords.left+options.margin.left});}};$.utils.validation={email:function(source){return($.utils.regexPatterns.email().test($(source).val()));},empty:function(source){return($(source).val().length<1);},alpha:function(source){return($.utils.regexPatterns.alpha().test($(source).val()));}};$.utils.regexPatterns={email:function(){return(/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,4})+$/);},alpha:function(){return(/^[a-zA-Z0-9]+$/);},nonAlpha:function(){return(/[^a-zA-Z0-9]/);},whiteSpace:function(){return(/[\s]/);},singleHyphen:function(){return(/-(?=-)/);}};$.utils.events={keyFunc:function(key,func){$(document).keyup(function(e){if(e.keyCode==key&&func!=undefined&&typeof(func)=='function'){func();};});},notify:function(status,keys,file){$.utils.ajaxify({url:$.config.paths.translate(),data:JSON.stringify({resourceKeys:keys,resourceFile:file}),success:function(msg){var infoType='<span class="'+status+'">'+msg.Password+'</span>';var infoText='<p>'+msg.UserName+'</p>';$('#infobox').append(infoType).append(infoText).addClass(status).show();}});},progress:{show:function(){},hide:function(){}},translate:function(keys,file){var translations=null;$.utils.ajaxify({url:$.config.paths.translate(),async:false,data:JSON.stringify({resourceKeys:keys,resourceFile:file}),success:function(data){translations=data;}});return translations;}};$.utils.ajaxify=function(config){jQuery.ajax(jQuery.extend({type:"POST",data:"{}",dataType:"json",contentType:"application/json; charset=utf-8",beforeSend:function(){$.utils.events.progress.show();},error:function(xhr,status,error){var err=eval("("+xhr.responseText+")");alert(xhr.responseText);},complete:function(){$.utils.events.progress.hide();}},config));};})(jQuery);
