function SlideShowCommands()
{
this.Common = new Common();
this.ContainerID = "SlideShowCommands";
this.Container = null;
this.Url = _Domain + "/AJAX/SlideShowCommands.aspx";
this.ProductFiles = window.frames["frame_ProductFilesFS"];
this.Timer = null;
this.Interval = 5; //20
this.FileCounter = 0;
this.CurrentFile = function(){
return this.Common.GetBrowserIndependentElement("txtCurrentImage");
}
this.TotalFiles = function(){
return this.Common.GetBrowserIndependentElement("image_counter");
}
this.CurrentMediaFile = null;
this.CurrentAudioFile = null;
this.MediaFileCount = function(){
if (this._MediaFiles != null){ return this._MediaFiles.length; }
else{ return 0;}
}
this.AudioFileCount = function(){
if (this._AudioFiles != null){ return this._AudioFiles.length; }
else{ return 0;}
}
this._MediaFiles = null;
this.GetMediaFiles = function(){
return this._MediaFiles;
};
this.SetMediaFiles = function(mediaFiles){
this._MediaFiles = MediaFiles;
};
this._AudioFiles = null;
this.GetAudioFiles = function(){
return this._AudioFiles;
};
this.SetAudioFiles = function(audioFiles){
this._AudioFiles = audioFiles;
};
this.Sound = new SoundController();
this.MediaPlayer = new MediaPlayer();
this.AudioPlayer = new AudioPlayer();
this.SliderContainerID = null;
this.SliderContainer = null;
this.PlayPause = function(){
return this.Common.GetBrowserIndependentElement("play_arrow");
}
this.PlayPause_AttachHandler = function(){
if (this.PlayPause() != null)
{
this.PlayPause().onclick = this.CycleFiles;
}
}
this.Stop = function(){
return this.Common.GetBrowserIndependentElement("stop_button");
}
this.Stop_AttachHandler = function(){
if (this.Stop() != null)
{
this.Stop().onclick = this.ClearTimer;
}
}
this.PreviousButton = function(){
return this.Common.GetBrowserIndependentElement("prev_arrow");
}
this.NextButton = function(){
return this.Common.GetBrowserIndependentElement("next_arrow");
}
this.SoundButton = function(){
return this.Common.GetBrowserIndependentElement("sound_button");
}
this.Next = function(){
if( _SlideShowCommands.MediaFileCount() > 1)
{
if (_SlideShowCommands.FileCounter < (_SlideShowCommands.MediaFileCount() - 1))
{
_SlideShowCommands.FileCounter++;
if (_SlideShowCommands.FileCounter != (_SlideShowCommands.MediaFileCount()))
{
_SlideShowCommands.MoveSliderToNewValue();
}
else
{
_SlideShowCommands.FileCounter--;
}
}
}
enableContentDocumentHeight = true;
}
this.Previous = function(){
if(_SlideShowCommands.FileCounter > 0)
{
_SlideShowCommands.FileCounter--;
if (_SlideShowCommands.FileCounter != -1)
{
_SlideShowCommands.MoveSliderToNewValue();
}
else
{
_SlideShowCommands.FileCounter++;
}
}
enableContentDocumentHeight = true;
}
this.Move = function(counter){
}
this.GetSliderContainer = function(){
this.SliderContainer = GetBrowserIndependentElement("frame_slider");
}
this.LoadSlider = function(){
_SlideShowCommands.SliderContainer = _SlideShowCommands.Common.GetBrowserIndependentElement("frame_slider");
_SlideShowCommands.SliderContainer.src = _Domain + "/AJAX/slider.aspx?max=" + this.MediaFileCount();
_SlideShowCommands.SliderContainer.style.display = "block";
}
this.RenderImageCount = function(){
this.CurrentFile().value = 1;
this.TotalFiles().value = '/' + this.MediaFileCount();
this.PlayPause_AttachHandler();
this.Stop_AttachHandler();
this.PreviousButton().onclick = this.Previous;
this.NextButton().onclick = this.Next;
}
this.CycleFiles = function(){
_SlideShowCommands.Stop().style.display = "block";
_SlideShowCommands.PlayPause().style.display = "none";
window.clearTimeout(_SlideShowCommands.Timer);
if (_SlideShowCommands.GetMediaFiles() != null)
{
if (_SlideShowCommands.MediaFileCount() != 1)
{
if( _SlideShowCommands.FileCounter <= _SlideShowCommands.MediaFileCount() - 1)
{
if (_SlideShowCommands.FileCounter == 0)
{
_SlideShowCommands.FileCounter++;
}
_SlideShowCommands.MoveSliderToNewValue();
_SlideShowCommands.FileCounter++;
_SlideShowCommands.Timer = setTimeout("_SlideShowCommands.CycleFiles()", _SlideShowCommands.Interval * 1000);
}
else
{
_SlideShowCommands.FileCounter = -1;
}
}
}
}
this.RefreshSoundButton = function(){
if (this.Sound.SoundButton != null)
{
if (this.Sound.State == true) { this.Sound.SoundButton.src = this.Sound.MuteImage; }
else { this.Sound.SoundButton.src = this.Sound.SoundImage; }
}
}
this.MoveSliderToNewValue = function(){
if (window["frame_slider"].moveSlider != null)
{
window["frame_slider"].moveSlider(this.FileCounter + 1);
}
}
this.MoveSliderToQueryValue = function(counter)
{
if (window.parent.frames["frame_slider"].moveSlider != null)
{
document.getElementById("txtCurrentImage").value = counter ;
window["frame_slider"].moveSlider(counter);
}
}
this.MoveSliderToFirst = function(){
_SlideShowCommands.Stop().style.display = "none";
_SlideShowCommands.PlayPause().style.display = "block";
if (window["frame_slider"].moveSlider != null)
{
window["frame_slider"].moveSlider(0);
}
}
this.LoadMediaPlayer = function(src, soundStatus){
this.MediaPlayer.LoadMediaPlayer(src, soundStatus);
}
this.LoadAudioPlayer = function(src, soundStatus){
this.AudioPlayer.LoadAudioPlayer(src, soundStatus);
}
this.SetMediaAudioFile = function(){
this.FileCounter = parseInt(this.CurrentFile().value) - 1;
if (this.GetMediaFiles() != null)
{
this.CurrentMediaFile = this.GetMediaFiles()[this.FileCounter];
if (this.CurrentMediaFile != null)
{
this.LoadMediaPlayer(this.CurrentMediaFile);
}
}
if (this.GetAudioFiles() != null)
{
this.CurrentAudioFile = this.GetAudioFiles()[this.FileCounter];
if (this.CurrentAudioFile != null)
{
this.LoadAudioPlayer(this.CurrentAudioFile);
}
}
}
this.ClearTimer = function(){
try
{
_SlideShowCommands.Stop().style.display = "none";
_SlideShowCommands.PlayPause().style.display = "block";
window.clearTimeout(_SlideShowCommands.Timer);
}
catch(ex)
{}
}
this.Load = function (){
this.Sound.RefreshSoundButton();
var request = _SlideShowCommands.Common.GetXMLHttpRequest();
try
{
if (request)
{
request.onreadystatechange = function() {
if( request.readyState == 4 )
{
_SlideShowCommands.Container = _SlideShowCommands.Common.GetBrowserIndependentElement(_SlideShowCommands.ContainerID);
if (_SlideShowCommands.Container != null)
{
if (GetUAgentMainScript() != "" && _SlideShowCommands.MediaFileCount() <= 1) {
_SlideShowCommands.Container.style.visibility = 'hidden';
_SlideShowCommands.Container.innerHTML = request.responseText;
_SlideShowCommands.LoadSlider();
_SlideShowCommands.RenderImageCount();
} else {
_SlideShowCommands.Container.style.visibility = 'visible';
_SlideShowCommands.Container.innerHTML = request.responseText;
_SlideShowCommands.LoadSlider();
_SlideShowCommands.RenderImageCount();
}
}
}
}
request.open('GET', _SlideShowCommands.Url, true);
request.send("");
}
}
catch(exp)
{
window.alert(exp.toString());
}
}
}

