$(document).ready(function()
{
	mxh.init();
});


var mxh =
{

	init: function()
	{
		structure.init();
		sections.init();
	},

	lang: function(langs)
	{
		var langDefault = 'pt-br';
		var lang;
		if ($('meta[http-equiv="Content-Language"]').attr('content'))
		{
			lang = $('meta[http-equiv="Content-Language"]').attr('content');
		}
		else
		{
			lang = langDefault;
		}
		var langValue = "";

		$.each(langs, function(key, value)
		{
			if (key == lang)
			{
				langValue = value.toString();
			}
		});
		return langValue
	},

	openCall: function()
	{
		var url = "http://www6.directtalk.com.br/CHAT/skin/F98C0001016C3000110E/Maxhaus/index.html"
		var url = dpcTracker._getLinkerUrl(url); 
		var popupWin = window.open(url,"atendimento","width=530,height=500,top=0,resizable=no,scrollbars=no,statusbar=yes");		
	}
};

var sections = {

	init: function()
	{

		var section = $('body').attr('class').split(" ")[0];

		if ($('body').hasClass('internal')) { sections.internalNav(); }

		if (section == 'default')
		{
			home.init();
		} else
		{
			section.replace("-", "_");
			eval(section).init();
		}

	},

	internalNav: function()
	{
		var el = '#section-nav dd';
		$(el + ' a').fadeTo(1, 1);
		$(el + '.active').animate({ height: 76 }, { queue: false, duration: 300 });
		$(el + '.active a').animate({ opacity: 1 }, { queue: false, duration: 300 });

		$(el).hover(function()
		{
			$(this).addClass('hover');
			$(el + '.active').animate({ height: 38 }, { queue: false, duration: 300 });
			//$(el + '.active a').animate({ opacity: 0 }, { queue: false, duration: 300 });
			$(this).animate({ height: 76 }, { queue: false, duration: 300 });
			$('a', this).animate({ opacity: 1 }, { queue: false, duration: 300 });
		}, function()
		{
			$(this).removeClass('hover');
			$(el + '.active').animate({ height: 76 }, { queue: false, duration: 300 });
			//$(el + '.active a').animate({ opacity: 0 }, { queue: false, duration: 300 });
			$(this).animate({ height: 38 }, { queue: false, duration: 300 });
			$('a', this).animate({ opacity: 1 }, { queue: false, duration: 300 });
		});
	}



};






















