//
// Javascript 1.3 (ECMA-262, Edition 1 specification)
// http://www.ecma-international.org/publications/standards/Ecma-262.htm
//
// last modified 06/11/2007
//
// Copyright 2007
// Verve Creative Inc | http://www.getverve.com
//

// Opens popup window for consultant biographies
function viewBio(id) {
	bioWin = window.open('bios/bio-' + id + '.html','bioWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=415,height=515,top=100,left=100');
	bioWin.focus();
}

// Form Validation
function CheckForm() { 
	var errorMsg = "";

	// regular expression to match alphanumeric characters and spaces 
  var re = /^[\w ]+$/;
  var nu = /^[\d ]+$/;
    
  if (document.forms[0].elements['name'].value == ""){
		errorMsg += "\n\tName - Enter your Name";	
	}
  
  if ((document.forms[0].elements['email'].value == "") || (document.forms[0].elements['email'].value.length > 0 && (document.forms[0].elements['email'].value.indexOf("@",0) == - 1 || document.forms[0].elements['email'].value.indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tEmail Address - Enter a valid email address";
	}
  
  if (document.forms[0].elements['phone'].value == ""){
		errorMsg += "\n\tPhone - Enter your Phone Number";
	}
  
  //If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "There are problems with the form.\n";
		msg += "Please correct the following and re-submit the form.\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}


<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}//-->



    // <![CDATA[
    function selectReplacement(obj) {
      obj.className += ' replaced';
      var ul = document.createElement('ul');
      ul.className = 'selectReplacement';
      var opts = obj.options;
      for (var i=0; i<opts.length; i++) {
        var selectedOpt;
        if (opts[i].selected) {
          selectedOpt = i;
          break;
        } else {
          selectedOpt = 0;
        }
      }
      for (var i=0; i<opts.length; i++) {
        var li = document.createElement('li');
		
        var txt = document.createTextNode(opts[i].text);
        li.appendChild(txt);
        li.selIndex = opts[i].index;
        li.selectID = obj.id;
        li.onclick = function() {
          selectMe(this);
        }
        if (i == selectedOpt) {
		
          li.className = 'selected';
          li.onclick = function() {
		  document.getElementById("SearchResTable").style.visibility="hidden";
		  document.getElementById("SearchResTableDiv").style.visibility="hidden";
            this.parentNode.className += ' selectOpen';
            this.onclick = function() {
              selectMe(this);
            }
          }
        }
        if (window.attachEvent) {
          li.onmouseover = function() {
            this.className += ' hover';
          }
          li.onmouseout = function() {
            this.className = 
              this.className.replace(new RegExp(" hover\\b"), '');
          }
        }
        ul.appendChild(li);
      }
      obj.parentNode.insertBefore(ul,obj);
    }
    function selectMe(obj) {
	
      var lis = obj.parentNode.getElementsByTagName('li');
	  
      for (var i=0; i<lis.length; i++) {
        if (lis[i] != obj) {
          lis[i].className='';
          lis[i].onclick = function() {
            selectMe(this);
          }
        } else {
          setVal(obj.selectID, obj.selIndex);
          obj.className='selected';
          obj.parentNode.className = 
            obj.parentNode.className.replace(new RegExp(" selectOpen\\b"), '');
          obj.onclick = function() {
            obj.parentNode.className += ' selectOpen';
            this.onclick = function() {
              selectMe(this);
            }
          }
        }
      }
    }
    function setVal(objID, selIndex) {
      var obj = document.getElementById(objID);
      obj.selectedIndex = selIndex;
	  if (objID=="ddlFunction"){
	  document.forms.searchOptions.SearchBy.value="Function";
	  document.forms.searchOptions.submit();
	  }
	  if (objID=="ddlBusiness"){
	  document.forms.searchOptions.SearchBy.value="Business";
	  document.forms.searchOptions.submit();
	  }
    }
    function setForm() {
      var s = document.getElementsByTagName('select');
      for (var i=0; i<s.length; i++) {
        selectReplacement(s[i]);
      }
    }
    window.onload = function() {
      (document.all && !window.print) ? null : setForm();
    }
	
	 function subMit(objID) {
      var obj = document.getElementById(objID);
     
	  if (objID=="ddlFunction"){
	  document.forms.searchOptions.SearchBy.value="Function";
	  document.forms.searchOptions.submit();
	  }
	  if (objID=="ddlBusiness"){
	  document.forms.searchOptions.SearchBy.value="Business";
	  document.forms.searchOptions.submit();
	  }
    }
    // ]]>




