
/* для осла 6 устраняем баг с кэшированием фоновых картинок */
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


var menu = {
	show: function (i) {
		var el_mmItem = document.getElementById('mm-item-' + i);
		el_mmItem.className = el_mmItem.className + ' active';
	},
	
	hide: function (i) {
		var el_mmItem = document.getElementById('mm-item-' + i);
//		el_mmItem.className = el_mmItem.className.replace(' active', '');
		setTimeout(function () { el_mmItem.className = el_mmItem.className.replace(' active', '') }, 50);
	}
}


function popupImg(url, width, height, title) {
	var scrollbars = 0;
	var x = (screen.width - width) / 2;
	var y = (screen.height - height) / 2;

	if (x < 0) x = 0;
	if (y < 0) y = 0;

	var w = width > screen.width ? screen.width : width;
	if (height > screen.availHeight) {
		h = screen.availHeight - 29;
		scrollbars = 1;
		w += 16;
	} else {
		h = height;
	}
	wnd = window.open('', 'popupImg', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + scrollbars + ',resizable=0,copyhistory=0,width=' + w + ',height=' + h + ',top=' + y + ',left=' + x);

	wnd.document.open();
	wnd.document.write("<html><head><title>"+title+"</title></head><body bgcolor=#ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0><a href='javascript:window.close()'><img src='" + url + "' border=0></a></body></html>");
	wnd.document.close;
	wnd.focus();

	return false;
}


function pageCurtain(flag) {
	if (flag) {
		$('body').append('<div id="page-curtain"><!--[if lte IE 6]><iframe></iframe><![endif]--></div>');
		$('#page-curtain').height($(document).height());
	} else {
		$('#page-curtain').remove();
	}
}

