$(document).ready(function() {

    $("a[rel='external']").attr("target", "_blank");

    initCharCount();

    embedLogo();

});

function initCharCount() {
    var el = $('.limit');
    if (el.length > 0) {
        $('.limit').simplyCountable({
            counter: '#counter',
            maxCount: 600,
            strictMax: true
        });
    }
}

function popup(url, name, width, height){
    var oWindow = window.open(url, name, "height=" + height + ", width=" + width + ", top=100, left=100, resizable=yes, scrollable=yes, scrollbars=yes");
    if (oWindow == null) {
        alert("Your popup blocker won’t allow you access to this window.");
    }
    else {
        //continue on
    }
}

function embedLogo() {
    var logo = $('.home #logo a');
    if (logo.length > 0) {
        var flashvars = {};
        var params = {
            menu: "false",
            wmode: 'transparent'
        };
        var attributes = {};

        swfobject.embedSWF("flash/BFDL_Logo.swf", "logo", "290", "115", "9.0.0", null, flashvars, params, attributes);
    }
}

if(!butterfinger){var butterfinger={};}
if(!butterfinger.insurance){butterfinger.insurance={};}
butterfinger.insurance.fileAClaim=function(me){
	var win=window,doc=document;

	$(doc).ready(function(){
		me=butterfinger.insurance.fileAClaim;
	});

	var encodeStoryHtml=function(){
		$('.txtStory').val($('.txtStory').val().replace('<','&lt;').replace('>','&gt;'));
	};

	// public members
	return{
		encodeStoryHtml:encodeStoryHtml
	};
}();

