var fxtimer = null;
var delay_ms;
function notify(type,msg,delay_ms){
	//type = error/success
	//msg = success/filetype/[custom]/null
	//delay_ms = ms/null

	if (fxtimer) { clearTimeout(fxtimer); } //clear previous timeout
	$("#notify_pop").hide().css("position","fixed"); //Hide the notifier
	
	if (!delay_ms) { delay_ms = 6000; } //6000 is default
	if (!type) { type = "error"; }
	
	if (type == "success") {
		$("#ui_state").addClass('ui-state-highlight').removeClass('ui-state-error');
		$("#ui_icon").addClass('ui-icon-info').removeClass('ui-state-alert');
	} else {
		$("#ui_state").addClass('ui-state-error').removeClass('ui-state-highlight');
		$("#ui_icon").addClass('ui-icon-alert').removeClass('ui-state-info');
	}
	
	$("#error_filetype_msg").hide();
	$("#error_custom_msg").hide();
	
	if (msg == "filetype") {
		$("#error_filetype_msg").show();
	} else if (msg){
		$("#error_custom_msg").html(msg).show();
	}
	
	function callback(){
		fxtimer = setTimeout(function(){
			$("#notify_pop").hide("blind");
		},delay_ms);
	};
	
	$("#notify_pop").show("bounce",0,"normal",callback);
};

$(document).ready(function(){
	$("#close_notify").click(function(){
		if (fxtimer) { clearTimeout(fxtimer); } //clear previous timeout
		$("#notify_pop").hide("blind").css("position","absolute"); //Hide the notifier
	});
});