	//skripty pro komunikaci mezi javascriptem a vlozenym SWF
  // ------- Private vars -------
	var jsReady = false;
	var swfReady = false;

	// ------- functions called by ActionScript -------
	// called to check if the page has initialized and JavaScript is available
	function isReady() {
    //alert("Swfko zavolalo fci isReady odpoved je " + jsReady);
    return jsReady;
    
	}

	// called to notify the page that the SWF has set it's callbacks
	function setSWFIsReady() {
		// record that the SWF has registered it's functions (i.e. that JavaScript
		// can safely call the ActionScript functions)
		//alert("fce setSWFIsReady v javascriptu");
    swfReady = true;
		
		updateStatus();
	}
	
	// called to notify the page of a new message
	function newMessage(value) {
		// append the message text to the end of the transcript
		document.forms["imForm"].transcript.value += "The Other Person: " + value + "\n";
	}

	// called to notify the page that the SWF user's availability (status) has changed
	function statusChange() {
		updateStatus();
	}


	// ------- event handling -------
	// called by the onload event of the <body> tag
	function pageInit() {
		// record that JavaScript is ready to go.
		jsReady = true;
	}

	// called when the "Send" button is pressed; the value in the messageText text field
	// is passed in as a parameter.
	function sendMessage(message) {
		if (swfReady)
		{
			// if the SWF has registered it's functions, add the message text to the
			// local transcript, send it to the SWF file to be processed there, and clear
			// the message text field.
			document.forms["imForm"].transcript.value += "You: " + message + "\n";
			document.forms["imForm"].messageText.value = "";
			getSWF("IntrovertIMApp").newMessage(message);
		}
	}


	// ------- utility functions -------
	// if the SWF has indicated it's ready for communication, calls the ActionScript
	// function to get the current "availability" status and writes it into the text field.
	function updateStatus() {
		if (swfReady) {
			var currentStatus = getSWF("IntrovertIMApp").getStatus();
			//alert("currentStatus = " + currentStatus);
      //document.forms["imForm"].status.value = currentStatus;
		}
	}

	// Gets a reference to the specified SWF file by checking which browser is
	// being used and using the appropriate JavaScript.
	// Unfortunately, newer approaches such as using getElementByID() don't
	// work well with Flash Player/ExternalInterface.


