
//=======================================================\\
//                 Array methods add-ons                 \\
//=======================================================\\


/* Component Library
 * Core components (Arrays)
 * by Dave Schontzler
 * (c) 2002, www.stilleye.com
 */

// Array Methods that may not be supported by older browsers
// return values from www.DevGuru.com reference sheets

// removes and returns last element of array
if(!Array.prototype.pop&&document.all)
{
	Array.prototype.pop = function()
	{
		var L, lastEl;
		if(this.length<1) return;
		L = this.length-1;
		lastEl = this[L];
		this.length = L;
		return lastEl;
	}
}

// adds 1 or more elements to an array (IE only)
if(!Array.prototype.push)
{
	Array.prototype.push =  function()
	{
		var i;
		for(i=0; j=arguments[i]; i++) this[this.length] = j;
		return this.length;
	}
}

// removes & returns 1st element in array
if(!Array.prototype.shift)
{
	Array.prototype.shift = function()
	{
		var L, firstEl, i;
		L = this.length;
		firstEl = this[0];
		for(i=1;i<L;i++) this[i-1] = this[i];
		delete this[L-1];
		return firstEl;
	}
}

// creates a new array from selection of another array
if(!Array.prototype.slice)
{
	Array.prototype.slice = function(begin,end)
	{
		var s, i;
		s = new Array();
		for(i=begin; i<(end?end:this.length); i++) s[s.length] = this[i];
		return s;
	}
}

// adds 1 or more elements to beginning of array
if(!Array.prototype.unshift)
{
	Array.prototype.unshift = function()
	{
		var a, L, i;
		a = arguments;
		L = this.length;
		for(i=0; i<L; i++) this[i+a.length] = this[i];
		for(i=0; a[i]; i++) this[i] = a[i];
		return this.length;
	}
}

String.prototype.isEmpty = function()
{
	if(this=="" || this.length==0) return true;
	else return false;
}



//=======================================================\\
//                    basic DOM add-ons                  \\
//=======================================================\\

		// Function adapted from Dan Pupius (pupius.co.uk):
		function getElementsByClass(className,node) {
		if(!node) node=document;
		var refTags = document.all?document.all:node.getElementsByTagName("*");
		 var retVal = new Array();
		  for(var i=0;i<refTags.length;i++) {
		    if(refTags[i].className == className) 
		       retVal.push(refTags[i]);
		  }
		  return retVal; 
		}

