    var gAppletPopup = null;

	function CloseApplication()
	{		
		if (gAppletPopup)
		{
			gAppletPopup.close();
			gAppletPopup = null;
		}
		window.close();
	}
	
	function CheckNavUA(p_sNavUA, p_sString)
	{
		var iIndex = p_sNavUA.indexOf(p_sString) + 1;
		return iIndex;		
	}
	
    function GetWebBrowser()
	{						
		var sNavUA = navigator.userAgent.toLowerCase();
		
		var sBrowser;
		var sOS;
		
		// Browser
		if (CheckNavUA(sNavUA, 'konqueror'))
		{
			sBrowser = "Konqueror";
			sOS = "Linux";
		}
		else if (CheckNavUA(sNavUA, 'safari')) 
			sBrowser = "Safari"
		else if (CheckNavUA(sNavUA, 'omniweb')) 
			sBrowser = "OmniWeb"
		else if (CheckNavUA(sNavUA, 'opera')) 
			sBrowser = "Opera"
		else if (CheckNavUA(sNavUA, 'webtv')) 
			sBrowser = "WebTV";
		else if (CheckNavUA(sNavUA, 'icab')) 
			sBrowser = "iCab"
		else if (CheckNavUA(sNavUA, 'msie')) 
			sBrowser = "IE"
		else if (CheckNavUA(sNavUA, 'firefox'))
			sBrowser = "Firefox"
		else 
			sBrowser = "Unknown";		
		
        // OS		
		if (!sOS)
		{
			if (CheckNavUA(sNavUA, 'linux')) 
				sOS = "Linux";
			else if (CheckNavUA(sNavUA, 'x11'))
				sOS = "Unix";
			else if (CheckNavUA(sNavUA, 'mac'))
				sOS = "Mac"
			else if (CheckNavUA(sNavUA, 'win'))
				sOS = "Win"
			else 
				sOS = "Unknown";
		}        
        
        // Send
		document["FittingBox"].SetWebBrowser(sBrowser, sOS, sNavUA);
    }
     
	function FlashShowApplet(sApplet, nX, nY, nWidth, nHeight, bUsePopup)
	{
		if (bUsePopup)
		{
			if (gAppletPopup)
			{
				gAppletPopup.location.replace(sApplet);
			}
			else
			{
				var param = "top="+nY+",left="+nX+",width="+nWidth+",height="+nHeight+",scrollbars=0, menubar=0,location=0,status=0,toolbar=0,resizable=0";			
				try {
					// Do not set a title to avoid popup blocking problem on IE !
					gAppletPopup = window.open(sApplet, null/*"FittingBox-3D"*/, param);
				}
				catch (e) 
				{
					alert("Popups blocked by a 3rd party");
				}
			}
		}
		else
		{
			// Load applet
			applet3Dcontent.location.replace(sApplet);
	
			// Show it
			var iframeApplet3D = document.getElementById("applet3Dcontent");
			iframeApplet3D.style.height = nHeight;
			iframeApplet3D.style.width = nWidth;
			var divApplet3D = document.getElementById("applet3D");
			divApplet3D.style.left = nX;   
			divApplet3D.style.top = nY;   
			divApplet3D.style.height = nHeight;
			divApplet3D.style.width = nWidth;
			divApplet3D.style.visibility = "visible";
		}
	}    
    
	function FlashCloseApplet(bUsePopup)
	{
		if (bUsePopup)
		{
			if (gAppletPopup)
			{
				gAppletPopup.close();
				gAppletPopup = null;
			}
		}
		else
		{
			// Hid
			var divApplet3D = document.getElementById("applet3D");
			divApplet3D.style.visibility = "hidden";
	
			// Set default location
			applet3Dcontent.location.replace("html/loading.html");
		}
	}
    
    function FlashSendVar(param1,param2,param3,param4,param5)
    {
        document["FittingBox"].FlashLoadVar(param1,param2,param3,param4,param5);
    }
    
    function FlashShowForm(bStatus, nX, nY, nWidth, nHeight)
	{
		var divAnimFlash2 = document.getElementById("animFlash2");
        if(bStatus)
        {
            document["FbForm"].FlashInitForm();
			
    		divAnimFlash2.style.left = nX;   
    		divAnimFlash2.style.top = nY;   
    		divAnimFlash2.style.visibility = "visible";   
        }
        else
        {
    		divAnimFlash2.style.visibility = "hidden";        
        }
    }    
    
    function SendGAStats(sPage)
    {
//@GA	   
	_uacct = "UA-1547164-1"; 
	    urchinTracker(sPage);
	    return true;
//@GA
		return false;
    }
