/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/

this.vtip = function() {    
    this.xOffset = -10; // x distance from mouse
    this.yOffset = 10; // y distance from mouse       
    
    $(".vtip").unbind().hover(    
        function(e) {
            this.t = this.title;
            this.title = ''; 
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            
            $('body').append( '<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>' );
                        
            $('p#vtip #vtipArrow').attr("src", '/_assets/bilder/vtip_arrow.png');
            $('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
            
        },
        function() {
            this.title = this.t;
            $("p#vtip").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);
                         
            $("p#vtip").css("top", this.top+"px").css("left", this.left+"px");
        }
    );            
    
};

jQuery(document).ready(
	function($){vtip();
		
})

$(document).ready(function() {
		if ($('.galleri.vis').length)
		$(document).keydown(function(e){
			if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
		    if (e.keyCode == 37) { 
				// Pressed left arrow key
		       	// console.log( "left pressed" );
				if ($('.forrige').length) {
					window.location = $('.forrige').attr('href');
		    		return false;
				}
		    }
			if (e.keyCode == 39) { 
		       	// Pressed right arrow key
			    // console.log( "left pressed" );
				if ($('.neste').length) {
					window.location = $('.neste').attr('href');
			    	return false;
				}
		    }
		});
		if ($('.sitater').length) {
			    $('.sitater').cycle({
					fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
					slideExpr: 'li',
					timeout: 30000,
				});
		}
});

