﻿
try{
    $(document).ready(function () {
        $('.bookmarkpage').bind('click', BookmarkPage);
        //$(".facebookshare").bind('click', FacebookShare);

        $("input").bind("keypress", function (event) {
            if (event.keyCode == 13) {
                delayLoader();
                $('.btnSearch').click();
                return false;
            } else {
                return true;
            }
        });
    });
}
catch (ex) { }

function delayLoader() {
    setTimeout(ShowLoader, 100);
}

function ShowLoader() {
    $(".searchloader").css("background", "url(/Gfx/21/loader-blue.gif) no-repeat left center");
    $(".searching").css({ "left": ($(document).width() / 2) - (300 / 2) + "px", "top": ($(window).height() / 2) - (75 / 2) - 50 + "px" });
    pageTracker._trackEvent('Search', 'SearchBox');
    return true;
}

function BookmarkPage()
{
    // Firefox
    if (window.sidebar)
        window.sidebar.addPanel(document.title, location.href, "");
    // Opera
    else if (window.opera && window.print) {
        var elem = document.createElement('a');
        elem.setAttribute('href', location.href);
        elem.setAttribute('title', document.title);
        elem.setAttribute('rel', 'sidebar');
        elem.click();
    }// Ie
    else if (document.all)
        window.external.AddFavorite(location.href, document.title);
    else // Others
        alert("Din browser understøtter ikke denne funktion.\nTilføj venligst vvsprisen.dk til dine favoritter via din browser.");

    pageTracker._trackEvent('Download', 'Added To Favorites');
}

function FacebookShare() {
    u = location.href;
    t = document.title;
    window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
    pageTracker._trackEvent('Networking', 'Facebook FanSite');
    return false;
}
