function loadApplet(media_server){
//alert(document.getElementById("sc").innerHTML);
	document.getElementById("sc").innerHTML =" <applet id='ScreenSharingWidget' code='SSWApplet' archive='/TOClient/bin/ScreenSharingWidget.jar' width='10' height='10' MAYSCRIPT> <param name='fmsIp' value='" + media_server  + "'> </applet>"; 
	try
	{
		//sprawdzenie czy applet rzeczywiście się zaladował 
		document.getElementById("ScreenSharingWidget").isActive();
	}
	catch(err)
	{
		showAlert('loadApplet_NOK','not_supported_os_for_screen_sharing');
	}
}

function startApplet(ssnCode, strName, usrLogin, usrPassword, type, frameTime, keyFrameTime, bitRate, maxDelay, compression) {
        //type - R (rectangle); F - fullscreen
        document.ScreenSharingWidget.startApplet(ssnCode, strName, usrLogin, usrPassword, type, frameTime, keyFrameTime, bitRate, maxDelay, compression);
}

function startStr(ssn_code, strName, user, password) {
        startApplet(ssn_code, strName, user, password, 'R',null,null,null,null,null);
}

function changeParams(type, frameTime, keyFrameTime, bitRate, maxDelay, compression)
{
        document.ScreenSharingWidget.changeParams(type, frameTime, keyFrameTime, bitRate, maxDelay, compression);
}

function changeParamsTest()
{
        changeParams('F', null, null, null, null, null);
}

function close() {
    document.ScreenSharingWidget.close();
}

function showAlert(str,params)
{
	getMovie("main").ssStatus(String(str),String(params));
	document.form1.result.value += str + "\n";
	if (params != null)
	{
		document.form1.result.value += 'params: ' + params + '\n';
	}
}

function showScreenSharingAlert(str)
{
        document.form1.resultScreenSharing.value += str + "\n";
}

function getMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	} else {
		return document[movieName]
	}
}
