<!--
// set our base location... differs for beta and release
if (location.hostname != "" && location.hostname != "erithacusnew" && location.hostname != "localhost") {
	HOMEDIR='/grafit/';
}
else {
	HOMEDIR='';
}

var v7latest = 0;
var v7latestbuild = 600;
var v6latest = 12;
var v6latestbuild = 237;
var v5latest = 13;
var v4latest = 21


// set our URL location... differs for beta and release
HOMEURL='http://www.erithacus.com/grafit/';

						
function showmail(emailalias, displayname, subject)
{
	var emaildomain = "erithacus.com";
	
	document.write("<a href='mailto:" + emailalias+ "@" + emaildomain);
	if (typeof subject!='undefined')
		document.write("?subject=" + subject);
	document.write("'>");
	if ((typeof displayname=='undefined') || (displayname==""))
		document.write(emailalias + "@" + emaildomain);
	else
		document.write(displayname);
	document.write("</a>");
}

function clickmail( emailalias, subject )
{
	var emaildomain = "erithacus.com";

	if (typeof subject==undefined)
		parent.location="mailto:" + emailalias + "@" + emaildomain;
	else
		parent.location="mailto:" + emailalias + "@" + emaildomain + "?subject=" + subject;
}

function preload(img) 
{
  var a=new Image();
  a.src=img;
  return a; 
}


function movein(which){
	which.background='images/leftbackground_hot.gif'
}

function moveout(which, orig){
	which.background=orig;
}


ribbonBackSel = preload('images/Ribbon%20group%20background%20selected.png');
ribbonBack = preload('images/Ribbon%20group%20background.png');
ribbonBackChosen = preload('images/Ribbon%20group%20background%20chosen.png');

ribbonSmallBackSel = preload('images/Ribbon small background selected.png');
ribbonSmallBackChosen = preload('images/Ribbon small background chosen.png');
	

function moveinribbon(which){
	document.body.style.cursor='pointer';
	which.background=ribbonBackSel.src;
}

function moveoutribbondef(which){
	document.body.style.cursor='default';
	which.background=ribbonBack.src;
}

function moveoutribbon(which, orig){
	document.body.style.cursor='default';
	which.background=orig;
}

function moveinribbonsmall(which){
	document.body.style.cursor='pointer';
	which.background=ribbonSmallBackSel.src;
}

function moveoutribbonsmalldef(which){
	document.body.style.cursor='default';
	which.background='';
}



// unframe ourselves if we are encased
if (self != top)
	top.location.href = self.location.href;

// avoid redirecting on local drive!
if (location.hostname != "" && location.hostname != "erithacusnew" && location.hostname != "localhost") {
	// make sure that we are at the correct URL
	var oururl="www.erithacus.com";

	if (location.hostname != oururl) {
		window.location.href = "http://" + oururl + location.pathname 
		}
	}

// Email Validation Javascript

function validateEmail(addr,man,db) {
if (addr == '' && man) {
   if (db) alert('Please enter an email address');
   return false;
}
var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
for (i=0; i<invalidChars.length; i++) {
   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
      if (db) alert('Error: email address contains invalid characters');
      return false;
   }
}
for (i=0; i<addr.length; i++) {
   if (addr.charCodeAt(i)>127) {
      if (db) alert("Error: email address contains non ascii characters.");
      return false;
   }
}

var atPos = addr.indexOf('@',0);
if (atPos == -1) {
   if (db) alert('Error: email address must contain an @');
   return false;
}
if (atPos == 0) {
   if (db) alert('Error: email address must not start with @');
   return false;
}
if (addr.indexOf('@', atPos + 1) > - 1) {
   if (db) alert('Error: email address must contain only one @');
   return false;
}
if (addr.indexOf('.', atPos) == -1) {
   if (db) alert('Error: email address must contain a period in the domain name');
   return false;
}
if (addr.indexOf('@.',0) != -1) {
   if (db) alert('Error: period must not immediately follow @ in email address');
   return false;
}
if (addr.indexOf('.@',0) != -1){
   if (db) alert('Error: period must not immediately precede @ in email address');
   return false;
}
if (addr.indexOf('..',0) != -1) {
   if (db) alert('Error: two periods must not be adjacent in email address');
   return false;
}
var suffix = addr.substring(addr.lastIndexOf('.')+1);
if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' && suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
   if (db) alert('Error: invalid primary domain in email address');
   return false;
}
return true;
}

