function DialogBox(title, htmlContent, close){var full=false;if(close!=null&&close==true){full=true;}if(document.getElementById('dlgBx')!=null){closeDialogBox();}var dlgBx=document.createElement('div');dlgBx.className="dlgBx";dlgBx.setAttribute("id","dlgBx");dlgBx.innerHTML='<div class="dlgtitlebar"><div class="dlg'+(full?'full':'')+'title">'+title+'</div>'+(full?'':'<a href="#" class="dlgclose" id="dlgclose" onclick="closeDialogBox();return false;">X</a>')+'</div><div class="dlgbody">'+htmlContent+'</div>';document.body.appendChild(dlgBx);}function closeDialogBox(){endBusy();rmChild('dlgBg');rmChild('dlgBx');}function getWindowWidth(){var w = 0;if(typeof(window.innerWidth)=='number'){w = window.innerWidth;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){w = document.documentElement.clientWidth;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight ) ){w = document.body.clientWidth;}return w;}function getWindowHeight(){var w = 0;if(typeof(window.innerHeight)=='number'){w = window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientHeight||document.documentElement.clientHeight)){w = document.documentElement.clientHeight;}else if(document.body&&(document.body.clientHeight||document.body.clientHeight ) ){w = document.body.clientHeight;}return w;}function ctrack(c,a,ol){if(typeof track=='function')track(c,a,ol);}var openPagesInNewWindow=false;var openPagesInline=true;var cUrl=null;function OpenPage(title,url,lUrl){if(document.getElementById('dlgBx')!=null){ctrack('op','clwin');closeDialogBox();}cUrl=lUrl?lUrl:url;if(cUrl.indexOf('http')!=0){var t=cUrl;if(t.indexOf('/')!=0){cUrl='http://www.myscenicdrives.com/';
}else{cUrl='http://www.myscenicdrives.com';
}cUrl+=t;}if(openPagesInNewWindow){var nw=window.open(cUrl,'_blank');if(nw){ctrack('op','newwin');return true;}}if(openPagesInline){document.location=cUrl;return false;}if(getWindowWidth()<850||getWindowHeight()<550){document.location=cUrl;ctrack('op','smwin');return false;}ctrack('op','inline');var dlgBx=document.createElement('div');dlgBx.className="openPg";dlgBx.setAttribute("id","dlgBx");dlgBx.innerHTML='<div class="dlgtitlebar" id="dlgtitlebar"><div class="dlgtitle">'+title+'</div><div class="dlgbuttons"><a href="'+cUrl+'" class="dlgexpand" id="dlgexpand" title="Full browser view">[]</a><a href="#" class="dlgclose" onclick="closeDialogBox();return false;" id="dlgclose" title="Close">X</a></div></div><div class="clear"></div><div class="dlgbody" id="dlgbdc"></div>';document.body.appendChild(dlgBx);document.getElementById('dlgbdc').innerHTML='<iframe src=\"'+url+'\">Loading '+url+'</iframe>';startBusy(false);return true;}function startBusy(shouldBg){if(document.getElementById('busy')!=null){endBusy();}var hasBg=true;if(shouldBg!=null&&shouldBg==false){hasBg=false;}if(hasBg){var busyBg=document.createElement('div');busyBg.className="busyBg";busyBg.setAttribute("id","busyBg");document.body.appendChild(busyBg);}var busy=document.createElement('div');busy.className="busy";busy.setAttribute("id","busy");busy.innerHTML='<img src="/busy.gif" id="busypict" />';document.body.appendChild(busy);}function endBusy(){rmChild('busy');rmChild('busyBg');}function rmChild(id){var e=document.getElementById(id);if(e!=null)document.body.removeChild(e);}function drawLink(link,soc){if(document.getElementById('dlgBx')==null){DialogBox('Share the link', '<div class="share"><p>Paste link in e-mail or IM</p><p><input type=\"text\" value=\"'+link+'\" size=\"50\" id=\"sharelink\" onFocus=\"select(); return false;\"/></p><p><div id=\"socshare\"></div></p><p><input type=\"submit\" value=\"Close\" onClick=\"closeDialogBox();return false;\" /></p></div>',false);document.getElementById('sharelink').focus();if(soc){document.getElementById('socshare').innerHTML='<p>'+soc+'</p>';}}}function isInPoly(points,ptLat,ptLong){var lat=new Array();var lng=new Array();for (var i=0;i<points.length/2;++i){var p=i*2;lat.push(points[p]-ptLat);lng.push(points[p+1]-ptLong);}var lC=0;var rC=0;for (var i=0;i<lat.length;++i){var ptLa=lat[i];var ptLo=lng[i];var np=(i+(lat.length-1))%lat.length;var npLa=lat[np];var npLo=lng[np];if(ptLo==0&&ptLa==0){return true;}var rStad=(ptLa>0)!=(npLa>0);var lStad=(ptLa<0)!=(npLa<0);if(rStad||lStad){var x=(ptLo*npLa-npLo*ptLa)/(npLa-ptLa);if(x>0&&rStad){++rC;}if(x<0&&lStad){++lC;}}}if((rC%2)!=(lC%2)){return true;}return (rC%2)==1;}/* imported from http:/www.JSON.org/json2.js */if(!this.JSON){ this.JSON ={}; }(function (){function f(n){return n < 10 ? '0' + n : n;}if(typeof Date.prototype.toJSON !== 'function'){Date.prototype.toJSON = function (key){return isFinite(this.valueOf()) ?this.getUTCFullYear()   + '-' +f(this.getUTCMonth() + 1) + '-' +f(this.getUTCDate())      + 'T' +f(this.getUTCHours())     + ':' +f(this.getUTCMinutes())   + ':' +f(this.getUTCSeconds())   + 'Z' : null;};String.prototype.toJSON =Number.prototype.toJSON =Boolean.prototype.toJSON = function (key){return this.valueOf();};}var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta ={'\b': '\\b','\t': '\\t','\n': '\\n','\f': '\\f','\r': '\\r','"' : '\\"','\\': '\\\\'},rep;function quote(string){escapable.lastIndex = 0;return escapable.test(string) ?'"' + string.replace(escapable, function (a){var c = meta[a];return typeof c === 'string' ? c :'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);}) + '"' :'"' + string + '"';}function str(key, holder){var i,k,v,length,mind = gap,partial,value = holder[key];if(value && typeof value === 'object' &&typeof value.toJSON === 'function'){value = value.toJSON(key);}if(typeof rep === 'function'){value = rep.call(holder, key, value);}switch (typeof value){case 'string':return quote(value);case 'number':return isFinite(value) ? String(value) : 'null';case 'boolean':case 'null':return String(value);case 'object':if(!value){return 'null';}gap += indent;partial = [];if(Object.prototype.toString.apply(value) === '[object Array]'){length = value.length;for (i = 0; i < length; i += 1){partial[i] = str(i, value) || 'null';}v = partial.length === 0 ? '[]' :gap ? '[\n' + gap +partial.join(',\n' + gap) + '\n' +mind + ']' :'[' + partial.join(',') + ']';gap = mind;return v;}if(rep && typeof rep === 'object'){length = rep.length;for (i = 0; i < length; i += 1){k = rep[i];if(typeof k === 'string'){v = str(k, value);if(v){partial.push(quote(k) + (gap ? ': ' : ':') + v);}}}} else{for (k in value){if(Object.hasOwnProperty.call(value, k)){v = str(k, value);if(v){partial.push(quote(k) + (gap ? ': ' : ':') + v);}}}}v = partial.length === 0 ? '{}' :gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +mind + '}' : '{' + partial.join(',') + '}';gap = mind;return v;}}if(typeof JSON.stringify !== 'function'){JSON.stringify = function (value, replacer, space){var i;gap = '';indent = '';if(typeof space === 'number'){for (i = 0; i < space; i += 1){indent += ' ';}} else if(typeof space === 'string'){indent = space;}rep = replacer;if(replacer && typeof replacer !== 'function' &&(typeof replacer !== 'object' ||typeof replacer.length !== 'number')){throw new Error('JSON.stringify');}return str('',{'': value});};}if(typeof JSON.parse !== 'function'){JSON.parse = function (text, reviver){var j;function walk(holder, key){var k, v, value = holder[key];if(value && typeof value === 'object'){for (k in value){if(Object.hasOwnProperty.call(value, k)){v = walk(value, k);if(v !== undefined){value[k] = v;} else{delete value[k];}}}}return reviver.call(holder, key, value);}cx.lastIndex = 0;if(cx.test(text)){text = text.replace(cx, function (a){return '\\u' +('0000' + a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))){j = eval('(' + text + ')');return typeof reviver === 'function' ?walk({'': j}, '') : j;}throw new SyntaxError('JSON.parse');};}}());function getComputedRealXY(obj){var curleft=curtop=0;if(obj.offsetParent){do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);return [curleft,curtop];}}function getStyle(el, style){if(!document.getElementById) return;var value = el.style[toCamelCase(style)];if(!value)if(document.defaultView)value = document.defaultView.getComputedStyle(el, "").getPropertyValue(style);else if(el.currentStyle)value = el.currentStyle[toCamelCase(style)];return value;}function toCamelCase(s){return s;}function getHttpRequest(){var httpRequest=null;if(window.XMLHttpRequest){httpRequest=new XMLHttpRequest();}else if(window.ActiveXObject){httpRequest=newActiveXObject("Microsoft.XMLHTTP");}else{alert("An error has occurred; please contact us (httpReq).");}return httpRequest;}function sendMail(f,s,r,cb,oe){var params='js=&f='+encodeURIComponent(f)+'&s='+encodeURIComponent(s)+'&r='+encodeURIComponent(r);var hr=getHttpRequest();hr.open('POST','/ContactUs.html',true);hr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');startBusy();hr.onreadystatechange=function(){if(hr.readyState!=4){return;}endBusy();var m;try{m=JSON.parse(hr.responseText);}catch(e){oe('An unknown error ocurred.  Please try again in a few minutes.');return;}if('error' in m){oe(m.error);return;}else{cb();}};hr.send(params);}FileUpload={mkframe : function(c){var n='msd'+Math.floor(Math.random()*79797);var d=document.createElement('div');d.innerHTML='<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="FileUpload.loaded(\''+n+'\')"></iframe>';document.body.appendChild(d);var i=document.getElementById(n);i.onComplete=c.onComplete;return n;},form:function(f,name){f.setAttribute('target',name);},submit:function(f,c){FileUpload.form(f,FileUpload.mkframe(c));return c.onStart();},loaded:function(id){var i=document.getElementById(id);var d=null;if(i.contentDocument){d=i.contentDocument;}else if(i.contentWindow){d=i.contentWindow.document;}else{d=window.frames[id].document;}if(d.location.href=="about:blank"){return;}var r=d.body.innerHTML;if(r.match('^<pre>.*<\/pre>$')){var pre='<pre>';r=r.substring(pre.length,r.length-(pre.length+1));}i.onComplete(r);}};var mobile=false;function createPOITip(p){rmChild('poiTip');var dt=document.createElement('div');dt.className="poiTip";dt.setAttribute("id","poiTip");var m=document.getElementById('maparea');if(m.style.position=='fixed'){dt.style.position='fixed';}else{dt.style.position='absolute';}dt.style.display='block';var off=getComputedRealXY(p);var left=off[0]-250;var top=off[1];if(left<=0){left=off[0];top+=100;}if(mobile){left=20;}dt.style.left=left+'px';dt.style.top=top+'px';dt.style.maxWidth='200px';dt.style.minWidth='150px';var onC="rmChild('poiTip');return false;";dt.innerHTML='<p><a href="#" onclick="'+onC+'">Close</a></p>';document.body.appendChild(dt);return dt;}function defaultElement(id,defaultTxt){var e=document.getElementById(id);if(e.placeholder&&elementSupportsAttribute('input','placeholder'))return true;var val=e.value;if(val==null||val==''){e.value=defaultTxt;addClass(e,'default_value');}else if(val==defaultTxt){addClass(e,'default_value');}e.onfocus=function(i){removeClass(e,'default_value');if(e.value==defaultTxt)e.value='';};e.onblur=function(){var val=e.value;if(val==null||val==''){e.value=defaultTxt;addClass(e,'default_value');}};}function addClass(e,v){if(!e.className){e.className=v;}else{var c=e.className;c+=' ';c+=v;e.className=v;}}function addClassL(e,v){return addClass(document.getElementById(e),v);}function hasClass(e,c){if(!e.className){return false;}return e.className.match('(\\s|^)'+c+'(\\s|$)');}function hasClassL(e,c){return hasClass(document.getElementById(e),c);}function removeClass(e,c){if(!e.className){return true;}var r='(\\s|^)'+c+'(\\s|$)';if(e.className.match(r)){e.className=e.className.replace(new RegExp(r),' ');}}function removeClassL(e,c){return removeClass(document.getElementById(e),c);}function maybeAdvance(c,l,n){if(document.getElementById(c).value.length==l){document.getElementById(n).focus();}}function setErrorField(b,e,err){if(e){document.getElementById(e).innerHTML=err;document.getElementById(b).style.display='block';}else{document.getElementById(b).style.display='none';}}var curForm;var lstD;var lstP;function uploadPicture(id,fl,va){curForm=id;lstD=fl;lstP=va;var func="'onStart':upload,'onComplete':uploaded";var f=document.getElementById(id);f.innerHTML='<div class="imgUpld"><h2>Share your pictures!</h2><p>Share your experience with our community by sharing your photographs.</p><p class="small">Approved pictures will be posted on this and other pages per our <a href="/About/terms.html">terms of use</a>.</p><p id="imgErr" class="error" style="display:none"><b>Error</b><span id="imgErrMsg"></span></p><form action="/image-uploader" method="post" onsubmit="if(document.getElementById(\'imgFile\').value==\'\'){document.getElementById(\'imgErrMsg\').innerHTML=\'Please select a file to upload.\';showElement(\'imgErr\');return false;}return FileUpload.submit(this,{'+func+'});" target="upldtgt" enctype="multipart/form-data"><input type="hidden" name="'+fl+'" value="'+va+'" /><p><label for="imgDesc">Description:</label> <input id="imgDesc" type="text" name="e" /></p><p><label for="imgFile">File:</label> <input id="imgFile" type="file" name="imgFile" /></p><input id="imgSubm" type="submit" value="Share" /> <div id="imgBusy" style="display:none">Please wait<img src="/small-busy.gif" alt="Please wait" /></div></form></div>';}function upload(){hideElement('imgErr');showElement('imgBusy');hideElement('imgSubm');hideElement('imgFile');return true;}function hideElement(id){var f=document.getElementById(id);f.style.display='none';}function showElement(id){var f=document.getElementById(id);f.style.display='block';}function showElementI(id){var f=document.getElementById(id);f.style.display='inline';}function isShown(id){var f=document.getElementById(id);return f.style.display!=''&&f.style.display!='none';}function uploaded(d){var done=false;try{var da=JSON.parse(d);done='success' in da;} catch(e){}if(!done){document.getElementById('imgErrMsg').innerHTML='An error occurred. Please try again.';showElement('imgErr');hideElement('imgBusy');showElement('imgSubm');showElement('imgFile');}var f=document.getElementById(curForm);var msg="'"+curForm+"'";f.innerHTML='<div class="imgUpldGood">Thanks for sharing! <a href="#" onclick="uploadPicture('+msg+',lstD,lstP);return false;">Share another picture?</a></div>';}function elementSupportsAttribute(e,a){var t=document.createElement(e);if(a in t)return true;return false;}function focusElement(e){if(!elementSupportsAttribute('input','autofocus')){document.getElementById(e).focus();}}var datePicker={calDiv : null,calForm : null,destId : null,dateToDisplay : null,onSet:null,getFirstDay:function(year,month){return new Date(year,month,1).getDay();},getMonthLen:function(year,month){var mo=new Date(year,month+1,1);mo.setHours(mo.getHours()-3);return mo.getDate();},populateTable:function(form){var today=new Date();var mo=form.chooseMonth.selectedIndex;var yr=parseInt(form.calyear.options[form.calyear.selectedIndex].text);var firstDay=this.getFirstDay(yr,mo);var howMany=this.getMonthLen(yr,mo);var dc=1;var tb=document.getElementById("caltb");while(tb.rows.length>0){tb.deleteRow(0);}var nr,nc,dateNum;var done=false;while(!done){nr=tb.insertRow(tb.rows.length);if(nr){for(var i=0;i<7;++i){nc=nr.insertCell(nr.cells.length);if(tb.rows.length==1&&i<firstDay){nc.innerHTML='&nbsp;';continue;}if(dc==howMany)done=true;if(dc<=howMany){if(this.dateToDisplay.getFullYear()==yr&&this.dateToDisplay.getMonth()==form.chooseMonth.selectedIndex&&this.dateToDisplay.getDate()==dc){nc.id='caltoday';}if(today.getFullYear()<yr||(today.getFullYear()==yr&&today.getMonth()>form.chooseMonth.selectedIndex)||(today.getFullYear()==yr&&today.getMonth()==form.chooseMonth.selectedIndex&&dc<today.getDate()))nc.innerHTML=dc;else{nc.innerHTML="<a href='#' onclick='datePicker.chooseDate("+dc+","+mo+","+yr+");return false;'>"+dc+"</a>";}dc++;}else{nc.innertHTML='&nbsp;';}}}else{done=true;}}},init:function(calDiv,calForm,destId,onSet){this.onSet=onSet;this.calDiv=calDiv;this.calForm=calForm;this.destId=destId;var off=getComputedRealXY(document.getElementById(destId));showElement(calDiv.id);this.calDiv.style.top=off[1]+'px';this.calDiv.style.left=off[0]+'px';this.fillYears();document.getElementById(destId).blur();document.getElementById('calprevmo').onclick=function(){if(calForm.chooseMonth.selectedIndex==0){if(calForm.calyear.selectedIndex==0)return false;else calForm.calyear.selectedIndex=calForm.calyear.selectedIndex-1;calForm.chooseMonth.selectedIndex=calForm.chooseMonth.options.length;}else{calForm.chooseMonth.selectedIndex=calForm.chooseMonth.selectedIndex-1;}calForm.chooseMonth.onchange(null);return true;};document.getElementById('calnextmo').onclick=function(){if(calForm.chooseMonth.selectedIndex==calForm.chooseMonth.options.length){if(calForm.calyear.selectedIndex==calForm.calyear.options.length)return false;}else{calForm.chooseMonth.selectedIndex=calForm.chooseMonth.selectedIndex+1;}calForm.chooseMonth.onchange(null);return true;};var today=new Date();var v=Date.parse(document.getElementById(this.destId).value);this.dateToDisplay=isNaN(v)||v<today.getMilliseconds()?today:new Date(v);calForm.chooseMonth.selectedIndex=this.dateToDisplay.getMonth();for(var i=0;i<calForm.calyear.options.length;++i){if(calForm.calyear.options[i].text==this.dateToDisplay.getYear()){calForm.calyear.selectedIndex=i;break;}}this.populateTable(calForm);},fillYears:function(){var today=new Date();var yr=today.getFullYear();var yearChooser=document.getElementById('calyear');for(i=yr;i<yr+5;++i){yearChooser.options[yearChooser.options.length]=new Option(i,i);}this.setCurrMonth(today);},setCurrMonth:function(today){document.getElementById("chooseMonth").selectedIndex=today.getMonth();},chooseDate:function(date,month,year){document.getElementById(this.destId).value=document.getElementById("chooseMonth").options[month].text+' '+date+', '+year;hideElement(this.calDiv.id);if(this.onSet)this.onSet();}}