var module_news_item;

jQuery(document).ready(

function(){

        module_news_item = {

             "currentImage":1

             ,"nextImage": function(){
                this.setImage(this.currentImage+1);
             }

	     
	     ,"openCurrent": function(){
	     
		window.open(moduleNewsItemPhoto[module_news_item.currentImage][1]);
	     
	     }

             ,"prevImage": function(){
                this.setImage(this.currentImage-1);
             }

             ,"showImg": function(){
	     
		jQuery('div#news_frame').css('background-image','url('+moduleNewsItemPhoto[module_news_item.currentImage][0]+')'); 
		jQuery('div#news_frame').fadeIn();
	     }

             ,"setImage": function(ind){

//		if( ind >= moduleNewsItemPhoto.length || ind < 1 ){
//		     return;
//		}
if( ind >= moduleNewsItemPhoto.length )
  {
       ind = 1;
  }

  if(  ind < 1 )
  {
       ind = moduleNewsItemPhoto.length-1;
  }

		this.currentImage = ind;

		jQuery('div#news_frame').fadeOut(200, this.showImg );
		jQuery('div#news_frame_text').html(moduleNewsItemPhoto[module_news_item.currentImage][2]);
                jQuery('div#news_frame').width('528px');
                jQuery('div#news_frame').height('183px');

             }
        }

        //jQuery('div#frame').corner('5px');
        module_news_item.setImage(1);

}

);