// various functions related to viewable browser dimensions and scroll offset
var isiPhone = Prototype.Browser.MobileSafari;

/*
var windowPosMethods = {
	putCenter: function(item) {
	  item = $(item);
	  var xy = item.getDimensions();
	  var win = this.windowDimensions();
	  var scrol = this.scrollOffset();
	  
	  item.style.left = (win[0] / 2) + scrol[0] - (xy.width / 2) + "px";
	  item.style.top = (win[1] / 2) + scrol[1] - (xy.height / 2) + "px";
	  
	},
	
	fullScreen: function(item) {
	  item = $(item);
	  var win = this.windowDimensions();
	  var scrol = this.scrollOffset();
	  item.style.height = scrol[1] + win[1] + "px";
	},
	
	windowDimensions: function() {
		alert("WindowDimensions");
	  var x, y;
	  if (self.innerHeight) {
		// all except Explorer
		x = self.innerWidth;
		y = self.innerHeight;
	  } else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	  } else if (document.body) {
		// other Explorers
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	  }
	  if (!x) x = 0;
	  if (!y) y = 0;
	  arrayWindowSize = new Array(x,y);
	  return arrayWindowSize;
	},
	
	scrollOffset: function() {
	  var x, y;
	  if (self.pageYOffset) {
		// all except Explorer
		x = self.pageXOffset;
		y = self.pageYOffset;
	  } else if (document.documentElement && document.documentElement.scrollTop) {
		// Explorer 6 Strict
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	  } else if (document.body) {
		// all other Explorers
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	  }
	  if (!x) x = 0;
	  if (!y) y = 0;
	  arrayScrollOffset = new Array(x,y);
	  return arrayScrollOffset;
	}
};
*/

var tipMethods = {
  centerElement: function(element, ajax_layer, par_layer){
	var vpo = $(par_layer).viewportOffset();
	var l1dim = $(par_layer).getDimensions();
	var mydim = $(ajax_layer).getDimensions();
	var dvpo = document.viewport.getDimensions();
	var offs = document.viewport.getScrollOffsets();
	var l = ((l1dim.width - mydim.width) / 2) + vpo.left;
	var t = ((dvpo.height - mydim.height) / 2) + offs.top;
	$(ajax_layer).setStyle({ 
		top: (t+'px'), 
		left: (l+'px') 
	});
  }
};
Element.addMethods(tipMethods);
