var st = {

	active: 0,
	ie6: (navigator.appName == "Microsoft Internet Explorer" && parseFloat(navigator.appVersion)==4 ? true : false),
	players: new Array(),
	
	// nastaveni prepinani stranek
	main_initialize:	function() {
	
		$('#main').cycle({
    		fx: 'scrollUp',
    		speed: 700,
    		timeout: 0
		});
		
		// prepinani cudliku
		$('#button-1').cycle({fx:'fade', speed:300, timeout:0});
		$('#button-2').cycle({fx:'fade', speed:300, timeout:0});
		$('#button-3').cycle({fx:'fade', speed:300, timeout:0});
		
	},

	// zmena sekce
	main_goto: function(idx) {
		
		if (this.active==7) {
			this.video_stop();
		}
		
	    if (idx!=this.active) {

			// efekt u tri buttonu, nejdrive pro normalni prohlizec
			if (this.ie6==false) {
			    if (idx>=1 && idx<=3) {
				    $('#button-'+idx).cycle(1);
				}
			    if (this.active>=1 && this.active<=3) {
				    $('#button-'+this.active).cycle(0);
			    }
			// efekt u tri buttonu, nejdrive pro a ted pro ie
			} else {
			    if (idx>=1 && idx<=3) {
				}
			    if (this.active>=1 && this.active<=3) {
			    }
			}
			// efekt u horniho menu
			if (idx==0 || idx>=4) {
				$('#button-'+idx).addClass('act');
			}
			if (this.active==0 || this.active>=4) {
				$('#button-'+this.active).removeClass();
			}

			// ztratime focus, at je to hezky
			$('#button-'+idx).blur();

			// zmena sekce
		    $('#main').cycle(idx);
		    
			// nastaveni aktualni sekce
	    	this.active = idx;
	    	
	    	// pripadne zobrazeni scrollbaru
	    	this.scroll_initialize();
	    	
		}
	},
	
	sroll_initialize: function() {
				
	},

	// nastaveni rotace obrazku
	prezentace_initialize:	function() {
		$('#images-frame').cycle({
    		fx: 'fade',
    		speed: 2000,
    		timeout: 2000
		});
	},
	
	// zobrazeni videa
	video_initialize: function() {

		// swf attributes
		var attributes = {};
		// swf parameters
		var params = {
			'allowfullscreen':		'true',
			'allowscriptaccess':	'always',
			'wmode':				'transparent'
		};

		var v_file = new Array('kolorektalni_vysetreni_pivrnec.flv','vize97_spot.flv');
		var v_id = new Array('8314','8334');
		
		// swf flashvars 
		for (i=0; i<v_file.length; i++) {
			
			var flashvars = {
			'file':				v_file[i],
			'image':			'http://video.meditorial.cz/dbpic/vthumb'+v_id[i]+'-450',
			'width':			394,
			'height':			240,
			'displaywidth':		394,
			'displayheight':	240,
			'bufferlength':		'1.5',
			'autostart':		'false',
			'streamer':			'http://video.meditorial.cz/stream/redir.php',
			'plugins':			''
			};

			swfobject.embedSWF("http://video.meditorial.cz/player/player.swf", "video-player"+(i+1), flashvars.width, flashvars.height, "9.0.0", "playerProductInstall.swf", flashvars, params, attributes);
			this.players[i] = "video-player"+(i+1);

		}

	},

	// zobrazeni videa
	video_stop: function() {
		for (i=0; i<this.players.length; i++) {
			//document.getElementById(this.players[i]).sendEvent(ViewEvent.STOP);

		}
	}	
	

}

window.onload = function() {
	st.prezentace_initialize();
	st.main_initialize();
	st.video_initialize();
}

 
