﻿
function openwin(ad) {
    var xx = '';
    window.open(ad, 'name', 'height=600,width=900,hotkeys=yes,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=no');
}

function opentra(id, cc) {
    var xx = '';
    window.open('/training/ppt.aspx?id=' + id + '&p=' + cc + '', 'name', 'height=670,width=820,hotkeys=yes,menubar=no,resizable=no,scrollbars=no,status=yes,titlebar=yes,toolbar=no');
}

function openquiz(id, cc) {
    var xx = '';
    window.open('/training/quiz.aspx?id=' + id + '', 'name', 'height=670,width=820,hotkeys=yes,menubar=no,resizable=no,scrollbars=no,status=yes,titlebar=yes,toolbar=no');
}


function popup(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=800,height=560,left=15,top=15');");
}


function disableEnterKey(e) {
    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13)
        return false;
    else
        return true;
}




function closewin() {
    window.opener.document.forms[0].submit();
    window.close();
}




var sec = 0;
var min = 0;
var hour = 0;

function stopwatch(text) {
    sec++;
    if (sec == 60) {
        sec = 0;
        min = min + 1;
    }
    else {
        min = min;
    }

    if (min == 60) {
        min = 0;
        hour += 1;
    }

    if (sec <= 9) {
        sec = "0" + sec;
    }

    document.aspnetForm.ctl00_ContentPlaceHolder1_txtStwa.value = ((hour <= 9) ? "0" + hour : hour) + " : " + ((min <= 9) ? "0" + min : min) + " : " + sec;
    SD = window.setTimeout("stopwatch();", 1000);
}


function initsize() {
    if (window.attachEvent) {
        window.attachEvent("onresize", ActualUserResize);
        window.attachEvent("onload", ActualUserResize);
    }
    if (window.addEventListener) {
        window.addEventListener("resize", ActualUserResize, true);
        window.addEventListener("load", ActualUserResize, true);
    }
}



function ActualUserResize() {
    resize();
    if (!document.readyState) document.readyState = "complete";
}


function resize() {

    var documentObj = document.documentElement;
    if (window.opera || (document.all && !(document.compatMode && document.compatMode == "CSS1Compat"))) documentObj = document.body;

    var pageheight = parseInt(documentObj.clientHeight);
    var pagewidth = parseInt(documentObj.clientWidth);

    var txth = document.getElementById('ctl00_ContentPlaceHolder1_txtH');
    if (txth != null) {
        txth.value = pageheight;
    };

    var txtw = document.getElementById('ctl00_ContentPlaceHolder1_txtW');
    if (txtw != null) {
        txtw.value = pagewidth;
    };

}
	
	