var isExpanded = false;
jQuery.noConflict();
jQuery(document).ready(expand);

jQuery(document).ready(function() {
	var counter = 0;

	function getUrlVars()
	{
	    var vars = [], hash;
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	    for(var i = 0; i < hashes.length; i++)
	    {
	        hash = hashes[i].split('=');
	        vars.push(hash[0]);
	        vars[hash[0]] = hash[1];
	    }
	    return vars;
	}	
	
	function addClick(from) {
		jQuery('#more').unbind('click');
		jQuery('#more').click(function(){
			jQuery('#loading').show();
			var urlVars = getUrlVars();
			jQuery.ajax({
	  			url: "index.php?id=" + ajaxId + "&begin=" + from,
	  			cache: false,
	  			success: function(html){
	    			jQuery('#moreContent').append('<span style="display:none" id="moreContent' + counter + '">' + html + '</span>');
					jQuery('#moreContent' + counter).slideDown('slow');
					
					//jQuery("#moreContent").append(html);
					var newOffset = from + 150;
					jQuery('#loading').hide();
					//addClick(newOffset);
					jQuery('#more').hide();
					jQuery('#more').unbind('click');
	  			}
			});
		});

	}

	if(newsCounter > 0) {
		addClick(6);
	} else {
		jQuery('#more').hide();
	}

	if(newsGes == 1) {
		jQuery('.expandAll').hide();
	}	

});

function expandNews(id) {
	jQuery(id).slideToggle('slow');
//	jQuery('#rgsnnest').hide();
}

function expand() {
	jQuery('.expandAll').unbind('click');
	jQuery(".expandAll").click(function () {
		jQuery(".news_full_even").slideDown("slow");
		jQuery('.expandAll').text('Collapse all news');
	});
	jQuery(".expandAll").click(collapse);
}

function collapse() {
	jQuery('.expandAll').unbind('click');
	jQuery(".expandAll").click(function () {
		jQuery(".news_full_even").slideUp("slow");
		jQuery('.expandAll').text('Expand all news');
	});	
	jQuery(".expandAll").click(expand);

	
}

hs.graphicsDir = '/fileadmin/templates/rr/js/highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header';
hs.showCredits = false;
