var just_a_flag = false; function onTemplateLoadedCallback() { } function revert($e) { var elmt = $e.css("left","auto").css("top", "auto").removeClass("inBox").get(0); if(elmt) elmt.className = elmt.className.replace(/(d(\d+))/, ""); } function getN(range) { if(range > 1) return Math.floor(Math.random()*range); else if(range == 1) return Math.round(Math.random()*10)/10; else if(range == 0.1) return Math.round(Math.random()*0.1*100)/100; } function reloadApp(app) { var operator = app.parameters.value("operator"); var range = parseFloat(app.parameters.value("range")); var count = parseInt(app.parameters.value("count")); var show = app.parameters.value("show"); if(!just_a_flag){ just_a_flag = true; show = "3"; } switch(show){ case "1": $("#labels div div").each(function(){ $(this).css("top","auto").css("left","auto") }) break; case "2": break; default: $scene = $("#scene"); $scene.empty(); $labels = $("
"); $scene.append($labels); $drops = $(""); $scene.append($drops); var meeted = []; for (var i = 0; i < count; i++) { var n = getN(range); while($.inArray(n, meeted) != -1) n = getN(range); meeted.push(n); $label = $("