﻿jQuery(document).ready(function() {  
   jQuery("label.lblSearch").text("S\u00F8g");
   jQuery("div.user:odd").css("margin-left","10px");
   jQuery("div.Underside-3col").parent().parent().parent().css("background","url(/Files/Billeder/gfx/graa_streger.gif) repeat-y");
   jQuery("div.IntranetForsideVenstre ul.newsList").parent().css("background","url(/Files/Billeder/intranetgfx/gradient_seneste_nyt.jpg) no-repeat 0 100%").css("min-height","176px");
   Heading();
  jQuery(window).bind("load", function() {
if(jQuery("object#brandFlash").length==0)
{
jQuery("td.images").css("display","block");
}
});
  var i =1;
  jQuery("ul.madPlan table tr").each(function(){
   jQuery(this).addClass("rowClass"+i % 3);
   i += 1;    
  });
});
function Heading() {
  Cufon.replace('h1.h1', {fontSize:'50px', margin: '0px'});
  Cufon.replace('h1.intrafront', {fontSize:'56px', margin: '0px'});
  Cufon.replace('div.Gaester h1.intrafront', {fontSize:'90px', margin: '0px'});
  Cufon.replace('div.Gaester h2', {fontSize:'32px', margin: '0px'});
  Cufon.replace('h3.h3', {fontSize:'30px', margin: '0px'});
  Cufon.replace('div.ForsideTop h1 span.headerTxt', {fontSize:'90px', margin: '0px'});
  Cufon.replace('div.ForsideTop h1 span.imgText', {fontSize:'74px', margin: '0px'});
  Cufon.replace('div.ForsideTop h1 span.imgAltText', {fontSize:'90px', margin: '0px'});
  
  Cufon.now();
}
 function goToPage(url)
 {
 if (url != "Vælg afdeling")
 {
 window.location.href =url;
 }
 }

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '90';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

/**
 * jQuery.fn.sortElements
 * --------------
 * @param Function comparator:
 *   Exactly the same behaviour as [1,2,3].sort(comparator)
 *   
 * @param Function getSortable
 *   A function that should return the element that is
 *   to be sorted. The comparator will run on the
 *   current collection, but you may want the actual
 *   resulting sort to occur on a parent or another
 *   associated element.
 *   
 *   E.g. $('td').sortElements(comparator, function(){
 *      return this.parentNode; 
 *   })
 *   
 *   The <td>'s parent (<tr>) will be sorted instead
 *   of the <td> itself.
 */
jQuery.fn.sortElements = (function(){
 
    var sort = [].sort;
 
    return function(comparator, getSortable) {
 
        getSortable = getSortable || function(){return this;};
 
        var placements = this.map(function(){
 
            var sortElement = getSortable.call(this),
                parentNode = sortElement.parentNode,
 
                // Since the element itself will change position, we have
                // to have some way of storing its original position in
                // the DOM. The easiest way is to have a 'flag' node:
                nextSibling = parentNode.insertBefore(
                    document.createTextNode(''),
                    sortElement.nextSibling
                );
 
            return function() {
 
                if (parentNode === this) {
                    throw new Error(
                        "You can't sort elements if any one is a descendant of another."
                    );
                }
 
                // Insert before flag:
                parentNode.insertBefore(this, nextSibling);
                // Remove flag:
                parentNode.removeChild(nextSibling);
 
            };
 
        });
 
        return sort.call(this, comparator).each(function(i){
            placements[i].call(getSortable.call(this));
        });
 
    };
 
})();

