function go(codein) {
  var parms   = getParms();
  var code;
  if(!codein) {
    code = parms.code;
  }
  else code = codein;
  //var cont    = _getel( 'content' );
  //_apptext( cont, "Checking code..." );
  
  request1( code );
}

var XMLobj;

function request1( code ) {
  var url      = '/template/cgi-bin/video.pl';
  //var url      = '/template/cgi-bin/wcm/wcm_video.pl';
  var pars     = 'op=get&code=' + code;
  
  //XMLobj       = createxml();
  //XMLobj.async = "false";
  
  //The current time is appended to the xmlpath as a query
  //   in order to force the browser to update the file on each
  //   load.
  //var time    = new Date();
  //var hours   = time.getHours();
  //var minutes = time.getMinutes();
  //var seconds = time.getSeconds();
  //XMLobj.load( url + '?' + pars );
  loadfile( url + '?' + pars, response1 );
}

function response1( xml ) {
  //var xml     = xmla.xml;
  var cont    = _getel( 'content' );
  _clear(cont);
  
  var res = xml.valid.value * 1;
  if( res == 1 ) {
      var ob      = _newel( 'object' );
      var path;
      var file = xml.fname.value;
      var swf;
      //if( file.indexOf('template') != -1 ) {
      //  path    = '/template/flashplayers/fileplayer.swf';
      //  swf     = path + '?file=' + file;
      //}
      //else {
        path = '/template/flashplayers/streamplayer.swf'
        file = file.substr( 0, file.length-4 );
        file = escape( file );
        file = file.replace('%3A',':');
        swf  = path + '?stream=' + file;
      //}
      ob.classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
      //ob.type     = 'application/x-shockwave-flash';
      ob.wmode    = 'transparent';
      ob.height   = xml.height.value * 1 + 20;
      ob.width    = xml.width.value * 1;
      ob.data     = swf;
      ob.data = swf;
      
      
      var param   = _newel( 'param' );
      param.name  = 'movie';
      param.value = swf;
      _append( ob, param );
      _append( cont, ob  );
      ob.movie = swf;
  }
  else if( res == 2 ) {
      _apptext( cont, "Code is no longer valid" );
  }
  else {
      _apptext( cont, "Code does not exist" );
  }
}
function getParms() {
  var text   = this.document.location.search.substr( 1 );
  var parms  = text.split( '&' );
  var obj    = new Object;
  for( var i = 0; i < parms.length; i++ ) {
    var parm  = parms[ i ];
    var parts = parm.split( '=' );
    if( parts.length == 1 ) {
      obj[ parts[ 0 ] ] = 1;
    }
    else {
      obj[ parts[ 0 ] ]  = parts[ 1 ];
    }
  }
  return obj;
}