function show_images(film_id) {
	$('a#image_'+film_id+'_0').trigger('click');
}
function show_schedule(film_id) {
	$('a#link_schedule_'+film_id).trigger('click');
}
function show_trailer(film_id) {
	$('a#link_trailer_'+film_id).trigger('click');
}

function flash_init() {
	// flash requirements
	var requiredMajorVersion = 8;
	var requiredMinorVersion = 0;
	var requiredRevision = 0;
	
	// detection
	var hasProductInstall = DetectFlashVer(7, 0, 0);
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	if ( hasProductInstall && !hasReqestedVersion ) {

		//alert('express install');
		
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		var MMdoctitle = document.title;
	
		var so = new SWFObject("playerProductInstall.swf", "flash_express_install", "100%", "100%", "6", "#109CEB");
		so.addVariable('MMredirectURL', MMredirectURL);
		so.addVariable('MMplayerType', MMPlayerType);
		so.addVariable('MMdoctitle', MMdoctitle);
		so.write("flash_div");		

	} else if (hasReqestedVersion) {		
		//alert('everything is fine');
		var so = new SWFObject("index_14.swf", "flash_object", "100%", "100%", requiredMajorVersion, "#109CEB");
		so.addParam('wmode', 'transparent');
		so.write("flash_div");		
	}
	else {  // flash is too old or we can't detect the plugin
		//alert('bad');
		var alternateContent = ''
		+ 'Для просмотра сайта необходим Adobe Flash Player. '
		+ '<a href=http://www.adobe.com/go/getflash/>Установить</a>';
		document.getElementById('flash_div').innerHTML = alternateContent;  // insert non-flash content
	}
}
function flash_resize() {
	var s = get_window_size();
	var obj = document.getElementById('flash_div');
	obj.style.height = (s.height-81)+'px';
}
function get_window_size() {
	var w = 0;
	var h = 0;
	//IE
	if(!window.innerWidth) {
		//strict mode
		if(!(document.documentElement.clientWidth == 0)) {
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else {
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else {
		w = window.innerWidth;
		h = window.innerHeight;
	}
	return {width:w,height:h};
}

window.onresize = function() {
	flash_resize();
}

$(function() {
	flash_init();

	Shadowbox.init();

	flash_resize();
	$('#sound > a').click(function() {
		var obj = get_flash_obj('flash_object');
		obj.soundTrigger();
		return false;
	});
	
	$('.schedule').hide();
	//show_trailer(0);
});
function sound_trigger_update(f) {
	$('#sound > a').html(f ? 'выключить звук' : 'включить звук');
}
function get_flash_obj(movieName) {
    if ($.browser == 'msie') {
        return window[movieName];
    }
    else {
        return document[movieName];
    }
}