
var DOMViewerObj;
var DOMViewerName ='summary-new';

        function onload_stats( f, d )
        {
		//var n = new Number;

                if ( null===f.src.match(/klak99/) )
                {
                // ok, the iframe has been loaded with the new data
                // basically 4 floating point numbers separated by /
                txt=f.contentWindow.document.body.innerHTML;

                num=txt.split(/\//);

                // need to to set the src-url for the image
                g=document.getElementById('piechart');
                //g.src='./traffic-piechart.php?size=80'+
                //      '&s1='+num[0]+
                //      '&s2='+num[1]+
                //      '&s3='+num[2]+
                //      '&s4='+num[3];
		g.src='/product/traffic-piechart-new/80'+
                      '/'+num[0]+
                      '/'+num[1]+
                      '/'+num[2]+
                      '/'+num[3];


                // need to change the numbers
		
		g=document.getElementById('pctclean');
		g.innerHTML=Number(num[0]).toFixed(2)+'%';
		g=document.getElementById('pctvirus');
                g.innerHTML=Number(num[1]).toFixed(2)+'%';
		g=document.getElementById('pctpossible');
                g.innerHTML=Number(num[2]).toFixed(2)+'%';
		g=document.getElementById('pctdefinite');
                g.innerHTML=Number(num[3]).toFixed(2)+'%';
		
                }
		else toggle_stats(d,'24h');

		return;
        }

	function onload_sums( f, d, p, id )
        {
                if ( null===f.src.match(/klak99/) )
                {
		//window.alert('onload '+p+'= '+f.contentWindow.document.body.innerHTML);
                // ok, the iframe has been loaded with the new data
                // basically 4 floating point numbers separated by /
                txt=f.contentWindow.document.body.innerHTML;

                num=txt.split(/\//);

		names=id.split(/\//);

		for( i=0; i<num.length; i++ )
		{
			g1=document.getElementById(names[i]);
			g1.innerHTML=num[i];
                }
		}
                else f.src='./acctmgr-summary-trafficsums?domain='+d+'&per='+p;

                return;
        }

	function toggle_stats( d, p )
        {
                f=document.getElementById('piechart');
                f.src="/images/ajax-loader6.gif"; 
		//f.src="/images/99.212598.png";
                f=document.getElementById('rpc1');
                // we need the numbers (they'll be cached by the browser)
                f.src='/sp98/customer/acctmgr-summary-trafficdata/'+d+'/'+p;

                // this will load the iframe, so that is where the next processing happens on load.

		// set the right menu 
		f=document.getElementById('navi24h');
		f.style.display=(p=='24h' ? '' : 'none');
		f=document.getElementById('navi30d');
                f.style.display=(p=='30d' ? '' : 'none');
		f=document.getElementById('navi1y');
                f.style.display=(p=='1y' ? '' : 'none');
        }
