// JavaScript Document
var pageTracker=_gat._getTracker("UA-778473-3");

//NoobSlide
var noobSlide=new Class({initialize:function(a){this.items=a.items;this.mode=a.mode||'horizontal';this.modes={horizontal:['left','width'],vertical:['top','height']};this.size=a.size||240;this.box=a.box.setStyle(this.modes[this.mode][1],(this.size*this.items.length)+'px');this.button_event=a.button_event||'click';this.handle_event=a.handle_event||'click';this.onWalk=a.onWalk||null;this.currentIndex=null;this.previousIndex=null;this.nextIndex=null;this.interval=a.interval||5000;this.autoPlay=a.autoPlay||false;this._play=null;this.handles=a.handles||null;if(this.handles){this.addHandleButtons(this.handles)}this.buttons={previous:[],next:[],play:[],playback:[],stop:[]};if(a.addButtons){for(var b in a.addButtons){this.addActionButtons(b,$type(a.addButtons[b])=='array'?a.addButtons[b]:[a.addButtons[b]])}}this.fx=new Fx.Tween(this.box,$extend((a.fxOptions||{duration:500,wait:false}),{property:this.modes[this.mode][0]}));this.walk((a.startItem||0),true,true)},addHandleButtons:function(a){for(var i=0;i<a.length;i++){a[i].addEvent(this.handle_event,this.walk.bind(this,[i,true]))}},addActionButtons:function(a,b){for(var i=0;i<b.length;i++){switch(a){case'previous':b[i].addEvent(this.button_event,this.previous.bind(this,[true]));break;case'next':b[i].addEvent(this.button_event,this.next.bind(this,[true]));break;case'play':b[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'next',false]));break;case'playback':b[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'previous',false]));break;case'stop':b[i].addEvent(this.button_event,this.stop.bind(this));break}this.buttons[a].push(b[i])}},previous:function(a){this.walk((this.currentIndex>0?this.currentIndex-1:this.items.length-1),a)},next:function(a){this.walk((this.currentIndex<this.items.length-1?this.currentIndex+1:0),a)},play:function(a,b,c){this.stop();if(!c){this[b](false)}this._play=this[b].periodical(a,this,[false])},stop:function(){$clear(this._play)},walk:function(a,b,c){if(a!=this.currentIndex){this.currentIndex=a;this.previousIndex=this.currentIndex+(this.currentIndex>0?-1:this.items.length-1);this.nextIndex=this.currentIndex+(this.currentIndex<this.items.length-1?1:1-this.items.length);if(b){this.stop()}if(c){this.fx.cancel().set((this.size*-this.currentIndex)+'px')}else{this.fx.start(this.size*-this.currentIndex)}if(b&&this.autoPlay){this.play(this.interval,'next',true)}if(this.onWalk){this.onWalk((this.items[this.currentIndex]||null),(this.handles&&this.handles[this.currentIndex]?this.handles[this.currentIndex]:null))}}}});

