  var sizes = new Array(3);
  sizes[0] = new Array(2);
  sizes[1] = new Array(2);
  sizes[2] = new Array(2);
  sizes[0][0] = 640;
  sizes[0][1] = 480;
  sizes[1][0] = 800;
  sizes[1][1] = 600;
  sizes[2][0] = 1024;
  sizes[2][1] = 768;
  

  function setvidsize(sizestr){
    var expdate = new Date('25 December, 2010 08:00:00');
    var c = "vidsize="+sizestr+"; expires="+expdate.toGMTString()+"; path=/members";
    window.document.cookie = c;
    alert('Preference saved\nvideo size set to ' + sizestr);
  }

  function getvidsize(){
    var c = window.document.cookie;
    if (c != "") {
      var apos = c.indexOf(";");
      if ( apos > -1 ) {
          var sizestr = c.substring(0,apos);
      } else {
        sizestr = c;
      }


      if ( sizestr == "vidsize=small" ) {
        document.sizeform.vidsize[0].checked = true;
      }
      if ( sizestr == "vidsize=medium" ) {
        document.sizeform.vidsize[1].checked = true;
      }
      if ( sizestr == "vidsize=large" ) {
        document.sizeform.vidsize[2].checked = true;
      }
    }
  }

  function newSkylight($video,$title) {
                    

    for (i=0;i<3;i++){
      if (document.sizeform.vidsize[i].checked) {
        var vidwidth = sizes[i][0];
        var vidheight = sizes[i][1];
        break;
      }
    }

    var winwidth = vidwidth + 50;
    var winheight = vidheight + 100;



    $win = window.open("","","width="+winwidth+",height="+winheight+",screenX=10,screenY=10");
    $win.document.open("text/html","replace");

    $title = 'IDS Training Video - '+$title+' by Gary Stafford';

    $html = '<html><head><title>' + $title + '</title></head>' +
            '<body><p><button onClick=\"window.close();\">Close Window</button></p>'+
            '<p><OBJECT ID=\"MediaPlayer\" WIDTH=' + vidwidth + 'HEIGHT='  + vidheight +
            'CLASSID=\"CLSID:6bf52a52-394a-11d3-b153-00c04f79faa6\" ' +
            'STANDBY=\"Loading Windows Media Player components...\" ' +
            'TYPE=\"application/x-oleobject\"> ' +
            '<PARAM NAME=\"FileName\" VALUE=\"mms://www.gann.co.uk/TrainingVideos/' + $video + '?WMThinning=0\">' +
            '<EMBED TYPE=\"application/x-mplayer2\" ' +
            'SRC=\"mms://www.gann.co.uk/TrainingVideos/' + $video + '?WMThinning=0\" ' +
            'NAME=\"MediaPlayer\" WIDTH=' + vidwidth +' HEIGHT=' + vidheight + '>' +
            '</EMBED></OBJECT></p></body></html>';

    $win.document.write($html);
//  $win.document.close;
//  $win.location.reload();

  }

