// JavaScript Document

function GetAbsPosition(object) {
var position = new Object;
position.x = 0;
position.y = 0;

if( object ) {
position.x = object.offsetLeft;
position.y = object.offsetTop;

if( object.offsetParent ) {
var parentpos = GetAbsPosition(object.offsetParent);
position.x += parentpos.x;
position.y += parentpos.y;
}
}

position.cx = object.offsetWidth;
position.cy = object.offsetHeight;

return position;
}

function checkMenu(menuItem,expand) {
position = GetAbsPosition(document.getElementById(menuItem));
document.getElementById(expand).style.left = (position.x -40) + "px";
document.getElementById(expand).style.width = (position.cx) + "px"
document.getElementById(expand).style.display = "inline";
}
function setState() {
	var itemName = pages;
	document.getElementById(itemName).className = 'nav1';
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0) || (s == " "))
}

function formCheck() {
    returntype=false;
    if (isEmpty(document.contactsform.fullname.value))
    {
      alert('Please enter your name');
	   document.contactsform.fullname.focus();
      return false;
    }

    if (isEmpty(document.contactsform.emailaddress.value))
    {
      alert('Please enter your email address');
	   document.contactsform.emailaddress.focus();
      return false;
    }
	if (isEmpty(document.contactsform.telephone.value))
    {
      alert('Please enter a contact telephone number');
	   document.contactsform.telephone.focus();
      return false;
    }
	if (isEmpty(document.contactsform.message.value))
    {
      alert('You haven\'t entered a message!');
	   document.contactsform.message.focus();
      return false;
    }
	if (isEmpty(document.contactsform.recaptcha_response_field.value))
    {
      alert('You haven\'t entered the reCaptcha code code');
	   document.contactsform.recaptcha_response_field.focus();
      return false;
    }
    return true;
}