//stkobject 1.8 from www.stonetrip.com
//js version 20111001

//-------------------- Plugin version & installer url --------------//
if (navigator.platform.indexOf("Win") != -1)
{
	//windows variables
	var st_plugvers = '1,8,1,1';
	var st_mime_type = 'application/x-shiva3d-1.8';
	var st_MozillaWebPlayer = 'ShiVa3D Plugin 1.8.1';
	var st_SilentUrl ='S3DWebPlayer-Silent-1.8.1.0.exe';
	var st_jarUrl = 'installer/S3DInstaller3.jar';
	var st_checkJar = 'installer/checkJava.jar'
}
else{
	//macOS and Linux variables
	st_plugvers = '1,8,1,0';
	var st_mime_type = 'application/x-shiva3d';
	var st_MozillaWebPlayer = 'ShiVa3D Plugin';
}

//plugin version
var st_dllvers  = '2.1.9.8';
var st_dllversBeta  = '2.1.9.8';
var st_pluginvers = '1.8.1';

var st_activeXWebPlayer = 'ShiVa3D.WebPlayer.'+st_pluginvers+'.0';

//is beta
var st_isBeta = true;

var st_url ='';

//plugin url
if(st_isBeta) st_url = 'http://www.stonetrip.com/players/'+st_pluginvers+'/';
else st_url = 'http://www.stonetrip.com/players/'+st_pluginvers+'/';

var st_pluginURL = 'engine/';

var st_macUrl = st_url+'installer/S3DWebPlayer-'+st_pluginvers+'.0.dmg';
var st_winUrl = st_url+'installer/S3DWebPlayer-'+st_pluginvers+'.0.exe';
var st_linuxUrl = st_url+'installer/S3DWebPlayer-'+st_pluginvers+'.0.xpi';

//installation pictures url and variables
var st_imageInstall = 'install-';
var st_imageAfterInstall = ''; 
var st_imageNoInstall = 'install-unknown-';
var st_imageNoInstall64 = 'install-64-';
var st_imageInstallExt = '.png';
var st_imageUrl = st_url+'image/'; 
var st_installWaiting = false;
var st_automaticReloadLaunched = false;

//timeOut for java installer
var st_timeOut = 2000;

//global variables

var st_width, st_height,st_width2, st_height2, st_data, st_server, st_quitURL, st_loadImg, st_loadingData, st_alternativePluginURL, st_errorURL, st_forceFailsafe, st_allowFullscreen, st_additionalStartupEnv, st_appAALevel, st_appShadowLevel, st_appPostRELevel, st_appReflectLevel, st_smartCache, st_language, st_customInstallerImageUrl, st_imageType, st_alternativeContent, st_pluginBackgroundColor,st_contextMenu, st_translation="",st_os,st_fromAjax=false,st_JavaEnabled=false,st_userHasCanceledJava=false,st_reloaded = false,st_needToUpdate = null,st_disableJava=false;

//----------------------Plugin version & installer url ---------------//

//Check for beta
if(st_isBeta){
   	  st_dllvers  = st_dllversBeta;
	  st_pluginURL = st_url+st_pluginURL+st_dllversBeta+'/';
}
else{
	  st_pluginURL = st_url+st_pluginURL+st_dllvers+'/';
}

//Check if a variable is valid or not
function st_isValid ( variable )
{
	return ( variable != null ) && ( variable != '' ) && ( variable != 'undefined' );
}

//check if java engine ins available
function st_checkJava(ajax)
{
	if(ajax){
		var a=document.createElement('applet');
		a.style.position = "absolute";
		a.style.top = 0;
		a.style.left = 0;
		a.setAttribute('id',"checkJava");
		a.setAttribute('name',"ShiVa3DWebPlayer");
		a.setAttribute('code',"checkJava.class");
		a.setAttribute('archive',st_checkJar);
		a.setAttribute('codebase',st_url);
		a.setAttribute('width',1);
		a.setAttribute('height',1);
		document.body.appendChild(a);
	}
	else{
	 	document.write('<div style="position:absolute;top:0px;left:0px"><applet name="ShiVa3DWebPlayer" id="checkJava" code="checkJava.class" archive="'+st_checkJar+'" codebase="'+st_url+'" width="1" height="1"></applet></div>');
	}
	try
	{
		var x = document.getElementById('checkJava').check();
		st_JavaEnabled = true;
		return true;
	}
	catch(e)
	{
		st_JavaEnabled = false;
		return false;
	}
}

