// storage class
function NewO(pic, time, numc, suptit, tit, excerpt, itemurl, foto, video) {
	this.pic = pic;
	this.time = time;
	this.numc = numc;
	this.suptit = suptit;
	this.tit = tit;
	this.excerpt = excerpt;
	this.itemurl = itemurl;
	this.foto = foto;
	this.video = video;
}

// fill item slot
function fillItemSlot(id, obj){
    $(id+" .NewO_Picture").find("img").attr('src', obj.pic);
    $(id+" .NewO_MetaTime").html(obj.time);
    $(id+" .NewO_MetaComments").html(obj.numc);
    $(id+" .NewO_SuperTitle").html(obj.suptit);
    $(id+" .NewO_Title").html('<a href="'+obj.itemurl+'">'+obj.tit+'</a>');
    $(id+" .NewO_Excerpt").html(obj.excerpt);
    if ( obj.foto ) $(id+" .NewO_FotoMark").show(); else $(id+" .NewO_FotoMark").hide();
    if ( obj.video ) $(id+" .NewO_VideoMark").show(); else $(id+" .NewO_VideoMark").hide();
}

// select/unselect indicators
function selectItemSelector(id, cl){
	$('#'+id+' .num0').removeClass('NewO_SelectorItemNumberSelected');
	$('#'+id+' .num5').removeClass('NewO_SelectorItemNumberSelected');
	$('#'+id+' .num10').removeClass('NewO_SelectorItemNumberSelected');
	$('#'+id+' .'+cl).addClass('NewO_SelectorItemNumberSelected');
}

// fill CE, only visible slots
function fillCE(id) {

	var j = 1;
	for(i=0;i<Oobjs[id].length;i++) {
		
		var ctrl;
		do {
			ctrl = "#"+id+"_"+j;
			if ( $(ctrl).css('display')!='none' &&  (! $(ctrl).hasClass("Selected")) ) break;
			j++;
		} while ( $(ctrl).length );
		
		if ( $(ctrl).length == 0 ) return;
		
		fillItemSlot(ctrl,Oobjs[id][i]);
		j++;
	}

	// switch off empty slots
	do {
		ctrl = "#"+id+"_"+j;
		if ( $(ctrl).length ) $(ctrl).hide();
		j++;
	} while ( $(ctrl).length );
		
}

$(document).ready(function(){
	  
    $(".NewO_ItemsRight OSlot").hover(
    	    
      function(event){
        $(this).removeClass("NewO_RightStyle1").addClass("NewO_RightStyle2");
        event.preventDefault();      
      },
      function(event){
          $(this).removeClass("NewO_RightStyle2").addClass("NewO_RightStyle1");
          event.preventDefault();      
        }
      
    );

});

