﻿	
function SetBackgroundImage() {
    var BodyHeight;
    var BodyWidth;
    var MinBodyWidth;
    var MinBodyHeight;
    
    try {
        if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {
            BodyHeight = window.innerHeight;
            BodyWidth = window.innerWidth;
            MinBodyWidth = 940;
            MinBodyHeight = 600;
            }
        else{
            if (navigator.userAgent.indexOf("MSIE") != -1) { 
                var ver = getInternetExplorerVersion();
                if (ver > -1) {
                    if (ver >= 8.0) {
                        BodyHeight = document.documentElement.clientHeight;
                        BodyWidth = document.documentElement.clientWidth;
                        MinBodyWidth = 940;
                        MinBodyHeight = 600;
                        }   
                    else{
                        BodyHeight = document.documentElement.clientHeight;
                        BodyWidth = document.documentElement.clientWidth;
                        MinBodyWidth = 950;
                        MinBodyHeight = 600;
                        }            
                    }
                }
            else{
                if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1){
                    BodyHeight = window.innerHeight;
                    BodyWidth = window.innerWidth;
                        MinBodyWidth = 950;
                        MinBodyHeight = 600;
                    }
                else{
                    if (navigator.userAgent.toLowerCase().indexOf('safari') > -1){
                        BodyHeight = window.innerHeight;
                        BodyWidth = window.innerWidth;
                        MinBodyWidth = 950;
                        MinBodyHeight = 600;
                        }
                    else{
                        BodyHeight = window.innerHeight;
                        BodyWidth = window.innerWidth;
                        MinBodyWidth = 950;
                        MinBodyHeight = 600;
                        }
                    }
                }
            }        
        if ((BodyWidth > MinBodyWidth) && (BodyHeight > MinBodyHeight)) {document.body.className="BckGrnd_center_center";}
        if ((BodyWidth > MinBodyWidth) && (BodyHeight <= MinBodyHeight)) {document.body.className="BckGrnd_top_center";}
        if ((BodyWidth <= MinBodyWidth) && (BodyHeight > MinBodyHeight)) {document.body.className="BckGrnd_center_left";}
        if ((BodyWidth <= MinBodyWidth) && (BodyHeight <= MinBodyHeight)) {document.body.className="BckGrnd_top_left";}
    }
    catch(e){}
}        

function LoadCSSFile(filename) {            
    var headID = document.getElementsByTagName("head")[0];
    var cssNode = document.createElement('link');
    cssNode.type = 'text/css';
    cssNode.rel = 'stylesheet';
    cssNode.href = filename;
    cssNode.media = 'screen';
    headID.appendChild(cssNode); 
}

function getInternetExplorerVersion() {    
    var rv = -1; 
    if (navigator.appName == 'Microsoft Internet Explorer') {        
        var ua = navigator.userAgent;        
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");        
        if (re.exec(ua) != null)   rv = parseFloat(RegExp.$1);    
        }    
    return rv;
}        

function LoadStyle() {
    if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {
        LoadCSSFile("css/design_ff.css");
        }
    else{
        if (navigator.userAgent.indexOf("MSIE") != -1) { 
            var ver = getInternetExplorerVersion();
            if (ver > -1) {
                if (ver >= 8.0) {
                    LoadCSSFile("css/design_ie8.css");
                    }   
                else{
                    LoadCSSFile("css/design_ie7.css");
                    }            
                }
            }
        else{
            if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1){
                LoadCSSFile("css/design_cr.css"); 
                }
            else{
                if (navigator.userAgent.toLowerCase().indexOf('safari') > -1){
                    LoadCSSFile("css/design_sf.css"); 
                    }
                else{
                    LoadCSSFile("css/design_xx.css"); 
                    }
                }
            }
        }
    document.body.style.visibility="visible";
}

function LoadStyleWithBackgroundImage() {
    SetBackgroundImage();
    LoadStyle();
    try{LoadIconImage();}catch(e){}
}

window.onload=LoadStyle;




