/*
    Code that looks for a validation summary on the page then
    if found will display a javascript alert.  The alert is
    populated by the text from the summary itself.
    
    NOTE: your summary needs the id
        id="Validationsummary1"
*/

// find the summary!!
var valSummary = document.getElementById('Validationsummary1') ;

// if found...
if(null != valSummary) {

    // debugger ; // uncomment to fire the debugger
    var strSummary = valSummary.innerHTML ;
    
    // 
    var re1 = /<li>/gi ;      // look for <li>
    var re2 = /<\/\li>/gi ;   // look for <li>
    var re3 = /<\S[^>]*>/gi ; // look for any HTML
    var re4 = /&amp;/gi ;     // look for &amp;
    
    // strip out all line breaks initially
    strSummary = strSummary.replace('\n','') ;
    
    // stick a line break after the colon
    strSummary = strSummary.replace(':',':\n') ;
    
    // replace <li> with ' - '
    strSummary = strSummary.replace(re1,' - ') ;
    
    // replace </li> with a line break
    strSummary = strSummary.replace(re2,'\n') ;
    
    // strip out the rest of the HTML
    strSummary = strSummary.replace(re3,'') ;
    
    // replace &amp; with &
    strSummary = strSummary.replace(re4,'&') ;
    
    // fire the message box
    alert(strSummary) ;
}
