/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'levitte-journal'; // required: replace example with your forum shortname
//var disqus_developer = 1; // developer mode is on

function entry_id(link) {
    id = link
    // Remove scheme and host if they are present
	.replace(/^[a-z]*:\/\/[^\/]*\//,"")
    // Remove identity if present
	.replace(/\#.*$/,"")
    // Remove initial './' is present
	.replace(/^\.\//,"")
    // Remove ending '.html' if present
	.replace(/\.html$/,"")
    // Replace all slashes
	.replace(/\//g,"_2F_");
    return id;
}
function fixup_hrefs() {
    as = document.getElementsByTagName("A");
    for(i = 0; i < as.length; i++) {
	href = as[i].getAttribute("HREF");
	if (href && href.match(/\#disqus_thread$/)) {
	    as[i].setAttribute("data-disqus-identifier",
			       entry_id(href));
	}
    }
}

var disqus_identifier = entry_id(document.URL);


// Usage, usually in page.tmpl:
// 
// <div id="disqus_thread"></div>
// <script type="text/javascript"><!--
//     disqus_comments();
// // --></script>
// <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
// <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>

function disqus_comments() {
    // Only do this in entry pages!
    url = document.URL.replace(/^[a-z]*:\/\/[^\/]*/,"");
    if (!url.match(/^\/entries\//)) {
	return;
    }

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
}


// Usage, usually in inlinepage.tmpl:
//
// <a href="http://example.com/article2.html#disqus_thread">Second article</a>
//
// and somewhere in the index page (or page.tmpl):
//
// <script type="text/javascript"><!--
//     disqus_count();
// // --></script>


function disqus_count() {
    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function () {
        var s = document.createElement('script'); s.async = true;
        s.type = 'text/javascript';
        s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
    }());
}

