function grid_block(){

  // grab some objects
  this.gridObjects = new Array();
  this.linkChanger_id = 0;
  this.nextLink = 0;
  this.colorList = 
  [ 
  //'#0033FF','#33AADD','#0099CC','#FFEE00','#4477FF','#FF9900',
    '#003399','#006699','#007780','#FF9900','#000099','#FF6600',
  '#0033FF','#0033EE','#0033CC','#0033BB','#0033AA','#003399',
    '#33AADD','#3399CC','#3388CC','#3377BB','#3366AA','#006699',
  '#0099CC','#0099BB','#0099AA','#008899','#007788','#007780',
  '#FFEE00','#FFDD00','#FFCC00','#FFBB00','#FFAA00','#FF9900',
  '#4477FF','#4466EE','#2266DD','#0033CC','#0033AA','#000099',
  '#FF9900','#FF8F00','#FF8800','#FF8000','#FF7700','#FF6600'
  ];

  this.imageArray = 
  [
    "e010938_sm.jpg", "world_sm.jpg", "compass_sm.jpg", "e012361_sm.jpg", "email2_sm.jpg", "e010968_sm.jpg", "e012353_sm.jpg", "fibers5_sm.jpg"
  ]

  this.linkArray =
  [
    [10, "about", "about.html"], [11, "products", "products.html"], [12, "services", "services.html"], [13, "info", "info.html"], [10, "about", "about_values.html"], [10, "about", "about_modules.html"], [10, "about", "about_technology.html"], [11, "products", "products_contact.html"]
  ]

  for(var i=1; i<22; i++) {
    this.gridObjects[i] = new ddObject(document.window, "block_" + i, 'silent');
    this.gridObjects[i].inst(); 
    this.gridObjects[i].block_id = i;
    this.gridObjects[i].parent = this;
    this.gridObjects[i].addEventHandler("onmouseover", function(d){ d.parent.onmouseover(d); });
    this.gridObjects[i].addEventHandler("onmouseout", function(d){ d.parent.onmouseout(d); });
    this.gridObjects[i].addEventHandler("onmousedown", function(d){ d.parent.onmousedown(d); });
    this.gridObjects[i].addEventHandler("onmouseup", function(d){ d.parent.onmouseup(d); });
    this.gridObjects[i].resetColorOff = false;

  }

  this.linkObject = new ddObject(document.window, "image_0", 'silent');
  this.linkObject.inst();
  this.linkObject.parent = this;
/*
  this.linkObject.addEventHandler("onmouseover", function(d){ d.parent.linkOver(d); });
  this.linkObject.addEventHandler("onmouseout", function(d){ d.parent.linkOut(d); });
  this.linkObject.addEventHandler("onmouseup", function(d){ d.parent.linkUp(d); });
*/  

}

grid_block.prototype.getNextColor = function(d){
  if (d.currentColor) {
    if (d.currentColor < this.colorList.length) {
      return this.colorList[d.currentColor++];
    } else {
      d.currentColor = 1;
      return this.colorList[0];
    }
  } else {
    d.currentColor = 1;
    return this.colorList[0];    
  }
}

grid_block.prototype.resetColor = function(block_id, color_id){
  if (!this.gridObjects[block_id].resetColorOff) {
    if (this.gridObjects[block_id].currentColor == color_id) {
      this.gridObjects[block_id].setBgColor("#FFFFFF");
    }
  }
}

grid_block.prototype.changeLinkPic = function(link_id){
  if (this.linkChanger_id == link_id) {    
    this.linkObject.css.backgroundImage = "url(images/stock/images/" + this.imageArray[this.nextLink] + ")" ;
//    this.linkObject.setBody("<img src=\"images/stock/images/" + this.imageArray[this.nextLink] + "\">");
//    this.linkObject.setBody("<img style=\"cursor:pointer;cursor:hand\" src=\"images/stock/images/" + this.imageArray[this.nextLink] + "\">");
  this.nextLink = (this.nextLink>this.imageArray.length-2)?0:this.nextLink+1;
  }
}

grid_block.prototype.onmouseover = function(d){
  if (enableBlocks) {
    d.setBgColor(this.getNextColor(d));
    setTimeout("grid_block.resetColor(" + d.block_id + ", " + (d.currentColor?d.currentColor:0) + ")", 3500);
  }
}

grid_block.prototype.onmouseout = function(d){
  if (enableBlocks) {
    // start link changer
    this.linkChanger_id++;
    setTimeout("grid_block.changeLinkPic(" + this.linkChanger_id + ")", 300);
  }
}

grid_block.prototype.onmousedown = function(d){

}

grid_block.prototype.linkOver = function(d){
 if (this.nextLink>0) {   
   //menu_bar.button_over(this.linkArray[this.nextLink-1][0], this.linkArray[this.nextLink-1][1]);
 }
}

grid_block.prototype.linkOut = function(d){
 if (this.nextLink>0) {   
   //menu_bar.button_out(this.linkArray[this.nextLink-1][0], this.linkArray[this.nextLink-1][1]);
 }
}

grid_block.prototype.linkUp = function(d){
 if (this.nextLink>0) {   
   top.location.href=this.linkArray[this.nextLink-1][2];
 }
}

grid_block.prototype.onmouseup = function(d){

  d.resetColorOff = !d.resetColorOff;

}

var grid_block = new grid_block();