// FriendMailer - NB: Opera returnere forkerte værdier mht. width og height
$(document).ready(function() { 
    $.blockUI.defaults.overlayCSS = {};
    $.blockUI.defaults.css = {};
        $(function() { 
            $('a#inlinepopup').click(function() {
                $.blockUI({ 
                    message: $('#overlay'),
                        css: {  
                            textAlign:  'left',
                            padding:    '0',
                            margin:     '0',
                            left: ($(window).width() - $("#overlay").width()) /2 + 'px',
                            top:  ($(window).height() - $("#overlay").height()) /2 + 'px',
                            width: ($("#overlay").width()) + 'px'
                        },
                        overlayCSS: {
                            backgroundColor: 'silver',
                            opacity: '0.5'
                        } 
                    }); 
                setTimeout($.unblockUI, 1000000); 
            });     
        $('#close').click(function() { 
            $.unblockUI({ fadeOut: 0 }); 
            return false; 
        });
        });
});

// FriendMailer Error - NB: Opera returnere forkerte værdier mht. width og height
$(document).ready(function() {
    if ( $("#overlay").find(".invalid").length > 0 )
    {
        $.blockUI({ 
            message: $('#overlay'),
                css: {  
                    textAlign:  'left',
                    padding:    '0',
                    margin:     '0',            
                    left: ($(window).width() - $("#overlay").width()) /2 + 'px',
                    top:  ($(window).height() - $("#overlay").height()) /2 + 'px',
                    width: ($("#overlay").width()) + 'px'
                },
                overlayCSS: {
                    backgroundColor: 'silver',
                    opacity: '0.5'
                }
        }); 
        $('#close').click(function() { 
            $.unblockUI({ fadeOut: 0 }); 
            return false; 
        });        
        setTimeout($.unblockUI, 1000000); 
    }
});

// Table
$(document).ready(function(){
    $(".stripeMe tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
    $(".stripeMe tr:even").addClass("even");
});

// Tabs
$(document).ready(function(){
    $(function(){
        $('#tabs ul.tabs-container').tabs();
    });
});


// Accordion
$(function(){
	//accordion
	$('#accordion').accordion({
		header: ".ui-accordion-header",
		active: false,
		alwaysOpen: false,
		clearStyle: true
	});
});


// Send kontakt- eller kursusbestillingsformular
$(document).ready(function(){
    $('#cfSend').click(function() {
        $.blockUI({ 
            css: { 
                padding:        '3em', 
                margin:         '0', 
                width:          '30%',  
                top:  ($(window).height()) /3 + 'px',
                left: ($(window).width())  /3 + 'px',
                textAlign:      'center',  
                color:          'black',  
                border:         '2px solid #aaa', 
                backgroundColor:'white', 
                cursor:         'wait', 
                '-webkit-border-radius': '10px', 
                '-moz-border-radius': '10px' 
            },
            overlayCSS: {
                backgroundColor: 'silver',
                opacity: '0.5'
            }
        }); 
        setTimeout($.unblockUI, 40000); 
    });     
});


// Kursusbestilling Error - Vis accordion og skjul link tekst
$(document).ready(function() {
    if ( $("#accordion").find(".invalid").length > 0 )
    {
        $('#accordion').accordion("destroy")
        $(".ui-accordion-header").hide();
    }
});


     