//Manual install plugin
function st_installPlugin( notJava, useAjax )
{
	if(notJava  || navigator.platform.indexOf("Win") ==-1 || st_checkJava(useAjax) )
	{
		if (navigator.platform.indexOf("Win") != -1){ 
			document.location.href = st_winUrl;
		}
		else
		{	
			if (navigator.platform.indexOf("Mac") != -1) { 
				document.location.href = st_macUrl;
			}else
			if (navigator.platform.indexOf("Linux") != -1) { 
				document.location.href = st_linuxUrl;
			}
		}
	}
	else
	{
		var a=document.createElement('applet');
		a.style.position = "absolute";
		a.style.top = 0;
		a.style.left = 0;
		a.setAttribute('id',"ShiVa3DWebPlayer");
		a.setAttribute('name',"ShiVa3DWebPlayer");
		a.setAttribute('code',"S3DInstaller.class");
		a.setAttribute('archive',st_jarUrl);
		a.setAttribute('codebase',st_url);
		a.setAttribute('width',1);
		a.setAttribute('height',1);
		var param = document.createElement("param");
		param.name = "player";
		param.value= st_SilentUrl;
		a.appendChild(param);
		document.body.appendChild(a);
	}
}

//refresh user environment while waiting for plugin install
function st_automaticReload ()
{
	if(st_userHasCanceledJava==false && document.getElementById('ShiVa3DWebPlayer'))
	{
		try
		{
			isValidate = document.getElementById('ShiVa3DWebPlayer').isValidate() ;
			isUptodate = st_isUpToDate ( );
			if( !isValidate || ( isValidate && !isUptodate ) )
			{
				st_userHasCanceledJava=true;
				DisplayInstaller();
			}
		}
		catch(err)
		{
			if (navigator.appName=="Microsoft Internet Explorer")
			{
				st_userHasCanceledJava=true;
				DisplayInstaller();
			}
		}
	}
	st_needToUpdate = ! st_isUpToDate ( );
    if ( st_needToUpdate )	setTimeout('st_automaticReload()', st_timeOut);
    else 
	{	
			st_reloaded = true;
			if(st_alternativeContent==1) document.getElementById('S3DalternativeContent').style.display='none';
			stkobject();
	}
}

//check plugin version
function st_isUpToDate () {
    navigator.plugins.refresh();	
	//  IE
    if (navigator.appName=="Microsoft Internet Explorer")
	{
		try
		{		
			var oS3D = new ActiveXObject(st_activeXWebPlayer);	
			if (oS3D) {					
				delete oS3D;				
				return true;
			}
			else
			{
				return false ;
			}
		}catch (err)
		{
			return false;
		}
		
	}
    else
	// mozilla
    if (navigator.plugins && navigator.plugins.length > 0)
	{
    	if (navigator.plugins[st_MozillaWebPlayer])
		{		
    		var descriptionwords = navigator.plugins[st_MozillaWebPlayer].description.split(" ");
			 var pluginversion = st_plugvers.split(",");
			
    		var descriptionversion = descriptionwords[2].split(",");
       		var greaterVersion = 0;    		
    		if ((pluginversion.length >=3)&& (descriptionversion.length>=3))
    		{
        		//compare version
        		if (parseInt(descriptionversion[0])>parseInt(pluginversion[0])) 
        		{
        		    greaterVersion=1;
                }
                else
        		if (parseInt(descriptionversion[0])==parseInt(pluginversion[0])) 
        		{
            		if (parseInt(descriptionversion[1])>parseInt(pluginversion[1])) 
            		{
            		    greaterVersion=1;
                    }
                    else
            		if (parseInt(descriptionversion[1])==parseInt(pluginversion[1])) 
            		{
                		if (parseInt(descriptionversion[2])>=parseInt(pluginversion[2])) 
                		{
                		    greaterVersion=1;
                        }
                    }
                }
    	    }
		    if (greaterVersion==1)
		    {
		    	var plugin = navigator.plugins[st_MozillaWebPlayer];
		    	var numTypes = plugin.length;
		    	for (j = 0; j < numTypes; j++)
		    	{
		    		mimetype = plugin[j];
		    		if (mimetype)
		    		{
		    			if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("shiva") != -1))
		    			{
		    				greaterVersion = 1;
		    			}
		    			// Mac wierdness
		    			if (navigator.mimeTypes[st_mime_type] == null)
		    				greaterVersion = 0;
		    		}
		    	}
        	}
			return (greaterVersion==1);
		}
    }
	return false; 
}

