﻿// JScript File
function CatchEnterKey(e)
{
    var pK = e ? e.which : window.event.keyCode;
    return pK != 13;
}
document.onkeypress = CatchEnterKey;
if (document.layers) document.captureEvents(Event.KEYPRESS);

function clickButton(e, buttonid)
{ 
      var evt = e ? e : window.event;
      var bt = document.getElementById(buttonid);
        
      if (bt){ 
          if (evt.keyCode == 13){ 
                bt.click(); 
                return false; 
          } 
      } 
}
function startQuiz()
{
    var url = "quiz/challenge.html";
    window.open(url, "Quiz", "status=0,toolbar=0,menubar=0,location=0,scrollbars=0,width=450,height=450");
}
function getElementById(name)
{
    var form = document.forms[0];
    for(i=0; i<form.length;i++)
    {
        if(form.elements[i].id.indexOf(name) != -1)
            return form.elements[i];
    }
}
function validateTextbox(x)
{
     
     if (x.value.search(/</) > -1 || x.value.search(/>/) > -1 || x.value.search(/{/) > -1 || x.value.search(/}/) > -1) 
    { 
            alert('Invalid character found in input text.');
            x.value='';
            setTimeout("document.forms[0]."+x.name+".select();",0);
    } 
}
 

