
// DOM Stuff

if(!window.Node){
  var Node = {
    ELEMENT_NODE : 1,
    ATTRIBUTE_NODE : 2,
    TEXT_NODE : 3,
    CDATA_SECTION_NODE : 4,
    ENTITY_REFERENCE_NODE : 5,
    ENTITY_NODE : 6,
    PROCESSING_INSTRUCTIONS_NODE : 7,
    COMMENT_NODE : 8,
    DOCUMENT_NODE : 9,
    DOCUMENT_TYPE_NODE : 10,
    DOCUMENT_FRAGMENT_NODE : 11,
    NOTATION_NODE : 12
  }
}

// --------------------------------------------------

function checkNode(node, filter){
  return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase());
}

// --------------------------------------------------

function getDescendents(node, filter, result){
  if(!result) result = new Array();
  var children = node.childNodes;
  for(var i = 0; i < children.length; i++){
    if(checkNode(children[i], filter)) result[result.length] = children[i];
    getDescendents(children[i], filter, result);
  }
  return result;
}

function getDescendentsByTagName(node, tag){
  return getDescendents(node, tag);
}

// --------------------------------------------------


/* This section auto runs the "cornerfy" script */
function init() {
 // Checks to see if this function has already been called
 // and returns if it has
 if (arguments.callee.done) return;

 // Flag this function so we don't do the same thing twice
 arguments.callee.done = true;

 // Round the corners (if there are any)
 bp_roundEm();
};

/* for Mozilla */
if (document.addEventListener) {
         document.addEventListener("DOMContentLoaded", init, false);
}

/* for other browsers */
window.onload = init;



function blank(url){
        winId = "pegasus" + Math.floor((100*(Math.random())));
        leftPos = 100;
        topPos = 100;
        properties = 'left=' + leftPos + ',top=' + topPos + ', width=500px, height=300px, location=yes, status=yes, toolbar=yes, menubar=yes, directories=yes, resizable=yes, scrollbars=yes';
        window.open(url,winId,properties);
        
        return false;
}


