function getMovie(id) {
    var M$ =  navigator.appName.indexOf("Microsoft")!=-1;
    return (M$ ? window : document)[id];
}


function playMovie(n){
	var	movie;				  	/* Flash movie to switch play/stop */

	for(var i=0; i<movies.length; i++){
		if(movie = getMovie(movies[i]) ){

				if(movies[i]==movies[n]){
					//$(movies[i]).style.visibility="visible";
					setTimeout( "$('"+movies[i]+"').style.visibility='visible'",1000);
					movie.Play();
				}
				else{
					movie.StopPlay();
					movie.Rewind();
					$(movies[i]).style.visibility="hidden";
				}

			
		}
	}

}


var Credits,PageContentWidth;

function correctCredits(){
	PageContentWidth = $('PageContent').offsetWidth+400;
	if(window.Credits){
		Credits.options.item.size = PageContentWidth;
		Credits.aItems.each(function(item) {
			item.setStyle("width",PageContentWidth);
		});
//		Credits.goTo(Credits.atScreen);
		Credits.container.setStyle("left", - Credits.atScreen * Credits.options.item.size);
	} 
}

/*
		window.addEvent("domready", function() {
				window.onresize = function(){ correctCredits() }
				PageContentWidth = $('PageContent').offsetWidth+400;
			
				Credits = new iCarousel("Credits", {
				idPrevious: "prev",
				idNext: "next",
				idToggle: "undefined",
				item: {
					klass: "Credit",
					size: PageContentWidth
				},
				animation: {
					type: "scroll",
					duration: 1000,
					amount: 1
				}
			});

			Credits.aItems.each(function(item) {
				item.setStyle("width",PageContentWidth);
			});
			
			
			$("to_AutoNoi").addEvent("click", function(event){new Event(event).stop();Credits.goTo(0);playMovie();this.blur() });
			$("to_AutoUzate").addEvent("click", function(event){new Event(event).stop();Credits.goTo(1);playMovie(1);this.blur() });
			$("to_AutoComerciale").addEvent("click", function(event){new Event(event).stop();Credits.goTo(2);playMovie();this.blur() });
			$("to_BunuriCasnice").addEvent("click", function(event){new Event(event).stop();Credits.goTo(3);playMovie(2);this.blur() });
			$("to_Echipamente").addEvent("click", function(event){new Event(event).stop();Credits.goTo(4);playMovie();this.blur() });
			
			//Credits.goTo(1);

		});
*/

