﻿var capsLock = false;
var shift = false;
function CtrlClick(ctrl) {
    if (ctrl == "ctrl_caps") {
        capsLock ^= true;
    }
    if (ctrl == "ctrl_shift") {
        shift = true;
    }
}
function Delete(all) {
    if (all == true) {
        document.getElementById("TextLine").value = "";
    }
    else {

        var txt = document.getElementById("TextLine").value;
        document.getElementById("TextLine").value = txt.substr(0, (txt.length - 1));
    }
}
function GotoSite() {
    var site = document.getElementById("TextLine").value;
    if (site.indexOf(".") == -1)
        site = site + ".com";
    if (site.indexOf("www.") == -1)
        site = "www." + site;
    if (site.indexOf("http://") == -1)
        site = "http://" + site;
    window.open(site);
    //window.location = site;
}
function SearchWeb() {
    var search = document.getElementById("TextLine").value;
    var site = "http://www.google.com/search?q=" + search;
    window.open(site);
}
function KeyClick(txt) {
    if (capsLock || shift)
        txt = txt.toUpperCase();
    document.getElementById("TextLine").value += txt;
    shift = false;
}    

function StyleButtons()
{
    var els = document.getElementsByTagName('input');
    var elsLen = els.length;
    var i = 0;
    for ( i=0;i<elsLen;i++ )
    {
        if ( els[i].getAttribute("type") )
        {
        if ( els[i].getAttribute("type") == 'text')
            els[i].className = "text";
        else
            els[i].className = "button";
        }
    }
}
