
$(document).ready(function () {
    //var CurrentTabName = '<%=PortalSettings.ActiveTab.TabName %>';
    var Defaulttext = 'Zoeken in de site';
    //var Defaulttext = '<%=PortalSettings.ActiveTab.TabName %>';
    //    if($('#dnn_dnnSEARCH_txtSearch').val == '')
    $('#dnn_dnnSEARCH_txtSearch').val(Defaulttext);

    $('#dnn_dnnSEARCH_txtSearch').addClass("idleField");

    $('#dnn_dnnSEARCH_txtSearch').focus(function () {
        $(this).removeClass("idleField").addClass("focusField");
        if (this.value == Defaulttext) {
            this.value = '';
        }
        if (this.value != Defaulttext) {
            this.select();
        }
    });
    //$("#myinput")[0].blur();
    $('#dnn_dnnSEARCH_txtSearch').blur(function () {
        $(this).removeClass("focusField").addClass("idleField");
        if ($.trim(this.value == '')) {
            this.value = Defaulttext;
        }
    });

    var CurretnTab = document.title;

    var currenturl = location.href;
    var nav_value;

    if (currenturl == getBaseURL()) {
        nav_value = "nav1";
        $("#nav1").css({ background: '#FFFFFF', color: '#FFB73A' });

    }
    if (currenturl.indexOf("Home") != -1) {
        nav_value = "nav1";
        $("#nav1").css({ background: '#FFFFFF', color: '#FFB73A' });
    }
    if (currenturl.indexOf("Bobo") != -1) {
        nav_value = "nav2";
        $("#nav2").css({ background: '#FFFFFF', color: '#FFB73A' });
    }
    if (currenturl.indexOf("Okki") != -1) {
        nav_value = "nav3";
        $("#nav3").css({ background: '#FFFFFF', color: '#FFB73A' });
    }
    if (currenturl.indexOf("Taptoe") != -1) {
        nav_value = "nav4";
        $("#nav4").css({ background: '#FFFFFF', color: '#FFB73A' });
    }
    if (currenturl.indexOf("NGJunior") != -1) {
        nav_value = "nav5";
        $("#nav5").css({ background: '#FFFFFF', color: '#FFB73A' });
    }
    if (currenturl.indexOf("OverBlink") != -1) {
        nav_value = "nav6";
        $("#nav6").css({ background: '#FFFFFF', color: '#FFB73A' });
    }

    if (currenturl.indexOf("Scholen") != -1) {
        nav_value = "nav7";
        $("#nav7").css({ background: '#FFFFFF', color: '#FFB73A' });
    }

    if (currenturl.indexOf("Adverteren") != -1) {
        nav_value = "nav7";
       $("#nav8").css({ background: '#FFFFFF', color: '#FFB73A' });
    }


    //mouseover function
    $('.HeadMenu li ').mouseover(function (e) {
        var navId = e.target.id;
        if (navId == 'nav10' || navId == 'nav0') {
            return;
        }
		//if (navId == 'nav8') {
         //   return;
       //}
        if (navId == 'nav9') {
            $("#" + navId).css({ background: 'url(/Portals/_default/Skins/blink/images/nav9_over.jpg) no-repeat', color: '#FFB73A' });
            return;
        }
        //$(navId).style.cursor='pointer';
        $("#" + navId).css({ background: '#FFFFFF', color: '#FFB73A' });
    });


    //mouseout function
    $('.HeadMenu li ').mouseout(function (e) {

        var navId = e.target.id;
        if (navId == 'nav10' || navId == 'nav0') {
            return;
        }

        document.getElementById(navId).style.cursor = 'pointer';

        if (nav_value == navId) {

        } else {
            if (navId == 'nav9') {
                $("#" + navId).css({ background: 'url(/Portals/_default/Skins/blink/images/nav9.jpg) no-repeat', color: '#FFFFFF' });
            } else {
                $("#" + navId).css({ background: 'url(/Portals/_default/Skins/blink/images/' + navId + '.jpg ) repeat-x', color: '#FFFFFF' });
            }
        }
    });


    //click function 
    $('.HeadMenu li').click(function (e) {
        var navId = e.target.id;
        if (navId == 'nav10' || navId == 'nav0') {
            return;
        }
        nav_value = navId;
        if (navId == 'nav1') {
            window.location.href = getBaseURL() + "Home.aspx";
        }
        if (navId == 'nav2') {
            window.location.href = getBaseURL() + "Bobo.aspx";
        }

        if (navId == 'nav3') {
            window.location.href = getBaseURL() + "Okki.aspx";
        }

        if (navId == 'nav4') {
            window.location.href = getBaseURL() + "Taptoe.aspx";
        }

        if (navId == 'nav5') {
            window.location.href = getBaseURL() + "NGJunior.aspx";
        }

        if (navId == 'nav6') {
            window.location.href = getBaseURL() + "OverBlink.aspx";
        }
        if (navId == 'nav7') {
            window.location.href = getBaseURL() + "Scholen.aspx";
        }
        if (navId == 'nav8') {
            window.location.href =getBaseURL()+ "Samenwerken.aspx";
        }
        if (navId == 'nav9') {
            window.open("http://shop.blinkuitgevers.nl");
        }

    });

});


function getBaseURL() {
    var url = location.href;  // entire url including querystring - also: window.location.href;
    var baseURL = url.substring(0, url.indexOf('/', 14));


    if (baseURL.indexOf('http://localhost') != -1) {
        // Base Url for localhost
        var url = location.href;  // window.location.href;
        var pathname = location.pathname;  // window.location.pathname;
        var index1 = url.indexOf(pathname);
        var index2 = url.indexOf("/", index1 + 1);
        var baseLocalUrl = url.substr(0, index2);

        return baseLocalUrl + "/";
    }
    else {
        // Root Url for domain name
        return baseURL + "/";
    }

}

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-10446996-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
 





