var player3dvia = {

	mimeType: 'application/x-3dvia-mpweb',
	installerURL: 'http://www.3dvia.com/download/mp/3DVIAMPWebPlayer-Installer.exe',
	pluginspage: 'http://www.3dvia.com/download/mp/3DVIAMPWebPlayer-Installer.exe',
	
	detect: function()
    {
    	var isPlayerInstalled = true;
    	if (navigator.mimeTypes && navigator.mimeTypes.length)
    	{
    		x = navigator.mimeTypes[player3dvia.mimeType];
    		if ((!x) || (!x.enabledPlugin))
    		{
    			isPlayerInstalled = false;
    		}
    	}
    	return isPlayerInstalled;
    },
				
	embed: function(divId, objectId, width, height, experienceId)
	{
		var html = '';
		if(navigator.appName == 'Microsoft Internet Explorer' || (player3dvia.detect() && navigator.appName == 'Netscape'))
		{
			html += '<object ' + (navigator.appName == 'Microsoft Internet Explorer' ? 'id="' + objectId + '" ' : '') + 'width="' + width + '" height="' + height + '" classid="CLSID:F705A1E9-0E4C-4F32-A647-2DE40809969A" codebase="' + player3dvia.installerURL + '">';
   			html += '<param name="content_src" value="' + experienceId + '">';
   			html += '<embed ' + (navigator.appName == 'Netscape' ? 'id="' + objectId + '"' : '') + 'width="' + width + '" height="' + height + '" type="' + player3dvia.mimeType + '" pluginspage="' + player3dvia.pluginspage + '" content_src="' + experienceId + '">';
			html += '</object>';
		}
		else if(!player3dvia.detect() && navigator.appName == 'Netscape')
		{
       		html += "<div style='text-align:center;width:" + width + "px;height:" + height + "px;padding-top:20px;'>";
			html += "<a style='text-decoration:none;' href='" + player3dvia.installerURL + "'>";
       		html += "<div style='width:300px;height:82px;margin-left:auto;margin-right:auto;border:1px solid #CCCCCC;background:#F2F2F2;'>";
       		html += "<p style='display:block;margin:18px 15px 0px 15px;'>This experience requires the 3DVIA Player.<br/><strong>Click here to install it</strong>"
			if(navigator.userAgent.indexOf("Chrome")!=-1)
			{
				html += ", then reload this page to play the experience.</p>";
			}
			else
			{
				html += ", then restart your browser to play the experience.</p>";
			}
       		html += "</div></a></div>";
		}
		else
		{
       		html += "<div style='text-align:center;width:" + width + "px;height:" + height + "px;'>";
       		html += "This experience is not yet available for your browser or Operating System. <br/><br/>";
       		html += "</div>";
		}
		document.getElementById(divId).innerHTML = html;
    }
}