﻿//****************************************************************************************
// START - Variables
//****************************************************************************************

var Body_Width;                     // This keeps the WIDTH of the browser when browser has been activated.
var Body_Height;                    // This keeps the HEIGHT of the browser when browser has been activated.

var Body_Height_Minimum = 800;     // Set the MIN-HEIGHT of the browser window for site to display in.

//****************************************************************************************
// END - Site Variables
//****************************************************************************************

//****************************************************************************************
// START - Functions
//****************************************************************************************

function OnLoad_Functions() 
{
    Site_Keep_ViewState();      // Step 1 : Set the site`s page browsing view state.
    
    Get_BrowserWindow_Size();   // Step 2 : Getting site body WIDTH and HEIGHT.

    Site_LayOut();              // Step 3 : Building the site layout.

    Site_Wallpaper();           // Step 4 : Loading wallpaper on site.
   
}

function OnResize_Functions()
{
    Get_BrowserWindow_Size();  // Step 1 : Getting site body WIDTH and HEIGHT.

    Site_LayOut();             // Step 2 : Building the site layout.

    Site_Wallpaper();          // Step 3 : Loading wallpaper on site.

}

// ******************************

function Site_Keep_ViewState() 
{
    javascript: window.history.forward(1);
}

// ******************************

function Get_BrowserWindow_Size()                  
{
    Body_Width = 0;
    Body_Height = 0;

    Body_Width = (document.documentElement.clientWidth);
    Body_Height = (document.documentElement.clientHeight);

    if (typeof (window.innerWidth) == 'number') // Check type of browser. If "number" then ( NON-IE )
    {
        Body_Width = window.innerWidth;
        Body_Height = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) // If browser in standards compliant mode then (IE 6+) 
    {
        Body_Width = document.documentElement.clientWidth;
        Body_Height = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) // Else IE 4 compatible
    {
        Body_Width = document.body.clientWidth;
        Body_Height = document.body.clientHeight;
    }

}

function Site_Wallpaper() 
{

    if (Body_Height < Body_Height_Minimum) 
    {
        document.images[0].style.width = Body_Width + "px";
        document.images[0].style.height = Body_Height_Minimum + "px";
    }
    else 
    {
        document.images[0].style.width = Body_Width + "px";
        document.images[0].style.height = Body_Height + "px";
    }
        
        
}

function Site_LayOut() 
{

    if (document.getElementById('Div_Site_Wallpaper')) {
        if (Body_Height < Body_Height_Minimum) {
            document.getElementById('Div_Site_Wallpaper').style.height = Body_Height_Minimum + "px";
        }
        else {
            document.getElementById('Div_Site_Wallpaper').style.height = Body_Height + "px";
        }
        document.getElementById('Div_Site_Wallpaper').style.width = Body_Width + "px";
        document.getElementById('Div_Site_Wallpaper').style.top = 0 + "px";
        document.getElementById('Div_Site_Wallpaper').style.left = 0 + "px";
    }

    if (document.getElementById('Div_Content_Wrapper')) {
        if (Body_Height < Body_Height_Minimum) {
            document.getElementById('Div_Content_Wrapper').style.height = Body_Height_Minimum + "px";
        }
        else {
            document.getElementById('Div_Content_Wrapper').style.height = Body_Height + "px";
        }
        document.getElementById('Div_Content_Wrapper').style.width = 1000 + "px";
        document.getElementById('Div_Content_Wrapper').style.left = ((Body_Width - 1000) / 2) + "px";
        document.getElementById('Div_Content_Wrapper').style.top = 0 + "px";
    }

    if (document.getElementById('Div_Header_Wrapper')) {
        document.getElementById('Div_Header_Wrapper').style.top = 0 + "px";
        document.getElementById('Div_Header_Wrapper').style.height = 250 + "px";
        document.getElementById('Div_Header_Wrapper').style.width = 1000 + "px";
    }

    if (document.getElementById('Div_Menu_Wrapper')) {
        document.getElementById('Div_Menu_Wrapper').style.top = 0 + "px";
        document.getElementById('Div_Menu_Wrapper').style.height = 110 + "px";
        document.getElementById('Div_Menu_Wrapper').style.left = 30 + "px";
        document.getElementById('Div_Menu_Wrapper').style.width = 940 + "px";
    }

    if (document.getElementById('Div_Menu')) {
        document.getElementById('Div_Menu').style.top = 75 + "px";
        document.getElementById('Div_Menu').style.height = 30 + "px";
        document.getElementById('Div_Menu').style.left = 220 + "px";
        document.getElementById('Div_Menu').style.width = 600 + "px";
    }

    if (document.getElementById('Div_Body_Wrapper')) {

        if (Body_Height < Body_Height_Minimum) {
            document.getElementById('Div_Body_Wrapper').style.height = (Body_Height_Minimum - (30 + 250)) + "px";
        }
        else {
            document.getElementById('Div_Body_Wrapper').style.height = (Body_Height - (30 + 250)) + "px";
        }
        document.getElementById('Div_Body_Wrapper').style.top = 250 + "px";
        document.getElementById('Div_Body_Wrapper').style.left = 30 + "px";
        document.getElementById('Div_Body_Wrapper').style.width = 940 + "px";
    }

    if (document.getElementById('Div_Body_Content')) {
        document.getElementById('Div_Body_Content').style.top = 0 + "px";
        document.getElementById('Div_Body_Content').style.left = 0 + "px";
    }

    if (document.getElementById('iFrame_Body_Content')) {
        if (Body_Height < Body_Height_Minimum) {
            document.getElementById('iFrame_Body_Content').style.height = (Body_Height_Minimum - (30 + 250)) + "px";
        }
        else {
            document.getElementById('iFrame_Body_Content').style.height = (Body_Height - (30 + 250)) + "px";
        }
    }

    iFrame_Body_Content

    if (document.getElementById('Div_Footer')) {
        if (Body_Height < Body_Height_Minimum) {
            document.getElementById('Div_Footer').style.top = (Body_Height_Minimum - 30) + "px";
        }
        else {
            document.getElementById('Div_Footer').style.top = (Body_Height - 30) + "px";
        }

        document.getElementById('Div_Footer').style.height = 30 + "px";
        document.getElementById('Div_Footer').style.width = 1000 + "px";
    }
}

//****************************************************************************************
// END - Functions
//****************************************************************************************