// Strips a string of blanks on either end
function stripBlanks(aString)
{
    var tmp = ""+aString;
    var bottom = 0;
    var top = tmp.length;
    if (tmp == "") return tmp;

    while (tmp.substring(bottom, bottom + 1) == " ") bottom++;

    if (bottom >= top) return("");
    
    while (tmp.substring(top - 1, top) == " ") top -= 1;
    
    return (tmp.substring(bottom, top));
}

function isBlank(str)
{
	return (str=='');
}




// collapsible outlines
/* CLOSED_IMAGE - the image to be displayed when the sublists are closed
 * OPEN_IMAGE   - the image to be displayed when the sublists are opened
 */
CLOSED_IMAGE='images\\plus_collapse.png';
OPEN_IMAGE='images\\minus_collapse.png';

/* makeCollapsible - makes a list have collapsible sublists
 * 
 * listElement - the element representing the list to make collapsible
 */
function makeCollapsible(listElement){

  // removed list item bullets and the sapce they occupy
  listElement.style.listStyle='none';
  listElement.style.marginLeft='0';
  listElement.style.paddingLeft='0';

  // loop over all child elements of the list
  var child=listElement.firstChild;
  while (child!=null){

    // only process li elements (and not text elements)
    if (child.nodeType==1){

      // build a list of child ol and ul elements and hide them
      var list=new Array();
      var grandchild=child.firstChild;
      while (grandchild!=null){
        if (grandchild.tagName=='OL' || grandchild.tagName=='UL'){
          grandchild.style.display='none';
          list.push(grandchild);
        }
        grandchild=grandchild.nextSibling;
      }

      // add toggle buttons
      var node=document.createElement('img');
      node.setAttribute('src',CLOSED_IMAGE);
      node.setAttribute('class','collapsibleClosed');
      node.onclick=createToggleFunction(node,list);
      child.insertBefore(node,child.firstChild);

    }

    child=child.nextSibling;
  }

}

/* createToggleFunction - returns a function that toggles the sublist display
 * 
 * toggleElement  - the element representing the toggle gadget
 * sublistElement - an array of elements representing the sublists that should
 *                  be opened or closed when the toggle gadget is clicked
 */
function createToggleFunction(toggleElement,sublistElements){

  return function(){

    // toggle status of toggle gadget
    if (toggleElement.getAttribute('class')=='collapsibleClosed'){
      toggleElement.setAttribute('class','collapsibleOpen');
      toggleElement.setAttribute('src',OPEN_IMAGE);
    }else{
      toggleElement.setAttribute('class','collapsibleClosed');
      toggleElement.setAttribute('src',CLOSED_IMAGE);
    }

    // toggle display of sublists
    for (var i=0;i<sublistElements.length;i++){
      sublistElements[i].style.display=
          (sublistElements[i].style.display=='block')?'none':'block';
    }

  }

}

function bookmark( pic, name, mainurl, titlestr, textlink )
{
	document.write("<a target=\"_blank\" href='" + mainurl + document.location.href);
	if (titlestr != "")
	{
		document.write( titlestr+document.title );
	}
	document.write( "' title='Share on " + name + "' >" );
	
	document.write("<img border=\"0\" height=\"24\" width=\"24\" src=\"" + "images/bookmarking/" + pic +"\" >" );
	
	if (textlink != "")
	{
		document.write( " " + textlink);
	}
	document.write( "</a> &nbsp;&nbsp;");
}


//-->