// jQuery Lazy Load
$(function(){
	$("img").lazyload({
		effect : "fadeIn"
	});
});

// External Link
$(document).ready( function () {
var domain = location.href.match(/^https?(:\/\/[a-zA-Z0-9.]+)\//i)[1];
$('a[href^=http]').not('[href*="'+domain+'"]').attr('target','_blank').addClass("extlink");
});


// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-51765-14']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();


// Archives
function selectUrl(sel){
    if(sel.options[sel.selectedIndex].value){
        location.href = sel.options[sel.selectedIndex].value;
    }
}
 
function addSelectForMonthly(data){
    var year = data.substring(0,4);
    var month = data.substring(12,14);
    var nodes = document.getElementById('monthlylist').getElementsByTagName("option");
    for (var i = 0; i < nodes.length; i++) {
        var selectYear = nodes[i].innerHTML.substring(0,4);
        var selectMonth = nodes[i].innerHTML.substring(5,7);
        if(year == selectYear && month == selectMonth){
            nodes[i].selected = true;
        }
    }
}

