jQuery(document).ready( function($)
{
	var getOS = function()
	{
		var
			platform = navigator.platform.toLowerCase(),
			os = { type: '', bit: 0 };
			
		if (platform.indexOf('mac') >= 0)
		{
			os.type = 'mac';
		}
		else if (platform.indexOf('linux') >= 0)
		{
			os.type = 'linux';
		}
		else // Windows will also serve as fallback
		{
			os.type = 'windows';
		}

		if (platform.indexOf('64') >= 0)
		{
			os.bit = 64;
		}
		if (platform.indexOf('32') >= 0)
		{
			os.bit = 32;
		}
		else
		{
			 // for mac and linux, the fallback will be 64bit,
			 // for others, it will be 32bit
			os.bit = (os.type === 'mac' || os.type === 'linux') ? 64 : 32;
		}

		return os;
	};

	if ($('.downloads').length > 0)
	{
		var os = getOS();

		$('.downloads .recommended .os-icon').addClass(os.type);
		$('.downloads .recommended p.'+os.type+'.'+os.bit+'bit').show();
		$('.downloads .other li.'+os.type+'.'+os.bit+'bit').hide();

// 		$('.open-overlay').trigger('click');
	}
});
