/*Get a Flash object*/////////////////////////////////////////////////////////////////////////////////////////////////////////
function flashObj(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		if (document.embeds && document.embeds[movieName]) {
			return document.embeds[movieName];
		}
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(movieName);
	}
}
/*Get a Flash ibject*/////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*Set the interface language previously chosen by the user*/////////////////////////////////////////////////////////////////////////////////////////////////////////
function set_flash_lang_interface(flashMovie) {
	//Set the var for the interface and the style of the main tpl which is a cookie
	flashMovie.SetVariable("interface_file","../design/level_users/blue/flash/interface/");
	
	//Check for the language
	var get_cookie = getCookie('lang');
	if(get_cookie=="en") {
		flashMovie.SetVariable("lang","en");
	}
	else if(get_cookie=="bg") {
		flashMovie.SetVariable("lang","bg");
	}
}
/*Set the interface language previously chosen by the user*/////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*A function called from Flash that defines which module must start*/////////////////////////////////////////////////////////////////////////////////////////////////////////
function define_comp() {
//		alert("flashMovie"+swf);
	//Video
	if(swf == "enc_space_videos") {
		encyclopedia_space_video();
	}
	else if(swf == "enc_videos") {
		encyclopedia_video();
	}
	else if(swf == "enc_browse") {
		encyclopedia_browse_space_video(path);
	}
	else if(swf == "live_lessons") {
		live_lessons(path);
	}
	//Video
	////////////////////////////////////////////////////////////////////////////
	//Imgs
	else if(swf == "enc_space_imgs") {
		encyclopedia_space_images();
	}
	else if(swf == "enc_timeline_imgs") {
		encyclopedia_timeline_images();
	}
	else if(swf == "enc_archive_imgs") {
		encyclopedia_archive_images();
	}
	else if(swf == "enc_maps_imgs") {
		encyclopedia_maps_images();
	}
	else if(swf == "enc_browse") {
		encyclopedia_browse_space_images(path);
	}
	else if(swf == "scientific_galleries") {
		scientific_galleries(path);
	}
	//Imgs
	////////////////////////////////////////////////////////////////////////////
	else {
		return false;
	}
}
/*A function called from Flash that defines which module it must start*/////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Encyclopedia
/*A set of functions used to set variables in Flash*/////////////////////////////////////////////////////////////////////////////////////////////////////////
  //Video
      function encyclopedia_video() {
	     var flashMovie=flashObj("main_swf");

	     //Get lang
	     var lang =  getCookie("lang");

	     flashMovie.SetVariable("root_dir","../rsc/level_users/flvs/encyclopedia/others/"+lang+"/");
	     flashMovie.SetVariable("root_dir_flvs","http://localhost/238/rsc/level_users/flvs/encyclopedia/others/"+lang+"/flvs/");

	     set_flash_lang_interface(flashMovie);
      }
   //Space
      //Video
	     function encyclopedia_space_video() {
			 var flashMovie=flashObj("main_swf")

			 //Get lang
			 var lang =  getCookie("lang");

			 flashMovie.SetVariable("root_dir","../rsc/level_users/flvs/encyclopedia/space/"+lang+"/");
			 flashMovie.SetVariable("root_dir_flvs","http://localhost/238/rsc/level_users/flvs/encyclopedia/space/"+lang+"/flvs/");

			 set_flash_lang_interface(flashMovie);
		 }
		 
      //Browse video
	  //This function is called from an ajax file
	     function encyclopedia_browse_space_video(path) {
			 var flashMovie=flashObj("main_swf")

			 flashMovie.SetVariable("path", path);
			 set_flash_lang_interface(flashMovie);
		 }
      //Live Lessons
	     function live_lessons(path) {
			 var flashMovie=flashObj("main_swf")

			 flashMovie.SetVariable("path", path);
			 set_flash_lang_interface(flashMovie);
		 }
      //Gallery
	     function encyclopedia_space_images() {
			 var flashMovie=flashObj("main_swf");

			 flashMovie.SetVariable("root_dir","../rsc/level_users/gallery/encyclopedia/space/");

			 flashMovie.SetVariable("lang","en");

			 set_flash_lang_interface(flashMovie);
		 }
		 //Archive
	     function encyclopedia_archive_images() {
			 var flashMovie=flashObj("main_swf");

			 flashMovie.SetVariable("root_dir","../rsc/level_users/gallery/encyclopedia/archive/");

			 set_flash_lang_interface(flashMovie);
		 }
		 //Timeline
	     function encyclopedia_timeline_images() {
			 var flashMovie=flashObj("main_swf");

			 flashMovie.SetVariable("root_dir","../rsc/level_users/gallery/encyclopedia/timeline/");

			 set_flash_lang_interface(flashMovie);
		 }
		 //Maps
	     function encyclopedia_maps_images() {
			 var flashMovie=flashObj("main_swf");

			 flashMovie.SetVariable("root_dir","../rsc/level_users/gallery/encyclopedia/maps/");

			 set_flash_lang_interface(flashMovie);
		 }
		 //Browse images
		 //This function is called from an ajax file
	     function encyclopedia_browse_space_images(path) {
			 var flashMovie=flashObj("main_swf")

			 flashMovie.SetVariable("path", path);
			 set_flash_lang_interface(flashMovie);
		 }

		 //Scientifc Galleries
	     function scientific_galleries(path) {
			 var flashMovie=flashObj("main_swf");
			 
			 flashMovie.SetVariable("root_dir", path);

			 set_flash_lang_interface(flashMovie);
		 }
/*A set of functions used to set variables in Flash*/////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

