var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var maxCheckFlashVersion = 25;

//---------------------------------------------------------------------------

function JSGetSwfVer(i)
{
   var flashVer = -1;

   if ((navigator.plugins != null) && (navigator.plugins.length > 0))
   {
      if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"])
      {
         var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
         var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
         var descArray = flashDescription.split(" ");
         var tempArrayMajor = descArray[2].split(".");
         var versionMajor = tempArrayMajor[0];
         var versionMinor = tempArrayMajor[1];
         if (descArray[3] != "")
            tempArrayMinor = descArray[3].split("r");
         else
            tempArrayMinor = descArray[4].split("r");
         var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
         flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      }
   }
   else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1)
      flashVer = 4;
   else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1)
      flashVer = 3;
   else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1)
      flashVer = 2;

   return flashVer;
}

//---------------------------------------------------------------------------

function HasFlashPlayer()
{   return true;
   var versionStr = new String();
   
   if (isIE && isWin && !isOpera)
   {      //VBtest();        return true;        /*         for(var i=25;i>0;i--)         {
            versionStr = 0;//VBtest();//VBGetSwfVer(i);
			
            if(versionStr=="-1")            {
               return false;
            }            else if(versionStr != "0")            {
               return true;
            }
         }*/   }
   else
   {
      versionStr = JSGetSwfVer(i);
      if (versionStr == "-1")
         return false;
      else if (versionStr != "0")
         return true;
   }

   return false;
}

//---------------------------------------------------------------------------

function DrawFlashItem(i)
{
   var imgSrc;
   var swfSrc;
   var nWidth;
   var nHeight;
   var hasRequestedVersion;
   if (i == 1)
   {
      imgSrc = new String("img/index/noflash.jpg");
      swfSrc = new String("flash/home-smaller.swf");
      nWidth = 750;
      nHeight = 262;
   }
   else
   {
      imgSrc = new String("img/designsoftware_soft/welssample.gif");
      swfSrc = new String("flash/wels.swf");
      nWidth = 400;
      nHeight = 300;
   }
   hasRequestedVersion = DetectFlashVer(1,0,0);
   //if (HasFlashPlayer() == false)      if (hasRequestedVersion == false)
   {
      if (i == 1)
         document.write("<a href=\"products.htm\"><img src = \"" + imgSrc + "\" width = \"" + nWidth + "\" height = \"" + nHeight + "\" title=\"Sample Installation - No Flash Capability\" alt=\"Sample Installation - No Flash Capability\" galleryimg=\"no\" /></a>");
      else
         document.write("<img src = \"" + imgSrc + "\" width = \"" + nWidth + "\" height = \"" + nHeight + "\" title=\"WELS application\" alt=\"WELS application\" galleryimg=\"no\" />");
   }
   else
   {
      document.write("<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" WIDTH=\"" + nWidth + "\" HEIGHT=\"" + nHeight + "\">");
      document.write("<PARAM NAME=\"movie\" VALUE=\"" + swfSrc + "\">");
      document.write("<PARAM NAME=\"quality\" VALUE=\"high\">");
      document.write("<PARAM NAME=\"WMode\" VALUE=\"transparent\">");
      document.write("<EMBED wmode=\"transparent\" SRC=\"" + swfSrc + "\" QUALITY=\"high\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\" TYPE=\"application/x-shockwave-flash\" WIDTH=\"" + nWidth + "\" HEIGHT=\"" + nHeight + "\"><\/EMBED>");
      document.write("<\/OBJECT>");
   }
}