/* SqueezeBox - Expandable Lightbox
* @version		1.1 rc2
* @author		Harald Kirschner <mail [at] digitarald.de> */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('n Q={J:{v:{x:2D,y:2E},1N:{x:2F,y:2G},1k:{x:20,y:20},1l:{x:1O,y:2H},1P:l,X:p,1Q:u,Y:u,R:2I,1R:0.7,1S:"",1T:"",1U:{},1V:{},1W:{},1m:l,1X:l,1Y:{},1Z:$r,21:$r,22:$r,2J:$r,23:$r,24:$r,25:$r},26:4(a){8(3.6){5 3}3.J=$A(3.J,a);3.6={};3.Z(3.J).27();3.D={K:3.11.z(3,[p]),1n:3.28.z(3),E:3.E.z(3),1o:3.29.z(3)};3.L=3.12=l;5 3},27:4(){3.o=m S("1p",{13:"F-o",2a:{T:"14",R:3.6.R}});3.9=m S("1p",{13:"F-9"});3.Y=m S("a",{13:"F-2K-E",2b:"#"});3.j=m S("1p",{13:"F-K",2a:{T:"14",R:3.6.R+2}}).15(3.Y,3.9);3.G={o:m 16.2c(3.o,$A({2d:"U",2e:1q.2f.2g,17:2h,1r:"1s"},3.6.1U)).M(0),j:m 16.2L(3.j,$A({2e:1q.2f.2g,2i:"B",17:2M,2N:16.2O.2P.2Q,1r:"1s",2i:"B"},3.6.1V)),9:m 16.2c(3.9,$A({2d:"U",17:2h,1r:"1s"},3.6.1W)).M(0)};$(C.1t).15(3.o,3.j)},2R:4(a,b){5 a.2j("1u",4(){5!Q.2k(3,b)})},2k:4(d,e){3.26();8(3.s){3.1v()}3.s=$(d);3.Z($A(3.J,e||{}));8(3.s&&3.6.1m){n f=3.s.2S(3.6.1m);8(f&&(f=2T.2U(f,3.6.1X))){3.Z(f)}}3.2l();3.t=((3.s)?(3.6.t||3.s.18("2b")):d)||"";n g=3.6.1P;8(g){5 3.19(g,3.1a[g].1b(3,u))}n h=l;3.1a.2V(4(a,b){n c=a.1b(3);8(c){h=3.19(b,c);5 u}5 l},3);5 h},2l:4(){3.o.M("2m",3.6.1T);3.j.M("2m",3.6.1S);8(2W.2X.2Y){3.j.1w("F-K-2Z")}},E:4(e){n a=($2n(e)==="30");8(a){e.31()}8(!3.L||(a&&!$32(3.6.1Q).1b(3,e))){5 3}3.G.o.1c(0).2o(3.1x.z(3));3.j.1y("T","14");3.1z();3.L=l;3.H("21",[3.9]);3.1v();5 3},1v:4(){3.s=3.q=p;3.6={};3.2p().Z(3.J).2q()},1A:4(){3.q=p;3.19("1d","33 34 2r")},19:4(a,b){8(!3.1e[a]){5 l}3.9.35="F-9-"+a;3.1B=3.1f.1g(3.G.o.6.17,3,3.1e[a].1b(3,b));8(3.o.36("U")){5 3}3.1x(u);3.G.o.1c(3.6.1R);5 3.11()},1f:4(a,b){3.1B=$2s(3.1B);3.1C();8(!a){3.1D(u)}N{8(3.12){3.1D(l)}3.H("22",[3.9],20)}3.9.r();8(["1d","37",l].38($2n(a))){3.9.M("39",a||"")}N{3.9.15(a)}3.2q();8(!3.L){3.1z(u);3.1h(b,u);3.L=u;3.H("1Z",[3.9])}N{3.1h(b)}},1h:4(a,b){n c=C.1E(),1F=C.2t();3.v=$A((3.12)?3.6.1N:3.6.v,a);n d={O:3.v.x,V:3.v.y,1G:(1F.x+(c.x-3.v.x-3.6.1k.x)/2).P(),1H:(1F.y+(c.y-3.v.y-3.6.1k.y)/2).P()};$2s(3.2u||p);3.1C();8(!b){3.G.j.1c(d).2o(3.1I.z(3))}N{3.j.1J(d).1y("T","");3.2u=3.1I.1g(1O,3)}5 3.11()},1z:4(a){n b=(a)?"2j":"3a";3.Y[b]("1u",3.D.E);3.o[b]("1u",3.D.E);C[b]("3b",3.D.1o)[b]("3c",3.D.1n);K[b]("1h",3.D.K)[b]("1n",3.D.K)},1D:4(a){3.12=a;3.j[(a)?"1w":"2v"]("F-2r");8(a){3.H("3d",[3.j])}},1x:4(a){3.o.1y("T",(a)?"":"14");$(C.1t)[(a)?"1w":"2v"]("1t-3e")},1I:4(){8(3.9.18("U")){3.H("24",[3.j])}3.G.9.1c(1)},1C:4(){8(!3.9.18("U")){3.H("25",[3.j])}3.G.9.M(0)},29:4(e){3f(e.1o){1K"3g":3.E(e);3h;1K"3i":1K"3j":5 l}},28:4(e){5 3.9.3k(e.X)},11:4(){n a=C.1E(),W=C.2t();3.o.1J({1G:W.x+"B",1H:W.y+"B",O:a.x+"B",V:a.y+"B"});3.j.1J({1G:(W.x+(a.x-3.j.3l)/2).P()+"B",1H:(W.y+(a.y-3.j.3m)/2).P()+"B"});5 3.H("23",[3.o,3.j])},2p:4(a){8(!3.$1i){5 3}8(!a){3.$1i=p}N{8(3.$1i[a]){3.$1i[a]=p}}5 3},I:4(a){5 $I(3,a)},1e:m 2w(),1a:m 2w()};Q.I(m 1q($r)).I(m 3n($r)).I(m 3o($r));Q.1a.I({2x:4(a){5(a||(/\\.(?:3p|3q|3r)$/i).2y(3.t))?3.t:l},1L:4(a){8($(3.6.X)){5 $(3.6.X)}8(3.s&&!3.s.3s){5 3.s}n b=3.t.3t(/#([\\w-]+)$/);5(b)?$(b[1]):(a?3.s:l)},2z:4(a){5(a||(3.t&&!(/^(?:3u|#)/i).2y(3.t)))?3.t:l},1M:4(a){5(a||3.t)?3.t:l},1d:4(a){5 u}});Q.1e.I({2x:4(b){n c,k=m 3v();3.q=p;k.1j=k.2A=k.2B=(4(){k.1j=k.2A=k.2B=p;8(!k.O){3.1A.1g(10,3);5}n a=C.1E();a.x-=3.6.1l.x;a.y-=3.6.1l.y;c={x:k.O,y:k.V};3w(n i=2;i--;){8(c.x>a.x){c.y*=a.x/c.x;c.x=a.x}N{8(c.y>a.y){c.x*=a.y/c.y;c.y=a.y}}}c.x=c.x.P();c.y=c.y.P();3.q=$(k);k=p;3.q.3x({O:c.x,V:c.y});8(3.L){3.1f(3.q,c)}}).z(3);k.2C=b;8(k&&k.1j&&k.3y){k.1j()}5(3.q)?[3.q,c]:p},1L:4(a){5 a.1L()},15:$3z(0),2z:4(b){3.q=m 3A.3B($A({3C:"18"},3.6.1Y)).3D({3E:4(a){3.1f(a);3.q=p}.z(3),3F:3.1A.z(3)});3.q.3G.1g(10,3.q,[{t:b}])},1M:4(a){5 m S("1M",$A({2C:a,3H:0,O:3.6.v.x,V:3.6.v.y},3.6.3I))},1d:4(a){5 a}});',62,231,'|||this|function|return|options||if|content||||||||||win|tmp|false|new|var|overlay|null|asset|empty|element|url|true|size||||bind|merge|px|document|bound|close|sbox|fx|fireEvent|extend|presets|window|isOpen|set|else|width|toInt|SqueezeBox|zIndex|Element|display|opacity|height|_1e|target|closeBtn|setOptions||reposition|isLoading|id|none|adopt|Fx|duration|get|setContent|parsers|call|start|string|handlers|applyContent|delay|resize|events|onload|marginInner|marginImage|parse|scroll|key|div|Events|link|cancel|body|click|trash|addClass|toggleOverlay|setStyle|toggleListeners|onError|applyTimer|hideContent|toggleLoading|getSize|_15|left|top|showContent|setStyles|case|clone|iframe|sizeLoading|50|handler|closable|overlayOpacity|classWindow|classOverlay|overlayFx|resizeFx|contentFx|parseSecure|ajaxOptions|onOpen||onClose|onUpdate|onMove|onShow|onHide|initialize|build|checkTarget|onKey|styles|href|Tween|property|onStart|prototype|clearChain|250|unit|addEvent|fromElement|assignOptions|class|type|chain|removeEvents|callChain|loading|clear|getScroll|showTimer|removeClass|Hash|image|test|ajax|onabort|onerror|src|600|450|200|150|75|65555|onResize|btn|Morph|750|transition|Transitions|Quint|easeOut|assign|getProperty|JSON|decode|some|Browser|Engine|trident4|ie6|event|stop|lambda|Error|during|className|retrieve|array|contains|html|removeEvent|keydown|mousewheel|onLoading|overlayed|switch|esc|break|up|down|hasChild|offsetWidth|offsetHeight|Options|Chain|jpg|png|gif|parentNode|match|javascript|Image|for|setProperties|complete|arguments|Request|HTML|method|addEvents|onSuccess|onFailure|send|frameBorder|iframeOptions'.split('|'),0,{}))
SqueezeBox.handlers.url=SqueezeBox.handlers.ajax;
SqueezeBox.parsers.url=SqueezeBox.parsers.ajax;
SqueezeBox.parsers.adopt=SqueezeBox.parsers.clone;

