﻿/**
* Site specific namespace
*/

var Vinter = {

	pushupMenu: function()
	{
		
		if ($(".expand"))
		{
			$(".expand dd").css("opacity", 0.8);
	            
			$(".expand").hover(function(e) {
	        
				var content = $(this).find("dd").get(0);
	            
				$(this).stop();
	            
				$(this).animate({
					top: "100px"
				}, 150);

			},
	        
			function(e) {
	        
				var content = $(this).find("dd").get(0);
	            
				$(this).stop();
	            
				$(this).animate({
					top: "281px"
				}, 150);
	            
			});
        }
	},
	
	activateMenu: function()
	{
		var m = /.+\/([^_-]+).*\.aspx/.exec(document.location.href);
		var f = m != null ? m[1].toLowerCase() : "default";
		$("#" + f + " a").addClass("active");

		$("#subnav li a").each(function(i, o) {
			if (o.href && o.href.toLowerCase() == document.location.href.toLowerCase())
				$(o).addClass("active");
		});
	},
	
	popupWin: function(e, attr)
	{
		
		var attr = (e.data == undefined) ? "" : e.data.attr;
		window.open(this.href, "popupwin", attr);
		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);
    }
    
    Vinter.pushupMenu();
	Vinter.activateMenu();
    
    // Set opacity
    $(".sidebar").css("opacity", 0.7);
	$(".popup").bind("click", {attr: "width=500, height=600, scrollbars=1"}, Vinter.popupWin);
	$(".external").bind("click", Vinter.popupWin);

});
