if (domainname != '')
{
	// domain has been set
}
else
{
	domainname = 'baybucks.com';
}

function email(account) {
   document.write('<a href="mailto:' + account + '@' + domainname + '" class="email">');
   document.write(account + '@' + domainname + '</a>');
}

function inputDefault(field) {
   if (!document.getElementById) return false;
   if (!document.getElementById(field)) return false;
   var fieldtochange = document.getElementById(field);

   var holder = fieldtochange.parentNode.firstChild;
   while (holder.nodeType == '3' || holder.nodeName != 'LABEL') {
      holder = holder.nextSibling;
   }

   if (holder == undefined) return false;
   holder = holder.innerHTML;

   if (fieldtochange.value == '') {
      fieldtochange.value = "Insert "+holder;
   }

   fieldtochange.onfocus = function() {
      if (this.value == "Insert " + holder)
         this.value = '';
   }
   fieldtochange.onblur = function() {
      if (this.value == '')
         this.value = "Insert " + holder;
   }
   return true;
}

function copy(inElement)
{
	// copys the value of a passed element to the systems clipboard
	if (inElement.createTextRange)
	{
		var range = inElement.createTextRange();
		if (range && BodyLoaded==1)
		range.execCommand('Copy');
		alert('woah');
	}
	else
	{
		var flashcopier = 'flashcopier';
		if (!document.getElementById(flashcopier))
		{
			var divholder = document.createElement('div');
			divholder.id = flashcopier;
			document.body.appendChild(divholder);
		}
		document.getElementById(flashcopier).innerHTML = '';
		var content;
		if (inElement.innerText)
		{
			content = inElement.innerText;
		}
		else
		{
			content = inElement.textContent;
		}
		var divinfo = '<embed src="/themes/mscCommon1/media/_clipboard.swf" FlashVars="clipboard='
		+ encodeURIComponent(content) + '" width="0" height="0" type="application/x-shockwave-flash"></embed>';
		document.getElementById(flashcopier).innerHTML = divinfo;
	}
}

//
// check if a window.onload event exists, and add to it if so, or create one if not
//

loadEvent = window.onload;
if (typeof loadEvent != 'function')
{
	window.onload = function()
	{
		inputDefault('commsubscription1_firstName');
		inputDefault('commsubscription1_email');
	};
}
else
{
	window.onload = function()
	{
		loadEvent();
		inputDefault('commsubscription1_firstName');
		inputDefault('commsubscription1_email');
	};
}