﻿// JScript 檔

        function render_chart( )
        {
            //alert('aaa')
            //basehome

            myHOT_ID = ''
//            
//            if (document.getElementById('myHOT'))
//            {
//                myHOT_ID = 'myHOT'
//            }
//            else
//            {
//                myHOT_ID = ''
//            }
            
            render_main(myHOT_ID)
        }
        function render_chart2( )
        {
            //alert('aaa')
            //basehome

            myHOT_ID = ''
            
            if (document.getElementById('myHOT'))
            {
                myHOT_ID = 'myHOT'
            }
            else
            {
                myHOT_ID = ''
            }
            
            render_main(myHOT_ID)
        }
        
        function render_main(myHOT_ID)
        {
            var viewportwidth; 
            var viewportheight; 

            if (typeof window.innerWidth != 'undefined') 
            { 
                  viewportwidth = window.innerWidth
                  viewportheight = window.innerHeight 
            } 
            else if (typeof document.documentElement != 'undefined' 
                    && typeof document.documentElement.clientWidth != 
                    'undefined' && document.documentElement.clientWidth != 0) 
            { 
                   viewportwidth = document.documentElement.clientWidth
                   viewportheight = document.documentElement.clientHeight 
            } 
            else 
            { 
                   viewportwidth = document.getElementsByTagName('body')[0].clientWidth
                   viewportheight = document.getElementsByTagName('body')[0].clientHeight 
            }
            
            if (viewportwidth  < 1024 )
            {
                if (typeof window.innerWidth == 'undefined')
                {
                    document.getElementById('basehome').style.width = '990' ; 
                    
                    if (myHOT_ID != '' )
                    {
                        if (location.pathname.toLowerCase().indexOf('default') >= 0)
                        {
                            document.getElementById(myHOT_ID).style.width = '560' ; 
                        }
                        else
                        {
                            document.getElementById(myHOT_ID).style.width = '700' ; 
                        }
                    }
                }
                else
                {
                   document.getElementById('basehome').style.width = '990' + 'px'; 
                   
                    if (myHOT_ID != '' )
                    {
                        if (location.pathname.toLowerCase().indexOf('default') >= 0)
                        {
                            document.getElementById(myHOT_ID).style.width = '560' + 'px'; 
                        }
                        else
                        {
                            document.getElementById(myHOT_ID).style.width = '700' + 'px'; 
                        }
                    }
                }
            }
            else
            {
                if (typeof window.innerWidth == 'undefined' )
                {
                    document.getElementById('basehome').style.width = viewportwidth - 10  ;
                    
                    if (myHOT_ID != '' )
                    {
                        if (location.pathname.toLowerCase().indexOf('default') >= 0)
                        {
                            document.getElementById(myHOT_ID).style.width = viewportwidth - 10 - 430 ;
                        }
                        else
                        {
                            document.getElementById(myHOT_ID).style.width = viewportwidth - 10 - 290  ;
                        }
                    }
                }
                else
                {
                   document.getElementById('basehome').style.width = viewportwidth - 10 + 'px'  ;
                   
                    if (myHOT_ID != '' )
                    {
                        if (location.pathname.toLowerCase().indexOf('default') >= 0)
                        {
                            document.getElementById(myHOT_ID).style.width = viewportwidth - 10 - 430 + 'px'  ;
                        }
                        else
                        {
                            document.getElementById(myHOT_ID).style.width = viewportwidth - 10 - 290  + 'px'  ;
                        }
                    }
                }
                
            }
        }
        
        // if FF2
        if(window.addEventListener)
        {
        window.addEventListener('resize', render_chart, false);
        }
        // if IE
        if(window.attachEvent)
        {
        window.attachEvent('onresize', render_chart);
        }
        
        window.onresize = render_chart
        window.resize = render_chart