////	AJAX	////
if( typeof XMLHttpRequest == "undefined" ) {
  XMLHttpRequest = function() {
    try {return new ActiveXObject("Msxml2.XMLHTTP.6.0");} catch(e) {};
    try {return new ActiveXObject("Msxml2.XMLHTTP.3.0");} catch(e) {};
    try {return new ActiveXObject("Msxml2.XMLHTTP");}     catch(e) {};
    try {return new ActiveXObject("Microsoft.XMLHTTP");}  catch(e) {};

    throw new Error("Your browser is out of date and does not support technologies required by this site.  Please consider upgrading immediately to a newer version of your browser.");
  };
}
/**
 *	Make AJAX object
 *
 *	Makes the AJAX object that the browser supports
 *	@return	object	Proper AJAX object for the browser
 */
function mkAJAXobject() {
  return new XMLHttpRequest();
}

////    HTML Interaction Functions    ////
/**
 * Get Elements By Class
 *
 * Retrieve elements by their class name
 * @param	searchClass	class to find
 * @param	object		node to narrow to
 * @param	string		specific tag to narrow to
 */
if (typeof getElementsByClass == "undefined") {
  function getElementsByClass(searchClass,tag) {
    var classElements = new Array();
    if ( tag == null )
      tag = '*';
    var els = document.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
    for (i = 0, j = 0; i < elsLen; i++) {
      if ( pattern.test(els[i].className) ) {
        classElements[j] = els[i];
        j++;
      }
    }
    return classElements;
  }
}

/**
 * Give Attribute
 *
 * Gives out attributes to a collection of nodes
 * @param	array	which nodes
 * @param	string	what attribute to give
 * @param	string	value for attribute
 */
function giveAttr(who,attr,val) {
for(i=0;i<who.length;i++)
  {
  who[i].setAttribute(attr,val);
  }
}

function urlencode(str) {
str = escape(str);
str = str.replace('+', '%2B');
str = str.replace('%20', '+');
str = str.replace('*', '%2A');
str = str.replace('/', '%2F');
str = str.replace('@', '%40');
return str;
}

function urldecode(str) {
str = str.replace('+', ' ');
str = unescape(str);
return str;
}

function var_dump(obj) {
   if(typeof obj == "object") {
      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
   } else {
      return "Type: "+typeof(obj)+"\nValue: "+obj;
   }
}

function CreateBookmarkLink() {
  title = "Signs! Stuff & Everything"; 
  url = "http://signsstuffandeverything.com";
  // Blogger - Replace with <$BlogItemPermalinkURL$> 
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}

function disableEnterKey(e) {
  var key;

  if(window.event)
    key = window.event.keyCode;	//IE
  else
    key = e.which;		//firefox

  if(key == 13)
    return false;
  else
    return true;
}

function clone(obj){
    if(obj == null || typeof(obj) != 'object')
        return obj;
    var temp = new obj.constructor(); // changed (twice)
    for(var key in obj)
        temp[key] = clone(obj[key]);
    return temp;
}