//to call a hud function
function DoFunction() {    
    var items = DoFunction.arguments.length;
    if (items == 0) return ;
    var command = DoFunction.arguments[0] ;
    if (items == 1){
        SHIVA3D.DoFunction(command, 0, command);
    }else{
        var arglist = new Array(items -1);
        for (i = 1;i < items;i++){
            arglist[i-1] = DoFunction.arguments[i];
        }
        SHIVA3D.DoFunction(command, items-1, arglist.toString());
    }
}

//replace current pack

function ChangeSTK( newSTKUrl ) {    
    SHIVA3D.Data = newSTKUrl;
}

//main function to display content
function st_write_object()
{
		var content ='' ;
		
		if(st_appAALevel==0 || st_appAALevel =="0") st_appAALevel=-1;
		
	    content +=	'<object id="SHIVA3D" width="'+st_width+'" height="'+st_height+'" CLASSID="CLSID:AC42E1C6-2D4C-49c7-947C-1BA3D7E309FC">';

		content +=	'\n<param name="CheckSystemVersion" value="'+st_dllvers+'"/>';
									                	content +=  '\n<param name="Data"									value="'+st_data+'"/>';
        if(st_isValid ( st_server )) 				    content +=	'\n<param name="Server"               					value="'+st_server+'"/>';
        if(st_isValid ( st_quitURL )) 				    content +=	'\n<param name="QuitURL"								value="'+st_quitURL+'"/>';
        if(st_isValid ( st_loadingData )) 			    content +=	'\n<param name="LoadingData"							value="'+st_loadingData+'"/>';
        if(st_isValid ( st_alternativePluginURL ))	    content +=	'\n<param name="AlternativePluginURL" 					value="'+st_alternativePluginURL+'"/>';
        else{  				   							content +=	'\n<param name="AlternativePluginURL" 					value="'+st_pluginURL+'"/>';}
        if(st_isValid ( st_errorURL) )				    content +=	'\n<param name="ErrorURL" 								value="'+st_errorURL+'"/>';
        if(st_isValid ( st_forceFailsafe ))				content +=	'\n<param name="ForceFailsafe" 							value="'+st_forceFailsafe+'"/>';
        if(st_isValid ( st_allowFullscreen) || (st_allowFullscreen==0))			content +=	'\n<param name="AllowFullscreen" 						value="'+st_allowFullscreen+'"/>';
		if(st_isValid ( st_additionalStartupEnv ))	    content +=	'\n<param name="AdditionalStartupEnv"					value="'+st_additionalStartupEnv+'"/>';
		if(st_isValid ( st_appAALevel ))				content +=	'\n<param name="AppAALevel"								value="'+st_appAALevel+'"/>';
		if(st_isValid ( st_appShadowLevel ))			content +=	'\n<param name="AppShadowLevel"							value="'+st_appShadowLevel+'"/>';
		if(st_isValid ( st_appPostRELevel ))			content +=	'\n<param name="AppPostRELevel"							value="'+st_appPostRELevel+'"/>';
		if(st_isValid ( st_appReflectLevel ))			content +=	'\n<param name="AppReflectLevel"						value="'+st_appReflectLevel+'"/>';
		if(st_isValid ( st_smartCache ))				content +=	'\n<param name="SmartCache"								value="'+st_smartCache+'"/>';
		if(st_isValid ( st_pluginBackgroundColor ))     content +=	'\n<param name="PluginBackgroundColor"					value="'+st_pluginBackgroundColor+'"/>';
 		if(st_isValid ( st_contextMenu )|| (st_contextMenu==0))				content +=	'\n<param name="ContextMenu"							value="'+st_contextMenu+'"/>';
		if(st_isValid ( st_translation ))		    	content +=	'\n<param name="Localization"	                        value="'+st_translation+'"/>';
					
		content +=	'\n<!--[if !IE]>--><embed type="'+ st_mime_type+'" width="'+st_width+'" height="'+st_height+'" ';
       if (navigator.platform.indexOf("Win") != -1) 
			content += ' Pluginspage="'+st_winUrl+'" ';
       else if (navigator.platform.indexOf("Mac") != -1) 
			content += ' Pluginspage="'+st_macUrl+'" ';
	   else if (navigator.platform.indexOf("Linux") != -1)
			content +=	' Pluginspage="'+st_linuxUrl+'" ';
											
		if(st_isBeta) content +=	' CheckSystemVersion	= "'+st_dllversBeta+'"'; else content +=	' CheckSystemVersion	= "'+st_dllvers+'"'; 
									            	content +=	' Data                  = "'+st_data+'"';
        if(st_isValid ( st_server )) 				content +=	' Server				= "'+st_server+'"';
        if(st_isValid ( st_quitURL )) 				content +=	' QuitURL 				= "'+st_quitURL+'"';
        if(st_isValid ( st_loadingData )) 			content +=	' LoadingData			= "'+st_loadingData+'"';
        if(st_isValid ( st_alternativePluginURL ))	content +=	' AlternativePluginURL  = "'+st_alternativePluginURL+'"';
		else{ 										content +=	' AlternativePluginURL  = "'+st_pluginURL+'"'; }
        if(st_isValid ( st_errorURL) )				content +=	' ErrorURL              = "'+st_errorURL+'"';
        if(st_isValid ( st_forceFailsafe ))			content +=	' ForceFailsafe			= "'+st_forceFailsafe+'"';
        if(st_isValid ( st_allowFullscreen )|| (st_allowFullscreen==0))		content +=	' AllowFullscreen       = "'+st_allowFullscreen+'"';
		if(st_isValid ( st_additionalStartupEnv ))	content +=	' AdditionalStartupEnv	= "'+st_additionalStartupEnv+'"';
		if(st_isValid ( st_appAALevel ))			content +=	' AppAALevel			= "'+st_appAALevel+'"';
		if(st_isValid ( st_appShadowLevel ))		content +=	' AppShadowLevel		= "'+st_appShadowLevel+'"';
		if(st_isValid ( st_appPostRELevel ))		content +=	' AppPostRELevel		= "'+st_appPostRELevel+'"';
		if(st_isValid ( st_appReflectLevel ))		content +=	' AppReflectLevel		= "'+st_appReflectLevel+'"';
		if(st_isValid ( st_smartCache ))			content +=	' SmartCache			= "'+st_smartCache+'"';
		if(st_isValid ( st_pluginBackgroundColor ))content +=	' PluginBackgroundColor	= "'+st_pluginBackgroundColor+'"';
		if(st_isValid ( st_contextMenu )|| (st_contextMenu==0))			content +=	' ContextMenu	        = "'+st_contextMenu+'"';
		if(st_isValid ( st_translation ))		    content +=	' Localization	        = "'+st_translation+'"';
							            content +=	' ></embed><!--<![endif]-->';
							            content +=	"\n</object>\n";
	if(st_reloaded==true) 
	{
		var oSpan = document.getElementById("S3DInstallSpan");
		oSpan.innerHTML=content;
	}
	else 
	{
		var oSpan = document.getElementById("S3DContent");
		oSpan.innerHTML=content;
	}
}

