/*
function fix_png() {
	document.getElementsByClassName('top_button').each(function(poElement){
		if ((browser.isIE55 || browser.isIE6up) && browser.isWin32){
			var cBGImg = poElement.currentStyle.backgroundImage;
			var cImage = cBGImg.substring(cBGImg.indexOf('"') + 1, cBGImg.lastIndexOf('"'));
			poElement.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + cImage + "', sizingMethod='scale')";
			poElement.style.backgroundImage = "none";
		}
	});
}
*/
function mouse_over (button) {
	var button = $('t_'+button);
	button.setOpacity ( 1 );
}

function mouse_out (button) {
	var button = $('t_'+button);
	button.setOpacity ( 0.75 );
//	fix_png();
}

function prepare_buttons() {
	$('t_mieszkania').setOpacity ( 0.75 );
	$('t_domy').setOpacity ( 0.75 );
	$('t_dzialki').setOpacity ( 0.75 );
	$('t_lokale').setOpacity ( 0.75 );
}

function set_opacity_both (id, opacity) {
	$('s_'+id).setOpacity( opacity );
	$('s_l_'+id).setOpacity( opacity );
}

function set_z_both (id, z) {
	$('s_'+id).setStyle({ zIndex: z });
	$('s_l_'+id).setStyle({ zIndex: z });
}

function change_slide(id_from,id_to) {
	var op_from = 1;
	var op_to = 0;
	new PeriodicalExecuter( function (pe) {
		if (op_from > 0) {
			op_from = op_from - 0.1;
			set_opacity_both (id_from, op_from);
			op_to = op_to + 0.1;
			set_opacity_both (id_to, op_to);
		} else pe.stop();
	}, 0.05 );
	set_z_both (id_from, 3);
	set_z_both (id_to, 5);
}

function slideshow() {
	set_opacity_both (1, 1);
	set_opacity_both (2, 0);
	set_opacity_both (3, 0);
	set_opacity_both (4, 0);
	set_z_both (1, 5);
	set_z_both (2, 3);
	set_z_both (3, 3);
	set_z_both (4, 3);
	var current_slide = 1;
	new PeriodicalExecuter( function (pe) {
		var prev_slide = current_slide;
		if (++current_slide > 4) current_slide = 1;
		change_slide(prev_slide,current_slide);
	}, 5 );
}

