function swapToNewApplet(appletID, screenshotID, c, w, h, f) {
// c= codebase, w=width, h=height, f=filename,
    var attributes = {
		name: 'ggbApplet', 
		code:'geogebra.GeoGebraApplet',
		archive: 'geogebra.jar',
		codebase: c,
        width: w,
        height: h
    };
    var parameters = {
        filename: f,
		java_arguments: '-Xmx512m',
		cache_archive: 'geogebra.jar, geogebra_main.jar, geogebra_gui.jar, geogebra_cas.jar, geogebra_export.jar, geogebra_properties.jar',
		cache_version: '3.2.33.1, 3.2.33.1, 3.2.33.1, 3.2.33.1, 3.2.33.1, 3.2.33.1',
		framePossible: 'false',
		showResetIcon: 'true',
		showAnimationButton: 'true',
		enableRightClick: 'false',
		errorDialogsActive: 'true',
		enableLabelDrags: 'false',
		showMenuBar: 'false',
		showToolBar: 'false',
		showToolBarHelp: 'true',
		showAlgebraInput: 'false'
    };
    
    var appletTag = document.createElement("applet");
    
	if (attributes != 'undefined' && attributes !== null) {
    	for (var attribute in attributes) {
        	appletTag.setAttribute(attribute,attributes[attribute]);
    	}
	}
    
    if (parameters != 'undefined' && parameters !== null) {
        for (var parameter in parameters) {
            var param = document.createElement("PARAM");
            param.setAttribute("name",parameter);
            param.setAttribute("value",parameters[parameter]);
            appletTag.appendChild(param);
        }
    }
    
    var bodyRef = document.getElementById(appletID);
    var screenshot = document.getElementById(screenshotID);
    bodyRef.removeChild(screenshot);
    bodyRef.appendChild(appletTag);
}
function swapToApplet(appletID, screenshotID, c, w, h, f) {
// c=codebase, w=width, h=height, f=filename,
    var attributes = {
		name: 'ggbApplet', 
		code:'geogebra.GeoGebraApplet',
		codebase: c,
		archive: 'geogebra.jar',
        width: w,
        height: h
    };
    var parameters = {
        filename: f,
		java_arguments: '-Xmx1000m',
		framePossible: 'false',
		showResetIcon: 'true',
		showAnimationButton: 'true',
		enableRightClick: 'false',
		enableLabelDrags: 'false',
		showMenuBar: 'false',
		showToolBar: 'false',
		showToolBarHelp: 'true',
		showAlgebraInput: 'false'
    };
    
    
    var appletTag = document.createElement("applet");
    
	if (attributes != 'undefined' && attributes !== null) {
    	for (var attribute in attributes) {
        	appletTag.setAttribute(attribute,attributes[attribute]);
    	}
	}
    
    if (parameters != 'undefined' && parameters !== null) {
        for (var parameter in parameters) {
            var param = document.createElement("PARAM");
            param.setAttribute("name",parameter);
            param.setAttribute("value",parameters[parameter]);
            appletTag.appendChild(param);
        }
    }
    
    
    var bodyRef = document.getElementById(appletID);
    var screenshot = document.getElementById(screenshotID);
    bodyRef.removeChild(screenshot);
    bodyRef.appendChild(appletTag);
}
function swapToRightClickApplet(appletID, screenshotID, c, w, h, f) {
// c=codebase, w=width, h=height, f=filename,
    var attributes = {
		name: 'ggbApplet', 
		code:'geogebra.GeoGebraApplet',
		codebase: c,
		archive: 'geogebra.jar',
        width: w,
        height: h
    };
    var parameters = {
        filename: f,
		java_arguments: '-Xmx1000m',
		framePossible: 'false',
		showResetIcon: 'true',
		showAnimationButton: 'true',
		enableRightClick: 'true',
		enableLabelDrags: 'false',
		showMenuBar: 'false',
		showToolBar: 'false',
		showToolBarHelp: 'true',
		showAlgebraInput: 'false'
    };
    
    
    var appletTag = document.createElement("applet");
    
	if (attributes != 'undefined' && attributes !== null) {
    	for (var attribute in attributes) {
        	appletTag.setAttribute(attribute,attributes[attribute]);
    	}
	}
    
    if (parameters != 'undefined' && parameters !== null) {
        for (var parameter in parameters) {
            var param = document.createElement("PARAM");
            param.setAttribute("name",parameter);
            param.setAttribute("value",parameters[parameter]);
            appletTag.appendChild(param);
        }
    }
    
    
    var bodyRef = document.getElementById(appletID);
    var screenshot = document.getElementById(screenshotID);
    bodyRef.removeChild(screenshot);
    bodyRef.appendChild(appletTag);
}
function swapToToolbarApplet(appletID, screenshotID, c, w, h, f) {
// c=codebase, w=width, h=height, f=filename,
    var attributes = {
		name: 'ggbApplet', 
		code:'geogebra.GeoGebraApplet',
		codebase: c,
		archive: 'geogebra.jar',
        width: w,
        height: h
    };
    var parameters = {
        filename: f,
		java_arguments: '-Xmx1000m',
		framePossible: 'false',
		showResetIcon: 'true',
		showAnimationButton: 'true',
		enableRightClick: 'false',
		enableLabelDrags: 'false',
		showMenuBar: 'false',
		showToolBar: 'true',
		showToolBarHelp: 'true',
		showAlgebraInput: 'false'
    };
    
    
    var appletTag = document.createElement("applet");
    
	if (attributes != 'undefined' && attributes !== null) {
    	for (var attribute in attributes) {
        	appletTag.setAttribute(attribute,attributes[attribute]);
    	}
	}
    
    if (parameters != 'undefined' && parameters !== null) {
        for (var parameter in parameters) {
            var param = document.createElement("PARAM");
            param.setAttribute("name",parameter);
            param.setAttribute("value",parameters[parameter]);
            appletTag.appendChild(param);
        }
    }
    
    
    var bodyRef = document.getElementById(appletID);
    var screenshot = document.getElementById(screenshotID);
    bodyRef.removeChild(screenshot);
    bodyRef.appendChild(appletTag);
}
