$(document).ready(function () {
     if (window.location.hash != "") {
        var o_hash = window.location.hash;
        //alert(o_hash.substring(1,o_hash.length));
        //console.log($(".areas a[omrade=" + o_hash.substring(1, o_hash.length) + "]").length);
        if ($(".areas a[omrade=" + o_hash.substring(1, o_hash.length) + "]").length > 0) {
            FilterOmrade(o_hash.substring(1, o_hash.length))
        }
    }
  
    $(".print").click(function () {
        print();
    })
    $('.startEshop input').keydown(function(e){
        if (e.keyCode == 13) {
            $(this).parents('form').submit();
            return false;
        }
    });
      
   if ($(".activityCity").length > 0) {
        //console.log($(".activityCity").prev("p").html());
        var sideP = "<p></p>"
        $("#content-side").append(sideP);
        $("#content-side p").append($(".activityCity").prev("p").html());
        $(".activityCity").prev("p").remove();
        $("#content-side").append($(".activityCity"));
    }  
    
   //Eshop login 
    $("#wd_username").focus(function () {
        if ($("#wd_username").val() == "Användarnamn") {
            $("#wd_username").val("")
        }
        
    })
    $("#wd_username").blur(function () {
        if ($("#wd_username").val() == "") {
            $("#wd_username").val("Användarnamn");
        }
    })

    $("#wd_password").focus(function () {
        if ($("#wd_password").val() == "Lösenord") {
            $("#wd_password").val("")
        }
        
    })
    $("#wd_password").blur(function () {
        if ($("#wd_password").val() == "") {
            $("#wd_password").val("Lösenord");
        }
    })

    switch($(".startBottomCol1 div.activity").length)
    {
      case 4:
        //$(".startBottomCol1 div.activity:eq(4)").style({"border":"none"});
      $("div.activity:eq(2)").css({"border-bottom":"none"});
      $("div.activity:eq(3)").css({"border-bottom":"none"});
        break;
      case 3:
        $("div.activity:eq(2)").css({"border-bottom":"none"});
        break;
      case 2:
        $("div.activity:eq(2)").css({"border-bottom":"none"});
        break;
      case 1:
        $("div.activity:eq(0)").css({"border-bottom":"none"});
        break;
    }
      
      
 if($("div#autoprint").length>0)
    {
        $("head link[href='/css/print.css']").attr("href", "/css/eventdescription.css");
        print();
        window.close();
    }

    $("a.printEventDescription").click(function () {
        /*Change the print stylesheet*/
        /*var eDesc = "<div>" + $("div.eventdescriptionholder").html() + "</div>";
        var OldSida = "<div>" + $("div#content-container").html() + "</div>";
        $("div#content-container").html($(eDesc).html());
        $("head link[href='/css/print.css']").attr("href", "/css/eventdescription.css");
        print();
        $("head link[href='/css/eventdescription.css']").attr("href", "/css/print.css");
        $("div#content-container").html($(OldSida).html());*/
    })


})