//get right click text
function st_localize()
{
		navlang = navigator.language;
		if(navlang == undefined) navlang=navigator.browserLanguage;
		if(navlang != undefined)
		{
			switch (navlang) {
			case "fr":
				st_translation="Plein &amp;eacute;cran|Couper le son|Options...|A propos|";
			break;
			case "hu":
				st_translation="Teljes k&amp;eacute;perny&amp;ouml;|Eln&amp;eacute;m&amp;iacute;t&amp;aacute;s|Be&amp;aacute;ll&amp;iacute;t&amp;aacute;sok|N&amp;eacute;vjegy|";
			break;
			}
		}
}


//force directX use
function writeFailsafeObject( Width, Height, Data, Banniere , Server, QuitURL, LoadImg, LoadingData, AlternativePluginURL, ErrorURL, ForceFailsafe, AllowFullscreen, AdditionalStartupEnv, AppAALevel, AppShadowLevel, AppPostRELevel, AppReflectLevel, SmartCache) {
	document.write("\n<div id='S3DContent'>\n");
 	stkobject( Width, Height, Data, Server, QuitURL, LoadImg, LoadingData, AlternativePluginURL, ErrorURL, 1, AllowFullscreen, AdditionalStartupEnv, AppAALevel, AppShadowLevel, AppPostRELevel, AppReflectLevel, SmartCache  ) ;
	document.write("\n</div>\n");
}

