function initialRequestOLD()
{var theTime=new Date();weatherStart()
var xx=new myAJAX();xx.onComplete=function(t)
{weatherDone(t);};xx.url='results.php?zipcode='+document.getElementById('theZipcode').value+"&date="+theTime+"&action=zipcode";xx.makeRequest();return void(0);}
function initialRequest()
{var theTime=new Date();var so=new SWFObject('/golden_text_effect_4.swf',"weatherBox",350,100,"8");so.addParam("wmode","transparent");so.write("weatherBox");return void(0);}
function weatherStart()
{document.getElementById('weatherBox').innerHTML="<br />Loading weather";return void(0);}
function weatherDone(responseText,statusText)
{document.getElementById('weatherBox').innerHTML=responseText;return void(0);}
function goNav()
{document.getElementById('fullCoverNav').className='showMe';document.getElementById('centerBoxContentNav').innerHTML='<center><br style="line-height: 30px;"/><form target="_blank" action="navdemo.php">Website: <input style="width: 300px;" type="text" name="url" value="http://"/><input type="submit" value="see now!"/></form></center>';return void(0);}
function hideNavBox()
{document.getElementById('fullCoverNav').className='hideMe';return void(0);}
function theReturnKey(e)
{if(e==13)
{goSearch(document.getElementById('theSearchBox').value,document.getElementById('searchCategories').value);}
return void(0);}
function theReturnKey2(e)
{if(e==13)
{goSearch(document.getElementById('theSearchBox2').value,'');}
return void(0);}
function superClose(e)
{if(e==27)
{var theTime=new Date();hideCoupons();var dude=new Array();dude[0]='vnContent';dude[1]='trueCenterGalleryVideo';dude[2]='penContent';dude[3]='canmerchants';var i=0;for(i=0;i<dude.length;i++){document.getElementById(dude[i]).className='hideMe';}
for(i=0;i<dude.length;i++){document.getElementById(dude[i]).innerHTML='';}
for(i=0;i<dude.length;i++)
{var so=new SWFObject('/blank.swf',dude[i],1,1,"8");so.addParam("wmode","transparent");so.write(dude[i]);}}
return void(0);}
function goSearchNav(theTerm)
{goSearch(theTerm,document.getElementById('searchCategories').value);}
function goSearch(searchTerm,categoryID)
{scroll(0,0);superClose(27);document.getElementById('fullCover').className='showMe';document.getElementById('theLoading').className='theLoadingOn';document.getElementById('theSearchBox').value=searchTerm;makeSearch(searchTerm,categoryID);return void(0);}
function hideBox()
{document.getElementById('fullCover').className='hideMe';return void(0);}
var categoryID='';function showPictures()
{scroll(0,0);superClose(27);document.getElementById('fullCoverGallery').className='showMe';var theTime=new Date();var so=new SWFObject('picturegallery.swf',"trueCenterGalleryVideo",980,530,"8");so.addParam("wmode","transparent");so.write("trueCenterGalleryVideo");return void(0);}
function hideBoxGallery()
{document.getElementById('fullCoverGallery').className='hideMe';return void(0);}
function makeSearch(searchTerm,categoryID)
{var theTime=new Date();var theTerm=Base64.encode(searchTerm);theTerm=theTerm.replace(/=/g,"");var i;for(i=0;i<document.getElementById('searchCategories').options.length-1;i++)
{if(document.getElementById('searchCategories').options[i].value==categoryID)
{document.getElementById('searchCategories').options[i].selected=true;}}
document.getElementById('theFrameId').src='maps.php?term='+theTerm+"&category="+categoryID+"&date="+theTime;var xx=new myAJAX();xx.onComplete=function(t)
{document.getElementById('searchResults').innerHTML=t;document.getElementById('theLoading').className='theLoadingOff';};xx.url='results.php?term='+theTerm+"&category="+categoryID+"&date="+theTime;xx.makeRequest();return void(0);}
function centerMap(adress,city,state,zip)
{window.frames['theFrame'].gotoAddress(adress,city,state,zip);return void(0);}
function showTour()
{superClose(27);document.getElementById('penContent').className='';var theTime=new Date();var so=new SWFObject('tour.swf',"penContent",960,600,"8");so.addParam("wmode","transparent");so.addParam("allowScriptAccess","always");so.write("penContent");return void(0);}
function closePEN()
{document.getElementById('penContent').className='hideTownBox';document.getElementById('penContent').innerHTML='';return void(0);}
var vnWidth=800;var vnHeight=500;document.write('<div style="position:absolute; top: 50%; left:50%; z-index:997;">');document.write('<div id="vnContent" style="position:absolute; top: -'+(vnHeight/2.4)+'px; left: -'+((vnWidth/2.2)-40)+'px; z-index:998;"></div>');document.write('</div>');function showMyNav()
{superClose(27);document.getElementById('vnContent').style.display="block";document.getElementById('vnContent').className="";var theTime=new Date();var so=new SWFObject('vn.swf',"vnContent",vnWidth,vnHeight,"8");so.addParam("wmode","transparent");so.addParam("allowScriptAccess","always");so.write("vnContent");document.getElementById('thePageChangerHistoryThing').src=WS_ROOT+'/blank.php?navigator';return void(0);}
function showNavMovie(theQuestion)
{var theTime=new Date();var so=new SWFObject("thanks.swf","mymovie",250,250,"9");so.addParam("wmode","transparent");so.addParam("allowScriptAccess","always");so.write("vnPerson");return void(0);}
function showNavMovie2(theQuestion)
{var theTime=new Date();var so=new SWFObject("thanks.swf","mymovie",250,250,"9");so.addParam("wmode","transparent");so.addParam("allowScriptAccess","always");so.write("vnPerson");return void(0);}
function showTowns()
{document.getElementById('townContent').className='showTheTown';return void(0);}
function showTowns2()
{superClose(27);document.getElementById('townContent').className='showTheTown';return void(0);}
function hideTowns()
{document.getElementById('townContent').className='hideTownBox';return void(0);}
function showCoupons(theTerm)
{superClose(27);contentBox('coupons');return void(0);}
function contentBox(thePlace,theExtra)
{document.getElementById('thePageChangerHistoryThing').src=WS_ROOT+'/results.php?die=yes&place='+thePlace;superClose(27);document.getElementById('couponContent').className='showTheTown';document.getElementById('couponCloseButton').className='';var theLoader="<br /><br /><center>";theLoader=theLoader+'<img src="/images/loadingcoupons.gif"/><br />';theLoader=theLoader+"Loading";theLoader=theLoader+"</center><br /><br />";document.getElementById('couponTrueContent').innerHTML=theLoader;var theTime=new Date();var xx=new myAJAX();xx.onComplete=function(t)
{document.getElementById('couponTrueContent').innerHTML=t;if(thePlace=="merchants"){playMerchantGuy();}
document.getElementById('couponContent').className='showTheTownBGNews';if(thePlace=="gas"){getStates();}};xx.url='results.php?'+thePlace+'=yes&extra='+theExtra;xx.makeRequest();}
function hideCoupons()
{scroll(0,0);document.getElementById('couponContent').className='hideTownBox';document.getElementById('couponTrueContent').innerHTML='';return void(0);}
function showContact()
{superClose(27);contentBox('contact');return void(0);}
function hideContact()
{document.getElementById('contactContent').className='hideTownBox';document.getElementById('couponTrueContent').innerHTML='';superClose(27);return void(0);}
function replaceTheForm()
{var xx2=new myAJAX();xx2.onComplete=function(t)
{document.getElementById('contactStatus').innerHTML=t;};xx2.ReplaceFormSubmit(document.forms['contactForm'],'sendemail.php','get');}
function goURL(theURL)
{superClose(27);contentBox('loadurl',theURL);}
function goBusiness(theID,placeToGo)
{if(!placeToGo){placeToGo='site';}
superClose(27);contentBox('loadbusiness',theID+'-'+placeToGo);}
function putAwayNav()
{document.getElementById('textbigger').className='hideNavText';}
function putAwayNav()
{document.getElementById('textbigger').className='hideNavText';}
var themin=35;var themax=45;var thecur=themin;var thedirection='up';var theOver='no';var theSpeed=60;function setOver(setter)
{theOver=setter;bouncy('yes');}
function bouncy(manualInvoke)
{if(theOver=='yes'){thecur=themax;}
if(theOver=='no'){thecur=themin;}
document.getElementById('theBouncer').style.right='-'+thecur+'px';}
var catLoader='<div style="text-align: center;"><br /><br /><br />Loading Content<br /><br /><br /></div>';function newCats(newCat)
{document.getElementById('catLeft').innerHTML=catLoader;document.getElementById('catCenter').innerHTML=catLoader;document.getElementById('catRight').innerHTML=catLoader;var theTime=new Date();var xx=new myAJAX();xx.onComplete=function(t){document.getElementById('catCenter').innerHTML=t;};xx.url='results.php?newCat='+newCat;xx.makeRequest();var xx=new myAJAX();xx.onComplete=function(t){document.getElementById('catLeft').innerHTML=t;};xx.url='results.php?newCatLeft='+newCat;xx.makeRequest();var xx=new myAJAX();xx.onComplete=function(t){document.getElementById('catRight').innerHTML=t;};xx.url='results.php?newCatRight='+newCat;xx.makeRequest();}
function myAJAX(myURL){if(myURL!='undefined'){this.url=myURL;}else{this.url='';}
this.targetURL='';this.async=true;this.method='GET';this.paramVals=new Array();this.paramKeys=new Array();this.http='';this.onComplete=function(t){alert("this is Default and should be replaced:\r\nContent returned:\r\n "+t);};var self=this;this.makeRequest=function(){if(this.http==''){if(window.XMLHttpRequest){this.http=new XMLHttpRequest();}
else{if(window.ActiveXObject){try{this.http=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{this.http=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}}}
var ParamString=self.processParams();if(this.method.toLowerCase()=="post"){this.http.open("POST",this.url,this.async);this.http.setRequestHeader("Content-length",ParamString.length);this.http.setRequestHeader("Connection","close");}
else if(this.method.toLowerCase()=="get"){var myURL=this.url;if(myURL.indexOf('?')>-1){myURL+='&'+ParamString;}
else{myURL+='?'+ParamString;}
ParamString=null;this.http.open("GET",myURL,this.async);}
this.http.onreadystatechange=this.processChange;this.http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.http.send(ParamString);};this.processParams=function(){var ParamString='';for(i=0;i<=(self.paramKeys.length-1);i++){var values=self.paramVals[i];if(values instanceof Array){for(j=0;j<=(values.length-1);j++){if(i>0||j>0){ParamString+='&';}
ParamString+=self.paramKeys[i]+"="+values[j];}}
else{if(i>0){ParamString+="&";}
ParamString+=self.paramKeys[i]+"="+self.paramVals[i];}}
return ParamString;};this.processChange=function(){switch(self.http.readyState){case 1:if(typeof self.onLoading=='function')self.onLoading();break;case 2:if(typeof self.onLoaded=='function')self.onLoaded();break;case 3:if(typeof self.onInteractive=='function')self.onInteractive();break;case 4:if(typeof self.onComplete=='function')self.onComplete(self.http.responseText);break}};this.processForm=function(form,takeURL,takeMethod){if((typeof takeURL!='undefined')&&takeURL==true){self.url=form.action;}
if((typeof takeMethod!='undefined')&&takeMethod==true){self.method=form.method.toUpperCase();}
var inputs=form.elements;var formEm=new Object();formEm.keys=new Array();formEm.vals=new Array();for(emKey in inputs){var em=inputs[emKey];if(typeof em=='object'){var type=em.type;switch(type.toLowerCase()){case'hidden':case'text':case'textarea':case'submit':case'hidden':if(em.name!=''&&em.value.length>0){self.addParam(em.name,em.value);}
break;case'radio':case'checkbox':if(em.checked){self.addParam(em.name,em.value);}
break;case'select-one':case'select-multiple':formEm.keys[formEm.keys.length]=em.name;if(em.multiple==true){var mySelections=Array();for(i=0;i<em.options.length;i++){var mOPTION=em.options[i];if(mOPTION.selected){mySelections[mySelections.length]=mOPTION.value;}}
self.addParam(em.name,mySelections);}
else{self.addParam(em.name,em.value);}
break;default:}}}};this.addParam=function(key,value){self.paramKeys[self.paramKeys.length]=key;self.paramVals[self.paramVals.length]=value;};this.SubmitForm=function(form,newURL,newMethod){this.processForm(form,true,true);if((typeof newURL!='undefined')){this.url=newURL;}
if((typeof newMethod!='undefined')){this.method=newMethod.toUpperCase();}
this.addParam('ajax',true);this.makeRequest();return false;};this.ReplaceFormSubmit=function(form,newURL,newMethod){form.onsubmit=function(){return self.SubmitForm(form,newURL,newMethod);};document.getElementById('contactStatus').innerHTML='sending...';};}
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=Base64._utf8_encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=Base64._utf8_decode(output);return output;},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
function setDate()
{var mydate=new Date();var year=mydate.getYear();if(year<1000){year+=1900;}
var day=mydate.getDay();var month=mydate.getMonth();var daym=mydate.getDate();if(daym<10){daym="0"+daym;}
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");var theDate=dayarray[day]+", "+montharray[month]+" "+daym+", "+year;var hours=mydate.getHours();var minutes=mydate.getMinutes();var seconds=mydate.getSeconds();var timeValue=""+((hours>12)?(hours-12):hours);if(timeValue=="0")timeValue=12;timeValue+=((minutes<10)?":0":":")+minutes;timeValue+=((seconds<10)?":0":":")+seconds;timeValue+=(hours>=12)?" P.M.":" A.M.";document.getElementById('theTime2').innerHTML="Today is "+theDate+" "+timeValue+"&nbsp; ";setTimeout("setDate()",1000);}
function goLink(thePlace,theID)
{var foo=new Date;var unixtime_ms=foo.getTime();var theURL='/media/'+thePlace+'/'+theID;if(thePlace=='coupons'){theURL='/results.php?coupons=yes&extra='+theID+'&time='+unixtime_ms;}
if(thePlace=='tour'){theURL='/media/tours/index.php?id='+theID+'&time='+unixtime_ms;}
if(thePlace=='website'){theURL='/results.php?redir='+theID+'&time='+unixtime_ms;}
return theURL;}
function setCookie(szName,szValue,szExpires,szPath,szDomain,bSecure)
{var szCookieText=escape(szName)+'='+escape(szValue);szCookieText+=(szExpires?'; EXPIRES='+szExpires.toGMTString():'');szCookieText+=(szPath?'; PATH='+szPath:'');szCookieText+=(szDomain?'; DOMAIN='+szDomain:'');szCookieText+=(bSecure?'; SECURE':'');document.cookie=szCookieText;}
function enrollForm()
{var options={target:'#enrollFormStatus',beforeSubmit:showEnrollRequest};$('#enrollForm').ajaxForm(options);}
function showEnrollRequest(formData,jqForm,options)
{$('#enrollFormStatus').html('<h3 style="padding: 10px;">Setting you up for some savings...</h3>');}
function getStates()
{$("#states").removeOption(/./);$("#states").addOption("","Loading States");$.getJSON("citySearch/api.php?f=stategaslist",function(data){$("#states").addOption("","- Pick a State");$.each(data,function(i,n){$("#states").addOption(i.replace(/ County/,''),i);});$("#states").sortOptions();$("#states").selectOptions("");});}
function getCounties(state)
{var today=new Date();var cookie_date=new Date(today.getYear(),today.getMonth()+1,today.getDate());setCookie("gasState",state,cookie_date);$("#counties").removeOption(/./);$("#counties").addOption("","Loading Counties for "+state);$.getJSON("citySearch/api.php?f=stategas&data="+state.replace(/ /,'%20'),function(data){$("#counties").addOption("",'- Pick a County in '+state+' -');$.each(data,function(i,n){$("#counties").addOption(i.replace(/ County/,''),i);});$("#counties").sortOptions();$("#counties").selectOptions("");});}
function getCities(state,county)
{if(county)
{var today=new Date();var cookie_date=new Date(today.getYear(),today.getMonth()+1,today.getDate());setCookie("gasCounty",county,cookie_date);$("#cities").removeOption(/./);$("#cities").addOption("","Loading Cities for "+county);$.getJSON("citySearch/api.php?f=countygas&data="+state+","+county,function(data){$("#cities").addOption("",'- Pick a City in '+county+' County -');$.each(data,function(i,n){$("#cities").addOption(n,i);});$("#cities").sortOptions();$("#cities").selectOptions("");});}}
function loadGasPrices(place)
{var today=new Date();var cookie_date=new Date(today.getYear(),today.getMonth()+1,today.getDate());setCookie("gasPrices",place,cookie_date);$("#data").html('Loading Data');$("#data").load("citySearch/api.php?f=gas&data="+place);}
