﻿function Clear(id) {
     var div = document.getElementById(id);
     div.innerHTML = '';
}
function handleKeyPress(e, form) {
    var evt = e ? e : window.event;
    if (evt.keyCode == 13) {
        CreateAWord();
        return false;
    } else {
       if ( !isAlpha (evt) ) {
          return false;
       }
    }   
}
function HideDiv(divid) {
    var div = document.getElementById(divid);
    div.style.display = 'none';
}
function isAlpha ( evt ) {
    var keyCode = evt.which ? evt.which : evt.keyCode;
    alpha = ( keyCode >= 'a'.charCodeAt ( ) &&
    keyCode <= 'z'.charCodeAt ( ) ) || 
    ( keyCode >= 'A'.charCodeAt ( ) &&
    keyCode <= 'Z'.charCodeAt ( ) ) || 
    ( keyCode >= 8 && keyCode <= 46 );
    return ( alpha );
}
function popup(h,w,ref) {
    var iMyWidth;
    var iMyHeight;
    iMyWidth = (window.screen.width/2) - ((w / 2));
    iMyHeight = (window.screen.height/2) - ((h / 2));
    //Open the window.
    var win2 = window.open(ref,"Window2","status=no,height=" + h + ",width=" + w + ",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
    win2.focus();
}
function setFocus(e) {
    var t = document.getElementById(e);
    t.focus();
}
function ShowDiv(divid) {
    var div = document.getElementById(divid);
    div.style.display = 'block';
}
function timedMsg(id){
    var t=setTimeout(function () {Clear(id)},3000) 
}
function timedMsg2 (id, message) {
    var t=setTimeout(function () {showMessage2(id, message)},1000)
}
function ToggleIconDiv(divid, imgid) {
    var div = document.getElementById(divid);
    var img = document.getElementById(imgid);
    if (div.style.display == 'block')
       {div.style.display = 'none';
        if (img) {img.src='images/expand.gif'}
    }
    else
    { div.style.display = 'block'; 
    if (img) {img.src='images/collapse.gif'}
    }
    alert(img.src);
}
function ToggleDiv(divid) {
    var div = document.getElementById(divid);
    if (div.style.display == 'block')
    {div.style.display = 'none';}
    else
    { div.style.display = 'block'; }
}