/**************************************************************

        Script  : Image Menu
        Version : 2.3
        Authors : Samuel Birch
        Desc    : 
        Licence : Open Source MIT Licence

**************************************************************/

var ImageMenu = new Class({
        
        getOptions: function(){
                return {
                        OnOpen: $lambda(false),
                        OnClose: $lambda(false),
                        OnClickOpen: $lambda(),
                        OnClickClose: $lambda(),
                        openWidth: 200,
                        transition: Fx.Transitions.Quad.easeOut,
                        duration: 400,
                        open: null,
                        border: 0
                };
        },

        initialize: function(elements, options){
                this.setOptions(this.getOptions(), options);
                
                this.elements = $$(elements);
                
                this.widths = {};
                this.widths.closed = this.elements[0].getStyle('width').toInt();
                this.widths.openSelected = this.options.openWidth;
                this.widths.openOthers = Math.round(((this.widths.closed*this.elements.length) - (this.widths.openSelected+this.options.border)) / (this.elements.length-1))
                
                
                this.fx = new Fx.Elements(this.elements, {wait: false, duration: this.options.duration, transition: this.options.transition});
                
                this.elements.each(function(el,i){
                        el.addEvent('mouseenter', function(e){
                                new Event(e).stop();
                                this.reset(i);
                                if(this.options.OnOpen){
                                        this.options.OnOpen(el, i);
                                }
                        }.bind(this));
                        
                        el.addEvent('mouseleave', function(e){
                                new Event(e).stop();
                                this.reset(this.options.open);
                                if(this.options.OnClose){
                                        this.options.OnClose(el, i);
                                }
                        }.bind(this));
                        
                        var obj = this;
                        
                        el.addEvent('click', function(e){
                        
                                if(obj.options.OnClickOpen){
                                        new Event(e).stop();
                                        if(obj.options.open == i){
                                                obj.options.open = null;
                                                obj.options.OnClickClose(this.href, i);
                                        }else{
                                                obj.options.open = i;
                                                obj.options.OnClickOpen(this.href, i);
                                        }
                                        
                                }
                                
                        })
                        
                }.bind(this));
                
                if(this.options.open != null){
                        if($type(this.options.open) == 'number'){
                                this.reset(this.options.open);
                                
                        }else{
                                this.elements.each(function(el,i){
                                        if(el.id == this.options.open){
                                                this.reset(i);
                                        }
                                },this);
                        }
                }
                
        },
        
        reset: function(num){
        
                if($type(num) == 'number'){
                        var width = this.widths.openOthers;
                        if(num+1 == this.elements.length){
                                width += this.options.border;
                        }
                }else{
                        var width = this.widths.closed;
                }
                
                var obj = {};
                this.elements.each(function(el,i){
                        var w = width;
                        if(i == this.elements.length-1){
                                w = width+5
                        }
                        obj[i] = {'width': w};
                }.bind(this));
                
                if($type(num) == 'number'){
                        obj[num] = {'width': this.widths.openSelected};
                }
                                
                this.fx.start(obj);
        }
        
});

