function getSliderRealValue(slider,offset){if(slider.realValues){for(var key in slider.realValues)
if(offset<=parseInt(key,10))
return slider.realValues[key];}
return false;};YAHOO.example.Sliders=function(){var Dom=YAHOO.util.Dom;var Event=YAHOO.util.Event;var months,credit,amount;var initHoriz=function(){var bg="horizBGDiv",thumb="horizHandleDiv",valFld="horizDest",valFldHideForm="months";months=YAHOO.widget.Slider.getHorizSlider(bg,thumb,0,174,58);months.realValues={58:'Less than 12',116:'12-18',174:'More than 18'};months.subscribe("change",function(offset){var realValue=getSliderRealValue(this,offset);Dom.get(valFld).innerHTML=realValue;Dom.get(valFldHideForm).value=realValue;Dom.get(bg).title=realValue;});Dom.get(valFld).title=""};var initHoriz2=function(){var bg="horizBGDiv2",thumb="horizHandleDiv2",valFld="horizDest2",valFldHideForm="credit";credit=YAHOO.widget.Slider.getHorizSlider(bg,thumb,0,174,6);credit.realValues={15:"$2,500-$4,999",30:"$5,000-$7,499",45:"$7,500-$9,999",60:"$10,000-$12,499",75:"$12,500-$14,999",90:"$17,500-$19,999",105:"$20,000-$24,999",120:"$25,000-$29,999",135:"$30,000-$49,999",160:"$50,000-$99,999",174:"$100,000+"};credit.subscribe("change",function(offset){var realValue=getSliderRealValue(this,offset);Dom.get(valFld).innerHTML=realValue;Dom.get(valFldHideForm).value=realValue;Dom.get(bg).title=realValue;});Dom.get(valFld).title=""};var initHoriz3=function(){var bg="horizBGDiv3",thumb="horizHandleDiv3",valFld="horizDest3",valFldHideForm="amount";amount=YAHOO.widget.Slider.getHorizSlider(bg,thumb,0,174,29);amount.realValues={29:"$10K",58:"$10k-$25k",87:"$25k-$50k",116:"$50k-$100k",145:"$100k-$250k",174:"$250k+"};amount.subscribe("change",function(offset){var realValue=getSliderRealValue(this,offset);Dom.get(valFld).innerHTML=realValue;Dom.get(valFldHideForm).value=realValue;Dom.get(bg).title=realValue;});Dom.get(valFld).title=""};return{init:function(){initHoriz();initHoriz2();initHoriz3();},getValues:function(){return{months:months.getValue(),credit:credit.getValue(),amount:amount.getValue()};},setValues:function(vals){for(var key in vals){var lc=eval(key+'.thumb.leftConstraint');var rc=eval(key+'.thumb.rightConstraint');vals[key]=parseInt(vals[key],10);if(isNaN(vals[key]))
vals[key]=0;if(vals[key]>rc)
vals[key]=rc;if(vals[key]<lc)
vals[key]=lc;}
months.setValue(vals.months,true,true);credit.setValue(vals.credit,true,true);amount.setValue(vals.amount,true,true);}}}();function getQueryVariable(variable){var vars=window.location.search.substring(1).split("&");for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable){return pair[1];}}
return false;}
Event.observe(window,'load',function(){var miniForm=$('mini-form');var applyForm=$('apply-form');if(miniForm||applyForm){var s=YAHOO.example.Sliders;s.init();if(miniForm){Event.observe($('next-step'),'click',function(){var vals=s.getValues();window.location.href=miniForm.action+'?months='+vals.months+'&credit='+vals.credit+'&amount='+vals.amount;});}
if(applyForm){s.setValues({months:getQueryVariable('months'),credit:getQueryVariable('credit'),amount:getQueryVariable('amount')});Event.observe($('get-quote'),'click',function(event){applySubmit(event);});}}
if($('contact-form')){Event.observe($('contact-send'),'click',function(){contactSubmit();});}});function applySubmit(event){var isOk=true;var errors={};['company','name','phone','email'].each(function(e){$(e).value=$F(e).stripTags();if($F(e).strip().empty()){errors[e]='Please enter '+$(e).previous('label').innerHTML;fieldErrorAdd(e);isOk=false;}
else{fieldErrorRemove(e);}});if(!errors['email']&&!$F('email').match(/^.+\@.+\.[a-z]{2,}$/i)){errors[e]='Please enter valid Email';fieldErrorAdd('email');isOk=false;}
if(isOk){$('controls-container').hide();$('processing-container').show();trackYsmcc();trackGacc();trackAcc();trackGac();trackGwo();new PeriodicalExecuter(function(pe){location.replace(appendAnchor('thanks'));$('apply-form').request({onSuccess:function(transport){if(transport.responseText.match(/error/i)){$('processing-container').hide();$('done-container').show();}
else{$('processing-container').hide();$('done-container').show();}}});pe.stop();},3);}
else{var errorList=$('apply-popup').select('ul').first();errorList.update();for(var key in errors){new Insertion.Bottom(errorList,'<li>'+errors[key]+'</li>');}
var btnPos=Position.cumulativeOffset(Event.element(event));var x=btnPos[0]-400;var y=btnPos[1]-300;var e=new Popup('apply-popup',null,{modal:true,position:x.toString()+','+y.toString(),opacity:.4});e.show();}}
function contactSubmit(){var isOk=true;['subject','company','name','phone','email','message'].each(function(e){$(e).value=$F(e).stripTags();if($F(e).strip().empty()){fieldErrorAdd(e);isOk=false;}
else{fieldErrorRemove(e);}});if(!$F('email').match(/^.+\@.+\.[a-z]{2,}$/i)){fieldErrorAdd('email');isOk=false;}
if(isOk){trackGac();location.replace(appendAnchor('thanks'));$('contact-form').request({onSuccess:function(transport){$('contact-controls-container').hide();$('contact-done-container').show();}});}}
function fieldErrorAdd(e){$(e).addClassName('error');$(e).previous('label').addClassName('error');}
function fieldErrorRemove(e){$(e).removeClassName('error');$(e).previous('label').removeClassName('error');}
function emulateHover(e,defClass,overClass){e=$(e);if(!e){return false;}
Event.observe(e,'mouseover',function(){e.addClassName(overClass);e.removeClassName(defClass);});Event.observe(e,'mouseout',function(){e.addClassName(defClass);e.removeClassName(overClass);});}
function addScriptTag(url){if(url.strip().empty()){return false;}
var script=document.createElement('scr'+'ipt');script.src=url;script.type='text/javascript';$$('body').first().appendChild(script);}
window.ysm_customData=new Object();window.ysm_customData.conversion="transId=,currency=,amount=";var ysm_accountid="1N25BA5UP642F2D5GQ76BGHG8P8";function trackYsmcc(){addScriptTag('https://srv3.wa.marketingsolutions.yahoo.com/script/ScriptServlet?aid='+ysm_accountid);}
var google_conversion_id=1055004438;var google_conversion_language="en_US";var google_conversion_format="1";var google_conversion_color="ffffff";var google_conversion_label="50CBCMC-RBCWroj3Aw";function trackGacc(){Insertion.Bottom($$('body').first(),'<img style="position:absolute;top:0;left:-9999px;" height="1" width="1" border="0" src="https://www.googleadservices.com/pagead/conversion/'+google_conversion_id.toString()+'/?label='+google_conversion_label+'&amp;script=0"/>');}
microsoft_adcenterconversion_domainid=292438;microsoft_adcenterconversion_cp=5050;function trackAcc(){Insertion.Bottom($$('body').first(),'<img style="position:absolute;top:0;left:-9999px;" height="1" width="1" border="0" src="https://'+microsoft_adcenterconversion_domainid.toString()+'.r.msn.com/?type=1&cp=1"/>');}
function trackGac(page){if(!page){var pageUrl=window.location.href;if(pageUrl.match(/apply\./)){page='appy_conf';}
else if(pageUrl.match(/(landing_page\.|index\.)/)){page='lp_conf';}
else if(pageUrl.match(/contact\./)){page='contact_conf';}}
pageTracker._trackPageview(page);}
function trackGwo(){var pageUrl=window.location.href;if(pageUrl.match(/(landing_page\.|index\.)/)){urchinTracker("/3368102601/goal");}}
function appendAnchor(a,url){url=url||window.location.href;return url.replace(/#.*$/,'')+'#'+a;}