


if (typeof Naruco == 'undefined') var Naruco = {};

Naruco.debug = false;

var isFunction = function(a){ return typeof a == "function"; };
var isNull     = function(a){ return typeof a == "object" && !a; };
var isNumber   = function(a){ return typeof a == "number" && isFinite(a);};
var isObject   = function(a){ return (a && typeof a == "object") || isFunction(a);};
var isString   = function(a){ return typeof a == "string";};
var isArray    = function(a){ return isObject(a) && a.constructor == Array; };
var isUndef    = function(a){ return typeof a == "undefined";};
var DoUnchanged= function(a){ return a;}
var DoNothing  = function(){};


Naruco.Cookie = {
	set: function(label, value, expireTime){
		var cookie = label + "=" + escape(value) +";  path=/;";
		if (isUndef(expireTime))
			document.cookie = cookie;
		else{
			var expires = new Date();
			expires.setTime(expires.getTime() + expireTime*1000);
			document.cookie = label + "=" + escape(value) +";  path=/; expires=" + expires.toGMTString() + ";";
		}
	},

	get: function(label){
		return isNull(document.cookie.match(new RegExp("(^"+label+"| "+label+")=([^;]*)"))) ? "" : unescape(RegExp.$2);
	},

	clear: function(label){
		Cookie.set(label, "");
	},

	getAll: function(){
		return document.cookie;
	}
};

Naruco.ajaxGet = function(url, data, complete_fn) {
	jQuery.ajax({
		url:		url,
		data:		data,

		error: function(request) {
			jQuery('#notices')
				.show()
				.append('<p class="alert">Error ' + request.status + ': ' + request.statusText + '</p>');
		},

		success: function() {
			jQuery('#notices').hide().html();
		},

		complete: function(request) {

			// Disable obtrusive document.write
			document.write = function(str) {};

			if ( Naruco.debug ) {
				//The debug console is a self contained
				//but now , here nothing to do
				//console.log(request);
			}

			if ( complete_fn ) {
				complete_fn( request.responseText );
			}

			// Lightbox v2.03.3 - Adds new images to lightbox
			if (typeof myLightbox != "undefined" && myLightbox instanceof Lightbox && myLightbox.updateImageList) {
				myLightbox.updateImageList();
			}
		}
	});
}

function fGoto() {}



