if (document.getElementById && document.getElementsByTagName && document.createTextNode) {

	document.write('<link rel="stylesheet" type="text/css" href="css/js_hide.css" />');

}

function addEvents() {

  var oTopNav = document.getElementById('topnav');

  if (oTopNav.firstChild) {

    var oLi = oTopNav.firstChild;
    while (oLi) {

      oLi.onmouseover = function() { this.className+="hover"; resizeIframe(this); };
      oLi.onmouseout = function() { this.className=this.className.replace(new RegExp("hover\\b"), ""); };

if (oLi.nodeType == 1) {
var subnavs = oLi.getElementsByTagName('Ul');
if (subnavs.length) {
if (subnavs[0].className == 'subnav')
subnavs[0].innerHTML = ('<iframe src="about:blank" scrolling="no" frameborder="0"></iframe>' + subnavs[0].innerHTML);
}

}


      oLi = oLi.nextSibling;

    }

  }

}

addLoadEvent(addEvents);


function resizeIframe(li) {

  if (li.firstChild) {
    var subItem = li.firstChild;
    while (subItem) {

      if (subItem.tagName == 'UL') {
        var subMenu = subItem;
        var iFrame = subMenu.firstChild;
        iFrame.style.width=subMenu.offsetWidth+"px";
        iFrame.style.height=subMenu.offsetHeight+"px";
        subMenu.style.zIndex="99";
        li.style.zIndex="99";
        //alert(subMenu.offsetWidth + "x" + subMenu.offsetHeight);
      }

      subItem = subItem.nextSibling;
    }


  }


}
/*

if (oSubMenu.firstChild.tagName == 'IFRAME') {

  var iFrame = oSubMenu.firstChild;
  iFrame.style.width=oSubMenu.offsetWidth+"px";
  iFrame.style.height=oSubMenu.offsetHeight+"px";
  oSubMenu.style.zIndex="99";
  oLi.style.zIndex="99";

}
*/

function checkEmail(emailAdd){
	var tempStr = emailAdd;
	var atPos = tempStr.indexOf('@');
	tempStr = tempStr.substr(atPos);
	var dotPos = tempStr.indexOf('.');
	var tempStr = tempStr.substr(dotPos);
	if(atPos < 1 || dotPos < 3 || tempStr.length < 3) msg+='\t any email address given must be in the format \'xx@xx.xx\' \n'
}


var msg = '';

function popupbrochureform(myform, windowname)
{

if(document.BrochureForm.EmailRecip.value.length < 1) msg+='\t you must provide an email address in the format \'xx@xx.xx\' \n';
if(document.BrochureForm.EmailRecip.value!='') checkEmail(document.BrochureForm.EmailRecip.value);

if(msg.length > 0)
    {
				alert('In order for the form to be submitted:\n' + msg);
				msg='';
				return false;
	} 
	else
	{
				if (! window.focus)return true;
				window.open('', windowname, 'height=400,width=400,resizable=yes,scrollbars=yes');
				myform.target=windowname;
				return true;
	}

}

