function pushHandler(object, event, handler){
          var handlersProp = '_handlerStack_'+event;
          var eventProp = 'on'+event

          if (typeof(object[handlersProp]) == 'undefined' ){
               object[handlersProp] = Array(handler);
          }else{
               object[handlersProp][object[handlersProp].length] = handler;
          }
          object[eventProp]=function(e){
               for( var i=0; i<object[handlersProp].length; i++ ){
                    eval( object[handlersProp][i](e) );
               }
          }
     }
/*function pushHandler(object, event, handler){
	var handlersProp = '_handlerStack_'+event;
	var eventProp = 'on'+event;

	if (typeof(object[handlersProp]) == 'undefined' )object[handlersProp] = Array(handler);
	                                            else object[handlersProp][object[handlersProp].length] = handler;
	object[eventProp]=function(e){
		for( var i=0; i<object[handlersProp].length; i++ ) eval( object[handlersProp][i](e) );
	}
}*/

function get(id){
	return document.getElementById(id);
}
// returns true if an element is in an array
// array - the haystack
// element - the needle
// func - an optional function to compare the needle to each element in the haystack
function inArray(array, element, func) {

	if (! func) {
		func = _argument;
	}

	var l = array.length;
	for (var i = 0; i < l; i++) {
		if (func(array[i]) == func(element)) {
			return true;
		}
	}

	return false;
}

// the default comparison function for inArray
function _argument(r) {
	return r;
}

function swap(id){
	var obj = get(id);

	if(obj.style.display=='none'){
		obj.style.display='';
		obj.style.visibility='visible';
	}else{
		obj.style.display='none';
		obj.style.visibility='hidden';
	}
	return false;
}
