/******************************************************************************
 **                  MEDIAGISTIC FUNCTIONS JS v4.7.r110707                   **
 **       Standard Version.  ©2011 Mediagistic.  All rights reserved.        **
 **                    http://www.mediagisticpageone.com                     **
 *****************************************************************************/
var state='none';var mgPageOne;var mgSchedulerOpen='nope';var isRedirect='false';var mgFormName='';var mgValidateAndGo=false;var mgLoadTimer=0;var mgRewriteLinks=true;if(typeof jQuery=='undefined'){var hostcheck=window.location.href;if(hostcheck.search(/localhost/)!=-1){alert("This page requires JQuery.\nPlease load \'mediagistic/jquery-1.4.2.min.js\' \nin your html files - before lpconfig and MGF js files.\n\nThis is a fundamental error.  Functionality from this point\nforward is not and should not be expected.");}}
$(document).ready(function(){mgPageOne=new mgPageInfo();mgGo();});function revealDiv(a){for(i=0;i<=mgPageOne.RelevantCopy.content.length;i++){if(a==mgPageOne.RelevantCopy.content[i]&&mgPageOne.Path.isHome==true){MG_showHide(a);}}}
function Querystring(qs){this.params=new Object();this.get=Querystring_get;if(qs==null)
qs=location.search.substring(1,location.search.length);if(qs.length==0)return;qs=qs.replace(/\+/g,' ');var args=qs.split('&');for(var i=0;i<args.length;i++){var value;var pair=args[i].split('=');var name=unescape(pair[0]);if(pair.length==2)
value=unescape(pair[1]);else
value=name;this.params[name]=value;}}
function Querystring_get(key,default_){if(default_==null)default_=null;var value=this.params[key];if(value==null)value=default_;return value;}
function getArgs(){var args=new Object();var query=location.search.substring(1);var pairs=query.split("&");for(var i=0;i<pairs.length;i++)
{var pos=pairs[i].indexOf('=');if(pos==-1)continue;var argname=pairs[i].substring(0,pos);var value=pairs[i].substring(pos+1);args[argname]=unescape(value);}
return args;}
function QueryDataCheck(){var args=getArgs();if(args.a){a=args.a;document.getElementById("adGroup").value=a;revealDiv(a);}else{a='';}
if(args.confirmation){isRedirect='true';confirmation=args.confirmation;confirmation=confirmation.replace(/__n__/g,'\n');mgPageOne.showAlert(confirmation);}
if(args.goTo){mgPageOne.toggleProductDetail(args.goTo,'slide','fast','74','238');mgPageOne.scrollPageTo(args.goTo,-130)}
mgPageOne.qdataCount++;}
function mgGo(){var t;mgLoadTimer++;if(document.getElementById('mg-formcontainer')){mgLoadTimer=0;var mgFormHtml="<style type=\"text/css\">\n #mg-shed-wrap {height:inherit!important;}\n</style>  <div id=\"mg-sched-wrap\">\n   <div id=\"mg-sched\"\>\n   <fo"+"rm id=\"mg-sched-form\" name=\"mg-sched-form\" act"+"ion=\"http://contact.heatingandairpros.com\" method=\"post\">\n   <div class=\"spacer\"></div>\n   <div id=\"mg-sched-main\">\n    <div class=\"label left f-name\">Name:</div>\n    <div class=\"label left f-phon\">Phone:</div>\n    <div class=\"clear\"></div>\n    <div class=\"txtdiv left f-name\"><input type=\"text\" name=\"LeadName\" id=\"LeadName\" class=\"txtinput f-name\" /></div>\n    <div class=\"txtdiv left f-phon\"><input type=\"text\" name=\"LeadPhone\" id=\"LeadPhone\" class=\"txtinput f-phon\" /></div>\n    <div class=\"clear\"></div>\n    <div class=\"label left f-eml\">Email Address:</div>\n    <div class=\"clear\"></div>\n    <div class=\"txtdiv left f-eml\"><input type=\"text\" name=\"LeadEmail\" id=\"LeadEmail\" class=\"txtinput f-eml\" /></div>\n    <div class=\"clear\"></div>\n    <div class=\"emg-note\">(for emergency service, please call us)</div>\n    <div id=\"mg-sched-appt\">\n     <div id=\"mg-sched-toggle\" onclick=\"MG_formShowHide('mg-sched-options','chk');\">\n      <div class=\"left chkbox\"><input type=\"checkbox\" id=\"mg-sched-options-ind\" name=\"LeadWantAppointment\" /></div>\n      <div class=\"left label\"> I'd like to schedule an appointment.</div>\n      <div class=\"clear\"></div>\n     </div>\n     <div id=\"mg-sched-options\">\n      <div class=\"label left f-addr\">Street Address</div>\n      <div class=\"clear\"></div>\n      <div class=\"txtdiv left f-addr\"><input type=\"text\" name=\"LeadStreet\" id=\"LeadStreet\" class=\"txtinput f-addr\" /></div>\n      <div class=\"clear\"></div>\n      <div class=\"label left f-city\">City</div>\n      <div class=\"label left f-zip\">ZIP Code</div>\n      <div class=\"clear\"></div>\n      <div class=\"txtdiv left f-city\"><input type=\"text\" name=\"LeadCity_f\" id=\"LeadCity_f\" class=\"txtinput f-city\" /></div>\n      <div class=\"txtdiv left f-zip\"><input type=\"text\" name=\"LeadZipCode\" id=\"LeadZipCode\" class=\"txtinput f-zip\" /></div>\n      <div class=\"clear\"></div>\n      <div class=\"label left f-addr\">What can we help you with?</div>\n      <div class=\"clear\"></div>\n      <div class=\"txtdiv left f-need\">\n       <select name=\"LeadNeed\" id=\"LeadNeed\" class=\"f-need\">\n       <option value=\"\">Please Select...</option>\n       <option value=\"New System\">New System</option>\n       <option value=\"Service\">Service</option>\n       <option value=\"Scheduled Maintenance\">Scheduled Maintenance</option>\n       <option value=\"Do not know\">something else or not sure</option>\n       </select>\n      </div>\n      <div class=\"clear\"></div>\n      <div class=\"label left f-addr\">Approximate age of your current system?</div>\n      <div class=\"clear\"></div>\n      <div class=\"txtdiv left f-sage\">\n       <select name=\"LeadSystemAge\" id=\"LeadSystemAge\" class=\"f-sage\">\n       <option value=\"Do not know or NA\">Not sure or N/A</option>\n       <option value=\"1 - 3 Years Old\">1 - 3 Years Old</option>\n       <option value=\"3 - 6 Years Old\">3 - 6 Years Old</option>\n       <option value=\"6 - 10 Years Old\">6 - 10 Years Old</option>\n       <option value=\"Over 10 Years Old\">Over 10 Years Old</option>\n       </select>\n      </div>\n      <div class=\"clear\"></div>\n      <div id=\"mg-sched-options-datetime\">\n      <div id=\"mg-sched-options-date\">\n      <div class=\"label left f-addr\">What day is best for you?</div>\n      <div class=\"clear\"></div>\n      <div class=\"txtdiv left f-date\">\n       <select name=\"LeadRequestedDate\" id=\"LeadRequestedDate\" class=\"f-date\">\n       <option value=\"\" selected>Please choose...</option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       <option></option>\n       </select>\n      </div>\n      <div class=\"clear\"></div>\n      </div>\n      <div id=\"mg-sched-options-time\">\n      <div class=\"label left\">What time would you prefer?<span class=\"footnote sup\">1</span>&nbsp;</div>\n      <div class=\"txtdiv left f-time\">\n       <select name=\"LeadRequestedTime\" id=\"LeadRequestedTime\" class=\"f-time\">\n       <option value=\"\" selected>Please choose...</option>\n       <option value=\"8\">8:00 AM</option>\n       <option value=\"8.5\">8:30 AM</option>\n       <option value=\"9\">9:00 AM</option>\n       <option value=\"9.5\">9:30 AM</option>\n       <option value=\"10\">10:00 AM</option>\n       <option value=\"10.5\">10:30 AM</option>\n       <option value=\"11\">11:00 AM</option>\n       <option value=\"11.5\">11:30 AM</option>\n       <option value=\"12\">12:00 PM</option>\n       <option value=\"12.5\">12:30 PM</option>\n       <option value=\"13\">1:00 PM</option>\n       <option value=\"13.5\">1:30 PM</option>\n       <option value=\"14\">2:00 PM</option>\n       <option value=\"14.5\">2:30 PM</option>\n       <option value=\"15\">3:00 PM</option>\n       <option value=\"15.5\">3:30 PM</option>\n       <option value=\"16\">4:00 PM</option>\n       <option value=\"16.5\">4:30 PM</option>\n       <option value=\"17\">5:00 PM</option>\n       <option value=\"17.5\">5:30 PM</option>\n       <option value=\"18\">6:00 PM</option>\n       </select>\n      </div>\n      <div class=\"clear\"></div>\n      </div>\n      <div class=\"left footnote\"><span class=\"sup\">1</span> <i>appointment dates/times subject to availability</i></div>\n      <div class=\"clear\"></div>\n      </div>\n     </div>\n    </div>\n    <div class=\"clear\"></div>\n   </div>\n   <div id=\"mg-sched-ft\">\n    <div id=\"mg-sched-form-tips\" class=\"label left\"><input type=\"checkbox\" id=\"LeadTips\" name=\"LeadTips\" value=\"true\" \><label for=\"LeadTips\" style=\"\">Send me HVAC offers and helpful tips</label></div>\n    <div class=\"label left\">Message/Comments/Additional Info:</div>\n    <div class=\"clear\"></div>\n    <div class=\"left f-msg\"><textarea id=\"LeadComments\" name=\"LeadComments\" class=\"f-msg\"></textarea></div>\n    <div class=\"clear\"></div>\n    <div class=\"left\" style=\"display:block;\" id=\"mgConvBar\"></div>\n    <div id=\"LeadComments_lct\" class=\"txtdiv left\" style=\"margin:2px;font-size:10px;width:30px;text-align:left\"></div>\n    <div class=\"txtdiv right f-submit\">\n    <input type=\"button\" id=\"btnSubmit\" name=\"btnSubmit\" onClick=\"MG_submitForm('mg-sched-form');return MG_validateForm('[!!]LeadName,[!1][~1]LeadEmail,[!1]LeadPhone,[!!]LeadComments,[@1]mg-sched-options-open,[~1]LeadZipCode,[~1]LeadNeed,[~1]LeadRequestedDate,[~1]LeadRequestedTime');\" value=\"Submit\" class=\"f-submit\"/>\n    </div>\n    <div class=\"clear\"></div>\n   </div>\n   <div id=\"mg-sched-internal\">\n    <input type=\"hidden\" name=\"AppointmentForm\" id=\"mg-sched-options-open\" value=\"\" /> \n    <input type=\"hidden\" name=\"LeadCity\" id=\"LeadCity\" value=\"\" />\n    <input name=\"ReturnPage\" type=\"hidden\" id=\"ReturnPage\" value=\"\" />\n    <input name=\"LeadCampaign\" id=\"LeadCampaign\" type=\"hidden\" value=\"\" />\n    <input name=\"AccountNumber\" id=\"AccountNumber\" type=\"hidden\" value=\"\" />\n    <input name=\"adGroup\" id=\"adGroup\" type=\"hidden\" value=\"\" />\n    <input name=\"ExternalEmail\" id=\"ExternalEmail\" type=\"hidden\" value=\"\" />\n    <input name=\"InternalEmail\" id=\"InternalEmail\" type=\"hidden\" value=\"\" />\n   </div>\n   </fo"+"rm>\n   <div id=\"mg-alert\"><div id=\"mg-alert-box\"><div id=\"mg-alert-header\"></div><div id=\"mg-alert-cbody\"></div><div id=\"mg-alert-footer\"></div></div></div>\n   </div>\n  </div><div style=\"clear:both;\"></div>";newDiv=document.createElement('div');newDiv.innerHTML=mgFormHtml;document.getElementById('mg-formcontainer').appendChild(newDiv);mgSetup();}else{if(mgLoadTimer<=50){t=setTimeout("mgGo()",200);}else{if(mgPageOne.Path.host.search(/localhost/)==-1){mgPageOne.reportError("Check for main container DIV (mg-formcontainer) failed","mgGo",true);}else{alert("Setup Error: Form HTML failed to load. If there is not supposed to be \n a form on this page, remove the call to MediagisticFunctions.js and\n the HTML form container.")}}}}
function mgSetup(){var t;mgLoadTimer++;if(document.getElementById('mg-alert')){mgPageOne.parseLinks();$('#mg-sched-options').hide();$('#mg-sched-options-datetime').hide();$.ajaxSetup({cache:false});QueryDataCheck();lpConfig();mgCheckSetup();}else{if(mgLoadTimer<=150){t=setTimeout("mgSetup()",200);}else{if(mgPageOne.Path.host.search(/localhost/)==-1){mgPageOne.reportError("Failed to locate JS-written form div (mg-alert).","mgSetup",true);}else{alert("Setup Error: Form HTML failed to load. If there is not supposed to be \na form on this page, remove the call to MediagisticFunctions.js.")}}}}
function mgCheckSetup(){var i,f,u,chkRC,chkFO,chkCI,errors='';if(mgPageOne.Path.isHome==true&&mgPageOne.RelevantCopy.content[0]!='nothing'){for(i=0;i<mgPageOne.RelevantCopy.content.length;i++){if(!document.getElementById(mgPageOne.RelevantCopy.content[i])){errors+=' - Missing Relevant Copy: '+mgPageOne.RelevantCopy.content[i]+'.\n';}}}
if(mgPageOne.configCount<1||mgPageOne.qdataCount<1){errors+=' - Outdated OnLoad calls detected.\n';}
if(errors!=''&&mgPageOne.Path.host.search(/localhost/)!=-1){mgPageOne.reportError(errors,"mgCheckSetup",false);}}
function MG_GetWinSize(i){if(i=="x"){if(window.innerWidth){return window.innerWidth;}else if(document.body.clientWidth){return document.body.clientWidth;}else{return window.innerWidth;}}else{if(window.innerHeight){return window.innerHeight;}else if(document.documentElement.clientHeight){return document.documentElement.clientHeight;}else{return window.innerHeight;}}}
function MG_showHide(tgt){var target=$('#'+tgt);if(target.is(":visible")){target.fadeOut(600);}else{target.hide();target.fadeIn(600);}}
function MG_formShowHide(targetDiv,indChk){var x,y,z,x_status,x_dt;x=targetDiv;x_status=document.getElementById(x).style.display;x_dt=x+'-datetime';var jx=$('#'+targetDiv);var jx_dt=$("#"+x_dt);if(mgPageOne.FormOptions.isScheduler==true){if(jx.is(":hidden")){jx.slideDown('fast');}
if(jx_dt.is(":hidden")){jx_dt.slideDown('fast');}else{jx_dt.slideUp('fast');}}else{if(jx.is(":hidden")){jx.slideDown('fast');if(jx_dt.is(":hidden")){jx_dt.slideDown('fast');}}else{jx.slideUp('fast');}}
y=targetDiv+'-ind';z=targetDiv+'-open';if(indChk){if(document.getElementById(z).value=='false'){document.getElementById(z).value='true';document.getElementById(y).checked=true;}else{document.getElementById(z).value='false';document.getElementById(y).checked=false;}}}
function MG_submitForm(theForm){mgFormName=theForm;mgValidateAndGo=true;}
function MG_joinFields(a,b,tgt){a=document.getElementById(a).value;b=document.getElementById(b).value;addAndCity=a+", "+b;document.getElementById(tgt).value=addAndCity;}
function MG_validateForm(){MG_joinFields('LeadStreet','LeadCity_f','LeadCity');var i,y,t,v,q,gc=0,rg='',f=[],args=[],errors='';var re,re1,re2,re3,re4=new RegExp();args=!MG_validateForm.arguments[1]?MG_validateForm.arguments[0].split(","):MG_validateForm.arguments;re1=/[[]!!]/g;re2=/[[]!\d]/g;re3=/[[]@\d]/g;re4=/[[]~\d]/g;i=0;while(i<args.length){f[i]=[];f[i][0]=args[i];f[i][1]=f[i][0].replace(/[[]!!]|[[]!\d]|[[]@\d]|[[]~\d]/gi,'');if(f[i][0].search(re1)!=-1){f[i][2]=true;if(document.getElementById(f[i][1]).value==''){errors+=' - '+f[i][1]+" is required.\n";}}else{f[i][2]=false;}
if(f[i][0].search(re2)!=-1){for(y=1;y<=9;y++){re=new RegExp("[[]!"+y+"]","g");if(f[i][0].search(re)!=-1){f[i][3]=y;}}}else{f[i][3]=0;}
if(f[i][0].search(re3)!=-1){for(y=1;y<=9;y++){re=new RegExp("[[]@"+y+"]","g");if(f[i][0].search(re)!=-1){f[i][4]=y;}}}else{f[i][4]=0;}
if(f[i][0].search(re4)!=-1){for(y=1;y<=9;y++){re=new RegExp("[[]~"+y+"]","g");if(f[i][0].search(re)!=-1){f[i][5]=y;}}}else{f[i][5]=0;}
i++;}
i=0;while(i<f.length){if(f[i][4]!=0){if(document.getElementById(f[i][1]).value=="true"){v=f[i][4];for(y=0;y<f.length;y++){if((f[y][5]==v)&&(document.getElementById(f[y][1]).value=='')){errors+=' - '+f[y][1]+' is required.\n';}}}}
i++;}
for(i=0;i<f.length;i++){t=new Array();if(f[i][3]!=0){re=new RegExp(f[i][3]);if(rg.search(re)==-1){v=f[i][3];rg=rg+=', '+v;for(y=0;y<f.length;y++){if(f[y][3]==v){t[y]=f[y][1];}else{t[y]='nothing';}}
eg='';for(y=0;y<t.length;y++){re=new RegExp(t[y],"gim");if(((t[y]!='nothing')&&(document.getElementById(f[y][1]).value!=''))||((t[y]!='nothing')&&(errors.search(re)!=-1))){eg='ok';gc--;}}
if(eg!='ok'){errors+=' - One of the following: ';for(y=0;y<t.length;y++){if(t[y]!='nothing'){errors+=t[y]+', ';}}
errors+='is required.\n';}}}}
if(errors.search(/Email/gim)==-1){i=0
while(i<f.length){if(f[i][1].search(/Email/gi)!=-1&&document.getElementById(f[i][1]).value!=''){if(document.getElementById(f[i][1]).value.search(/[@]/g)==-1){errors+=' - The email address entered appears to be invalid. Please check spelling and try again.\n';}}
i++}}
if(errors.search(/Phone/gim)==-1){i=0
while(i<f.length){if(f[i][1].search(/Phone/gi)!=-1){if(document.getElementById(f[i][1]).value!=''){if(document.getElementById(f[i][1]).value.search(/[0-9]{3}-[0-9]{3}-[0-9]{4}/g)==-1){errors+=' - The phone number you entered appears to be incorrect.  Please use the format: \"999-999-9999\".\n';}}}
i++}}
errors=errors.replace(/Lead/gm,'');if(errors!=''){var alertmsg='Your request cannot be processed without the following information:\n'+errors;mgPageOne.showAlert(alertmsg);return false;}else{if(mgValidateAndGo==true){document.forms[mgFormName].submit();}
return true;}}
function mgReportConversion(){var strWrite="";tgtDiv=document.getElementById("mgConvBar");if(mgPageOne.ConversionData.useCD!=false){google_conversion_id=mgPageOne.ConversionData.gID;google_conversion_language="en";google_conversion_format="2";google_conversion_color="ffffff";google_conversion_label=mgPageOne.ConversionData.gLabel;google_conversion_value=mgPageOne.ConversionData.gValue;window.ysm_customData=new Object();window.ysm_customData.conversion="transId=,currency=,amount=";ysm_accountid=mgPageOne.ConversionData.yID;microsoft_adcenterconversion_domainid=587765;microsoft_adcenterconversion_cp=5050;microsoft_adcenterconversionparams=new Array();microsoft_adcenterconversionparams[0]="dedup=1";strWrite=strWrite+"<img height='1' width='1' style='border-style:none;' alt='' src='http://www.googleadservices.com/pagead/conversion/"+google_conversion_id+"/?label="+google_conversion_label+"&amp;guid=ON&amp;script="+google_conversion_value+"'/>";strWrite=strWrite+"<SCR"+"IPT language='JavaScript' type='text/javascript' "+"SRC=//"+"srv1.wa.marketingsolutions.yahoo.com"+"/script/ScriptServlet"+"?aid="+ysm_accountid+"></SCR"+"IPT>";strWrite=strWrite+"<IMG width='1' height='1' SRC='http://587765.r.msn.com/?type=1&cp=1&dedup=1'/>";}
if(mgPageOne.ConversionData.useCD2==true){var sw_loc=(("https:"==document.location.protocol)?"https://analytics.":"http://analytics.");strWrite=strWrite+"<scr"+"ipt src='"+sw_loc+"sitewit.com/sw.js' type='text/javascript'></scr"+"ipt>";strWrite=strWrite+"<scr"+"ipt type='text/javascript'>";strWrite=strWrite+" var sw = new _sw_analytics(); sw.id = '"+mgPageOne.ConversionData.swID+"'; sw.set_goal("+mgPageOne.ConversionData.swGoal+"); sw.register_page_view();";strWrite=strWrite+"</scr"+"ipt>";}
tgtDiv.innerHTML=strWrite;}
function lpConfig(){var f,p,lp,erMsg,hUrlB='',hUrl='';var formReturnPage=mgPageOne.Path.protocol+"://"+mgPageOne.Path.host+mgPageOne.Path.virtualPathClean+"?confirmation=Thank you. We have received your information. __n__If you requested an appointment, you will be contacted to confirm the date and time.";if(document.forms['mg-sched-form']){hUrlB+='/dpath/sem/'+formAcctNumber+'-'+formLeadCampaign+'/';hUrl='http://contact.heatingandairpros.com'+hUrlB;}else{if(mgPageOne.Path.host.search(/localhost/)!=-1){errMsg="Setup Error.\nA script was called prematurely. This is most likely due to \nobsolete onload calls in the BODY tag.";}else{errMsg="Page configuration error. Our technical team is being \nnotified. Please try again later. We apologize for any inconvenience.";mgPageOne.reportError("lpConfig() called prematurely - likely due to obsolete body tag calls","lpConfig",false);}}
document.getElementById("mg-sched-options-open").value="false";document.forms['mg-sched-form'].action=hUrl;document.getElementById("ExternalEmail").value=formExtEmail;document.getElementById("InternalEmail").value=formIntEmail;document.getElementById("ReturnPage").value=formReturnPage;document.getElementById("LeadCampaign").value=formLeadCampaign;document.getElementById("AccountNumber").value=formAcctNumber;mgMakeDatePullDown();if(mgPageOne.FormOptions.showDate==false){document.getElementById("mg-sched-options-date").style.display='none';document.getElementById("LeadRequestedDate").value=mgGetDateValue(1);}
if(mgPageOne.FormOptions.showTime==false){document.getElementById("mg-sched-options-time").style.display='none';document.getElementById("LeadRequestedTime").value=9;}
if(mgPageOne.FormOptions.isScheduler==true){MG_formShowHide('mg-sched-options','chk');}
if(isRedirect=='true'){mgReportConversion();}
mgPageOne.limitInput('LeadComments',1000,true);mgPageOne.configCount++;var $sched=$("#mg-sched-wrap");var fh=$sched.height();$("#mg-sched-form-tips").css({"text-align":"left","padding":"0 0 0.3em 0","height":"1.1em"});$("#LeadComments").parent().css({"margin-top":"0.2em"});}
function reachAround(){}
function mgShowOverlay(tgt,hdMsg,cbMsg){var divOlBox=tgt+'-box';var divTitle=tgt+'-header';var divCBody=tgt+'-cbody';hdMsg+='<div id=\"mg-alert-topclose\" onclick=\"mgPageOne.showHide(\''+tgt+'\',\'fade\',\'fast\');\" title=\"close\"></div>';document.getElementById(divTitle).innerHTML=hdMsg;var cbMsg=cbMsg.replace(/ - /gm," &bull;");cbMsg=cbMsg.replace(/\n/gm,"<br/>");var closeBtn='<div align=\"center\"><div style=\"float:right;margin-right:75px;margin-top:4px;margin-bottom:4px;\"><input type=\"button"\ id=\"mg-alert-close\" value=\" OK \" onclick=\"mgPageOne.showHide(\''+tgt+'\',\'fade\',\'fast\');\" /></div><div style=\"clear:both;\"></div>';document.getElementById(divCBody).innerHTML=cbMsg;document.getElementById(tgt+'-footer').innerHTML=closeBtn;document.getElementById(tgt).style.visibility='hidden';document.getElementById(tgt).style.display='block';var boxHeight=document.getElementById(divOlBox).offsetHeight;var winHHalf=Math.round(MG_GetWinSize("y")/2);var boxHHalf=Math.round(boxHeight/2);var boxTop=winHHalf-boxHHalf;document.getElementById(divOlBox).style.top=boxTop+'px';document.getElementById(tgt).style.display='block';document.getElementById(tgt).style.visibility='visible';}
function mgMakeDatePullDown(){var i=1;while(i<=14)
{document.getElementById("LeadRequestedDate").options[i].text=mgGetDateText(i);document.getElementById("LeadRequestedDate").options[i].value=mgGetDateValue(i);i++;}
var t=setTimeout("mgRemoveDaysClosed()",200);}
function mgRemoveDaysClosed(){var i=1;var tgtList=document.getElementById("LeadRequestedDate");var tagForRemoval=new Array("no","no","no","no","no","no","no","no","no","no","no","no","no","no");while(i<=14){var optionIndex=tgtList.options[i];var optText=optionIndex.text;var optValue=optionIndex.value;if(mgPageOne.FormOptions.showSaturday==false&&tagForRemoval[i]!="yes"){if(optText.search(/Saturday/)!=-1){tagForRemoval[i]="yes";}else{tagForRemoval[i]="no";}}
if(mgPageOne.FormOptions.showSunday==false&&tagForRemoval[i]!="yes"){if(optText.search(/Sunday/)!=-1){tagForRemoval[i]="yes";}else{tagForRemoval[i]="no";}}
i++;}
i=13;while(i>=0){if(tagForRemoval[i]=="yes"){tgtList.remove(i);}
i=i-1;}}
function mgGetDateText(i){var myDate=new Date();var tempDateStr=""
myDate.setDate(myDate.getDate()+i);var tempdayofMonth=myDate.getDate();var tempdayofWeek=myDate.getDay();var tempmonth=myDate.getMonth()+1;var tempyear=myDate.getYear();if(tempyear<2000){tempyear=tempyear+1900;}
tempDateStr=mgGetDayofWeek(tempdayofWeek)+', '+mgGetMonthofYear(tempmonth)+' '+tempdayofMonth+', '+tempyear;return tempDateStr;}
function mgGetDateValue(i){var myDate=new Date();var tempDateStr=""
myDate.setDate(myDate.getDate()+i);var tempdayofMonth=myDate.getDate();var tempmonth=myDate.getMonth()+1;var tempyear=myDate.getYear();if(tempyear<2000){tempyear=tempyear+1900;}
tempDateStr=tempmonth+'/'+tempdayofMonth+'/'+tempyear;return tempDateStr;}
function mgGetDayofWeek(tempdayofWeek){switch(tempdayofWeek)
{case 0:return'Sunday';case 1:return'Monday';case 2:return'Tuesday';case 3:return'Wednesday';case 4:return'Thursday';case 5:return'Friday';default:return'Saturday'}}
function mgGetMonthofYear(tempmonth){switch(tempmonth){case 1:return'January';case 2:return'February';case 3:return'March';case 4:return'April';case 5:return'May';case 6:return'June';case 7:return'July';case 8:return'August';case 9:return'September';case 10:return'October';case 11:return'November';default:return'December';}}
function mgPageInfo(){this.FormOptions=new MG_FormOptions();this.RelevantCopy=new MG_RelevantCopy();this.ConversionData=new MG_ConversionData();this.configCount=0;this.qdataCount=0;this.commonFilePath="http://contact.heatingandairpros.com/semforms/standard/";if(this.FormOptions.useCommonFiles){if(this.FormOptions.useCommonFiles==false){this.commonFilePath="mediagistic/";}}
this.Path=new function(){this.rawURL=window.location.href;this.protocol="";this.host="";this.virtualPath="";this.virtualPathClean="";this.queryString="";this.fileName="";this.isHome=false;var tmp;tmp=this.rawURL.split("://");this.protocol=tmp[0];this.virtualPath=tmp[1];tmp=this.virtualPath.split("/");this.host=tmp[0];this.virtualPath=this.virtualPath.replace(this.host,"");if(this.virtualPath.search(/\?/)!=-1){tmp=this.virtualPath.split("?");this.virtualPathClean=tmp[0];this.queryString=tmp[1];}else{this.virtualPathClean=this.virtualPath;this.queryString="";}
tmp=this.virtualPathClean.match(/[a-z0-9_]{1,}\.[a-z0-9_\#]{2,}$/gi);if(tmp==null){this.fileName="default_document";}else{this.fileName=tmp[0];}
if(this.fileName.search(/[default|index|home]|[internet_specials]/gi)!=-1){this.isHome=true;}else{this.isHome=false;}}}
mgPageInfo.prototype.xClick=function(tgturi,tgt){var sysMsg=document.getElementById("LeadComments").value+" [!br!][#MG-DFCR-1#]";var msgCache=document.getElementById("LeadComments").value;if(document.getElementById("LeadRequestedDate").value==""){document.getElementById("LeadRequestedDate").value=mgGetDateValue(1);}
if(document.getElementById("LeadRequestedTime").value==""){document.getElementById("LeadRequestedTime").value=9;}
document.getElementById("LeadComments").value=sysMsg;var qspfx="?";if(tgturi.search(/\?/)!=-1){qspfx="&";}
document.getElementById("ReturnPage").value=tgturi+qspfx+"SEMredirect=true&cid="+$("#LeadCampaign").val();if(!tgt){tgt="_self";}
document.forms['mg-sched-form'].target=tgt;document.forms['mg-sched-form'].submit();document.forms['mg-sched-form'].target="_self";document.getElementById("LeadComments").value=msgCache;}
mgPageInfo.prototype.parseLinks=function(){var x,i,p,p2;if(!typeof(MG_FormOptions.parseExternalLinks)){mgRewriteLinks=MG_FormOptions.parseExternalLinks;}
if(mgRewriteLinks==true){$('a[href^="http"]').each(function(i){p=$(this).attr('href').split('://');p2=p[1].split('/');t=$(this).attr('target');if(p[0]=="http"||p[0]=="https"){$(this).bind("click",function(){mgPageInfo.prototype.xClick(this.href,this.target);return false;});}});}}
mgPageInfo.prototype.reportError=function(errmsg,callingFunction,isFatal){var reportHandler='http://contact.heatingandairpros.com/semleads/reportClientSideError.asmx/processReport';if(reportHandler!=''){var errorData="errorMessage="+errmsg+"&callingFunction="+callingFunction+"&isFatal="+isFatal+"&fromURL"+window.location.href+"&accountNumber="+formAcctNumber+"&leadCampaign="+formLeadCampaign+"&internalEmail="+formIntEmail;}}
mgPageInfo.prototype.showAlert=function(themsg){if(this.FormOptions.richAlerts){if(this.FormOptions.richAlerts==true){mgShowOverlay('mg-alert','Alert',themsg);}else{alert(themsg);}}else{alert(themsg);}}
mgPageInfo.prototype.showHide=function(tgt,effect,speed){var target=$("#"+tgt);var fxtype='fade',fxtime='fast',h,w,indA,indB,theHtml;var hasInd=false;if(target.siblings(".mgIndExpand")){hasInd=true;indA=target.siblings(".mgIndExpand");indB=target.siblings(".mgIndCollapse");}
if(effect){fxtype=effect;}
if(speed){fxtime=speed;}
if(target.is(":visible")){if(fxtype=="slide"){target.slideUp(fxtime);}else{target.fadeOut(fxtime);}}else{target.css("display","block");h=target.height()+"px";target.css("height",h);target.css("display","none");target.hide();if(fxtype=="slide"){target.slideDown(fxtime);}else{target.fadeIn(fxtime);}}
if(hasInd==true){if(indA.is(":visible")){indA.hide();indB.show();}else{indB.hide();indA.show();}}
if(target.siblings(".mgIndOther")){var otherInd=target.siblings(".mgIndOther");if(otherInd.is(":hidden")){otherInd.show();}else{otherInd.hide();}}}
mgPageInfo.prototype.swapDiv=function(tgtDivA,tgtDivB,baseDiv){var divA,divB,useBase="";if(baseDiv){useBase=baseDiv;}
divA=$("#"+useBase+tgtDivA);divB=$("#"+useBase+tgtDivB);if(div1.is(":visible")){div1.hide();div2.show();}else{div2.show();div1.hide();}}
mgPageInfo.prototype.prodImgZoom=function(tgtId,smSize,lgSize){var tgt=$("#"+tgtId);var isSquare,tgtSize=[],wHsm=[],wHlg=[],i;if(smSize.search(/x/i)!=-1){isSquare=false;wHsm=smSize.split("x");sHlg=lgSize.split("x");}else{isSquare=true;for(i=0;i<2;i++){wHsm[i]=smSize;wHlg[i]=lgSize;}}
if(tgt.width()==smSize){tgtSize[0]=parseInt(wHlg[0]);tgtSize[1]=parseInt(wHlg[1]);}else{tgtSize[0]=parseInt(wHsm[0]);tgtSize[1]=parseInt(wHsm[1]);}
tgt.animate({width:tgtSize[0],height:tgtSize[1]},400);}
mgPageInfo.prototype.toggleProductDetail=function(productId,effect,speed,smImgSize,lgImgSize){var tgtImg="img-"+productId;mgPageInfo.prototype.showHide(productId,'slide','fast');mgPageInfo.prototype.prodImgZoom(tgtImg,smImgSize,lgImgSize);}
mgPageInfo.prototype.scrollPageTo=function(tgtElementById,offsetPx){var tgt=$("#"+tgtElementById);var tgtY=tgt.offset();if(!offsetPx){offsetPx=0;}
var adjScroll=tgtY.top+offsetPx;$('html, body').animate({scrollTop:adjScroll},500);}
mgPageInfo.prototype.limitInput=function(tgtElementById,maxsize,showCount){var $tgt=$('#'+tgtElementById);if(showCount==true){$('#'+tgtElementById+'_lct').fadeTo('fast',0.3);$('#'+tgtElementById+'_lct').text(maxsize);$('#'+tgtElementById).keyup(function(){mgPageOne.limitedInputCounter(tgtElementById,maxsize);});}
$('#'+tgtElementById).keypress(function(){var t=$(this).val().length;var tmp,c;c=maxsize-1;if(t>=maxsize){tmp=$(this).val();$(this).val(tmp.substr(0,c));}});$('#'+tgtElementById).blur(function(){var t=$(this).val().length;var tmp,c;c=maxsize-1;if(t>=maxsize){tmp=$(this).val();$(this).val(tmp.substr(0,c));}
mgPageOne.limitedInputCounter($(this).attr('id'),maxsize);});}
mgPageInfo.prototype.limitedInputCounter=function(el,maxsize){var $el=$('#'+el);var $liveCt=$('#'+el+'_lct');var tval=$('#'+el).val();var charsNow=parseInt(tval.length);var charsLeft=maxsize-charsNow;$liveCt.text(charsLeft);}
