//************************************************//
//   Copyright 2005 All Rights Reserved	  	      //
//   standard.js                                  //
//   Ryan White 06-02-2006                        //
//************************************************//

function externalLinks() 
{
  if (document.getElementsByTagName)
  {
    var anchors = document.getElementsByTagName("a");

    for (var i=0; i<anchors.length; i++) 
    {
      var hrefValue  = anchors[i].href.toString();
      var expression = /(environmenthouse)|(validator)/; 
    
      if ( !( hrefValue.match(expression) ) )
      {  
         anchors[i].onclick = function(){return openWin(this.href)};
      }
    }
  }
}  

function openWin(pageHref) 
{
  show = window.open(pageHref);
  show.window.focus();

  return false;
}

function openWindow(pageHref, pageName, pageWidth, pageHeight) 
{
	var center_t = (screen.height - pageHeight) / 2;
	var center_l = (screen.width - pageWidth) / 2;
	
	props = 'height=' + pageHeight + ' ,width=' + pageWidth+' ,top=' + center_t+' ,left=' + center_l+' ,scrollbars=yes ,noresize';	
	show  = window.open(pageHref, pageName, props);
	show.window.focus();
	
	return false;
}

function levelling() 
{
  if((!document.getElementById) && document.all)                   // .all returned, enter lamo browser mode
  {
    document.getElementById = function(id)                         // replace getElementById with a mod hack
    {
      element = document.all[id];                                  // attempt to "get" the element by its id
       
      if(element)                                                  // something found, continue                                           
      { 
        if((!element.id)||(element.id != id))                      // if not an exact match digress further
        {
          if(element.length)                                       // if returned collection like behaviour
          {
            for(var k = 0; k<element.length ;k++)
            {
              if((element[k].id)&&(element[k].id == id))           // find a valid member and an id specific match within collection 
              {
                return element[k];
              }
            }
          }
        } 
        else                                                       // return match, not null, not name match, not collection 
        {
          return element;
        }     
      }
           
      return null;                                                 // no much at all return null 
    };
  }
}

function confirmDelete(recordName)
{
	return confirm("You are about to permanently delete a " + recordName + " from the database. Continue?");
}


////////////////////////////////////////////////////