function writeSessionCookie(b,a){if(testSessionCookie()){document.cookie=escape(b)+"="+escape(a)+";domain=.motel6.com;path=/";return true}else{return false}}function getCookieValue(b){var a=new RegExp(escape(b)+"=([^;]+)");if(a.test(document.cookie+";")){a.exec(document.cookie+";");return unescape(RegExp.$1)}else{return false}}function testSessionCookie(){document.cookie="testSessionCookie=Enabled";if(getCookieValue("testSessionCookie")=="Enabled"){return true}else{return false}}function testPersistentCookie(){writePersistentCookie("testPersistentCookie","Enabled","minutes",1);if(getCookieValue("testPersistentCookie")=="Enabled"){return true}else{return false}}function writePersistentCookie(f,c,b,g){var d=new Date();g=g/1;var a=b;switch(a.toLowerCase()){case"years":var e=d.getYear();if(e<1000){e=e+1900}d.setYear(e+g);break;case"months":d.setMonth(d.getMonth()+g);break;case"days":d.setDate(d.getDate()+g);break;case"hours":d.setHours(d.getHours()+g);break;case"minutes":d.setMinutes(d.getMinutes()+g);break;default:break}document.cookie=escape(f)+"="+escape(c)+"; expires="+d.toGMTString()+";domain=.motel6.com;path=/"}function deleteCookie(a){if(getCookieValue(a)){writePersistentCookie(a,"Pending delete","years",-1)}return true}function findPos(a){var b=curtop=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;while(a=a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop}}return[b,curtop]}function setSurveySessionTrue(){var a;writePersistentCookie("SurveySessionID","1","years",1);a=getCookieValue("SurveySessionID");alert("surveysessionid true "+a);window.close()}function setSurveySessionFalse(){var a;writePersistentCookie("SurveySessionID","0","years",1);a=getCookieValue("SurveySessionID");alert("surveysessionid false "+a);window.close()}var popupDiv="";var takelogo='<div class="surveylogo" onclick="TakeMotel6Survey();"></div>';function getSessionIDPopup(){var b;var a="0";b=getCookieValue("SessionID");if(!b){b=Math.random();writePersistentCookie("SurveySessionID",b,"years",1);a="1"}return[b,a]}function surveytest(){var a=window.open("/index.php");if(a&&a.top){writeSessionCookie("TakeSurvey","0")}else{alert("The window has been blocked. Please allow popups from motel6.com and return to motel6.com to take survey.")}}function TakeMotel6Survey(){writeSessionCookie("TakeSurvey","0");window.location.href="http://www.motel6survey.com"}function DeclineSurvey(){writeSessionCookie("TakeSurvey","0");document.getElementById("SurveyAsk").innerHTML=""}function AcceptSurvey(){writeSessionCookie("TakeSurvey","1");'<div id="SurveyFollow"><div class="surveylogo" onclick="TakeMotel6Survey();"></div></div>';document.getElementById("SurveyAsk").innerHTML="";document.getElementById("SurveyFollow").innerHTML=takelogo}function egsurvey(){var c=window.location.hostname;var b=window.location.pathname;var a=getCookieValue("TakeSurvey");if(b=="/ms/my-motel6-login.do"||b=="/ms/reservation-confirmed.do"){egsurvey_new()}else{if(a=="1"){egsurvey_new()}}}function egsurvey_new(){var h=Math.random();var c=getSessionIDPopup();var e=getCookieValue("TakeSurvey");var f=c[0];var b=c[1];if(b=="1"){var d=findPos(document.getElementById("navHome"))[0];newleftEdge=d+200;var a='<style type="text/css"> .location {      position:fixed;     left:'+newleftEdge+'px;     top:10px;     border:2px solid #a9cFF4;} .outer {      padding-top:15px;     padding-bottom:30px;     padding-left:25px;     padding-right:25px;     background:#d1e6fb;     width:362px;} .buttons {  margin-top:5px;  float:right;}.copy {     border:1px solid #fff;      background:#a9cFF4;     padding-top:15px;     padding-left:25px;     padding-bottom:25px;     padding-right:25px;     font-family:Arial,Helvetica,sans-serif;     font-size:12px;} </style> <div id="SurveyAsk"><div class="location"><img src="https://www.goin6.com/motel6/survey_header.jpg"><div class="outer"><div class="copy">We would really appreciate it if you\'d answer a few quick questions about your experience here today.<ul><li>Just click "ok" below</li><li>Then click on the survey icon in the upper left hand corner when you\'re about to leave the site.</ul>The survey will only take a minute or two.<br/> Thanks.</div><div class="buttons">   <a href="" onclick="javascript:AcceptSurvey();"><img src="https://www.goin6.com/motel6/ok.gif" border="0"></a>   <a href="" onclick="javascript:DeclineSurvey();"><img src="https://www.goin6.com/motel6/cancel.gif" border="0"></a></div></div></div></div>';var g='<style type="text/css">.surveylogo {   cursor:pointer;   position: fixed;   left: 20px;   top: 0px;   width: 100px;   height: 100px;   border:1px solid #cccccc;   background: url(https://www.goin6.com/motel6/take_survey.gif); } </style><div id="SurveyFollow"></div>';document.write(a);document.write(g)}if(e=="1"){document.write('<style type="text/css"> .surveylogo { cursor:pointer; position: fixed; left: 20px; top: 0px; width: 100px; height: 100px; border:1px solid #cccccc; background: url(https://www.goin6.com/motel6/take_survey.gif); } </style> <div class="surveylogo" onclick="TakeMotel6Survey();"></div>')}}function showCookies(){var b=getCookieValue("SessionID");var a=getCookieValue("SurveySessionID");alert("sessionid "+b);alert("surveysessionid "+a)};