//backward compatibility -- deprecated
function writeObject( Width, Height, Data, Banniere, Server, QuitURL, LoadImg, LoadingData, AlternativePluginURL, ErrorURL, ForceFailsafe, AllowFullscreen, AdditionalStartupEnv, AppAALevel, AppShadowLevel, AppPostRELevel, AppReflectLevel, SmartCache) {
	document.write("\n<div id='S3DContent'>\n");
 	stkobject( Width, Height, Data, Server, QuitURL, LoadImg, LoadingData, AlternativePluginURL, ErrorURL, ForceFailsafe, AllowFullscreen, AdditionalStartupEnv, AppAALevel, AppShadowLevel, AppPostRELevel, AppReflectLevel, SmartCache  ) ;
	document.write("\n</div>\n");
}

//backward compatibility -- deprecated
function stkobject( Width, Height, Data, Server, QuitURL, LoadImg, LoadingData, AlternativePluginURL, ErrorURL, ForceFailsafe, AllowFullscreen, AdditionalStartupEnv, AppAALevel, AppShadowLevel, AppPostRELevel, AppReflectLevel, SmartCache, Language, CustomInstallerImageUrl, ImageType, AlternativeContent,PluginBackgroundColor,ContextMenu,Ajax,DisableJava ) {
	
	if(document.getElementById("S3DContent")==null)isOld=true;
	else isOld=false;
	if(isOld && (Ajax==null || Ajax==0))document.write("\n<div id='S3DContent'>\n");
	
	if(!st_reloaded){ 
		//storing variable 
		st_width=Width.toString(); st_height=Height.toString(); st_data=Data; st_server=Server; st_quitURL=QuitURL; st_loadImg=LoadImg; st_loadingData=LoadingData; st_alternativePluginURL=AlternativePluginURL; 
		st_errorURL=ErrorURL; st_forceFailsafe=ForceFailsafe; st_allowFullscreen=AllowFullscreen; st_additionalStartupEnv=AdditionalStartupEnv; st_appAALevel=AppAALevel; 
		st_appShadowLevel=AppShadowLevel; st_appPostRELevel=AppPostRELevel; st_appReflectLevel=AppReflectLevel; st_smartCache=SmartCache; st_language=Language; 
		st_customInstallerImageUrl=CustomInstallerImageUrl; st_imageType=ImageType;st_alternativeContent=AlternativeContent;st_pluginBackgroundColor=PluginBackgroundColor;
		st_contextMenu=ContextMenu;	
		if(Ajax==null || Ajax==0) st_fromAjax = false; else st_fromAjax=true;
		if(DisableJava==null || DisableJava==0) st_disableJava = false; else st_disableJava=true;
		st_width2=st_width;
		st_height2=st_height;
		if(st_height.indexOf("%")==-1)st_height2=st_height2+"px";
		if(st_width.indexOf("%")==-1)st_width2=st_width2+"px";
		document.getElementById("S3DContent").style.height=st_height2;
	}
	
	if ( st_needToUpdate == null ) st_needToUpdate = ! st_isUpToDate ( );
    if ( st_needToUpdate ){ DisplayInstaller( ); }
    else
    {		
		st_localize();
		st_write_object();	
	}
	if(isOld && !st_fromAjax)
	{
		document.write("</div>");
		return''
	}
}

