$(document).ready(function(){
	$('form input[name=os_version]').val( getOSVersion() );
});


// get UA string
// parse UA string
function Is ()
{
	var agt = navigator.userAgent.toLowerCase();
	var platform = navigator.platform;

	this.major = parseInt(navigator.appVersion);
	this.opera = (agt.indexOf("opera") != -1);

	this.win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1))

    this.win16 = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1));
    this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1));
    this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows95")!=-1) || (agt.indexOf("windows 4.0")!=-1));
    this.win98 = ((agt.indexOf("win98")!=-1)||(agt.indexOf("windows 98")!=-1) ||(agt.indexOf("windows 4.1")!=-1))
    this.winnt31 = ((agt.indexOf("winnt")!=-1)||(agt.indexOf("windows nt 3.1")!=-1));
    this.winnt35 = (agt.indexOf("windows nt 3.5")!=-1);
    this.winnt40 = (agt.indexOf("windows nt 4.0")!=-1);
    this.winme = (agt.indexOf("windows 4.9")!=-1);
    this.win2000 = (agt.indexOf("windows nt 5.0")!=-1);
    this.winxp = (agt.indexOf("windows nt 5.1")!=-1);
    this.winVista = (agt.indexOf("windows nt 6.0")!=-1);
    this.win7		= (agt.indexOf("windows nt 6.1")!=-1);

    this.win32 = (this.win95 || this.winnt || this.win98 || ((this.major >= 4) && (platform == "Win32") &&(agt.indexOf("wow64")==-1)) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
    this.win64 = ((platform == "Win64") || (agt.indexOf("win64")!=-1) || (agt.indexOf("wow64")!=-1) || (agt.indexOf("64bit")!=-1) || (agt.indexOf("64-bit")!=-1));
}

// formatting output string
function getOSVersion ()
{
	var os = '';

	var is;
	is = new Is();

	if (is.win)
		os = "Windows ";

	if (is.win31)
		os += " 3.1";
	if (is.win95)
		os += " 95";
	if (is.win98)
		os += " 98";
	if (is.winnt31)
		os += " NT 3.1";
	if (is.winnt35)
		os += " NT 3.5";
	if (is.winnt40)
		os += " NT 4.0";
	if (is.winme)
		os += " Me";
	if (is.win2000)
		os += " 2000";
	if (is.winxp)
		os += " XP";
	if (is.winVista)
		os += " Vista";
	if (is.win7)
		os += " Seven";

	if	(is.opera)

	if (is.win16)
		os += " 16-bit";
	if (is.win32)
		os += " 32-bit";
	if (is.win64)
		os += " 64-bit";

	return os;
}
