(function($){$.jNotify={defaults:{autoHide:true,clickOverlay:false,MinWidth:200,TimeShown:2000,ShowTimeEffect:200,HideTimeEffect:200,LongTrip:15,HorizontalPosition:'center',VerticalPosition:'top',ShowOverlay:true,ColorOverlay:'#000',OpacityOverlay:0.3,onClosed:null,onCompleted:null},init:function(msg,options,id){opts=$.extend({},$.jNotify.defaults,options);if($("#"+id).length==0)
$Div=$.jNotify._construct(id,msg);WidthDoc=parseInt($(window).width());HeightDoc=parseInt($(window).height());ScrollTop=parseInt($(window).scrollTop());ScrollLeft=parseInt($(window).scrollLeft());posTop=$.jNotify.vPos(opts.VerticalPosition);posLeft=$.jNotify.hPos(opts.HorizontalPosition);if(opts.ShowOverlay&&$("#jOverlay").length==0)
$.jNotify._showOverlay($Div);$.jNotify._show(msg);},_construct:function(id,msg){$Div=$('<div id="'+id+'"/>').css({opacity:0,minWidth:opts.MinWidth}).html(msg).appendTo('body');return $Div;},vPos:function(pos){switch(pos){case'top':var vPos=ScrollTop+parseInt($Div.outerHeight(true)/2);break;case'center':var vPos=ScrollTop+(HeightDoc/2)-(parseInt($Div.outerHeight(true))/2);break;case'bottom':var vPos=ScrollTop+HeightDoc-parseInt($Div.outerHeight(true));break;}
return vPos;},hPos:function(pos){switch(pos){case'left':var hPos=ScrollLeft;break;case'center':var hPos=ScrollLeft+(WidthDoc/2)-(parseInt($Div.outerWidth(true))/2);break;case'right':var hPos=ScrollLeft+WidthDoc-parseInt($Div.outerWidth(true));break;}
return hPos;},_show:function(msg){$Div.css({top:posTop,left:posLeft});switch(opts.VerticalPosition){case'top':$Div.animate({top:posTop+opts.LongTrip,opacity:1},opts.ShowTimeEffect,function(){if(opts.onCompleted)opts.onCompleted();});if(opts.autoHide)
$.jNotify._close();else
$Div.css('cursor','pointer').click(function(e){$.jNotify._close();});break;case'center':$Div.animate({opacity:1},opts.ShowTimeEffect,function(){if(opts.onCompleted)opts.onCompleted();});if(opts.autoHide)
$.jNotify._close();else
$Div.css('cursor','pointer').click(function(e){$.jNotify._close();});break;case'bottom':$Div.animate({top:posTop-opts.LongTrip,opacity:1},opts.ShowTimeEffect,function(){if(opts.onCompleted)opts.onCompleted();});if(opts.autoHide)
$.jNotify._close();else
$Div.css('cursor','pointer').click(function(e){$.jNotify._close();});break;}},_showOverlay:function(el){var overlay=$('<div id="jOverlay" />').css({backgroundColor:opts.ColorOverlay,opacity:opts.OpacityOverlay}).appendTo('body').show();if(opts.clickOverlay)
overlay.click(function(e){e.preventDefault();opts.TimeShown=0;$.jNotify._close();});},_close:function(){switch(opts.VerticalPosition){case'top':if(!opts.autoHide)
opts.TimeShown=0;$Div.stop(true,true).delay(opts.TimeShown).animate({top:posTop-opts.LongTrip,opacity:0},opts.HideTimeEffect,function(){$(this).remove();if(opts.ShowOverlay&&$("#jOverlay").length>0)
$("#jOverlay").remove();if(opts.onClosed)opts.onClosed();});break;case'center':if(!opts.autoHide)
opts.TimeShown=0;$Div.stop(true,true).delay(opts.TimeShown).animate({opacity:0},opts.HideTimeEffect,function(){$(this).remove();if(opts.ShowOverlay&&$("#jOverlay").length>0)
$("#jOverlay").remove();if(opts.onClosed)opts.onClosed();});break;case'bottom':if(!opts.autoHide)
opts.TimeShown=0;$Div.stop(true,true).delay(opts.TimeShown).animate({top:posTop+opts.LongTrip,opacity:0},opts.HideTimeEffect,function(){$(this).remove();if(opts.ShowOverlay&&$("#jOverlay").length>0)
$("#jOverlay").remove();if(opts.onClosed)opts.onClosed();});break;}},_isReadable:function(id){if($('#'+id).length>0)
return false;else
return true;}};jNotify=function(msg,options){if($.jNotify._isReadable('jNotify'))
$.jNotify.init(msg,options,'jNotify');};jSuccess=function(msg,options){if($.jNotify._isReadable('jSuccess'))
$.jNotify.init(msg,options,'jSuccess');};jError=function(msg,options){if($.jNotify._isReadable('jError'))
$.jNotify.init(msg,options,'jError');};})(jQuery);

// Browser
var _ua = navigator.userAgent.toLowerCase();
var browser = {
	version: (_ua.match( /.+(?:me|ox|on|rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
	opera: /opera/i.test(_ua),
	msie: (/msie/i.test(_ua) && !/opera/i.test(_ua)),
	msie6: (/msie 6/i.test(_ua) && !/opera/i.test(_ua)),
	msie7: (/msie 7/i.test(_ua) && !/opera/i.test(_ua)),
	msie8: (/msie 8/i.test(_ua) && !/opera/i.test(_ua)),
	msie9: (/msie 9/i.test(_ua) && !/opera/i.test(_ua)),
	mozilla: /firefox/i.test(_ua),
	chrome: /chrome/i.test(_ua),
	safari: (!(/chrome/i.test(_ua)) && /webkit|safari|khtml/i.test(_ua)),
	iphone: /iphone/i.test(_ua),
	ipod: /ipod/i.test(_ua),
	iphone4: /iphone.*OS 4/i.test(_ua),
	ipod4: /ipod.*OS 4/i.test(_ua),
	ipad: /ipad/i.test(_ua),
	safari_mobile: /iphone|ipod|ipad/i.test(_ua),
	opera_mobile: /opera mini|opera mobi/i.test(_ua),
	mobile: /iphone|ipod|ipad|opera mini|opera mobi/i.test(_ua)
};

// DOM loaded
$(function() {
	
});