ImageMenu.implement(new Options);
ImageMenu.implement(new Events);

//--------------------------------Noobslide-------------------------------------------
	window.addEvent('domready', function(){
var nS2 = new noobSlide({
			box: $('theSlides'),
			items: [0,1],
			interval: 3000,
			size: 820,
			fxOptions: {
				duration: 1400,
				transition: Fx.Transitions.Quart.easeOut,
				wait: false
			},
			addButtons: {
				//previous: $('prev1'),
				//play: $('play1'),
				//stop: $('stop1'),
				next: $('next1')
			}
		});

//	}); //slut domready

//---använd Imagemenu
  //      window.addEvent('domready', function(){
/*                var basicMenu = new ImageMenu($$('#imageMenuBasic a'),{
                        openWidth:310, 
                        border:2
                });*/
                
                var advancedMenu = new ImageMenu($$('#imageMenuAdvanced a'),{
                        openWidth:326, 
                        border:2,
                        //open: 1,
/*                        OnOpen: function(el, i){
													
                                $('log').set('html', 'menu item <b>opened</b>: <br>link: {element} <br>this is number {num} in the list'.substitute({element: el, num: (i+1)}));
                        },
                        OnClose: function(el, i){
                                $('log').set('html', 'menu item <b>closed</b>: <br>link: {element}  <br>this is number {num} in the list'.substitute({element: el, num: (i+1)}));
                        },  */
                        OnClickOpen: function(el, i){
if (i==1 || i==5){
	if (i==1){
		//nS2.next;
	} else {
		//alert("FEM");
	}
} else {
location.href=el;	
}
                                /*$('log').set('html', 'menu item <b>clicked open</b>: <br>link: {element}  <br>this is number {num} in the list'.substitute({element: el, num: (i+1)}));*/
                        } /*,      
                        OnClickClose: function(el, i){
                                $('log').set('html', 'menu item <b>clicked close</b>: <br>link: {element}  <br>this is number {num} in the list'.substitute({element: el, num: (i+1)}));
                        }  */             
                });
        }); 


