/*
 *
 * Copyright (c) 2008 George Bonnes (george@olm1.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Version 0.9.1
 *
 * $LastChangedDate$
 * $Rev$
 *
 */


(function($){
  $.fn.vCenterElement = function(options) {
	var pos = {
    	sTop : function() {
    	  return window.pageYOffset
    	  || document.documentElement && document.documentElement.scrollTop
    	  ||	document.body.scrollTop;
    	},
    	wHeight : function() {
    	  return window.innerHeight
    	  || document.documentElement && document.documentElement.clientHeight
    	  || document.body.clientHeight;
    	}
    }
	  
	return this.each(function(index) {
	  if (index == 0) {
		var $this = $(this);
		var elHeight = $this.height();
		var elTop = parseInt(pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2));
		$this.css({
		  position: 'absolute',
		  marginTop: '0',
		  top: elTop
		});
	  }
	});
  };
})(jQuery); // end plugin


(function($){
  $.fn.centerElement = function(options) {
	var pos = {
    	sLeft : function() {
    	  return window.pageXOffset
    	  || document.documentElement && document.documentElement.scrollLeft
    	  ||	document.body.scrollLeft;
    	},
    	wWidth : function() {
    	  return window.innerWidth
    	  || document.documentElement && document.documentElement.clientWidth
    	  || document.body.clientWidth;
    	}
    }
	  
	return this.each(function(index) {
	  if (index == 0) {
		var $this = $(this);
		var elWidth = $this.width();
		var elLeft = parseInt(pos.sLeft() + (pos.wWidth() / 2) - (elWidth / 2));
		$this.css({
		  position: 'absolute',
		  marginLeft: '0',
		  left: elLeft
		});
	  }
	});
  };
})(jQuery); // end plugin