

$(document).ready(function(){
    if($.browser.msie) {
        $('.flashfont, h2.large, .main h2').flash(
            { 
                src: '/font.swf', 
                flashvars: { 
                    css: [
                        '* { color: #000000; }',
                        'a { color: #000000; text-decoration: none; }',
                        'a:hover { text-decoration: none; }'
                    ].join(' ')
                }
            },
            { version: 8 },
            function(htmlOptions) {
                htmlOptions.flashvars.txt = this.innerHTML;
                this.innerHTML = '<div>'+this.innerHTML+'</div>';
                var $alt = $(this.firstChild);
                htmlOptions.height = $alt.height();
                htmlOptions.width = $alt.width();
                $alt.addClass('alt');
                $(this)
                    .addClass('flash-replaced')
                    .prepend($.fn.flash.transform(htmlOptions));						
            }
        );
    }
    $.ifixpng('/img/pixel.gif');
    $('#logo, #logo_bcms, .icon_start').ifixpng();
});





$(function() {

    $('#livesearch input').liveSearch({
        ajaxURL: '/livesearch?q=',
        width: 300,
        offset_left: 29,
        html: '<ul><li><span class="text"><i>Skriv för att söka</i></span></li></ul>'
    })
    
    $('#email-link').click(function() {
        $(this).emailpopper({action: '/popper/send', name:'Ljus i Hus', recipient:'info', lang: 'sv_SE', cellStyle: {background: '#222'}})
    })
    $('#mailtest').click(function() {
        $(this).emailpopper({action: '/popper/send', name:'Kalle', recipient:'kalle', lang: 'sv_SE', cellStyle: {background: '#222'}})
    })            
    

    // ===================
    // = Remote validate =
    // ===================
    $('.remotevalidate').remoteValidate()


    window.setTimeout(function() { fadespot($('#spot0'))}, 0)
    window.setTimeout(function() { fadespot($('#spot1'))}, 200)
    window.setTimeout(function() { fadespot($('#spot2'))}, 400)        
})
// 
function fadespot(spot) {
    spot.animate({top: 0}, 'slow')
}


function printPage() {
    var prefix = window.location.href.indexOf('?') === -1 ? '?' : '&'
    window.open(window.location.href + prefix + 'print=1','print','width=700,height=500,scrollbars=yes,resizable=yes');
    return false
}