/*************************************************************/


//--------------Moquee----------------
Mooquee = new Class({
    Implements: [Options],
 
    options: {
        element: 'mooquee',
        cssitem: 'mooquee_item',
        firstitem:0,
        trans:{'tin':'up', 'tout':'fade'}, //each transition is up, down, left, right, fade
        pause: 1, //seconds (keep pause equal or higher to duration to allow time for items to reset)
        duration: 1, //number of seconds to move marquee items
        overflow:'hidden', //if your item flows over how do you want to handle it. Auto(scroll) or Hidden work best...
        startOnLoad:true
    },
    initialize: function(options){
        this.setOptions(options);
        this.itemFXs = [];
        this.outDelay = 0;
        this.inDelay = 0;
        this.started = false;
        this.currentitem = this.options.firstitem;
        this.loop = true;
        if (typeof(this.options.trans) == "string") this.options.trans = {'tin':this.options.trans, 'tout':this.options.trans};
       
        window.addEvent('domready', function() {
            //get all mooqueeItems
            this.items = $$('#' + this.options.element + ' .' + this.options.cssitem);
            this.totalitems = this.items.length;
            if($(this.options.element).style.overflow != 'hidden')
                $(this.options.element).style.overflow = 'hidden';
            if($(this.options.element).style.position != 'relative')
                $(this.options.element).style.position = 'relative';
 
            this.setMooqueeFXs();
            this.setTrans(this.options.trans);// has setMooqueeItems in it
 
            if(this.options.startOnLoad)
                this.mooveAll.delay(this.options.pause*1000 ,this);
        }.bind(this));
       
       
    },
    setMooqueeItems: function(){
        this.resetting =true;
        var i=0;
       
        this.items.each(function (element){
            if($(element).style.position != 'absolute')
                $(element).style.position = 'absolute';
            $(element).style.width = $(this.options.element).clientWidth + 'px';
            $(element).style.overflow = this.options.overflow;
           
            if(i == this.currentitem)
                this.itemFXs[i].set(this.resetStyle).set(this.inStyle);
            else
                this.itemFXs[i].set(this.resetStyle).set(this.startStyle);
           
            i++;
        }.bind(this));
        this.resetting =false;
    },
    setMooqueeFXs: function(){
        var i=0;
        this.items.each(function (element){
            this.itemFXs[i] = new Fx.Morph(element,{duration:(this.options.duration*1000)});
            i++;
        }.bind(this));
    },
    mooveAll: function(){
 
        this.previousitem = this.currentitem;
       
        if((this.currentitem + 1) == this.totalitems)
            this.currentitem = 0;
        else
            this.currentitem = this.currentitem + 1;
       
        this.moove.delay(this.outDelay*this.options.duration*1000, this, this.previousitem);
        this.moove.delay(this.inDelay*this.options.duration*1000, this, this.currentitem);
 
    },
    moove: function(itemnumber){
        if(itemnumber == this.previousitem)
        {
            this.itemFXs[itemnumber].start(this.outStyle).chain(function(){
                if(!this.resetting)this.itemFXs[itemnumber].set(this.resetStyle).set(this.startStyle);
            }.bind(this));
        } else {
            this.itemFXs[itemnumber].start(this.inStyle).chain(function(){
                if(this.loop == true)
                    this.loopTimer = this.mooveAll.delay(this.options.pause*1000 ,this);
            }.bind(this));
        }
    },
    setTrans: function(newTrans){
        this.startStyle = {}
        this.inStyle = {};
        this.outStyle = {};
        this.resetStyle = {};
        this.inDelay = 0;
        switch(newTrans.tin){
                case 'up':
                    this.startStyle = {'top': $(this.options.element).clientHeight};
                    this.inStyle = {'top': 0};
                break;
                case 'down':
                    this.startStyle = {'top': $(this.options.element).clientHeight * -1};
                    this.inStyle = {'top': 0};
                break;
                case 'left':
                    this.startStyle = {'left': $(this.options.element).clientWidth};
                    this.inStyle = {'left': 0};
                break;
                case 'right':
                    this.startStyle = {'left': $(this.options.element).clientWidth * -1};
                    this.inStyle = {'left': 0};
                break;
                case 'fade':
                    this.startStyle = {'opacity': 0};
                    this.inStyle = {'opacity': 1};
                break;
        }
        switch(newTrans.tout){
                case 'up':
                    this.outStyle = {'top': $(this.options.element).clientHeight * -1};
                    this.resetStyle = {'top': 0};
                break;
                case 'down':
                    this.outStyle = {'top': $(this.options.element).clientHeight};
                    this.resetStyle = {'top': 0};
                break;
                case 'left':
                    this.outStyle = {'left': $(this.options.element).clientWidth * -1};
                    this.resetStyle = {'left': 0};
                break;
                case 'right':
                    this.outStyle = {'left': $(this.options.element).clientWidth};
                    this.resetStyle = {'left': 0};
                break;
                case 'fade':
                    this.outStyle = {'opacity': 0};
                    this.resetStyle = {'opacity': 1};
                    this.inDelay = .5;
                break;
        }
        this.setMooqueeItems();
    }
});

 
    mookieExampleOne = new Mooquee({
       element:'citatlist',
       trans:{'tin':'down', 'tout':'fade'},
       duration:1, //time in seconds
       pause:6
    });
