//orderby=published	
	var reAllowedAttributes = /^(id|class|alignment|align|valign|rowspan|colspan|width|height|background|cellspacing|cellpadding|border|href|src|target|alt|title)$/i
	var reAllowedHTMLTags = /^(h1|h2|h3|h4|a|img|br|em|li|ol|p|pre|strong|ul|div|u|sub|sup|table|tbody|blockquote|tr|td)$/i

	function ParseHTML(theHTML){
	// Start of with a test to match all HTML tags and a group for the tag name which we pass in as an extra parameter
	theHTML = theHTML.replace(/<[/]?([^> ]+)[^>]*>/g, function(match,HTMLTag)
	{
	// if the HTML tag does not match our list of allowed tags return empty string which will be used as a
	// a replacement for the pattern in our inital test.
	if(!reAllowedHTMLTags.test(HTMLTag)){
	return "";
	}else{
	// The HTML tag is allowed so check attributes with the tag

	// Certain attributes are allowed so we do another replace statement looking for attributes and using another
	// function for the replacement value.
	match = match.replace(/ ([^=]+)="[^"]*"/g, function(match2, attributeName)
	{
	// If the attribute matches our list of allowed attributes we return the whole match string
	// so we replace our match with itself basically allowing the attribute.
	if(reAllowedAttributes.test(attributeName)){
	return match2;
	}else{
	return "";  // not allowed so return blank string to wipe out the attribute value pair
	}
	});

	}
	return match;

	}); //end of the first replace

	//return our cleaned HTML
	return theHTML;
	}

			$.getJSON('http://bigfootmama.blogspot.com/feeds/posts/default?alt=json-in-script&callback=?', function(data){
			$('#blogpost').html("");
			
			
			$.each(data.feed.entry, function(i, entry){
				if(i < numposts) {
				var posttitle = entry.title.$t;
				if (posttitle.length < 20) numchars+=30;
				var posturl;
				var vsebina;	
				vsebina = "";
				for (var k = 0; k < entry.link.length; k++) {
						if (entry.link[k].rel == 'alternate') {
							posturl = entry.link[k].href;
							break;
						}
					}
	    posttitle = posttitle.link(posturl);
	    
	    readmorelink = readmorelink.link(posturl);
	    var postdate = entry.published.$t;
	    var cdyear = postdate.substring(0,4);
	    var cdmonth = postdate.substring(5,7);
	    var cdday = postdate.substring(8,10);
	    var monthnames = new Array();
	    monthnames[1] = "Jan";
	    monthnames[2] = "Feb";
	    monthnames[3] = "Mar";
	    monthnames[4] = "Apr";
	    monthnames[5] = "May";
	    monthnames[6] = "Jun";
	    monthnames[7] = "Jul";
	    monthnames[8] = "Aug";
	    monthnames[9] = "Sep";
	    monthnames[10] = "Oct";
	    monthnames[11] = "Nov";
	    monthnames[12] = "Dec";

	    if ("content" in entry) {
	    var postcontent = entry.content.$t;
	    } else if ("summary" in entry) {
	    var postcontent = entry.summary.$t;
	    } else
	    var postcontent = "";
	    //var re = /<\S[^>]*>/g;
		//var re = /<(?!br)(?!a)(?!\/a)\S[^><]*>/g;
		//var re = /<?(div|span|font|:\w+)[^>]*?>/g;
	//	var re = /<span[^>]*>[^>]+<\/span>/ig,"" ;
		//    postcontent = postcontent.replace(re, "");
		if (showlist == true) {
		var klasa = 'article';
		} else {
		var klasa = 'novica';
		 //var re = /<\S[^>]*>/g;
		 //postcontent = postcontent.replace(re, "");
		}
		
		if (showpostdate == true) vsebina +='<p class="date">' + cdday + ' ' + monthnames[parseInt(cdmonth,10)] + ' ' + cdyear +'</p>';
				
		vsebina += "<h4>"+posttitle+"</h4>";
		
		if (showlist == true) vsebina += "<br /><br />";
	 	//if (showmedia == true) vsebina += '<span class="blogfoto"><img src="' + entry.media$thumbnail.url.replace("s72-c","s300") + '"></span>';
	    if (showpostsummary == true) {
		postcontent = ParseHTML(postcontent);
	    if (postcontent.length < numchars) {
	    vsebina += postcontent;
	    } else {
	    postcontent = postcontent.substring(0, numchars);
	    var quoteEnd = postcontent.lastIndexOf(" ");
	    postcontent = postcontent.substring(0,quoteEnd);
	    vsebina += postcontent+ ' ... <br /><div class="readmore"' + readmorelink + '</div></div>';
	    }
		}
		//vsebina = ParseHTML(vsebina)+'<div class="readmore"' + readmorelink + '</div>';
		var $vseskp = "<div class='"+klasa+"'>"+vsebina+"</div>";
		$('#blogpost').html($vseskp);
		
		}
		
		});	
		
	});	

	
