//<![CDATA[

 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }

                var myListener = new Object();
                
                /**
                 * Initialisation
                 */
                myListener.onInit = function()
                {
                    
                };
                /**
                 * onClick event on the video
                 */
                myListener.onClick = function()
                {
                    var total = document.getElementById("info_click").innerHTML;
                    document.getElementById("info_click").innerHTML = Number(total)+1;
                };
                /**
                 * onKeyUp event on the video
                 */
                myListener.onKeyUp = function(pKey)
                {
                    document.getElementById("info_key").innerHTML = pKey;
                };
                /**
                 * onComplete event
                 */
                myListener.onFinished = function()
                {
                    window.location='/welcome';
                };
                /**
                 * Update
                 */
                myListener.onUpdate = function()
                {
                   play();
                };
                
                function getFlashObject()
                {
                    return document.getElementById("myFlash");
                }
                function play()
                {
                    if (myListener.position == 0) {
                        getFlashObject().SetVariable("method:setUrl", "/SupremacyFilmsIntro.flv");
                    }
                    getFlashObject().SetVariable("method:play", "");
                }
                function pause()
                {
                    getFlashObject().SetVariable("method:pause", "");
                }
                function stop()
                {
                    getFlashObject().SetVariable("method:stop", "");
                }
                function setWidth()
                {
                    var width = document.getElementById("inputWidth").value;
                    getFlashObject().width = width+"px";
                }
                function setHeight()
                {
                    var height = document.getElementById("inputHeight").value;
                    getFlashObject().height = height+"px";
                }
                function setPosition()
                {
                    var position = document.getElementById("inputPosition").value;
                    getFlashObject().SetVariable("method:setPosition", position);
                }
                function setVolume()
                {
                    var volume = document.getElementById("inputVolume").value;
                    getFlashObject().SetVariable("method:setVolume", volume);
                }
                function loadImage()
                {
                    var url = document.getElementById("inputImage").value;
                    var depth = document.getElementById("inputImageDepth").value;
                    var verticalAlign = document.getElementById("inputImageVertical").value;
                    var horizontalAlign = document.getElementById("inputImageHorizontal").value;
                    
                    getFlashObject().SetVariable("method:loadMovieOnTop", url+"|"+depth+"|"+verticalAlign+"|"+horizontalAlign);
                }
                function unloadImage()
                {
                    var depth = document.getElementById("inputUnloadDepth").value;
                    getFlashObject().SetVariable("method:unloadMovieOnTop", depth);
                }
            //]]>
