/**
 *
 * Javascript Site-Toolbox
 *
 * Authors:
 *  Michael Hoffmann (hoffmann@henworx.de)
 */

// General Init Code +++++++++++++++++++++++++++++++++++++++++++++++++++++++

// bekommt der Gecko eigene Stylesheets? (_gecko.css)

var geckocss = true;
var cssdebug = false; // Information ueber erkannte Browser und geladene CSS


/*

   DynAPI Distribution
   Browser Class
   The DynAPI Distribution is distributed under the terms of the GNU LGPL license.

*/

function Browser() {
   var b=navigator.appName;
   if (b.indexOf('Netscape')!=-1) this.b="ns";
   else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
   else if (b=="Microsoft Internet Explorer") this.b="ie";
   this.version=navigator.appVersion;
   this.v=parseInt(this.version);
   this.ns=(this.b=="ns" && this.v>=4);
   this.ns4=(this.b=="ns" && this.v==4);
   this.ns6=(this.b=="ns" && this.v==5);
   this.ie=(this.b=="ie" && this.v>=4);
   this.ie4=(this.version.indexOf('MSIE 4')>0);
   this.ie5=(this.version.indexOf('MSIE 5')>0);
   this.ie55=(this.version.indexOf('MSIE 5.5')>0);
   this.ie6=(this.version.indexOf('MSIE 6.0')>0);
   this.opera=(this.b=="opera");
   this.gecko=(navigator.product == "Gecko");
   this.dom=(document.createElement && document.appendChild && document.getElementsByTagName)?true:false;
   this.def=(this.ie||this.dom); // most used browsers, for faster if loops
   var ua=navigator.userAgent.toLowerCase();
   if (ua.indexOf("win")>-1) this.platform="win32";
   else if (ua.indexOf("mac")>-1) this.platform="mac";
   else this.platform="other";
}

is=new Browser();




// Welcher Stylesheet? ++++++++++++++++++++++++++++++++++++++++++++++

function getStyleName(path,name) {
   var style = '';

   if(cssdebug)
	   alert("ie:"+is.ie+"   ns:"+is.ns+"   opera:"+is.opera+"   version:"+is.v+"  platform:"+is.platform+"   dom:"+is.dom+"   gecko:"+is.gecko+"  def:"+is.def+"  Vers:--"+is.version+"--");

   if(geckocss && is.gecko) {
      style = path+name+'_gecko.css';
   } else if((is.ie && is.v >= 4) || (is.ns && is.v >= 5))
      style = path+name+'_ie.css';
   else if (is.opera)
      style = path+name+'_opera.css';
   else
      style = path+name+'_ns.css';

   if(cssdebug)
	  alert('Lade CSS:__'+style+'__');

   return(style);

}

