﻿var Vinter = {
	
	activateMenu: function()
	{
		var m = /.+\/([^_-]+).*\.aspx/.exec(document.location.href);
		var f = m != null ? m[1].toLowerCase() : "default";
		$("#" + f).addClass("active");

		$("#subnav li").each(function(i, o) {
			
			// console.log(o.firstChild);
		
			if (o.firstChild.href && o.firstChild.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;
			});
		});
	},
	
	popup: function(e)
	{
		window.open(this.href, "popupwin", "width=400, height=550, scrollbars=1");
		return false;
	}
};


$(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);

    }
	
		    $(function(){
				// Accordion
				$("#accordion").accordion({ collapsible: true, autoHeight: false });
				
				$("#accordion").accordion( 'activate' , 10);
				//$("#accordion").accordion( 'activate' , 2);
				//$("#accordion").accordion('option', 'collapsible', true);
				
				$("#accordion2").accordion({ header: "h3", collapsible: true, autoHeight: false });
				
				$("#accordion2").accordion( 'activate' , 10);
			});
			
			
			
			$(function() {
      jQuery("div#galleyslider").codaSlider()
      });
			
			
			
			
//	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");
			});
		}	
			
	
   });
   */
});



//var Vinter = {
//	
//	cleanOnClick: function(event)
//	{
//	
//		var t = event.target;
//		t.select();
//		t.style.color = "#000000";
//		
//	},

//	pageInit: 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... 
//			alert(2);
//			$("body").addClass("png8");
//			//document.execCommand('BackgroundImageCache', false, true);
//		//}
//		
//		
//		// Select inputs on click
//		$(".cleanonclick").bind("click", Vinter.cleanOnClick);
//	
//		//Vinter.activateMenu();
//		
//	}
//		

//}

//$(document).ready(Vinter.pageInit);