﻿
// Her legges javascript-funksjoner

function sendmail(user, domain, suffix) {
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}

function viseposttekst(link) {
    if (link.value == "") link.value = "din e-post";
}
function fjerntekst(link) {
    if (link.value == "din e-post")
        link.value = "";
}

/*
* jQuery FlyOut
*			outSpeed:	speed in milliseconds for the flyout animation - default: 1000
*
*			inSpeed:	speed in milliseconds for the flyback animation - default: 500
*
*			outEase:	the easing method to use for the flyout animation - default: swing
*
*			inEase:		the easing method to use for the flyback animation - default: swing
*			
*			loadingSrc: the image file to use while an image is being loaded prior to flyout
*						default: none
*						
*			loader: 	the ID for the created flyout div that contains the sub-content
*						this is currently only useful for multiple skinnings via CSS
*						default: 'loader'
*
*			loaderZIndex: the CSS z-index for the flyout
*						default: 500
*
*			widthMargin: the left and right margin space for the final flyout
*						this value is effectively divided between the left and right margin
*						default: 40
*			
*			heightMargin: the top and bottom margin space for the final flyout
*						this value is effectively divided between the top and bottom margin
*						default: 40
*
*			loadingText: text shown when image is loading
*
*			closeTip: tip text for image alt/title tags
*
*			destElement: the destination container - overrides height and widthMargins
*						specified in CSS notation - e.g. "#picContainer"
*						default: none
*
*			destPadding: number of pixels to pad when flying out to destElement
*						default: 10
*
*			startOffsetX: horizontal offset added to thumb left value for start of flyout animation
*						Hint: can be negative.
*						default: 0
*
*			startOffsetY: vertical offset added to thumb top value for start of flyout animation.
*						default: 0
*
*			startHeight: overrides starting height of flyout animation
*						default: 0  (uses thumb image height by default)
*
*			startWidth: overrides starting width of flyout animation
*						default: 0  (uses thumb image width by default)
*
*			flyOutStart: function to run at start of flyout animation
*						default: none
*
*			flyOutFinish: function to run at finish of flyout animation
*						default: none
*
*			putAwayStart: function to run at start of putaway animation
*						default: none
*
*			putAwayFinish: function to run at finish of putaway animation
*						default: none
*
* For more details see: http://nixbox.com/demos/jquery.flyout.php
*
* @example $('.thumb').flyout();
* @desc standard flyouts applied to all elements with the 'thumbs' class. 
* 
* @example $('.thumb').flyout({loadingSrc:'images/thumb-loading.gif',
*								outEase:'easeOutCirc',
*								inEase:'easeOutBounce'});
*/
/* jQuery FlyOut - Jolyon Terwilliger, Nixbox Web Designs - http://nixboxdesigns.com/jquery.flyout.php */
$.fn.extend({ flyout: function(c) { var d = false; var e = false; var f; var g; var h; var i; var j; var k = new Image(); var l = 'img'; var m; this.click(function() { if (e == true) { return false } if (d) { putAway(this) } else { flyOut(this) } return false }); var o = jQuery.extend({ outSpeed: 1000, inSpeed: 500, outEase: 'swing', inEase: 'swing', loadingSrc: null, loader: 'loader', loaderZIndex: 500, widthMargin: 40, heightMargin: 40, loadingText: "Loading...", closeTip: " - Click here to close", destPadding: 20, startOffsetX: 0, startOffsetY: 0, startHeight: 0, startWidth: 0, flyOutStart: function() { }, flyOutFinish: function() { }, putAwayStart: function() { }, putAwayFinish: function() { }, shownClass: 'shown' }, c); function flyOut(b) { e = true; f = $(b); g = $('img', b); k = new Image(); sL = $(window).scrollLeft(); sT = $(window).scrollTop(); h = g.offset(); h.left += o.startOffsetX; h.top += o.startOffsetY; i = (o.startHeight > 0 ? o.startHeight : g.height()); j = (o.startWidth > 0 ? o.startWidth : g.width()); $('<div></div>').attr('id', o.loader).appendTo('body').css({ 'position': 'absolute', 'top': h.top, 'left': h.left, 'height': i, 'width': j, 'opacity': .5, 'display': 'block', 'z-index': o.loaderZIndex }); if (o.loadingSrc) { $('#' + o.loader).append($('<img/>').load(function() { $(this).css({ 'position': 'relative', 'top': i / 2 - (this.height / 2), 'left': j / 2 - (this.width / 2) }).attr('alt', o.loadingText) }).attr('src', o.loadingSrc)) } else { $('#' + o.loader).css('background-color', '#000').append($('<span></span>').text(o.loadingText).css({ 'position': 'relative', 'top': '2px', 'left': '2px', 'color': '#FFF', 'font-size': '9px' })) } $(k).load(function() { imgtag = $('<img/>').attr('src', f.attr('href')).attr('title', g.attr('title') + o.closeTip).attr('alt', g.attr('alt') + o.closeTip).height(i).width(j); o.flyOutStart.call(b); if (o.destElement) { var a = $(o.destElement); max_x = a.innerWidth() - (o.destPadding * 2); max_y = a.innerHeight() - (o.destPadding * 2) } else { max_x = $(window).width() - o.widthMargin; if ($.browser.opera) wh = document.getElementsByTagName('html')[0].clientHeight; else wh = $(window).height(); max_y = wh - o.heightMargin } width = k.width; height = k.height; x_dim = max_x / width; y_dim = max_y / height; if (x_dim <= y_dim) { y_dim = x_dim } else { x_dim = y_dim } dw = Math.round(width * x_dim); dh = Math.round(height * y_dim); if (dw > width) { dw = width } if (dh > height) { dh = height } if (o.destElement) { dPos = a.offset(); dl = Math.round((a.outerWidth() / 2) - (dw / 2) + dPos.left); dt = Math.round((a.outerHeight() / 2) - (dh / 2) + dPos.top) } else { dl = Math.round(($(window).width() / 2) - (dw / 2) + sL); if ($.browser.opera) wh = document.getElementsByTagName('html')[0].clientHeight; else wh = $(window).height(); dt = Math.round((wh / 2) - (dh / 2) + sT) } $('#' + o.loader).empty().css('opacity', 1).append(imgtag).width('auto').height('auto').animate({ top: dt, left: dl }, { duration: o.outSpeed, queue: false, easing: o.outEase }); $('#' + o.loader + ' ' + l).animate({ height: dh, width: dw }, o.outSpeed, o.outEase, function() { o.flyOutFinish.call(b); d = b; f.addClass(o.shownClass); e = false; $('#' + o.loader + ' ' + l).click(function() { putAway(null) }) }) }); k.src = f.attr('href') } function putAway(a) { if (e == true || d == false) { return false } o.putAwayStart.call(d); e = true; h = g.offset(); h.left += o.startOffsetX; h.top += o.startOffsetY; $('#' + o.loader).animate({ top: h.top, left: h.left }, { duration: o.inSpeed, queue: false, easing: o.inEase }); $('#' + o.loader + ' ' + l).animate({ height: i, width: j }, o.inSpeed, o.inEase, function() { $('#' + o.loader).css('display', 'none').remove(); o.putAwayFinish.call(d); e = false; k = null; if (a && a != d) { d = false; flyOut(a) } d = false; f.removeClass(o.shownClass) }) } return this } });