$(document.body).ready(function () {
 	
    var news_interval;
    
	function fadenews() {
		$('#active').fadeOut(2000, function () {
			$(this).removeAttr('id');
			$(this).is(':last-child') ? $(this).siblings(':first-child').fadeIn(1000).attr('id','active') : $(this).next().fadeIn(1000).attr('id','active')
		});
	};
	
	function showprop(id){
		var i=id.rel;
		if (document.getElementById){ 
			obj = document.getElementById("p"+i); 
			if (obj.style.display == "none"){ 
				obj.style.display = ""; 
			} else { 
				obj.style.display = "none";
			} 
		} 
	};
	
	function hideprop(id){
		var i=id.rel;
		if (document.getElementById){ 
			obj = document.getElementById("p"+i); 
			obj.style.display = "none";
		} 
	};
	
	function prepareGallery(){
	  if( document.getElementById &&
	      document.getElementsByTagName ){
	    if( document.getElementById( 'newproplist' ) ){
	      var gallery = document.getElementById( 'newproplist' );
	      var links = gallery.getElementsByTagName( 'a' );
	      for( var i=0; i < links.length; i++ ){
	        links[i].onmouseover = function(){
	          return showprop(this);
	        };
	        links[i].onmouseout = function(){
	          return hideprop(this);
	        };
	        links[i].onclick = function(){
	          return hideprop(this);
	        };
	      }
	    }
	  }
	};
	
	news_interval = setInterval(fadenews, 5500);
	$('.newsbox').hover(function() {
		clearInterval(news_interval);}, function() {
		news_interval = setInterval(fadenews, 5500);
		fadenews();
	});
	
	prepareGallery();

});

