﻿/**
* Site specific namespace
*/
var Vinter = {
	
	activateMenu: function()
	{
		var m = /.+\/([^_-]+).*\.aspx/.exec(document.location.href);
		var f = m != null ? m[1].toLowerCase() : "default";
		var item = $("#" + f + " > a");
		item.addClass("active");
		
		if (item[0])
			$(item[0].parentNode).addClass("active-parent");

		$("#subnav li a").each(function(i, o) {
			if (o.href && o.href.toLowerCase() == document.location.href.toLowerCase())
				$(o).addClass("active");
		});
	},
	
	externalLinks: function() 
	{
		$("a[rel=external]").each(function(i, item)	{
			$(item).click(function(e) {
				window.open(this.href, "external");
				return false;
			});
		});
	}
};

/**
* Onload inits
*/

$(document).ready(function() {
    
    // Append class to body if IE < 7
    // Do this so we don't need conditional comments
    if($.browser.msie === true && parseInt($.browser.version) <= 6)
    {
        // Add png8 to body... 
        $("body").addClass("png8");
        document.execCommand('BackgroundImageCache', false, true);
    }
	
	if($.browser.msie === true && parseInt($.browser.version) >= 7)
    {
        // Add ie7 to body... 
        $("body").addClass("ie7"); 
		document.execCommand('BackgroundImageCache', false, true);
    }
   
	Vinter.activateMenu();
   
   /*
   $(".accordion").click(function(e) {
	
		if ($("dl", this).css("display") == "block")
		{
			$("dl", this).slideUp("fast");
		}
		else	
		{
			var that = this;
			$(".accordion dl").each(function(i, item) {
				(item.parentNode == that) ? $(item).slideDown("medium") : $(item).slideUp("medium");
			});
		}	
			
	
   });
   */
});
