    var SpaceLoaded = 0;
    var SoapNamespace = {};
    var orig_h = 47;

    var $j = jQuery.noConflict();

    $j(function() {
      SoapNamespace.login = function(movieID, ACT, username, password) {
        $j.ajax({
           type: "POST",
           url: "http://" + document.domain,
           data: {username:username, password:password, flash:1, ACT:ACT},
           responseType: 'RAW',
           movieID: movieID
         });
      }

      SoapNamespace.get = function(movieID, params) {
        var QueryString;
        QueryString = "http://" + document.domain + "/index.php?flash=1" + params;           /* The random number is for caching */
        myDebug(QueryString);

        $j.ajax({
           type: "GET",
           url: QueryString,
           movieID: movieID
         });
      }

      /* currently used to Resize height of Universal Header */
      SoapNamespace.resizeHeight = function(id, h, t) {
        var flashobject_id = '#'+id;
        //$j(temp).animate({height:h});
        if (true || window.navigator.userAgent.indexOf("MSIE") == -1) {
          $j(flashobject_id).css('height',h);
          var new_pos = (h - orig_h);
          $j('#TheRest').animate({top:new_pos},t);
        } else {  /* Required for IE6 - build in a check - look at pop.js which has it in */
          $j(flashobject_id).animate({height:h},t);
        }
      }

      SoapNamespace.resetHeight = function(id, h, t) {
        var flashobject_id = '#'+id;
        if (true || window.navigator.userAgent.indexOf("MSIE") == -1) {
          $j(flashobject_id).css('height',orig_h);
          var new_pos = 0;
          $j('#TheRest').animate({top:0},t);
        } else {  /* Required for IE6 - build in a check - look at pop.js which has it in */
          $j(flashobject_id).animate({height:orig_h},t);
        }
      }

      $j().ajaxComplete(function(event, request, settings) {
        var cookies = request.getResponseHeader("set-cookie");
        if (cookies) {
          cookie_arr = cookies.split('\n');
          for(i=0; i<cookie_arr.length; i++) {
            document.cookie = cookie_arr[i];
          }
        }

        var randomnumber=Math.floor(Math.random()*1000);
        var movieID = settings.movieID;
        if (movieID && movieID.length > 0) {
          obj = getFlashMovie(movieID);
          if (obj && obj.JSComplete) {
            try {
              obj.JSComplete(request.responseText);
            }
            catch (e) {
            }
          }
        } else {
          for (var newmovieID in aMovies) {
            obj = getFlashMovie(aMovies[newmovieID]);
            if (obj && obj.JSComplete) {
              try {
                obj.JSComplete(request.responseText);
              }
              catch (e) {
              }
            }
          }
        }
      });

      $j().ajaxError(function(event, request, settings) {
/*        alert('Error');  */
      });
      SpaceLoaded=1;

    })

    function resizeHeight(id, h, t) {
      SoapNamespace.resizeHeight(id, h, t);
    }
    function resetHeight(id, h, t) {
      SoapNamespace.resetHeight(id, h, t);
    }

    var aMovies = new Array;

    function RegisterFlash(cFlashObject) {
        var i = aMovies.length;
        aMovies[i] = cFlashObject;
    }

    function getFlashMovie(movieName) {
          var isIE = navigator.appName.indexOf("Microsoft") != -1;
          obj = (isIE) ? window[movieName] : document[movieName]
          return obj;
    }

    function DoLogIn(movieID, act, name, pass) {
       // This sends a post request with username and password
      SoapNamespace.login(movieID, act, name, pass)();
    }

    function GetData(movieID, queryString) {
       // This sends a post request with username and password
      SoapNamespace.get(movieID, queryString);
    }

    function SayHello() {
       /* This is a handshake with ActionScript - if this fails, JS or ExtInt is not working */
      if (SpaceLoaded == 0) {
         return "Wait";
      } else {
         return "Hello " + document.domain;
      }
    }
    function SetCookie(movieID, biscuit) {
       /* This sets a cookie from ActionScript */
          if (biscuit) {
            document.cookie = biscuit;
          }
          return document.cookie;
       }

       function FlashToJavascript(cMessage) {
          /* Biscuit is set to the same value as the cookie */
          myDebug("Flash Says: " + cMessage);
       }

       function myDebug(cMessage) {
          obj = document.getElementById('blurb');
          if (obj) {
            cOldHTML = obj.innerHTML;
            if (cOldHTML == '-') {
                cOldHTML = cMessage;
            } else {
                cOldHTML = cOldHTML + '<br />' + cMessage;
            }
            obj.innerHTML = cOldHTML;
          }
       }



