function Zone(z){

    this.id=z.zid;
    this.status=z.status;
    this.pics=z.media.pics;

}

function respondToClick(event) {
  var element = event.element();
  photo_id=element.id.split("_",2)[1];
  var img1src='http://192.231.196.11/SZONE/img.php?id='+ photo_id + '&width=402';
  $('CROPIC').update(new Element('img',{src:img1src}));
}


function Slider(){
    this.pos=0;
    this.step=3;
    
}


Slider.prototype.start=function(step){
    this.step=step;
    new PeriodicalExecuter(function(pe){
        slider.pe=pe;
        slider.slide(slider.step);
    },.05);
}



Slider.prototype.stop=function(){
    slider.pe.stop();
}

Slider.prototype.slide=function(step){this.pos+=step;$("SLIDER").setStyle({'left':this.pos+'px'});}



var slider=new Slider();

Zone.prototype.getId=function(){return this.id;}

Zone.prototype.getStatus=function(){return this.status;}

Zone.prototype.getPics=function(){return this.pics;}

Zone.prototype.showReport=function(){

  var img1src='http://192.231.196.11/SZONE/img.php?id='+ this.getPics()[0].id + '&width=402';

  $('CROPIC').update(new Element('img',{src:img1src}));

  var picdiv=$('SLIDER');
    picdiv.setStyle({'left':'0px'});

  picdiv.update('');

var code=['Minmally Restrictive','Moderately Restrictive','Highly Restrictive'];
var score=['Open','Open','Open','Limited','Limited','Limited','Limited','Limited','Closed','Closed','Closed'];

   $('des').innerHTML=score[this.getStatus().des];
   $('access').innerHTML=code[this.getStatus().access];
   $('surv').innerHTML=code[this.getStatus().surv];
   $('beh').innerHTML=code[this.getStatus().behavior];




  var pcount=this.getPics().length;
  for(var i=0;i<pcount;i++){
        var aPic=this.getPics()[i];
        var src='http://192.231.196.11/SZONE/img.php?id='+ aPic.id + '&height=50'
        var img = new Element('img', { src:src,'id':'pic_'+aPic.id});

        img.observe('click', respondToClick);


        var thumb_div=new Element('div',{'class':'thumb_div'})
        thumb_div.appendChild(img)
          
        picdiv.appendChild(thumb_div);

      

  }

}