//--------------Slut Moquee----------------



//---------------Squeezebox-----------------------------
SqueezeBox.parsers.swf = function(preset) {
	return (preset || this.url.test(/\.swf/)) ? this.url : false;
};
 
SqueezeBox.handlers.swf = function(url) {
	var size = this.options.size;
	return new Swiff(url, {
		id: 'sbox-swf',
		width: size.x,
		height: size.y
	});
};
 
window.addEvent('domready', function() {
 
	/**
	 * That CSS selector will find all <a> elements with the
	 * class boxed.
	 *
	 * The second argument sets additional options
	 */
	SqueezeBox.assign($$('a.boxed'), {
		parse: 'rel'
	});
 
 SqueezeBox.assign($$('a[rel=boxed][href^=#]'), {
		size: {x: 356, y: 230}
	});


 
}); //slut domready

//-----------------------------------VisitSpy-------------------------
VisitSpy = new Class({
 
	Implements : [Options,Events],
 
	built : false,
	gaReady : false,
	matches : [],
 
	options : {
		'autorun' : true,
		'useGA' : false,
		'prepend' : 'visited: ',
		'id' : 'VisitSpy',
		'links' : [],
		'onReady' : $empty,
		'onMatch' : $empty,
		'onComplete' : $empty
 	},
 
	initialize : function(options){
		this.setOptions(options);
 
		if(this.options.useGA) this.addEvent('onMatch',this.setVar.bind(this));					
 
		if(this.options.autorun) {
			window.addEvent('domready', function(){
				this.inject();
				if(this.options.useGA) this.checkGA();
				this.loaded();
			}.bind(this));
		}
	},
 
	inject : function(){
		if(!Browser.loaded) return this.inject.delay(50,this);
		if(this.built) return;
 
		this.spy = new Element('div',{
			'id' : this.options.id,
			'styles' : { 'display' : 'none' }
		}).inject(document.body);
 
		this._css = new Element('style').set('type', 'text/css').inject(document.head);
		var text = '#'+this.options.id+' a { color : #000000 }  #'+this.options.id+' a:visited { color : #ffffff }';
		if(Browser.Engine.name == 'trident') this._css.styleSheet.cssText = text;
		else this._css.set('text',text);
 
		this.built = true;
	},
 
	loaded : function(){
		if(!this.built || (this.options.useGA && !this.gaReady)) return this.loaded.delay(50,this);
		this.fireEvent('onReady');
		if(this.options.autorun) this.checkLinks();			
	},
 
	checkGA : function(){
		if(this.gaReady) return;
		if($type(pageTracker) == 'object' && $type(pageTracker._setVar) == 'function') this.gaReady = true;
		else this.checkGA.delay(50,this);
	},
 
	setLinks : function(links){
		this.options.links = links;
		this.loaded();
	},
 
	checkLinks : function(){
		this.matches = [];
		this.options.links.each(function(link,idx){
			var a = new Element('a',{'href' : 'http://'+link}).set('text','#').inject(this.spy);
			if( a.getStyle('color') == '#ffffff') this.fireEvent('onMatch',link);
			a.destroy();
		},this);
		this.fireEvent('onComplete', this.matches, 20);
		this.reset();
	},
 
	setVar : function(link){
		if(!this.gaReady) return;
		pageTracker._setVar(this.options.prepend+link);
	},
 
	reset : function(){
		this.matches = [];
		this.options.links = [];
	},
 
	remove : function(){
		this.built = false;
		this.spy.destroy();
		this._css.destroy();
 
	}
});
//VisitSpy Remote
VisitSpy.Remote = new Class({
 
	Extends : VisitSpy,
 
	haveLinks : false,
 
	options : {
		'url' : '',
		'encoded' : false
	},
 
	initialize : function(options){
 
		this.parent(options);
 
		this.request  =  new Request.JSON({
				url : this.options.url, 
				onComplete : function(request){
alert(request.data);
					if(!request.data) return;
					this.options.links = (this.options.encoded) ? Base64.decode(request.data).split(',') : request.data;
					this.haveLinks = true;
				}.bind(this)
		});
 
		if(this.options.autorun){
			this.getLinks();
			this.addEvent('onComplete',this.send.bind(this));
		}
	},
 
	setLinks : function(links){
		this.haveLinks = true;
		this.parent();
	},
 
	getLinks : function(){
		this.request.get({'encoded' : this.options.encoded});
	},
 
	loaded : function(){
		if(!this.haveLinks) return this.loaded.delay(50,this);
		this.parent();
	},
 
	send : function(links){
		this.request.get({ 
			encoded : this.options.encoded, 					
			data : (this.options.encoded) ? Base64.encode(links.join(',')) : links
		});
	},
 
	reset : function(){
		this.parent();
		this.haveLinks = false;
	}
 
});

