/*
Object inheritance framework from
http://www.coolpage.com/developer/javascript/Correct%20OOP%20for%20Javascript.html

Example implementation:

function Foo (a, b, c) {
	// do something
}

Bar.Inherits(Foo);
function Bar (a, b) {
	var c = 'blah';
	this.Inherits(Foo, a, b, c);
}

*/

/* Object.prototype.Inherits = function( parent )
	{
		if( arguments.length > 1 )
		{
			parent.apply( this, Array.prototype.slice.call( arguments, 1 ) );
		}
		else
		{
			parent.call( this );
		}
	}
*/

Function.prototype.Inherits = function( parent )
	{
		this.prototype = new parent();
		this.prototype.constructor = this;
	};

  // **************************************************************************************************
  // ****      I.E. DOM IMPLEMENTATION ISSUE FIX                                                   ****
  // **************************************************************************************************
  
  // Stub function
  function createElementWithName(){}
  
  // Anonymous function fills in stub automatically depending on browser implementation of name
  // attribute.  IE requires a non-standard call to document.createElement in order to set the name
  // attribute for elements, which is necessary for dynamically generated forms.
  (function(){
    try {
      var el=document.createElement( '<div name="foo">' );
      if( 'DIV'!=el.tagName ||
          'foo'!=el.name ){
        throw 'create element error';
      }
      createElementWithName = function( tag, name ){
        return document.createElement( '<'+tag+' name="'+name+'"></'+tag+'>' );
      };
    }catch( e ){
      createElementWithName = function( tag, name ){
        var el = document.createElement( tag );
        // setAttribute might be better here ?
        el.name = name;
		el.setAttribute("name",name);
        return el;
      };
    }
  })();
  
  // Add createElementWithName to document object as createNamedElement
  if (typeof(document.createNamedElement) == 'undefined') {
    document.createNamedElement = createElementWithName;
  }
