window.onload = associateimages;
  var clickmessage='Copyright 2007 The Newfoundland Club and/or the respective owners. Do not use without permission. Contact web.editor@thenewfoundlandclub.co.uk for futher information'
	function disableclick(e)
  {
		if (document.all)
    {
		  if (event.button==2||event.button==3)
      {
		    if (event.srcElement.tagName=='IMG')
        {
		      alert(clickmessage);
		      return false;
		    }
		  }
	  }
    else if (document.layers)
    {
		  if (e.which == 3)
      {
		    alert(clickmessage);
		    return false;
		  }
	  }
    else if (document.getElementById)
    {
		  if (e.which==3&&e.target.tagName=='IMG')
      {
		    alert(clickmessage)
		    return false;
		  }
		}
    //alert("Test")
    return true
	}
	function associateimages()
  {
		for(i=0; i<document.images.length;i++)
    {
      //alert(document.images[i].id);
      //alert(document.images[i].name);
			if ((document.images[i].id == "NewfClub") || (document.images[i].name == "NewfClub"))
      {
       	//alert("ID = "+document.images[i].id);
      	//alert("Name = "+document.images[i].name);
        //alert("setting it "+i);
        document.images[i].onmousedown=disableclick;
      }
		}
    var sPath = window.location.pathname;
    //var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    //alert(sPage);
    //alert(window.location.href);
    var docName = document.body.id;
    //alert(docName);
    if ((sPage == 'index.htm') || (sPage == ""))
    {
      //alert("Get cookie = "+getCookie("FloatNewfs"));
      inName = document.getElementById("ToggleNewfs");
      if (getCookie("FloatNewfs") == null || getCookie("FloatNewfs") == 'Yes')
      {
        //alert("Change");
        //alert(inName.value);
        inName.value = "Disable Floating Newfs";
        floatNewfs = true;
      }
      else
      {
        inName.value = "Enable Floating Newfs";
        floatNewfs = false;
      }
      if (floatNewfs)
      {
        //alert("OK bubbles");
        startBubbles();
        //alert("Started");
      }
    }
    //    startBubbles(); // Remove this line to stop the floating Newfs.
	}
	if (document.all)
  {
		document.onmousedown=disableclick
	}
  else if (document.getElementById)
  {
		document.onmouseup=disableclick
	}
  else if (document.layers)
  {
    alert("Layers")
		associateimages()
	}
  
  var newfLogo;
  var newfHeader
  var newfProf;
  
  function preloadem()
  {
    if (document.images)
    {
      newfLogo = new Image;
      newfHeader = new Image;
      newfProf = new Image;
    
      newfLogo.src = "/images/newfclublogo.jpg"
      newfHeader.src = "/images/NewfHeader1.gif"
      newfProf.src = "/images/newfprof.gif"
    }
    else
    {
      newfLogo.src = ""
      newfHeader.src = ""
      newfProf.src = ""
    }
  }
var m1 = "ma" + "il" + "to" + String.fromCharCode(2*29);
var mBit = String.fromCharCode(8*8);
var sBit = String.fromCharCode(2*23);
var breedInfoEml = "breed"+sBit+"info";
var healthcordEml = "health"+sBit+"coordinator";
var mbrshpEml = "membership";
var nfscnEml = "newfscene";
var novsEml = "novelties";
var presEml = "president";
var secEml = "secretary";
var treasurerEml = "treasurer";
var trophiesEml = "trophies";
var viceChairEml = "vice"+sBit+"chair";
var webEdtrEml = "web"+sBit+"editor";
var welfareEml = "welfare";
var workChairEml = "work"+sBit+"chair";
var workViceChairEml = "work"+sBit+"vicechair";
var workSecEml = "work"+sBit+"secretary";
var showEntsEml = "showentries";
var bookSalesEml = 'booksales';
var cardSalesEml = 'cardsales';
/*
*
* Individual people.
*
*/
var jBrownEml = "judith"+sBit+"Brown";
var jBurrowsEml = "john"+sBit+"burrows";
var rChadwickEml = "ronnie"+sBit+"chadwick";
var gColdwellEml = "gary"+sBit+"coldwell";
var jDaviesEml = "jonathan"+sBit+"davies";
var bHindletEml = "bob"+sBit+"hindlet";
var mMagorrianEml = "martin"+sBit+"magorrian";
var mWilksEml = "marion"+sBit+"wilks";
var SCEml = "sandra"+sBit+"constable";
var AREml = "andrea"+sBit+"raven";
var KCEml = "kevin"+sBit+"clarke";
var RGEml = "rachel"+sBit+"gaines";
var JWEml = "james"+sBit+"watts";
var LBEml = "llynda"+sBit+"baugh";
var domName = "thenewfoundlandclub" + sBit + "co" + sBit + "uk";

function emlBld(mlName)
{
  var retName = mlName + mBit + domName;
  return retName;
}

function targetIt(oneToChange)
{
	oneToChange.target = '_blank';
}

function confirmit()
{
  var status = confirm("You have clicked to view the file in a new window. "+
                  "This will take some time to appear in that window.\n"+
                  "If this is what you want to do, click OK.\nOtherwise, click Cancel, "+
                  "then right-click the link and select 'Save Target As...' to download "+
                  "it to your computer.");
	//alert('Status = '+status);
	return status;
}

function confirmTarget(oneToChange)
{
	var status = confirmit();
	//alert('Return = '+status);
	if (status)
	{
		//alert('New Window');
		oneToChange.target = '_blank';
	}
	return status;
}

function toggleFloatNewfs()
{
  expireDate = new Date;
  expireDateYear = expireDate.getYear();
  if (expireDateYear < 2000)
  {
    expireDateYear += 1900;
  }
  //alert("Expire year = "+expireDateYear); 
  expireDate.setYear(expireDateYear+6);
  inName = document.getElementById("ToggleNewfs");
  if (getCookie("FloatNewfs") == null || getCookie("FloatNewfs") =='Yes')
  {
    setCookie("FloatNewfs","No",expireDate);
  }
  else
  {
    setCookie("FloatNewfs","Yes",expireDate);
  }
  window.location.reload();
}

/**
 * Read the JavaScript cookies tutorial at:
 *   http://www.netspade.com/articles/javascript/cookies.xml
 */

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    /* alert(">"+name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "")+"<"); */

    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" + 
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function mOver(thisOne)
{
 thisOne.className = 'hilite';
}

function mOut(thisOne,thisClass)
{
 if (thisClass == undefined)
 {
   thisOne.className = '';
 }
 else
 {
   thisOne.className = thisClass;
 }
}

function keyCatch()
{
	//alert('Keycode = '+event.keyCode);
	if (event.keyCode == 27)
	{
		document.GoBack.submit();
	}
}

function uppCaseWords(frmObj)
{
  var index;
  var tmpStr;
  var tmpChar;
  var preString;
  var postString;
  var strlen;
  tmpStr = frmObj.value.toLowerCase();
  strLen = tmpStr.length;
  if (strLen > 0)
  {
    for (index = 0; index < strLen; index++)
    {
      if (index == 0)
      {
        tmpChar = tmpStr.substring(0,1).toUpperCase();
        postString = tmpStr.substring(1,strLen);
        tmpStr = tmpChar + postString;
      }
      else
      {
        tmpChar = tmpStr.substring(index, index+1);
        if (tmpChar == " " && index < (strLen-1))
        {
          tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
          preString = tmpStr.substring(0, index+1);
          postString = tmpStr.substring(index+2,strLen);
          tmpStr = preString + tmpChar + postString;
        }
      }
    }
  }

  frmObj.value = tmpStr;
}
