$.fn.randomContent = function(options){
	var defaults = {
		xmlPath: "/hell.xml",
		nodeName: "horns"
	};
	var options = $.extend(defaults, options);
	var contentArray = new Array();
	var rc = this;
	$.get(defaults.xmlPath, {}, function(xml){
		$(defaults.nodeName,xml).each(function(i) {
			contentArray.push($(this).text());
		});
		getRandom = function() {
			var num = contentArray.length
			var randNum = Math.floor(Math.random()*num);

			var content = "";
			for(x in contentArray){
				if(x==randNum){
					content = contentArray[x];
				}
			};
			return content;
		}
		rc.each(function(){
			$(this).append(getRandom());
		});
	});
};

function DraugiemSay(title,url,titlePrefix ){
    window.open(
        'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent(title) +
        '&link=' + encodeURIComponent(url) +
        ( titlePrefix ? '&titlePrefix=' + encodeURIComponent(titlePrefix) : '' ),
        '',
        'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
    );
    return false;
}

$(document).ready(function(){
	$('#hell').randomContent();
});
