

	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// FLASH AND SHOCKWAVE LIBRARY / NEGORA © 2007
	//
	// Description: Functions to handle Flash and Shockwave elements.
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// FLASH
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	function Flash () {
	}
	
	
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// IT BUILDS A FLASH OR SHOCKWAVE ELEMENT ADAPTED TO THE VERSION OF PLAYER WHICH IS BEING USED
		//
		// _src				Source URL
		// _w					Width
		// _h					Height
		// ? _id				Element ID
		// ? _title				Title
		//
		// Note 1: It returns an "object" element for Windows based systems using IE. Otherwise, an "embed" element.
		// Note 2: It automatically recognises if it's either a Flash or Shockwave file checking its extension. If no extension
		// is present, it sets it as a Flash file by default.
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
		
		Flash.build = function (_src, _w, _h, _id, _title) {
			
			var fl = null;
			
			// If it's a Windows based system using IE, it builds a "object" element.
			// If not, an "embed" element.
			if (CliNav.IE && CliNav.WIN && ! CliNav.OPERA) {
				
				fl = document.createElement ("object");
				
				// IMPORTANT: To make sure that IE doesn't keep "loading forever", these parameters must be specified before the
				// Class ID assignation.
				var list_param = new Object ();
				list_param = {"movie": _src, "src": _src, "quality": "best", "wmode": "transparent", "menu": "false", "allowScriptAccess": "sameDomain"}
	
				for (var key in list_param) {
					var param = document.createElement ("param");
					param.setAttribute ("name", key);
					param.setAttribute ("value", list_param [key]);
					fl.appendChild (param);
				}
				
				// It chooses the corresponding Class ID depending on the type of the source file.
				if (_src.substring (_src.length - 4) == ".dcr") {
					fl.setAttribute ("classid", "clsid:166b1bca-3f9c-11cf-8075-444553540000");
				} else {
					fl.setAttribute ("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
				}
				
				// It takes the version for the codebase from the global variable specified in "cons.js".
				fl.setAttribute ("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="
				+ $INIT.getFlashVer ().replace (new RegExp ("\\.", "gm"), ","));
				
			} else {
				
				fl = document.createElement ("embed");
				fl.setAttribute ("type", "application/x-shockwave-flash");
				fl.setAttribute ("src", _src);
				fl.setAttribute ("quality", "best");
				fl.setAttribute ("wmode", "transparent");
				fl.setAttribute ("menu", "false");
				
			}
			
			// It sets the properties which are common to both elements, "object" and "embed".
			if (_id != null) fl.setAttribute ("id", _id);
			if (_id != null) fl.setAttribute ("name", _id);
			if (_title != null) fl.setAttribute ("title", _title);
			if (_title != null) fl.setAttribute ("alt", _title);
			fl.setAttribute ("width", "" + _w);
			fl.setAttribute ("height", "" + _h);
	
			return fl;
			
		}
		
		
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// IT WRITES THE XHTML CODE OF A FLASH OR SHOCKWAVE ELEMENT ADAPTED TO THE VERSION OF PLAYER WHICH IS
		// BEING USED
		//
		// _src				Source URL
		// _w					Width
		// _h					Height
		// ? _id				Element ID
		// ? _title				Title
		//
		// Note 1: Only writting the XHTML code through a function removes the border around the Flash or Shockwave
		// elements which appear on IE. If you use "document.write ()" in the main script of a page, it will fail.
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
		
		Flash.write = function (_src, _w, _h, _id, _title) {
			
			var fl = Flash.build (_src, _w, _h, _id, _title);
			document.write (CliElem.getHTML (fl));
			
		}
	
	