
function objectEval(text)  {
    // eval() breaks when we use it to get an object using the { a:42, b:'x' }
    // syntax because it thinks that { and } surround a block and not an object
    // So we wrap it in an array and extract the first element to get around
    // this.
    // The regex = [start of line][whitespace]{[stuff]}[whitespace][end of line]
    text = text.replace(/\n/g, ' ');
    text = text.replace(/\r/g, ' ');
    if (text.match(/^\s*\{.*\}\s*$/))
    {
      text = '[' + text + '][0]';
    }
    return eval(text);
}
    
function toggleVisibility(theElem){        
    if(theElem!=undefined && theElem!=null){
        try{
            var visible = theElem.style.display!='none';                
            if(visible){
                if(theElem.display!=undefined){
                    theElem.originalDisplay = theElem.style.display;
                }
                theElem.style.display='none';                    
            }else{
                if(theElem.originalDisplay==undefined){
                    theElem.originalDisplay='block';
                }                    
                theElem.style.display=theElem.originalDisplay;
            }
        }catch(e){alert(e);}
    }
}
