$(document).ready(function() {
	setTimeout(function(){$('#maintable').fadeIn('slow')},1000);
	
	flash_src = $('#flash').attr('flash')
	$('#flash[flash]').flash({src:flash_src,width:'100%',height:'100%',wmode:'transparent'})
	
	$('img[bimg]').click(function(){
		new_src = $(this).attr('bimg')
		new_name = $(this).attr('name')
		$('#galimage').attr('src',new_src);
		$('#galname').text(new_name);
	})
	
	$('.alpha').hover(function(){$(this).animate({opacity: 1})},function(){$(this).animate({opacity: 0.6})})
	
	$('.print').click(function(){
		print();
		return false;
	})
});

function open_mmg_video()
{
	modal_width = 780;
	modal_height = 600;
	$("#modal").remove();
	var modal = $('<div id=modal style="display: none"></div>').appendTo('body');
	modal.css('position','absolute').width(modal_width).height(modal_height);
	var left_coord = parseInt($(document).scrollLeft() + ($(window).width() - modal_width) / 2);
	var top_coord = parseInt($(document).scrollTop() + ($(window).height() - modal_height) / 2);
	if(left_coord < 0) left_coord = 0;
	if(top_coord < 0) top_coord = 0;
	modal.css('left',left_coord).css('top',top_coord);
	var reg = new RegExp('^/','g');
	var t = 100 - Math.random() * 100;
	t = parseInt(t) % 10;
	if(t < 3) file = '742';
	else if(t < 6) file = '743';
	else if(t < 9) file = '744';
	else file = '745';
	modal.load('/open_image.php?sh=1&file=' + file,function(){
		$(this).show()
	});
}
