var blank = new Image();
blank.src = '/i/blank.gif';
 
$(document).ready(function() {
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (badBrowser) {
		// get all pngs on page
		$('img[src$=.png]').each(function() {
			if (!this.complete) {
				this.onload = function() { fixPng(this) };
			} else {
				fixPng(this);
			}
		});
	}
	$("a.group").fancybox({
		'zoomSpeedIn': 300, 
		'zoomSpeedOut':	300,
		'frameHeight' : 220,
		'overlayShow': false
	});
});
 
function fixPng(png) {
	// get src
	var src = png.src;
	// set width and height
	if (!png.style.width) { png.style.width = $(png).width(); }
	if (!png.style.height) { png.style.height = $(png).height(); }
	// replace by blank image
	png.onload = function() { };
	png.src = blank.src;
	// set filter (display original image)
	png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}

function poll_vote(id){
	vote_name = "input:radio[@name=poll_" + id + "]:checked";
	vote_value = $(vote_name).val();
	if(vote_value == undefined) alert('Вы не выбрали вариант ответа!');
	else {
		$.ajax({
			url: "/pollajax.php",
			global: false,
			type: "POST",
			data: ({pollid: id, voteid: vote_value}),
			//dataType: "html",
			success: function(msg){
				alert('Спасибо, что проголосовали!');
			}
		});

		//alert('Вы проголосовали за вариант №' + vote_value);
	}
}