	
	// -------------------------------------------------------------------------------------------------
	// jquery extend
	// -------------------------------------------------------------------------------------------------
		
	$.fn.extend({
		findPos : function() {
			obj = $(this).get(0);
			var curleft = obj.offsetLeft || 0;
			var curtop = obj.offsetTop || 0;
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
			return {x:curleft, y:curtop};
		}
	});
	
	$.fn.extend({
		visible : function() {
			if($(this).css("display") == "block" || $(this).css("display") == "") return true;
			return false;
		}
	});
	
	
	// cross-browser opacity
	$.fn.extend({
		opacity : function(value) {
			$(this)
				.css("opacity", value)
				.css("-moz-opacity", value)
				.css("filter", "alpha(opacity = " + (value * 100) + ")")
				.css("zoom", "1"); // ie7
		}
	});
	
	// toggle
	$.fn.extend({
		toggleVisible : function() {
			if($(this).visible()) $(this).hide();
			else $(this).show();
		}
	});
	
	// check if element exists
	$.fn.extend({
		exists : function() {
			var obj = $(this).get(0);
			if(obj) return true;
			else return false;
		}
	});
	
	// -------------------------------------------------------------------------------------------------
	// prototype arrays
	// -------------------------------------------------------------------------------------------------
	
	Array.prototype.inArray = function(element) {
		for(var i=0; i < this.length; i++){
			if(arguments.length > 1){
				if(this[i][arguments[1]] == element) return true;
			}else{
				if(this[i] == element) return true;
			}
		}
		return false;
	}
	
	Array.prototype.remove = function(s){
		for(var i = 0; i < this.length; i++){
			if(s == this[i]) this.splice(i, 1);
		}
	}
	
	Array.prototype.arrayElementIndex = function(element) {
		for(var i=0; i < this.length; i++){
			if(this[i] == element) return i;
		}
		return false;
	}