﻿var ie7 = IE7Recognizer();
var ie6 = IE6Recognizer();
$(document).ready(function(){
    $(".detail").hover(function(){$(this).addClass("don");}, function(){$(this).removeClass("don");}); 
    $('.f-level li').hover(function() {
        if (this.timer) clearTimeout(this.timer);
        $(this).children('div').show();
        $(this).find("a:first").addClass("hover");
    }, function() {
        var _this = this;
        if ($(this).parent().is('.f-level')) {
            this.timer = setTimeout(function() {
                $(_this).children('div').hide();
                $(_this).find("a.hover").removeClass("hover");
                Cufon.replace('.header .right .menu ul.f-level li a.ah', { fontFamily: 'Helvetica', hover: true, hoverables: {a:true, em:true, span:true}});
            }, 200);
        } else {
            $(_this).children('div').hide();
            $(_this).find("a.hover").removeClass("hover");
            Cufon.replace('.header .right .menu ul.f-level li a.ah', { fontFamily: 'Helvetica', hover: true, hoverables: {a:true, em:true, span:true}});

        }
    });
    $(".menu .sub").each(function(){
        h = parseInt($(this).height());
        iframe = $(this).find("iframe")[0];
        $(iframe).css("height", h + "px");
        if (ie6 || ie7) {
            lll = $(this).find("td").length;
            if (lll==3) $(this).css("width", "806px");
            if (lll==4) {
                $(this).css("width", "1072px");
                if (ie6) {
                    $(this).css("margin-right", "194px");
                }
            }
        }
    });
    Cufon.replace('.news-panel .h .c span', { fontFamily: 'Helvetica'});
    Cufon.replace('.textpage-header .inner h1', { fontFamily: 'Helvetica'});
    Cufon.replace('.panel h2', { fontFamily: 'Helvetica'});
    Cufon.replace('.header .right .menu ul.f-level li a.ah', { fontFamily: 'Helvetica', hover: true, hoverables: {a:true, em:true, span:true}});
    $(".box-panel .m a").hover(function(){$(this).addClass("hover");}, function(){$(this).removeClass("hover");});
    $("#read-more-2").click(function(){
        $(this).parent().parent().find(".adding").each(function(){
            if ($(this).css("display") == "none") {
                $(this).css("display", "block");
            } else {
                $(this).css("display", "none");
            }  
        });
    });
});
var transparentImage = "http://valbay.ws2.obiqsoft.se/App_Themes/Main/img/none.gif";
function fixTrans(){if (typeof document.body.style.maxHeight == 'undefined') {var imgs = document.getElementsByTagName("img");for (i = 0; i < imgs.length; i++){if (imgs[i].src.indexOf(transparentImage) != -1){return;}if (imgs[i].src.indexOf(".png") != -1){var src = imgs[i].src; h = $(imgs[i]).height(); w = $(imgs[i]).width(); imgs[i].src = transparentImage; imgs[i].height = h; imgs[i].width = w; imgs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";imgs[i].style.display = "inline-block";}}}}
if (document.all && !window.opera) attachEvent("onload", fixTrans);

function setTab(index) {
    if(!index) index = 1;
    $(".box-content").hide();
    $(".box-panel").find("a").each(function(){$(this).removeClass("active");});
    $(this).addClass("active");
    $("#b-c-"+index).show();
}
function IE7Recognizer() {
   if (navigator.userAgent.toString().indexOf("MSIE 7.0") != -1) return true;
   return false;    
}
function IE6Recognizer() {
   if (navigator.userAgent.toString().indexOf("MSIE 6.0") != -1) return true;
   return false;    
}
