﻿// kribi3dplayer.js

// EB+GS v1.8 Sep-18-2009


function CreateKribi3DPlayerIE (id, width, height, majorVersion, tellHandler) 
{
  document.write('<object id="' + id + '" classid="clsid:fa560d3d-6cfd-41cc-8779-5ae6cc4cd532"');
  var version = '-1,-1,-1,-1';
  if (majorVersion != undefined) version = majorVersion + ',0,0';
  document.write(' codebase="http://download.kribi3d.com/kribi3dplayer.cab#Version=' + version + '"');
  document.write(' width="' + width + '" height="' + height + '"></object>');
  if (tellHandler == undefined) return;
  document.write('<script language="javascript" type="text/javascript" for="' + id + '" event="Tell(msg)">');  
  document.write(tellHandler + '(msg);');
  document.write('</script>');  
}

function CreateKribi3DPlayerNP (id, width, height, majorVersion, tellHandler) 
{  
  document.write('<object id="' + id + '" type="application/x-kribi3d"');
  document.write(' codebase="http://download.kribi3d.com/kribi3dplayer.xpi"');
  document.write(' width="' + width + '" height="' + height + '"></object>'); 
  if (tellHandler == undefined) return; 
  document.write('<script language="javascript" type="text/javascript">');
  document.write('var ' + id + ' = document.getElementById("' + id + '");');
  document.write('function ' + id + 'Tell (msg) { ' + tellHandler + '(msg); } ');
  document.write(id + '.Tell = ' + id + 'Tell;');
  document.write('</script>'); 
}

function CreateKribi3DPlayer (id,width,height,majorVersion,tellHandler) 
{
  if (navigator.appName == "Microsoft Internet Explorer")
    CreateKribi3DPlayerIE(id,width,height,majorVersion,tellHandler); 
  else
    CreateKribi3DPlayerNP(id,width,height,majorVersion,tellHandler);  
}

function Vect3 (vx,vy,vz) 
{
  this.x = vx;
  this.y = vy;
  this.z = vz;
}

Vect3.prototype.initFromString = function (str)
{
  var pos1 = str.indexOf(',',0);
  var pos2 = str.indexOf(',',pos1+1); 
  this.x = str.substring(0,pos1); 
  this.y = str.substring(pos1+1,pos2); 
  this.z = str.substring(pos2+1,str.length);
};

Vect3.prototype.toString = function ()
{
  return this.x + ',' + this.y + ',' + this.z;
}


// End of kribi3dplayer.js