//display the right installation pictures
function DisplayInstallerPicture(urlInstaller,os,navigatorType)
{
	st_JavaApplet='';
	if(st_alternativeContent ==1)
		document.getElementById('S3DalternativeContent').style.display='block';
	else
	{
		newContent = "";
		if(st_userHasCanceledJava==false){
			newContent += "\n"+'<div id="S3DInstallSpan" align="center" style="width:'+st_width2+';height:'+st_height2+';">';
		}
		
		//Java detection		
		if(os=="win" && (st_JavaEnabled || st_checkJava(st_fromAjax)) && st_userHasCanceledJava==false  && st_disableJava==false ) {	
			newContent += "\n"+'<div id="S3DInstall" style="height:'+st_height2+';display:block;cursor:wait">\n'
			+'<table  border="0" cellspacing="0" cellpadding="0" style="height:'+st_height2+'">\n'
			 +'<tr>\n'
				+'<td valign="middle"><div align="center"><img src="'+st_imageUrl+'installJava-'+st_language+st_imageInstallExt+'" border="0"/></div></td>\n'
			  +'</tr>\n'
			+'</table>\n'
			+'</div>\n';
			
			if(st_fromAjax)
			{
				var a=document.createElement('applet');
				a.style.position = "absolute";
				a.style.top = 0;
				a.style.left = 0;
				a.setAttribute('id',"ShiVa3DWebPlayer");
				a.setAttribute('name',"ShiVa3DWebPlayer");
				a.setAttribute('code',"S3DInstaller.class");
				a.setAttribute('archive',st_jarUrl);
				a.setAttribute('codebase',st_url);
				a.setAttribute('width',1);
				a.setAttribute('height',1);
				var param = document.createElement("param");
				param.name = "player";
				param.value= st_SilentUrl;
				a.appendChild(param);
				document.body.appendChild(a);
				setTimeout('st_automaticReload()', st_timeOut);
				st_automaticReloadLaunched = true;
			}
			else
			{
				window.onload=function(){
					st_JavaApplet='<div style="position:absolute;top:0px;left:0px" id="Java_Div"><applet name="ShiVa3DWebPlayer" id="ShiVa3DWebPlayer" code="S3DInstaller.class" archive="'+st_jarUrl+'" codebase="'+st_url+'" width="1" height="1"><param name="player" value="'+st_SilentUrl+'" /></applet></div>';
					var a=document.getElementById('S3DContent');
					a.innerHTML+=st_JavaApplet;
					setTimeout('st_automaticReload()', st_timeOut);
					st_automaticReloadLaunched = true;
				}

			}
		
		} 
		else {
			
			st_installString = "\n"+'<div id="S3DInstall" style="height:'+st_height2+';display:block;">\n'
			+'<table  border="0" cellspacing="0" cellpadding="0" style="height:'+st_height2+'">\n'
			 +'<tr>\n'
				+'<td valign="middle"><div align="center"><img onClick="location.href=\''+urlInstaller+'\';document.getElementById(\'S3DReload\').style.display = \'block\';document.getElementById(\'S3DInstall\').style.display = \'none\';" src="'+st_imageUrl+'install-'+st_language+st_imageInstallExt+'" border="0" style="cursor:pointer"/></div></td>\n'
			  +'</tr>\n'
			+'</table>\n'
			+'</div>\n';
			
			st_reloadString ='<div id="S3DReload" style="width: '+st_width2+';height:'+st_height2+';display:none ;">\n'
			+'<table border="0" cellspacing="0" cellpadding="0" style="height:'+st_height2+'">\n'
			  +'<tr>\n'
				+'<td valign="middle"><div align="center"><img src="'+st_imageUrl+navigatorType+os+'-'+st_language+st_imageInstallExt+'" border="0" usemap="#Map1" /></div></td>\n'
			  +'</tr>\n'
			+'</table>\n'
			+'<map name="Map1" id="Map1">\n'
			  +'<area shape="rect" coords="343,0,451,21" style="cursor:pointer" title="Previous step" onClick="document.getElementById(\'S3DInstall\').style.display = \'block\';document.getElementById(\'S3DReload\').style.display = \'none\';" />\n'
			+'</map>\n'
			+'</div>\n';
			
			newContent+=st_installString+st_reloadString;
			
			if(!st_automaticReloadLaunched) { st_automaticReloadLaunched = true ; setTimeout('st_automaticReload()', st_timeOut); }
			
		}
		
		newContent +=  "\n"+'</div>';
		
		if(st_userHasCanceledJava)
		{
			document.getElementById("S3DInstallSpan").innerHTML = newContent;
		}
		else
		{
			if(st_fromAjax)
				document.getElementById("S3DContent").innerHTML += newContent;
			else
				document.write(newContent);	
		}
	} 
}

