function MM_openBrWindow(theURL,winName,features) { 
        window.open(theURL,winName,features);
        return false;
}

function colorCoder(str)
        {
            // Turn < and > into &LT; and &GT; (case matters)
            str = str.replace(/\<([^!])/g, '&LT;$1');
            str = str.replace(/([^-])\>/g, '$1&GT;');
            // Handle attribute="value" - make the attribute red and value blue
            str = str.replace(/([a-zA-Z0-9:]+)\=\"([^"]*)"/g, '<font color="red">$1</font><font color="blue">="$2"</font>');
            // Color tag openers and closers brown                
            str = str.replace(/\&LT\;([a-zA-Z0-9:]+)/g, '&LT;<font color="brown">$1</font>');
            str = str.replace(/\&LT\;\/([a-zA-Z0-9:]+)/g, '&LT;/<font color="brown">$1</font>');
            // Comments are green
            str = str.replace(/\<\!--/g, '<font color="green">&lt;!--');
            str = str.replace(/--\>/g, '--&gt;</font>');
            // The < and > characters are black
            str = str.replace(/\&LT\;/g, '<font color="black">&lt;</font>');
            str = str.replace(/\/\&GT\;/g, '<font color="black">/&gt;</font>');
            str = str.replace(/\&GT\;/g, '<font color="black">&gt;</font>');
            // Turn hard tabs into four spaces
            str = str.replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
            str = str.replace(/\n/g, '<br/>');
            return str;
        }

function viewXML(pXmlString)
    {
                       
        var winName = 'Window1' + Math.ceil((Math.random((new Date).getMilliseconds))*1000).toString();
        
        var colorCodedXml = colorCoder(pXmlString);
        
        var win = window.open('',winName,'status=yes,scrollbars=yes,resizable=yes,width=1024,height=500,location=0');
        
        win.document.body.innerHTML = '<div  style="padding:10px 10px 10px 10px;border:solid 1px gray;border-width:1px 1px 0px 1px;font-family:Lucida Grande,Geneva,Arial,Verdana,sans-serif">'
                                + '<div style="font-size:16px">Instructions:</div>'
                                + '<ol style="font-size:14px">'
                                +   '<li>Save the code below in an XML file and name it "Data.xml"</li>'
                                +   '<li>Download the HTML page <a target="_blank" href="temp.html"> here </a></li>'
                                +   '<li>Save the HTML page in the same directory on the server</li>'
                                +   '<li>Now you can open the HTML page in any browser to see the chart</li>'
                                + '<ol>'
                                + '</div>';
                            

        win.document.body.innerHTML += '<div  style="border:solid 1px gray;padding:10px 10px 10px 10px;font-family:Lucida Grande,Geneva,Arial,Verdana,sans-serif;font-size:12px;">' + colorCodedXml + '</div>';
        
    }
    
function viewHTML(pHtmlString)
    {
                       
        var winName = 'Window1' + Math.ceil((Math.random((new Date).getMilliseconds))*1000).toString();
        
        var colorCodedXml = colorCoder(pHtmlString);
        
        var win = window.open('',winName,'status=yes,scrollbars=yes,resizable=yes,width=1024,height=500,location=0');
        
        win.document.body.innerHTML = '<div  style="padding:10px 10px 10px 10px;border:solid 1px gray;border-width:1px 1px 0px 1px;font-family:Lucida Grande,Geneva,Arial,Verdana,sans-serif">'
                                + '<div style="font-size:16px">Instructions:</div>'
                                + '<ol style="font-size:14px">'
                                +   '<li>Save the code below in an HTML page</li>'
                                +   '<li>Make sure that you have Visifire.xap and Visifire.js is in the same folder.' 
                                    +   'If required download <a href="download_silverlight_wpf_controls.php">here</a></li>'
                                +   '<li>Now you can open the HTML  page in any browser to see the chart</li>'
                                + '<ol>'
                                + '</div>';
                            

        win.document.body.innerHTML += '<div  style="border:solid 1px gray;padding:10px 10px 10px 10px;font-family:Lucida Grande,Geneva,Arial,Verdana,sans-serif;font-size:12px;">' + colorCodedXml + '</div>';
        
    }
