// calculation
foot[W] = layout[W];
foot[H] = Math.round(layout[W] * headfootratio);
foot[X] = layout[X];
foot[Y] = layout[Y] + layout[H] - foot[H];

// set foot
setstyle('foot', [
  ['backgroundColor', colorattivo],
  ['left', foot[X]],
  ['top', foot[Y]],
  ['width', foot[W]],
  ['height', foot[H]]
]);
setstyle('footline', [
  ['backgroundColor', colorheadfootline],
  ['left', foot[X]],
  ['top', foot[Y]],
  ['width', foot[W]],
  ['height', 1]
]);
setstyle('footmenu', [
  ['backgroundColor', colorattivo],
  ['left', foot[X]],
  ['top', foot[Y]],
  ['width', foot[W]],
  ['height', foot[H]]
]);
setstyle('footable', [['width', layout[W]]]);
setstyle('foottabletd0', [['width', Math.round(18 * scale)]]);
setstyle('footspacer0', [
  ['width', Math.round(18 * scale)],
  ['height' , head[H] - 1]
]);
setstyle('foottabletd1', [['width', Math.round(861 * scale)]]);
setstyle('foottabletd2', [['width', Math.round(100 * scale)]]);
setstyle('footabA', [
  ['width', Math.round(33 * scale)],
  ['height' , Math.round(23 * scale)]
]);
setstyle('footabslash', [
  ['width', Math.round(16 * scale)],
  ['height' , Math.round(23 * scale)]
]);
setstyle('footabB', [
  ['width', Math.round(33 * scale)],
  ['height' , Math.round(23 * scale)]
]);
setstyle('foottabletd3', [['width', Math.round(21 * scale)]]);
setstyle('footspacer1', [
  ['width', Math.round(21 * scale)],
  ['height' , Math.round(49 * scale)]
]);

//prload images
var footabimgs = new Array();
footabimgs[0] = new Image(); footabimgs[0].src = 'images/footabAe.gif';
footabimgs[1] = new Image(); footabimgs[1].src = 'images/footabAd.gif';
footabimgs[2] = new Image(); footabimgs[2].src = 'images/footabBe.gif';
footabimgs[3] = new Image(); footabimgs[3].src = 'images/footabBd.gif';

//functions
function foot(action, id) {
  switch(action) {
    case "over":
	  if(id == 'attivo') {
	    document.getElementById('footabA').src = footabimgs[0].src;
		document.getElementById('footabB').src = footabimgs[3].src;
	  }
	  else {
	    document.getElementById('footabB').src = footabimgs[2].src;
		document.getElementById('footabA').src = footabimgs[1].src;
	  }
    break;
	case "out":
	  if(siteid == 'attivo') {
	    document.getElementById('footabA').src = footabimgs[0].src;
	    document.getElementById('footabB').src = footabimgs[3].src;
	  }
	  else {
	    document.getElementById('footabA').src = footabimgs[1].src;
	    document.getElementById('footabB').src = footabimgs[2].src;
	  }
	break;
	case "click":
	  menuabrollover = false;
	  setstyle('menuabslash', [['visibility', 'hidden']]);
	  setstyle('menuaba', [['visibility', 'hidden']]);
	  setstyle('menuabb', [['visibility', 'hidden']]);
	  setstyle('menurocket', [['visibility', 'visible']]);
	  //document.getElementById('headrocket').src = 'images/spacer.gif';
      setstyle('menucreativeresource', [['visibility', 'hidden']]);
	  setstyle('menulogo', [['visibility', 'hidden']]);
	  setstyle('menutext', [['visibility', 'hidden']]);
	  setstyle('footmenu', [['visibility', 'hidden']]);
	  groundingI = 0;
	  if(id == 'attivo') {
	    siteid = 'attivo';
	    //document.getElementById('headlogo').src = headimgs[0].src;
		document.getElementById('menurocketimg').src = menuimgs[0].src;
		document.getElementById('menulogoimg').src = menuimgs[2].src;
		setbodystyle([
		  ['color', colorattivo],
		  ['scrollbarHighlightColor', colorattivo],
          ['scrollbarShadowColor', colorattivo],
		  ['scrollbarArrowColor', colorattivo]
		]);
		grounding();
	  }
	  else {
	    siteid = 'bene';
	    //document.getElementById('headlogo').src = headimgs[1].src;
		document.getElementById('menurocketimg').src = menuimgs[1].src;
		document.getElementById('menulogoimg').src = menuimgs[3].src;
		setbodystyle([
		  ['color', colorbene],
		  ['scrollbarHighlightColor', colorbene],
          ['scrollbarShadowColor', colorbene],
		  ['scrollbarArrowColor', colorbene]
		]);
		grounding();
	  }
    break;
  }
}