﻿//addLoadEvent(divSize);
//addResizeEvent(divSize);

function setWindowStatus(buttonName) {

    if (buttonName == "print") {
        window.status = "Print Section";
    }

    if (buttonName == "null") {
        window.status = "null";
    }
}

function print_article() {
    var pfriendly = frames['docframe'].pfriendly; //frames('docframe').document.getelementbyid('pfiendly');
    window.open(pfriendly, 'printwindow');
    return false;
}

function showView(view) {
    window.status = '';
    var navtoc = document.getElementById('navtoc');
    var navsrch = document.getElementById('navsrch');
    var buttoc = document.getElementById('toc');
    var butsrch = document.getElementById('srch');

    if (view == 'navtoc') {
        navsrch.className = 'vishidden';
        navsrch.style.visibility = 'hidden';
        navsrch.style.display = 'none'
        navtoc.className = 'visvisible';
        navtoc.style.visibility = 'visible';
        navtoc.style.display = 'block'
        buttoc.className = 'button pick';
        butsrch.className = 'button nopick';
    }

    if (view == 'navsrch') {
        navtoc.className = 'vishidden';
        navtoc.style.visibility = 'hidden';
        navtoc.style.display = 'none'
        navsrch.className = 'visvisible';
        navsrch.style.visibility = 'visible';
        navsrch.style.display = 'block'
        butsrch.className = 'button pick';
        buttoc.className = 'button nopick';
    }
}

function divSize() {
    var winX;
    var winY;
    // Read Screen Size - all except Explorer
    if (top.self.innerHeight) {
        winX = top.self.innerWidth;
        winY = top.self.innerHeight;
    }
    // Read Screen Size - Explorer 6 Strict Mode
    else if (top.document.documentElement && top.document.documentElement.clientHeight) {
        winX = top.document.documentElement.clientWidth;
        winY = top.document.documentElement.clientHeight;
    }
    // Read Screen Size - other Explorers
    else if (top.document.body) {
        winX = top.document.body.clientWidth;
        winY = top.document.body.clientHeight;
    }

    // Set minumum page size
    if (winX < 600) { winX = 600; }
    if (winY < 400) { winY = 400; }

    //alert(winY - header);
    document.getElementById('header').style.width = winX + "px"; //1280
    document.getElementById('pageWrap').style.width = winX + "px"; //1280
    document.getElementById('pageWrap').style.height = (winY - 65) + "px"; //895
    document.getElementById('leftcol').style.height = (winY - 65) + "px"; //895
    document.getElementById('leftnav').style.height = (winY - 100) + "px"; //860
    document.getElementById('srchframe').style.height = (winY - 141) + "px"; //819
    document.getElementById('tocframe').style.height = (winY - 141) + "px"; //819
    document.getElementById('slider').style.height = (winY - 65) + "px"; //895
    document.getElementById('rightcol').style.height = (winY - 65) + "px"; //895
    document.getElementById('rightcol').style.width = (winX - 350) + "px";  //930
    document.getElementById('dochead').style.width = (winX - 350) + "px";  //930
    document.getElementById('docframe').style.width = (winX - 350) + "px";  //930
    document.getElementById('docframe').style.height = (winY - 100) + "px";  //860
}

/*-------------------------------------------------
addLoadEvent:
App startup loader
-------------------------------------------------*/
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

/*-------------------------------------------------
addResizeEvent:
App Resize loader
-------------------------------------------------*/
function addResizeEvent(func) {
    var oldonload = window.onresize;
    if (typeof window.onresize != 'function') {
        window.onresize = func;
    } else {
        window.onresize = function() {
            oldonload();
            func();
        }
    }
}


