
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25540656-1']);
_gaq.push(['_trackPageview']);
(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

// google +1 button render script
window.___gcfg = {lang: 'sv'};
(function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();


var wennerlund = function() {
	var uniqueIndex = 0;
	function getNewID() {
		uniqueIndex++;
		return 'unid_' + uniqueIndex;
	}
	function fader(tag, interval, fadetime) {
		if (tag) {
			if (!tag.id) tag.id = getNewID();
			this.id = tag.id;
		} else {
			alert('fader must be assigned to an imagetag');
		}
		this.interval = interval || 5000;
		this.fadetime = fadetime || 500;
		this.images = new Array();
		this.index = 0;
		this.alpha = 20;
	}
	fader.prototype.add = function(url) {
		this.images[this.images.length] = url;
	}
	fader.prototype.start = function(stop) {
		var scopeThis = this;
		if (!stop)
			this.tag(true).src = this.images[(this.index+1)%this.images.length];
		clearTimeout(this.fadehandle);
		this.fadehandle = setTimeout(function(){scopeThis.fade(stop);}, this.interval);
	}
	fader.prototype.fade = function(stop, inverted) {
		clearTimeout(this.fadehandle);
		var scopeThis = this;
		if ((this.alpha>0 && !inverted) || (this.alpha<20 && inverted)) {
			this.alpha=(this.alpha + (inverted?1:-1))%21
			this.tag(true).style.filter = 'alpha(opacity=' + (100-100*(this.alpha/20)) + ')';
			this.tag(true).style.opacity = 1-(this.alpha/20);
			this.tag(true).style.display = 'block';
			this.fadehandle = setTimeout(function(){scopeThis.fade(stop, inverted);}, Math.round(this.fadetime/20));
		} else {
			if (!stop) {
				this.alpha = 20;
				this.index++;
				this.tag().src = this.images[this.index%this.images.length];
				this.tag(true).style.display = 'none';
				this.tag(true).src = this.images[(this.index+1)%this.images.length];
				this.fadehandle = setTimeout(function(){scopeThis.fade(stop);}, this.interval-this.fadetime);
			}
		}
	}

	fader.prototype.init = function() {
		var scopeThis = this;
		this.tag().onmouseover = function() {
			scopeThis.start(true);
		}
		this.tag(true).onmouseover = function() {
			scopeThis.start(true);
		}
		this.tag(true).onmouseout = function() {
			scopeThis.fade(true,true);
		}
	}

	fader.prototype.tag = function(isFader) { return document.getElementById(this.id + ((isFader)?'fader':'')); }
	return {fader:fader};
}();