//when plugin is missing, display the right installation process
function DisplayInstaller() {
	if ( st_needToUpdate )
	{
		if(st_isValid(st_customInstallerImageUrl )) st_imageUrl = st_customInstallerImageUrl;
		if(st_isValid(st_imageType)) 
		{
			if ( st_imageType[0] !="." )
				st_imageInstallExt = "."+st_imageType;
			else
				st_imageInstallExt = st_imageType;
		}
		
		if(st_isValid(st_language )) 
		{ 
			navlang = navigator.language;
			if(navigator.language ==undefined) navlang=navigator.browserLanguage;
			if(st_language != navlang) st_language = "en"; 
		}
		else 
		{
			st_language = "en";
		}
			
		//browser detection
		browser = navigator.userAgent.toLowerCase();
		browserArray = ["chrome","safari","firefox","msie","opera"];
		for (i in browserArray)
		{
			if (browser.indexOf(browserArray[i])!= -1)
			{
				browser = browserArray[i];
				break;
			}
		}
		if(browser==navigator.userAgent.toLowerCase())browser="firefox";
			
		st_installWaiting = false;
		//platform detection
		if (navigator.platform.indexOf("Win") != -1){ 
				if(browser=="msie" && (navigator.appVersion).indexOf("x64") != -1 )
				{
					newContent = '<div style="width:'+st_width2+'; height:'+st_height2+'; background-image:url('+st_imageUrl+st_imageNoInstall64+st_language+st_imageInstallExt+'); background-position:center; background-repeat:no-repeat;"></div>';
					
					if(st_fromAjax)
						document.getElementById("S3DContent").innerHTML += newContent;
					else 
						document.write(newContent);
				}
				else {
					st_installWaiting=true;
					DisplayInstallerPicture(st_winUrl,"win",browser);
				}
		}
		else
		{	
			if (navigator.platform.indexOf("Mac") != -1) { 
				st_installWaiting=true;
				DisplayInstallerPicture(st_macUrl,"mac",browser);
			}else
			{
				if (navigator.platform.indexOf("Linux") != -1) { 
					st_installWaiting=true;
					DisplayInstallerPicture(st_linuxUrl,"linux",browser); 
				}
				else {
					newContent = '<div style="width:'+st_width2+'; height:'+st_height2+'; background-image:url('+st_imageUrl+st_imageNoInstall+st_language+st_imageInstallExt+'); background-position:center; background-repeat:no-repeat;"></div>';
					
					if(st_fromAjax)
						document.getElementById("S3DContent").innerHTML += newContent;
					else 
						document.write(newContent);
				}
			}
		}
	}
}
