//Google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26992719-1']);
_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';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
})();

var openInNewWindow=function (e) {
    var href=$(this).attr("href");
    if (typeof href !== 'undefined' && href !== false) {
        var event;
        if (!e) event = window.event;
        else event = e;
        // Abort if a modifier key is pressed
        if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
            return true;
        } else {
            // Change "_blank" to something like "newWindow" to load all links in the same new window
            var newWindow = window.open(href, '_blank');
            if (newWindow) {
                if (newWindow.focus) {
                    newWindow.focus();
                }
                return false;
            }
        }
    }
    return true;
};

$("body").ready(function(){
	
	
	if($.browser.msie && parseFloat($.browser.version)<7){
		$("body").find('[src$=".png"]').each(function(){
			$(this).replaceWith(
				$("<div />")
					.css({
						"filter":"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr('src')+"', sizingMethod='scale')",
						"width":$(this).width(),
						"height":$(this).height(),
						"zoom":"1",
						"display":"inline"
					})
			);
		});
	}


    $(this).find("a[href]").each(function(){
		$(this).attr("href",$(this).attr("href").replace(/^maillink\:([^;]+);([^;]+);([^;]+)$/,"mailto:$1@$2.$3"));
        if($(this).attr("href").match(/^http\:\/\//)!=null || $(this).attr("href").match(/^www\./)!=null){
           	$(this).attr("target","_blank");
        }
    });
    $(this).find("[data-email]").each(function(){
        var args=$(this).attr("data-email").split(";");
        $(this).removeAttr("data-email");
        $(this).html(args[0]+"@"+args[1]+"."+args[2]);
    });
});

(function($) {
    var cache = [];
    $.preLoadImage = function(url,callback) {
        var cacheImage = document.createElement('img');
        cacheImage.src = url;
        cache.push(cacheImage);
        cacheImage.onload=callback;
    }
})(jQuery)
