function ns_sub() {
    $.ajax({
	type: 'POST',
	url: '/site/newsletter_sub_ajax',
	data: $('#newsletter_form').serialize(),
	success: function(data) {
	    //if (data.error == 0) {
	    $('#newsletter_form').html('<p>' + data.msg + '</p>');
	//}
	},
	dataType: "json"
    });

}

function strip_tags (input, allowed) {
    allowed = (((allowed || "") + "")
	.toLowerCase()
	.match(/<[a-z][a-z0-9]*>/g) || [])
    .join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
    var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
    commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
    return input.replace(commentsAndPhpTags, '').replace(tags, function($0, $1){
	return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
    });
}

function show_words (content, word_count) {
    var all_words = content.split(' ');
    var output = '';
    for (var i = 0; i < word_count; i++) {
	output += all_words[i] + ' ';
    }

    return output;
}
