/*
** by Sitsanlis Ilias
*/

var startLabel="Έναρξη",pauseLabel="Παύση",dtSlowFactor=.1;function fullscreenchanged(t){resizeCanvas()}function toggleFullScreen(){document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():document.documentElement.requestFullscreen()}function checSlowMotion(){dt=(dtSlow=$("#slowMotion").is(":checked")?dtInitial*dtSlowFactor:dtInitial,dtSlow)}function playMovieStartClick(){framePlay=!1,playMovie=!0}function playMoviePauseClick(){framePlay=!1,playMovie=!1}function stopButtonCkick(){playMovie=!1,dt=dtSlow,restart()}document.addEventListener("fullscreenchange",fullscreenchanged),$(document).ready(function(t){var o=$("#refresh");"yes"==o.val()?location.reload(!0):o.val("yes")}),$(function(){$("#settings").button({text:!1,label:"Menu",icons:{primary:"ui-icon-menu"}}).click(function(){$("#dialogVariables").dialog("isOpen")?($("#dialogVariables").dialog("close"),document.getElementById("left").classList.remove("floatLeft")):($("#dialogVariables").dialog("open"),"float"==flagPos?document.getElementById("left").classList.remove("floatLeft"):document.getElementById("left").classList.add("floatLeft")),resizeCanvas()}),$("#fullScreenMain").button({text:!1,label:"Πλήρης Οθόνη",icons:{primary:"ui-icon-extlink"}}).click(function(){toggleFullScreen()}),$("#fullScreen").button({text:!1,label:"Πλήρης Οθόνη",icons:{primary:"ui-icon-extlink"}}).click(function(){toggleFullScreen()}),$("#fixDown").button({text:!1,label:"Στοίχηση Κάτω",icons:{primary:"ui-icon ui-icon-arrow-d"}}).click(function(){$("#dialogVariables").dialog("option","resizable",!1);for(var t=0;t<=1;t++)flagPos="down",fixVariablesPosition(flagPos)}),$("#fixRight").button({text:!1,label:"Στοίχηση Δεξιά",icons:{primary:"ui-icon ui-icon-arrow-r"}}).click(function(){$("#dialogVariables").dialog("option","resizable",!1),fixVariablesPosition("right"),flagPos="right"}),$("#fixFloat").button({text:!1,label:"Ελεύθερο",icons:{primary:"ui-icon ui-icon-move"}}).click(function(){$("#dialogVariables").dialog("option","resizable",!0),flagPos="float",fixVariablesPosition(flagPos)}),$("#dialogVariables").dialog({autoOpen:!1,closeOnEscape:!0,height:"auto",width:180,resize:"auto",resizable:!1,minHeight:50,minWidth:100,autoResize:!0,open:function(t,o){document.getElementById("left").classList.add("floatLeft"),resizeCanvas()},close:function(t,o){document.getElementById("left").classList.remove("floatLeft"),resizeCanvas()},hide:{effect:"fade",duration:250},position:{my:"right top",at:"right top",of:window},draggable:!0}),$("#dialogVariables").on("dialogdragstart",function(t,o){document.getElementById("left").classList.remove("floatLeft"),dragFlag=!0}),$("#dialogVariables").on("dialogdragstop",function(t,o){dragFlag=!1}),$(".ui-dialog-titlebar").hide(),$.ui.dialog.prototype._focusTabbable=$.noop}),$(function(){$("#beginning").button({text:!1,icons:{primary:"ui-icon-seek-first"}}).bind("touchstart mousedown",function(t){dt=-dtSlow,playMovie=!0,framePlay=!0}).bind("touchend mouseup",function(t){playMovie=!1,framePlay=!1,dt=dtSlow,$("#play").button("option",{label:"Έναρξη",icons:{primary:"ui-icon-play"}})}),$("#end").button({text:!1,icons:{primary:"ui-icon-seek-end"}}).click(function(){playMovie=!0,framePlay=!0,$("#play").button("option",{label:startLabel,icons:{primary:"ui-icon-play"}})}),$("#rewind").button({text:!1,icons:{primary:"ui-icon-seek-prev"}}).mousedown(function(){playMovie=!0,dt=-dtSlow*factor}).bind("touchstart",function(t){playMovie=!0,dt=-dtSlow*factor,t.preventDefault()}).bind("touchend mouseup",function(t){dt=dtSlow,playMovie=!1,$("#play").button("option",{label:startLabel,icons:{primary:"ui-icon-play"}})}),$("#forward").button({text:!1,icons:{primary:"ui-icon-seek-next"}}).mousedown(function(){playMovie=!0,dt=dtSlow*factor}).bind("touchstart",function(t){playMovie=!0,dt=dtSlow*factor,t.preventDefault()}).bind("touchend mouseup",function(t){dt=dtSlow,playMovie=!1,$("#play").button("option",{label:startLabel,icons:{primary:"ui-icon-play"}})}),$("#play").button({text:!1,label:startLabel,icons:{primary:"ui-icon-play"}}).click(function(){var t=playMovie?(playMoviePauseClick(),{label:startLabel,icons:{primary:"ui-icon-play"}}):(playMovieStartClick(),{label:pauseLabel,icons:{primary:"ui-icon-pause"}});$(this).button("option",t).button("refresh")}),$("#stop").button({text:!1,icons:{primary:"ui-icon-arrowrefresh-1-e"}}).click(function(){stopButtonCkick(),$("#play").button("option",{label:startLabel,icons:{primary:"ui-icon-play"}})}),$("#slowMotion").button({text:!1}).click(function(){checSlowMotion()})});