function BCarouselSelectionItem(parent,item) {
    this.classname="BCarouselSelectionItem";
    this.parent = parent;
    this.item = item;
    this.selected = false;
    this.pos = {x:Math.floor(Math.random()*400)-200,y:0,z:0};
    this.createView();
    this.clickListener = this.clicked.bindAsEventListener(this);
    Event.observe(this.view,"click", this.clickListener, false);
    this.mouseoverListener = this.mouseover.bindAsEventListener(this);
    Event.observe(this.view,"mouseover", this.mouseoverListener, false);
    this.mouseoutListener = this.mouseout.bindAsEventListener(this);
    Event.observe(this.view,"mouseout", this.mouseoutListener, false);
}
BCarouselSelectionItem.prototype.createView = function() {
    //var div = document.createElement("div");
    var img = document.createElement("img");
    img.src=this.item.icon;
    img.style.position="absolute";
    img.style.left=this.pos.x+"px";
    img.style.top=this.pos.y+"px";
    img.style.zIndex=this.pos.z;
    img.style.width="200px";
    img.style.height="120px";
    //img.style.backgroundColor="#ddd";
    img.style.border="2px solid white";
    img.style.cursor="pointer";
    this.view = img;
}
BCarouselSelectionItem.prototype.redraw = function(pos) {
    var w = (pos.z/8);
    var h = w/1.5;
    this.view.style.left=(pos.x-w/2)+"px";
    this.view.style.top=(pos.y-h/2)+"px";
    this.view.style.zIndex=pos.z;
    this.view.style.width=w+"px";
    this.view.style.height=h+"px";
}
BCarouselSelectionItem.prototype.clicked = function() {
    this.parent.clicked(this);
}
BCarouselSelectionItem.prototype.select = function() {
    this.selected = true;
    this.view.style.border="2px solid #E5D26D";
    //this.view.style.backgroundColor="#ddf";
}
BCarouselSelectionItem.prototype.deselect = function() {
    this.selected = false;
    this.view.style.border="2px solid white";
    //this.view.style.backgroundColor="";
}
BCarouselSelectionItem.prototype.mouseover = function() {
    this.view.style.border="2px solid #840300";
    //this.view.style.backgroundColor="#eee";
}
BCarouselSelectionItem.prototype.mouseout = function() {
    this.view.style.border="2px solid "+(this.selected?"#E5D26D":"white");
    //this.view.style.backgroundColor=(this.selected?"#ddf":"");
}
