 /**
       *
       */
       

       


       function getLandscapeID(){return landscapeID};
    function getLanguageID(){return language};

       
      function focusFlash()
      {
         var movie = getFlashMovie("flash_movie");
         movie.focus();
               }
      
      /**
       *
       */
      function getBrowserWidth() 
      {
           var myWidth = 0, myHeight = 0;
           if( typeof( window.innerWidth ) == 'number' ) {
             //Non-IE
             myWidth = window.innerWidth;
             myHeight = window.innerHeight;
           } else {
             if( document.documentElement &&
                 ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
               //IE 6+ in 'standards compliant mode'
               myWidth = document.documentElement.clientWidth;
               myHeight = document.documentElement.clientHeight;
             } else {
               if( document.body &&
                ( document.body.clientWidth || document.body.clientHeight ) ) {
                 //IE 4 compatible
                 myWidth = document.body.clientWidth;
                 myHeight = document.body.clientHeight;
               }
             }
           }
         
         return myWidth;

         
      }
      
      /** 
       *
       */
       function updateFlashPosition()
      {
         var movie = getFlashMovie("flash_movie");
      
         if (movie!=undefined)
            movie.updateBrowserWidth(getBrowserWidth());
      }
      
       
      function getURLArgs() 
      {
         var args = new Object();
         var query = location.search.substring(1);
         var pairs = query.split("&");
      
         for(var i = 0; i < pairs.length; i++) 
         {
            var pos = pairs[i].indexOf('=');
            if (pos == -1) continue;
            var argname = pairs[i].substring(0,pos);
            var value = pairs[i].substring(pos+1);
            args[argname] = unescape(value);
         }
      
         return args;
      }
      
      /**
       *
       */
      function findRandomLandscape()
      {
         var landscapeIDs = ["night", "day","newyork", "mountains", "sea", "london", "urban", "desert"];
         var r = (Math.floor(Math.random()*landscapeIDs.length));
         return landscapeIDs[r];
      }
      
      /**
       *
       */
       function setActiveStyleSheet(landscapeID, language)
      {        
         if (landscapeID==undefined){
            landscapeID="day";
         }
         if (language==undefined || language==""){ 
            language="en";
         }
            
         var movie = getFlashMovie("flash_movie");//window.document.flash_movie;
         
         if (movie!=undefined)
            movie.updateStyleSheet(landscapeID, language, getBrowserWidth());
            
   
         movie.focus();
      }
      
      /**
       * Utilizes swfObject to embedd the swf
       */
      function embeddFlash()
      {
         var flashvars = getURLArgs();
         var domain="http://staging.changeyourworld.sustrans.precedenthost.co.uk";
         flashvars.allow=domain;
         flashvars.allowhttps=domain;

         
         var params = {wmode:"transparent", allowScriptAccess:"always", autofocus:"true"};

         var attributes = {};
         attributes.id = "ViewManager";
         attributes.name = "flash_movie";
         swfobject.embedSWF("flash_bin_update/ViewManager.swf", "myViewManager", "2000", "350", "10.0.0", false, flashvars, params, attributes);
      }
      
      
      /**
       * Returns a flash movie with the same name of "movieName"
       * Compliant with IE
       */
      function getFlashMovie(movieName)
      {   
         var isIE = navigator.appName.indexOf("Microsoft") != -1;
            return (isIE) ? window[movieName] : document[movieName];
      }
      
      embeddFlash();
      window.onresize = updateFlashPosition;

