jQuery(document).ready(function($) {
	
	var expertMode = false;
	if ($('.tx-spbrowserdetect-pi1 #expertMode').length) {
		expertMode = true;
	}
	
	$.cookie('tx_spbrowserdetect_pi1_jssetcookie', 'test_jssetcookie');
	if ($.cookie('tx_spbrowserdetect_pi1_jssetcookie') == 'test_jssetcookie') {
		$('#jcookietest_out').html('JS-Cookies <span class="good">aktiviert</span>');
		$('#sendMail a').each(function() {
			$(this).attr('href', $(this).attr('href') + '+%20JS-Cookies%20aktiviert%0A%0A');
		});
	}
	$.cookie('tx_spbrowserdetect_pi1_jssetcookie', null);

	$('#jscreentest_out').append('Bildschirmgröße: ' + screen.width + 'x' + screen.height + "<br />");
	$('#sendMail a').each(function() {
		$(this).attr('href', $(this).attr('href') + 'Bildschirmgröße: ' + screen.width + 'x' + screen.height + '%0A%0A');
	});

	if ($('#jstyletest').css('width') == '42px') {
		$('#jstyletest_out').html('CSS <span class="good">aktiviert</span> (getestet via JS)');
		$('#sendMail a').each(function() {
			$(this).attr('href', $(this).attr('href') + '+%20CSS%20aktiviert%20(getestet%20via%20JS)%0A%0A');
		});
	}

	if (expertMode) {
		$('#jSupport').append('<table><tbody></tbody></table>');
		$.each($.support, function(index, data) {
			if (data) {
				$('#jSupport table tbody').append('<tr><td>' + index + '</td><td class="c"><span class="good">+</span></td></tr>');
			}
			else {
				$('#jSupport table tbody').append('<tr><td>' + index + '</td><td class="c"><span class="bad">-</span></td></tr>');
			}
			$('#sendMail a').each(function() {
				$(this).attr('href', $(this).attr('href') + index + ':%20' + data + '%0A');
			});
		});
	}
	
	
	$('#sendMail a').each(function() {
		$(this).attr('href', $(this).attr('href').replace(/-%20Javascript%20deaktiviert/,'+%20Javascript%20aktiviert'));
	});
	
	
});

