var incManageHideBar = function()
{
this.timeoutBarPointer;
this.goUp;
this.canShowCursor;
this.callback;
this.showBarPointer = function(state) {
if (state) {
// Bar
this.goUp = true;
$("#controlbar").stop(true);
$("#controlbar").animate({bottom: 0}, 500, function() {incHideBar.goUp = false;});
if (!incPlayer.ipad) {
// Pointer
document.body.style.cursor = "default";
this.canShowCursor = false;
}
} else {
if (incPlayer.ipad && !incPlayer.playerIsReady) {
// we don't hide the bar on ipad if the player is not in play
return;
}
// Bar
$("#controlbar").animate({bottom: -70}, 2000, function() {});
if (!incPlayer.ipad) {
// Pointer
document.body.style.cursor = "url(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==), pointer";
setTimeout(function() {incHideBar.canShowCursor = true;}, 300);
}
}
if (this.callback !== null) {
this.callback(state);
}
};
this.hideBarPointerTimeout = function(time) {
this.timeoutBarPointer = setTimeout(function() {
incHideBar.showBarPointer(false);
}, time);
};
this.showBarPointerOnAction = function(hideTime) {
// Controls
if (!this.goUp && this.canShowCursor) {
this.showBarPointer(true);
if (this.timeoutBarPointer) {
window.clearTimeout(this.timeoutBarPointer);
}
this.hideBarPointerTimeout(hideTime);
}
};
this.init = function(callback) {
this.goUp = false;
this.canShowCursor = incPlayer.ipad;
this.callback = callback;
if (!incPlayer.ipad) {
// Hide bar and pointer in seconds
this.hideBarPointerTimeout(4000);
}
if (incPlayer.ipad) {
document.ontouchmove = function(e) {
if (typeof( popupOn ) === "undefined" || !popupOn) {
e.preventDefault();
}
};
document.ontouchstart = function() {
incHideBar.showBarPointerOnAction(6000);
};
} else {
document.onmousemove = function() {
incHideBar.showBarPointerOnAction(4000);
};
}
};
};
var incHideBar = new incManageHideBar();