if(typeof Prototype=='undefined'){
	throw("Baby, gimme Prototype!");
}

var Cookie = {
	set: function(name, value, daysToExpire) {
		var expire = '';
		if (daysToExpire != undefined) {
			var d = new Date();
			d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));expire = '; expires=' + d.toGMTString();
		}
		return (document.cookie = escape(name) + '=' + escape(value || '') + expire +"; path=/");
	},
	get: function(name) {
		var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));
		return (cookie ? unescape(cookie[2]) : null);
	},
	erase: function(name) {
		var cookie = Cookie.get(name) || true;
		Cookie.set(name, '', -1);
		return cookie;
	}
}

var imgwins = [];
var imginfos = [];
var thumbs = [];

function swapThumb(target,obj, titletarget,bildtitel) {
	if (imgwins[target] && thumbs[obj]) {
	var preview_target = imgwins[target];
		preview_target.src = thumbs[obj].src;
	}
	if (imginfos[titletarget]) {
		imginfos[titletarget].innerHTML = bildtitel;
	}
}

function register_imgwin(id, imginfo){
	var tmp = (typeof Prototype=='undefined') ? document.getElementById(id) : $(id);

	imgwins[id] = tmp;
	if (!imginfos[imginfo]) {
		var ii = (typeof Prototype=='undefined') ? document.getElementById(imginfo) : $(imginfo);
		imginfos[imginfo]=ii;

	}
}
function preloadThumb(id, url) {

	if (id && url) {
	var tmp = new Image();
	tmp.src = url;
	thumbs[id] = tmp;
	}

}
function open_galerie(href) {
//
	window.open(href,'popup_galerie','resizable=yes,width=750,height=700,toolbar=no,status=no,menubar=no,scrollbars=yes').focus();
	return false;
}

