// --------- Browser Detect ----------- //
var detect = navigator.userAgent.toLowerCase();

// --------- set varables ------------- //
var majorversion = parseInt(navigator.appVersion); 
var minorversion = parseFloat(navigator.appVersion); 
var OS,browser,version,total,thestring;
var cms_platform,cms_browser;

version = majorversion+'/'+minorversion;

// -------- Check browser type -------- //

if (checkIt('msie') && parseFloat(detect.charAt(checkIt('msie') + 'msie'.length)) >=5) {
	browser = "ie";
} else if (checkIt('netscape') && parseFloat(detect.charAt(checkIt('netscape') + 'netscape'.length)) >=5) {
	browser = "mozilla";
} else if (checkIt('gecko/') && parseFloat(detect.charAt(checkIt('gecko/') + 'gecko/'.length)) >=5) {
	browser = "mozilla";
} else if (checkIt('mozilla') && parseFloat(detect.charAt(checkIt('mozilla') + 'mozilla'.length)) >=5) {
	browser = "mozilla";
} else if (checkIt('opera')) {
	browser = "opera";
} else {
	browser = "netscape";
}

// ---------- check version ---------- //

if (checkIt('win')) {
	OS = "win";
} else if (checkIt('linux')) {
	OS = "linux";
} else if (checkIt('mac')) {
	OS = "mac";
} else {
	OS = "linux";
}

// ----------- Check flash and version ------------ //

var is_Flash        = false;
var is_FlashVersion = 0;

if ((browser=="mozilla" || browser=="opera") || (OS=="mac" && minorversion>=5)) {  

   var plugin = (navigator.mimeTypes && 
                 navigator.mimeTypes["application/x-shockwave-flash"] &&
                 navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) ?
                 navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
   if (plugin) {
      is_Flash = true;
      is_FlashVersion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
   }
}

if (OS=="win" && minorversion>=4)
{
   document.write(
      '<scr' + 'ipt language=VBScript>' + '\n' +
      'Dim hasPlayer, playerversion' + '\n' +
      'hasPlayer = false' + '\n' +
      'playerversion = 10' + '\n' +
      'Do While playerversion > 0' + '\n' +
         'On Error Resume Next' + '\n' +
         'hasPlayer = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & playerversion)))' + '\n' +
         'If hasPlayer = true Then Exit Do' + '\n' +
         'playerversion = playerversion - 1' + '\n' +
      'Loop' + '\n' +
      'is_FlashVersion = playerversion' + '\n' +
      'is_Flash = hasPlayer' + '\n' +
      '<\/sc' + 'ript>'
   );
}


// ------------ functions ------------ //

function checkIt(string) {
	var place = detect.indexOf(string) + 1;
	return place;
}



