System.Gadget.onDock = checkState;
System.Gadget.onUndock = checkState;

// CheckState - this function checks docking state and innitiates appropriate function.

function checkState(){
if(!System.Gadget.docked)
    {
        undock();
    }
    else if (System.Gadget.docked)
    {
        dock();
    }
    var d = new Date()
    var time = d.getHours()
    var ipath = checkDock()
    tOD2 = "999"
    setBack(time, ipath)
}

/// Dock and Undock functions ///
function dock(){ 
document.body.style.height="75"
document.body.style.width="130"
document.body.style.font="12pt calibri"
document.body.style.lineHeight="20px"
}

function undock() {
document.body.style.height="150"
document.body.style.width="260"
document.body.style.font="25pt calibri"
document.body.style.lineHeight="45px"
}