//This script detects the following:
//Flash
//Windows Media Player
//Java
//Shockwave
//RealPlayer
//QuickTime
//Acrobat Reader
//SVG Viewer


var agt=navigator.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var ns  = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);


var pluginlist = '';
var flash = false;
var realplayer = false;
var mediaplayer = false;
var quicktime = false;
var acrobat = false;
var java = false;
var navegador = false;
var mensajeNavegador = '';

//alert(agt);
//alert('Es netscape?');
//alert(ns);
//alert('Es windows?');
//alert(win);


if (ie && win) {	
    //pluginlist = 
    //detectIE("Adobe.SVGCtl","SVG Viewer") + 
    //detectIE("SWCtl.SWCtl.1","Shockwave Director") + 
    //detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + 
    //detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + 
    //detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + 
    //detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + 
    //detectIE("PDF.PdfCtrl.5","Acrobat Reader"); 
    //detectIE("Adobe.SVGCtl","SVG Viewer") 


    //Si es Internet Explorer 
    //LOS NOMBRES DE CLASES PUEDEN VARIAR CON LAS VERSIONES DEL SOFTWARE
    if (detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") != ''){flash = true;}
    if (detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") != ''){realplayer = true;}
    if (detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") != ''){quicktime = true;}
    if (detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") != ''){mediaplayer =true;}
    if (detectIE("PDF.PdfCtrl.5","Acrobat Reader") != ''){acrobat = true;}
    if (navigator.javaEnabled()){java = true;}

    if (navigator.userAgent.toLowerCase().indexOf("msie 7.0") != -1  ||
     navigator.userAgent.toLowerCase().indexOf("msie 6.0") != -1 )
    {
        navegador = true;
    }
    else
    {
     mensajeNavegador = 'La versión de internet explorer no es es compatible, se necesita IE 6 en adelante';
    }

}

if (ns || !win) {
       
       		nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
//		pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader");

//        alert(pluginlist);

    if (detectNS("application/x-shockwave-flash","Shockwave Flash") != ''){flash = true;}
    if (detectNS("audio/x-pn-realaudio-plugin","RealPlayer") != ''){realplayer = true;}
    if (detectNS("video/quicktime","QuickTime")  != ''){quicktime = true;}
    if (detectNS("application/x-mplayer2","Windows Media Player") != ''){mediaplayer =true;}
    if (detectNS("application/pdf","Acrobat Reader") != ''){acrobat = true;}
    if (navigator.javaEnabled()){java = true;}
    
    navegador = true;
    
    
}

function detectIE(ClassID,name) 
    { 
    result = false; 
    document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); 
    if (result) return name+','; 
    else return ''; 
    }

function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }


//pluginlist += navigator.javaEnabled() ? "Java," : "";
//if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);

//SAMPLE USAGE- detect "Flash"
//if (pluginlist.indexOf("Flash")!=-1)
//document.write("You have flash installed")

