var javawsInstalled = 0;
var javaURL = "http://www.java.com";

isIE = "false";

if (navigator.mimeTypes && navigator.mimeTypes.length) {
	x = navigator.mimeTypes['application/x-java-jnlp-file'];
	if (x) {
		javawsInstalled = 1;
	} 	
} else { 
	isIE = "true";
}



function webstartCheck() {
	var testDiv = document.getElementById("webstartWarning");
	if( javawsInstalled != 1 ) {
		testDiv.innerHTML = 'Java not detected, which is required to run Bitvo!  Get it at <a href="'+ javaURL + '">www.java.com</a> .';
	}

}

function getJava() {
	window.open(javaURL);
}

/*****************************************************************/
/* Functions */
/*****************************************************************/


/*
function ieCheck() {
	var userAgent = navigator.userAgent.toLowerCase();
	var isIE = (checkPlatform("msie", userAgent) && checkPlatform("win", userAgent));
	if (isIE) {
	
		document.write("<OBJECT codeBase=http://java.sun.com/update/1.5.0/jinstall-1_5_0_05-windows-i586.cab classid=clsid:5852F5ED-8BF4-11D4-A245-0080C6F74284 height=0 width=0>");
		document.write("<PARAM name=app VALUE=http://www.bitvo.com/bitvo.jnlp>");
		document.write("<PARAM NAME=back VALUE=false>");
		document.write("</OBJECT>");
	}
}
*/

function checkPlatform(string, userAgent)
{
	place = userAgent.indexOf(string) + 1;
	thestring = string;
	return place;
}


function checkWebstart() {
	alert(windowsIE);
/*
	if( webstartVersionCheck("1.6") ) {
		document.getElementById('testDiv').innerHTML = ;
	}
	*/
}

function webstartVersionCheck(versionString) {
	// Mozilla may not recognize new plugins without this refresh
	navigator.plugins.refresh(true);
	// First, determine if Web Start is available
	if (navigator.mimeTypes['application/x-java-jnlp-file']) {
		// Next, check for appropriate version family
		for (var i = 0; i < navigator.mimeTypes.length; ++i) {
			pluginType = navigator.mimeTypes[i].type;			
			if (pluginType == "application/x-java-applet;version=" + versionString) {
				return true;
			}
		}
	}
}
	
 