function chcol(obj1,obj2,val1,val2)
{if(val2==2)
{document.getElementById('getQuote').innerHTML="<table width='100%' border='0' cellspacing=0 cellpadding=3><input type=hidden name=comval id=comval value=1 /><tr><td id=nm>&nbsp;</td></tr><tr><td align='center'><a href='http://www.electricchoice.com/compare_prices.php' target='_blank'><img src='images/btn_getRates.png' border='0' /></a></td></tr><tr><td align='center'>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table>"
document.getElementById(obj1).style.backgroundImage="url('images/blue_tab.png')";document.getElementById(obj2).style.backgroundImage="url('images/grey_tab.png')";document.getElementById(obj1).style.color='#FFF';document.getElementById(obj2).style.color='#333';}
else
{document.getElementById('getQuote').innerHTML="<table width=100% border=0 cellspacing=0 cellpadding=3><input type=hidden name=comval id=comval value=1 /><tr><td id=nm><strong>Company Name:</strong></td><td><input type=text name=fname id=fname  class=txtField /></td></tr><tr><td><strong>Phone:</strong></td><td><input type=text class=txtField id=cno name=cno  /></td></tr><tr><td><strong>Email:</strong></td><td><input type=text id=email name=email  class=txtField /></td>  </tr><tr><td></td><td ><img style=cursor:pointer; onclick='return validate_form(form1)'; type=image src=images/btn_getQuote.png alt=Get Quote /></td></tr></table>";document.getElementById(obj1).style.backgroundImage="url('images/blue_tab.png')";document.getElementById(obj2).style.backgroundImage="url('images/grey_tab.png')";document.getElementById(obj1).style.color='#FFF';document.getElementById(obj2).style.color='#333';document.getElementById('nm').innerHTML=val1;document.getElementById('comval').value=val2;document.getElementById('fname').style.border='#A9A9A9'+' 1px solid';document.getElementById('email').style.border='#A9A9A9'+' 1px solid';document.getElementById('cno').style.border='#A9A9A9'+' 1px solid';}}
function chm(obj)
{if(obj==1)
{document.getElementById('getQuote').innerHTML='<p align=center><strong>Thank you for relying on us to help you with your business electricity needs. One of our senior energy consultants will contact you by phone, email or both within two business hours.</strong><br><br></p>'}
if(obj==2)
{document.getElementById('getQuote').innerHTML='<p align=center><strong>Thank you for relying on us to provide you with the best customer service and lowest electric rates for your home.</strong><br><br></p>'}}
function fullname(val)
{val1=document.getElementById(val).value
var u=/^[a-zA-Z.& ]+$/;var c=u.test(val1);if(c)
{Highlight(val,'#A9A9A9');return true;}
else
{Highlight(val,'red');return false;}}
function IsEmail(val)
{val1=document.getElementById(val).value
var u=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;var c=u.test(val1);if(c)
{Highlight(val,'#A9A9A9');return true;}
else
{Highlight(val,'red');return false;}}
function contact(val,minno,maxno)
{val1=document.getElementById(val).value
var u=/^[0-9]+$/;var c=u.test(val1);if((val1.length>=minno&&val1.length<=maxno)&&(c))
{Highlight(val,'#A9A9A9');return true;}
else
{Highlight(val,'red');return false;}}
function Highlight(obj,col)
{document.getElementById(obj).style.border=col+' 1px solid';}
function validate_form(thisform)
{var er=0;var foc='';with(thisform)
{if(fullname('fname')==false)
{if(er==0)
foc='fname';er=1;}
if(IsEmail('email')==false)
{if(er==0)
foc='email';er=1;}
if(contact('cno',5,15)==false)
{if(er==0)
foc='cno';er=1;}
if(er==1)
{document.getElementById(foc).focus();return false;}
else
{status();}}}
function selectcon(obj)
{if(document.getElementById(obj).value=='')
{Highlight(obj,'red');return false;}
else
{Highlight(obj,'#A9A9A9');return true;}}
function validate_form2(thisform,newobj)
{if(readIt(newobj)==true)
{document.getElementById('formdiv').innerHTML='We have already received a submission from you.<br> Please call us at 1-800-977-4020 to request<br> additional information';return false;}
var er=0;var foc='';with(thisform)
{if(fullname('cname')==false)
{if(er==0)
foc='cname';er=1;}
if(fullname('con_name')==false)
{if(er==0)
foc='con_name';er=1;}
if(IsEmail('email2')==false)
{if(er==0)
foc='email2';er=1;}
if(contact('phonec',5,15)==false)
{if(er==0)
foc='phonec';er=1;}
if(er==1)
{document.getElementById(foc).focus();return false;}
else
{saveIt(newobj,'submit',1)
return true;}}}
var xmlHttp
var gggg
function status()
{var fn=document.getElementById('fname').value;var em=document.getElementById('email').value;var cn=document.getElementById('cno').value;var comv=document.getElementById('comval').value;gggg=comv;xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{alert("Browser does not support HTTP Request")
return}
var url="ajaxphp/sendmail.php"
url=url+"?fname="+fn+"&email="+em+"&cno="+cn+"&comval="+comv;xmlHttp.onreadystatechange=stateChangedaddtochain
xmlHttp.open("GET",url,true)
xmlHttp.send(null)}
function stateChangedaddtochain()
{if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{chm(gggg);}}
function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new XMLHttpRequest();}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
