


function endsWith (str, suffix) {
	if (str.length < suffix.length) return false;
    var start = str.length - suffix.length;
    return str.substring(start) == suffix;
};

function submit(formId) {
	var form = document.getElementById(formId);
	form.submit();
	return false;
}

function Contains( obj ) 
{ 
   for ( i in this ) 
      if ( this[i] == obj ) 
         return true; 
   return false; 
}//Contains 
Array.prototype.Contains = Contains; 

function Remove( obj ) 
{ 
   for ( i in this ) 
      if ( this[i] == obj ) 
      { 
         this.splice( i, 1 ); 
         return; 
      } 
}//Remove 
Array.prototype.Remove = Remove; 

function RemoveAll( obj ) 
{ 
   for ( i in this ) 
      if ( this[i] == obj ) 
         this.splice( i, 1 ); 
}//RemoveAll 
Array.prototype.RemoveAll = RemoveAll; 

function formatDate(theDate) {
  thisyear = theDate.getFullYear();
	thismonth = theDate.getMonth();
	thismonth++;
	if (thismonth < 10) thismonth = "0" + thismonth;
	thisday = theDate.getDate();
	if (thisday < 10) thisday = "0" + thisday;
	return thisday + "/" + thismonth + "/" + thisyear;
}

function toggleWithElementId(id1, id2){
	var elem1 = document.getElementById(id1);
	toggleWithElement(elem1, id2);
}

function toggleWithElement(obj, id){
	var elem = document.getElementById(id);
	if (obj.style.display == "none") {
		obj.style.display = "block"
		elem.style.display = "none";
	} else {
		obj.style.display = "none"
		elem.style.display = "block";
	}
	return false;
}

function toggleElement(id){
	var elem = document.getElementById(id);
	return toggleElementObj(elem);
}

function toggleElementObj(elem){
	if (elem.style.display == "none") 
		elem.style.display = "block";
	else elem.style.display = "none";
	return false;
}

function addLoadListener(onloadfunction){
	if (window.addEventListener)
	    window.addEventListener("load", onloadfunction, false)
	else if (window.attachEvent)
	    window.attachEvent("onload", onloadfunction)
	else if (document.getElementById)
	    window.onload=onloadfunction;
}


