/*==========================================
  Common
==========================================*/

String.prototype.trim = function() {
    return this.replace( /^\s+|\s+$/, "" );
}

function removeCSSClass( elem, className ) {
    elem.className = elem.className.replace( className, "" ).trim();
}

function addCSSClass( elem, className ) {
    removeCSSClass( elem, className );
    elem.className = ( elem.className + " " + className ).trim();
}

function changeStyle() { //Change style
  var i,p,v,obj,args=changeStyle.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { p=args[i+1]; v=args[i+2];
    if (obj.style) { obj=obj.style; }
    obj[p]=v; 
  }
}

/*------------------------------------- 
	addEvent
	cross-browser event handling for IE5+,  NS6 and Mozilla
	By Scott Andrew
-------------------------------------*/  
function addEvent(elm, evType, fn, useCapture)
{
  if (elm.addEventListener){
    elm.addEventListener(evType, fn, useCapture);
    return true;
  } else if (elm.attachEvent){
    var r = elm.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be added");
  }
}

/*-------------------------------------
	push and shift for IE5
-------------------------------------*/
function Array_push() {
	var A_p = 0
	for (A_p = 0; A_p < arguments.length; A_p++) {
		this[this.length] = arguments[A_p]
	}
	return this.length
}

if (typeof Array.prototype.push == "undefined") {
	Array.prototype.push = Array_push
}

function Array_shift() {
	var A_s = 0
	var response = this[0]
	for (A_s = 0; A_s < this.length-1; A_s++) {
		this[A_s] = this[A_s + 1]
	}
	this.length--
	return response
}

if (typeof Array.prototype.shift == "undefined") {
	Array.prototype.shift = Array_shift
}

