function FindTagsByName(container, name, Tag){
    
    var elements = document.getElementsByTagName(Tag);
    for (var i = 0; i < elements.length; i++){
        // if (elements[i].getAttribute("name") == name) {
        container.push(elements[i]);
    //  }
    }
}

function replaceBR(){


    
    var elements = [];
    FindTagsByName(elements, "code", "pre");
   
    //alert(elements.length);

    for(var i=0; i < elements.length; i++) {
       if(elements[i].nodeName.toUpperCase() == "PRE") {
            brs = elements[i].getElementsByTagName("br");
            // alert(elements[i].innerHTML+"brs length"+brs.length);
            for(var j = 0, brLength = brs.length; j < brLength; j++) {
                var newNode = document.createTextNode("\n");
                elements[i].replaceChild(newNode, brs[0]);
            }
        }


    }
}

function replaceBRandHighlight(){
    replaceBR();
    SyntaxHighlighter.highlight();
}



function checkBrowser(){

    if(jq.browser.msie()){
        if(jq.browser.version.number() < 8){
            alert("Exam delivery is supported only in Internet Explorer 8.0. You may use FireFox or Chrome to take the exam. ");
            return false;
        }
    }

    if(!confirm('The exam will begin now. Please confirm!')){ return false; } else { return true; }

}//fn ends


function checkBrowserForRec(){
     if(!jq.browser.firefox()){
        
            alert(" We suggest you to use Firefox 3.x plus as few sophisticated features may not work with other browsers.");
            return false;
       
    }

   return true;
}



     var infoWindowAMShown = false;
     var infoWindowAMTimer;
     function showModalInfoWindow()
     {
          infoWindowAMTimer = setTimeout("if(!infoWindowAMShown){Richfaces.showModalPanel('ajaxLoadingModalBox');infoWindowAMShown=true;}", 1);
     }
     function hideModalInfoWindow()
     {
          if (infoWindowAMShown){Richfaces.hideModalPanel('ajaxLoadingModalBox');infoWindowAMShown=false;}else{if(infoWindowAMTimer)clearTimeout(infoWindowAMTimer);}
     }


 function showModalInfoWindowLongDelay()
     {
          infoWindowAMTimer = setTimeout("if(!infoWindowAMShown){Richfaces.showModalPanel('ajaxLoadingModalBox');infoWindowAMShown=true;}", 500);
     }




