﻿$(document).ready(function () {

    /*Sprog content tab handler*/
    $("#languageTabs li").click(function () {
        var _MotherId = $(this).attr("id");
        $("#languageTabs li").removeClass("languageTabActive");
        $(this).addClass("languageTabActive");
        $("#languageContentHolder li.tabContent[id = 'Content" + _MotherId + "']").show();
        $("#languageContentHolder li.tabContent[id != 'Content" + _MotherId + "']").hide();
    });
	
	var expandedVideoInfo=false;
    /*Product info tab handler*/
    $(".tabHeadline").click(function () {
        var _mother = $(this).parent();
        $(this).toggleClass("tabHeadlineActive")
        $(".tabContent", _mother).slideToggle("fast", function () {
			if(expandedVideoInfo){}
			else{
			 fleXenv.fleXcrollMain("videoInfoBox");
			 }
			 expandedVideoInfo= true;
        });		
		
    });

    /*Fullscreen mode handler*/

    $("#removeFullScreenMode").click(function () {

        if ($(this).hasClass("hideContent")) {
            $(this).removeClass("hideContent");
			$("div#hideContentHolder").css("display",""); 
			
			$("div#hideContentHolder").fadeTo('slow', 1.0, function () {
				});
		
            

            $("a", this).text("Skjul indhold");

        }
        else {
			  setTimeout(function() {
				$("div#hideContentHolder").fadeTo('slow', 0.0, function () {
					$("#removeFullScreenMode").show();
					$("div#hideContentHolder").css("display","none"); 
				});
				
			},100);
			
            $(this).addClass("hideContent");

            $("a", this).text("Vis indhold");
        }

    });


    /*Removing empty UL from menu*/
    if ($("ul.lv2").html() == '') {
        $("ul.lv2").remove();
    }

    /*Show searchHolder*/
    $(".activeSearchHolder").click(function () {
        $("#searchFieldHolder").fadeIn();
    });

    $("#searchFieldHolderClose").click(function () {

        $("#searchFieldHolder").fadeOut(function () {

            $("#searchFieldHolder").hide();
        });


    });

    /*Searchfield remove text*/
    $("#searchFieldHolder").formHighlighter(
    {
        classFocus: 'searchFieldFocus',
        classBlur: 'searchField',
        classKeyDown: 'searchFieldKeydown',
        classNotEqualToDefault: 'searchFieldKeydown'
    });

    /*Remove searchfield text from resoultpage.*/
    $(".xsltsearch_form").formHighlighter(
    {
        classFocus: 'inputFocus',
        classBlur: 'input',
        classKeyDown: 'inputKeydown',
        classNotEqualToDefault: 'inputKeydown'
    });
});