//--------------Ladda Google Analytics----------------

window.addEvent('domready',function(){
//Analytics
//var pageTracker=_gat._getTracker("UA-778473-3");
pageTracker._initData();
pageTracker._trackPageview();
//check VisitSpy
/*new VisitSpy({
	useGA : true,
	prepend : 'VaritHos: ',
   links : ['www.nordicmagic.se','magiarkivet.se','www.komikerklubben.se','http://www.houdi.se/blog/']
   //,onMatch : function(link){ alert(link); }
}); 
*/

});

//-----------------------------------fixa on load-------------------------

window.addEvent('load', function() {

			/* preloading */
var images = [
			  'konsult/img/spinner.gif',
			  'konsult/img/closebox.png',
			  'konsult/img/closebox.gif',
			  'konsult/img/1_kenta.jpg',
			  'konsult/img/2_kenta.jpg',
			  'konsult/img/kentaback2.png',
			  'konsult/img/mainflapp.png',			  
			  'konsult/img/slideback.png',
			  'konsult/img/expert.png',
			  'konsult/img/navbuttons.png',
			  'konsult/img/kontakt.jpg',
			  'konsult/img/yearback.jpg',
			  'konsult/img/tinyknapp.png',
			  'konsult/img/perlback.png',
			  'konsult/img/theKey.png'
			  ];
var loader = new Asset.images(images, {
    onComplete: function(){
        //advanced.start({'top': [-40,274], 'left': [-70,792]});
    }
});

//Ta bort IE's drag-funktion
if(Browser.Engine.trident){ document.ondragstart = function(){return false;} }

//Analytics outgoing links
	if(pageTracker) {
		$$('a[href^=http]').each(function(el) {
			el.addEvent('click',function() {
				var dd = '/exit-links/' + el.get('href').replace('http://','');
				pageTracker._trackPageview(dd);
			}.bind(this));
		});
	} //slut Analytics


}); //slut onLoad