
function ie_onload()
{
	//init_menu();
	var cortona_is_up_today = false;
	if (!goodie) {
		//window.location.replace(parent_url + '/download/');
		alert('window.location.replace');
	} else {
		try {
			var cort_obj = new ActiveXObject("Cortona.Information.1");
			var cort_ver = cort_obj.Version;
			if (cort_ver.substr(cort_ver.lastIndexOf('.') + 1) >= 165) cortona_is_up_today = true;
			cort_obj = null;
		}
		catch(e) {
			//alert(e.message);
		}
	}
	if (cortona_is_up_today) {
		document.all.item('cortonabox').innerHTML = ie_cortona_string('cube3scriptless.wrl', 128, 128);
		window.onerror=ie_errortrap;
		//alert(cortona_is_up_today);
		//document.all.item('cortonanone').style.display = 'none';
		//document.all.item('cortonayes').style.display = 'inline';
	}
	else {
		//alert(cortona_is_up_today);
		//document.all.item('cortonanone').style.display = 'inline';
		//document.all.item('cortonayes').style.display = 'none';
	}
	return cortona_is_up_today;
//	document.all.item('button').disabled = cortona_is_up_today;
}

function ie_cortona_string(scene, width, height)
{
/////////////////////////////////////////////////////////////
///////////////////////CHECK VERSION!!!//////////////////////
/////////////////////////////////////////////////////////////
	s = '<object classid="clsid:86A88967-7A20-11d2-8EDA-00600818EDB1" id="cortona" width="' + width + '" height="' + height + '" codebase="';
	s += '/bin/'; //separate line because generator
	s += 'cortvrml.cab#Version=5,1,0,165">';
	s += '<param name="scene" value="' + scene + '">';
	s += '<param name="vrml_background_color" value="#ffffff">';
	s += '<param name="vrml_splashscreen" value="false">';
	s += '<param name="vrml_dashboard" value="false">';
	s += '<param name="rendererhints" value="8704">';
	s +='<param name="license" value="{5AB1EBB2-ED44-4E1C-8FA7-F24C3F47335D};http://www.parallelgraphics.com/vrml/parallelgraphics_license.xml;{73D200AC-DAC3-43AA-B1F5-B7F1F4AF4A16};http://www.paragraph.ru/vrml/paragraph_license.xml;{28988016-E3A8-43A3-94E5-A3545D177405};http://draft.paragraph.ru/vrml/draft_license.xml">';
	s += '</object>';
	//return s;
	
	vhtml='<div class="vrml_wrapper">';
	vhtml+='<object classid="clsid:86A88967-7A20-11d2-8EDA-00600818EDB1" id="vrml_frame" width="' + width + '" height="' + height + '" codebase="http://www.parallelgraphics.com/bin/cortvrml.cab#Version=4,2,0,93"> ';
	vhtml+='<param name="scene" value="' + scene + '"> ';
	vhtml+='<param name="vrml_background_color" value="#FFFFFF"> ';
	vhtml+='<param name="vrml_splashscreen" value="false"> ';
	vhtml+='<param name="vrml_dashboard" value="true"> ';
	vhtml+='<param name="ColliderMode" value="0"> ';
	//vhtml+='<param name="Skin" value="{46BB95BF-8EB4-481A-A1EF-50D43FC32B9D}; style/cad.zip"> ';
	vhtml+='<param name="license" value="{5AB1EBB2-ED44-4E1C-8FA7-F24C3F47335D};http://www.parallelgraphics.com/vrml/parallelgraphics_license.xml;{73D200AC-DAC3-43AA-B1F5-B7F1F4AF4A16};http://www.paragraph.ru/vrml/paragraph_license.xml;{28988016-E3A8-43A3-94E5-A3545D177405};http://draft.paragraph.ru/vrml/draft_license.xml">';
	vhtml+='<embed type="x-world/x-vrml" ';
	vhtml+='src="' + scene + '" ';
	vhtml+='width=' + width + '';
	vhtml+='height=' + height + '';
	vhtml+='VRML_BACKGROUND_COLOR="#FFFFFF" ';
	vhtml+='VRML_SPLASHSCREEN="false" ';
	vhtml+='VRML_DASHBOARD="true" ';
	vhtml+='collidermode="0" ';
	vhtml+='Skin="{46BB95BF-8EB4-481A-A1EF-50D43FC32B9D}; style/cad.zip" ';
	vhtml+='align="middle" frameborder="no"> ';
	vhtml+='</object></div>';
	return vhtml;

}

function ie_component_string(name, clsid, ver)
{
	s = '<object classid="clsid:' + clsid + '" width="0" height="0" codebase="';
	s += '/bin/'; //separate line because generator
	s += name + '.cab#Version=' + ver + '"></object>'; 
	return s;
}

function ie_errortrap(msg,url,line)
{
	//alert('msg:'+msg+' / url:'+url+' / line:'+line);
    return true;
}

var st;
var flag;
function ie_clearImg()
{
	st = setTimeout("ie_clearImg()", 1000);
	if(cortona) if(cortona.Engine) if(cortona.Engine.RootNodes.Count > 1)
	{
		if(document.images)if(document.images['installing'])document.images['installing'].src='/style/img/successful.gif';
		clearTimeout(st);
		flag=1;
		window.onerror=null;
		document.all.item('cortonanone').style.display = 'none';
		document.all.item('cortonayes').style.display = 'inline';
		alert();
	}
}

function ie_install_cortona()
{
	//document.all.item('cortonabox').innerHTML = ie_cortona_string('/vrml/splines/cube3scriptless.wrl', 128, 128);
	document.all.item('cortonabox').style.display = 'block';
	document.all.item('cortonabox').innerHTML = ie_cortona_string('cube3scriptless.wrl', 128, 128)+'<img name=installing src="/style/img/installing.gif" width=130 height=23>';
	window.onerror=ie_errortrap;
	ie_clearImg();
	if (!flag)if(document.images)if(document.images['installing'])document.images['installing'].src='/style/img/installing.gif';
}

////////////////////////////////SCREEN SAVER//////////////////////////////////////

function ie_ss_string()
{
/////////////////////////////////////////////////////////////
///////////////////////CHECK VERSION!!!//////////////////////
/////////////////////////////////////////////////////////////
	return ie_component_string('cortsave', '7A2CB982-9E7E-11D3-990D-00A0C94C695A', '2,2,0,52');
}

function ie_install_ss()
{
	document.all.item('ssbox').innerHTML = ie_ss_string();
}

function ie_install_full_ss()
{
//	s = ie_component_strings();
	s = ie_cortona_string('', 0, 0);
	s += ie_ss_string();
	document.all.item('ssbox').innerHTML = s;
}

///////////////////////////////////////converter////////////////////////////////////////////

function ie_install_converter()
{
/////////////////////////////////////////////////////////////
///////////////////////CHECK VERSION!!!//////////////////////
/////////////////////////////////////////////////////////////
	document.all.item('converterbox').innerHTML = ie_component_string('cortvrml10', '10B80396-96A7-11D3-B7A6-00A0C94C6AE0', '3,1,0,55');
}

