(function($) { $.fn.ssnRotate = function(b) { var c = { SwitchSpeed: 7000, hideEffect: function(a) { a.fadeOut(2500) }, showEffect: function(a) { a.fadeIn(2500) } }; b = $.extend(c, b); var d = this.ssnSelectList({ hideEffect: b.hideEffect, showEffect: b.showEffect }); Rotate(d, b.SwitchSpeed); return this }; function Rotate(a, b) { setTimeout(function() { a.next(); Rotate(a, b) }, b) } })(jQuery); (function($) { $.fn.ssnSelectList = function(b) { var c = { showFirstAndHideOthers: true, hideEffect: function(a) { a.hide() }, showEffect: function(a) { a.show() } }; var d = $.extend(c, b); if (d.showFirstAndHideOthers) this.filter(':first').show().end().filter(':gt(0)').hide(); var e = { list: this, selectedID: 0, options: d, selected: function() { return getSelected(e) }, next: function() { goNext(e); return this }, prev: function() { goPrev(e); return this }, goto: function(a) { gotoID(e, a); return this } }; return e }; function getSelected(a) { return a.list.eq(a.selectedID) } function goNext(a) { var b = a.list.length; var c = a.selectedID + 1; if (c >= b) c = 0; gotoID(a, c) } function goPrev(a) { var b = a.list.length; var c = a.selectedID - 1; if (c < 0) c = b - 1; gotoID(a, c) } function gotoID(a, b) { var c = a.list.length; if (b >= 0 && b < c) { hideSelected(a); a.selectedID = b; showSelected(a) } } function hideSelected(a) { a.options.hideEffect(a.selected()) } function showSelected(a) { a.options.showEffect(a.selected()) } })(jQuery); (function($) { $.ssnSubscription = function(a) { var b = { NameID: 'subscribeName', NameHiddenID: '', EmailID: 'subscribeEmail', EmailHiddenID: '', TextNameMissing: 'Navn skal skrivast.', TextEmailMissing: 'Teldupostur skal skrivast.', SubscribeID: 'subscribe', UnsubscribeID: 'unsubscribe', SubscribeProc: function() { }, UnsubscribeProc: function() { }, NameValue: { fo: 'Navn', da: 'Navn', en: 'Name' }, EmailValue: { fo: 'Teldupostur', da: 'E-mail', en: 'E-mail'} }; c = $.extend(b, a); bindEvents() }; var c; function bindEvents() { var a = $('#' + c.NameID + ',#' + c.EmailID); a.each(function() { onDeselecting(this) }).focus(function() { onSelecting(this) }).blur(function() { onDeselecting(this) }); $('#' + c.SubscribeID).click(function() { if (validate()) c.SubscribeProc() }); $('#' + c.UnsubscribeID).click(function() { if (validate()) c.UnsubscribeProc() }) } function onSelecting(e) { if ($(e).val() == getCurrentValue(e)) $(e).val("") } function onDeselecting(e) { if ($(e).val() == "") $(e).val(getCurrentValue(e)) } function getCurrentValue(e) { if (e.id == c.NameID) return getText(c.NameValue); return getText(c.EmailValue) } function validate() { var a = $('#' + c.NameID); var b = $('#' + c.EmailID); if (isEmptyOrHasDefaultValue(a)) { alert(c.TextNameMissing); return false } else if (isEmptyOrHasDefaultValue(b)) { alert(c.TextEmailMissing); return false } else { $('#' + c.NameHiddenID).val(a.val()); $('#' + c.EmailHiddenID).val(b.val()); return true } } function isEmptyOrHasDefaultValue(a) { var b = a.val(); if (b == '' || b == getCurrentValue(a.get(0))) return true; return false } function getText(a) { return eval('(obj.' + getLanguage() + ')') } function getLanguage() { return "fo" } })(jQuery); (function($) { $.fn.ssnSameHeight = function() { var b = 0; return this.each(function() { var a = $(this).height(); if (a > b) b = a }).height(b) } })(jQuery);