var PLATFORM_IDS         = new Array();
var PLATFORM_LONG_NAMES  = new Array();

var platformSelectIndex = 0;
var platformId = "";
var platformName = "";

PLATFORM_IDS[0]		= "";
PLATFORM_IDS[1]		= "Solaris SPARC";
PLATFORM_IDS[2]		= "Solaris x86";
PLATFORM_IDS[3]		= "Red Hat Linux";
PLATFORM_IDS[4]		= "SUSE Linux";
PLATFORM_IDS[5]		= "Windows 95";
PLATFORM_IDS[6]		= "Windows 98";
PLATFORM_IDS[7]		= "Windows ME";
PLATFORM_IDS[8]		= "Windows 2000 (SP4+)";
PLATFORM_IDS[9]		= "Windows XP (SP1 SP2)";
PLATFORM_IDS[10]	= "Windows 2003";
PLATFORM_IDS[11]	= "Vista";
PLATFORM_IDS[12]	= "Mac";
PLATFORM_IDS[13]	= "Sun Java Desktop System";
PLATFORM_IDS[14]    = "Mac Intel";
PLATFORM_IDS[15]    = "Mac PPC";

PLATFORM_LONG_NAMES[0]	= "By Platform";
PLATFORM_LONG_NAMES[1]	= "Solaris SPARC";
PLATFORM_LONG_NAMES[2]	= "Solaris x86";
PLATFORM_LONG_NAMES[3]	= "Red Hat Linux";
PLATFORM_LONG_NAMES[4]	= "SUSE Linux";
PLATFORM_LONG_NAMES[5]	= "Windows 95";
PLATFORM_LONG_NAMES[6]	= "Windows 98";
PLATFORM_LONG_NAMES[7]	= "Windows ME";
PLATFORM_LONG_NAMES[8]	= "Windows 2000";
PLATFORM_LONG_NAMES[9]	= "Windows XP (SP2/SP3)";
PLATFORM_LONG_NAMES[10] = "Windows 2003";
PLATFORM_LONG_NAMES[11] = "Windows Vista";
PLATFORM_LONG_NAMES[12] = "Mac OS X";
PLATFORM_LONG_NAMES[13] = "Sun Java Desktop System";
PLATFORM_LONG_NAMES[14] = "Mac OS X (Intel)";
PLATFORM_LONG_NAMES[15] = "Mac OS X (PowerPC)";

function write_platforms() {
   for(var i=0; i < PLATFORM_IDS.length; i++ ) {
   	document.write('<option value="' + PLATFORM_IDS[i] + '">' + PLATFORM_LONG_NAMES[i] + '</option>');
   }
}

function detect_platform() {
    var agent = navigator.userAgent;

    if (agent.toUpperCase().indexOf("SUNOS SUN4") != -1) {
        platformSelectIndex = 1;
	}
    if (agent.toUpperCase().indexOf("SUNOS I86PC") != -1) {
        platformSelectIndex = 2;
    }
    if (agent.toUpperCase().indexOf("RED HAT LINUX") != -1) {
        platformSelectIndex = 3;
    }
    if (agent.toUpperCase().indexOf("SUSE LINUX") != -1) {
        platformSelectIndex = 4;
    }
    if (agent.toUpperCase().indexOf("WINDOWS 95") != -1) {
        platformSelectIndex = 5;
    }
    if (agent.toUpperCase().indexOf("WINDOWS 98") != -1) {
        platformSelectIndex = 6;
    }
    if (agent.toUpperCase().indexOf("WINDOWS ME") != -1) {
        platformSelectIndex = 7;
    }
    if (agent.toUpperCase().indexOf("WINDOWS NT 5.0") != -1) {
        platformSelectIndex = 8;
    }
    if (agent.toUpperCase().indexOf("WINDOWS NT 5.1") != -1) {
        platformSelectIndex = 9;
    }
    if (agent.toUpperCase().indexOf("WINDOWS NT 5.2") != -1) {
        platformSelectIndex = 10;
    }
    if (agent.toUpperCase().indexOf("WINDOWS NT 6.0") != -1) {
        platformSelectIndex = 11;
    }
    if (agent.toUpperCase().indexOf("MAC OS") != -1) {
        platformSelectIndex = 12;
    }
    if (agent.toUpperCase().indexOf("SUN JAVA") != -1) {
        platformSelectIndex = 13;
    }
    if (agent.toUpperCase().indexOf("INTEL MAC OS") != -1) {
        platformSelectIndex = 14;
    }
    if (agent.toUpperCase().indexOf("PPC MAC OS") != -1) {
        platformSelectIndex = 15;
    }

	platformId = PLATFORM_IDS[platformSelectIndex];
	platformName = PLATFORM_LONG_NAMES[platformSelectIndex];
}


