
var Day = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var Month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var Mlong = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var Leap = 2004;
var Hours = new Array(1,2,3,4,5,6,7,8,9,10,11,12);
var Minutes = new Array("00","05","10","15","20","25","30","35","40","45","50","55");
var Day_num = new Array("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
var Shift = new Array("AM","PM");
var List1 = new Array;
var List2 = new Array;
var Car = new Array("Choose One","Compact Car","Intermediate Size Car","Full Size Car","Mini-Van","Full Size SUV","Pick Up Truck","15 Passenger Van");
var Phone_type= new Array("Choose One","Home","Cell","Business");
var Year_Here;
var Year_Gone;
var Address;
var City;
var State;
var Zip;
var Email;
var today;
var date_day;
var date_month;
var date_year;
var message="Sorry, that function is disabled.\n\nContents & Graphics are Copyrighted Material of Black Hills Car Rentals.  \These images are not Public Domain, and should NOT be taken from this site."; // Message for the alert box
var Cat_List= new Array("Campgrounds","Lodging")
var Llist = new Array;
    Llist[0]= new Array("Lake Park Campground & Cottages","http://www.lakeparkcampground.com","Campgrounds");
    Llist[1]= new Array("Lake Park Campground & Cottages","http://www.lakeparkcampground.com","Lodging");
	Llist[2]= new Array("Rushmore Shadows Resort","http://www.rushmoreshadows.com","Campgrounds");
	Llist[3]= new Array("Rushmore Shadows Resort","http://www.rushmoreshadows.com","Lodging");
today = new Date();
date_day = today.getDate();
date_month = today.getMonth();
date_year = today.getYear();
if(date_year<2000) date_year = date_year+1900;
Year_Here = date_year;
Year_Gone = date_year;
function click(e) {
if (navigator.appName=="Microsoft Internet Explorer") {
if (event.button == 2) {
alert(message);
return false;
}
}
if (navigator.appName=="Netscape") {
if (e.which == 3) {
alert(message);
return false;
}
}
if (navigator.appName=="Netscape") {
document.captureEvents(Event.MOUSEDOWN);

}
}
document.onmousedown=click;

function trap() {
  if(document.images) {
    for(i=0;i<document.images.length;i++) {
      document.images[i].onmousedown = click;
      document.images[i].onmouseup = click;
    }
  }
}

 
function everytime(){
  document.writeln('<div id="side1"><div id="side2"><div id="side3"><center><br>');
  document.writeln('<p class="uplc1">800-733-9735<br>605-342-6696<br>Fax: 605-348-8726</p>');
  document.writeln('<p class="uplc2">bhcarrentals@rushmore.com</p></center>');
  document.writeln('<div id="menu"><center>');
  document.writeln('<a href="index.html" class="menopt"><b>Home</b></a><br><br>');
  document.writeln('<a href="inquire.html" class="menopt"><b>Rental Inquiry</b></a><br><br>');
  document.writeln('<a href="about.html" class="menopt"><b>About Us</b></a><br><br>');
  document.writeln('<a href="contact.html" class="menopt"><b>Contact Us</b></a><br><br>');
  document.writeln('<a href="links.html" class="menopt"><b>Links</b></a><br><br>');
  document.writeln('</div>');
  document.writeln('</center></div></div></div><div id="top1"><div id="top2"><div id="top3"><div id="top4">');
  document.writeln('<img src="top1.jpg" width="600" height="100" alt="" border="0" align="">');
  document.writeln('</div></div></div></div>'); 
  document.writeln('<div id="logo"><center><img src="bhcr.gif" width="400" height="73" alt="" border="0" align=""><br></center></div>');
}
function Quote1() {
  for(i=0;i<Phone_type.length;i++) document.writeln('<option value="'+i+'" >'+Phone_type[i]+'</option>');
  document.askfor.phtype.options[0].selected=true;
}
function Quote2() {
  var today = new Date();
  var date_month = today.getMonth();
  for(i=0;i<12;i++) document.writeln('<option value="'+i+'">'+Month[i]+'</option>');
  document.askfor.monthhere.options[date_month].selected=true;
}
function Quote2a() {
  var today = new Date();
  var date_month = today.getMonth();
  for(i=0;i<12;i++) document.writeln('<option value="'+i+'">'+Month[i]+'</option>');
  document.askfor.monthgone.options[date_month].selected=true;
}
function Quote3() {
  var today = new Date();
  var date_day = today.getDate();
  var month_hold = date_month;
  if(date_day+1>Mlong[month_hold]) {
    if(date_month==11){
	   month_hold = 0;
	   date_day = -1;
	}
	else {
	   month_hold = date_month + 1;
	   date_day = -1;
	}
  }
  for(i=0;i<Mlong[month_hold];i++){
     List1[i] = Day_num[i]
     document.writeln('<option value="'+i+'">'+List1[i]+'</option>');
  }
  document.askfor.datehere.options[date_day].selected = true;
}

function Quote3a() {
  var today = new Date();
  var date_day = today.getDate();
  var month_hold = date_month;
  if(date_day+1>Mlong[month_hold]) {
    if(date_month==11){
	   month_hold = 0;
	   date_day = -1;
	}
	else {
	   month_hold = date_month + 1;
	   date_day = -1;
	}
  }
  for(i=0;i<Mlong[month_hold];i++){
     List2[i] = Day_num[i]
     document.writeln('<option value="'+i+'">'+List2[i]+'</option>');
  }
  document.askfor.dategone.options[date_day].selected = true;
}

function Quote4() {
  for(i=0;i<12;i++){
     if(i==8) {
	   document.writeln('<option value="'+i+'" selected>'+Hours[i]+'</option>');
	 }
	 else {
	   document.writeln('<option value="'+i+'">'+Hours[i]+'</option>');
	 }
  }
}

function Quote5() {
  document.writeln('<option value="0" selected>'+Minutes[0]+'</option>');
  for(i=1;i<Minutes.length;i++) document.writeln('<option value="'+i+'">'+Minutes[i]+'</option>');
}

function Quote6() {  
  document.writeln('<option value="0" selected>'+Car[0]+'</option>');
  for(i=1;i<Car.length;i++) document.writeln('<option value="'+i+'">'+Car[i]+'</option>');
} 
  

function MonthSet(){
  var lst;
  var tot;
  var TempList = new Array;
  if(document.askfor.monthhere.selectedIndex!=document.askfor.monthgone.selectedIndex)document.askfor.monthgone.options[document.askfor.monthhere.selectedIndex].selected=true;
  if(List1.length!=Mlong[document.askfor.monthhere.selectedIndex]){
	 lst = List1.length;
	 List1.length = 0;
	 TempList.length = 0;
	 if(date_month>document.askfor.monthhere.selectedIndex) Year_Here++;
	 for(i=0;i<Mlong[document.askfor.monthhere.selectedIndex];i++) {
	    List1[i] = new Option(Day_num[i]);
	 }
	 tot = List1.length;
	 for(i=lst;i>0;i--) document.askfor.datehere.options[i] = null;
	 for(i=0;i<List1.length;i++) document.askfor.datehere.options[i] = List1[i];
	 date_day = today.getDate();
	 document.askfor.datehere.options[date_day+1].selected = true;
  }
  if(List2.length!=Mlong[document.askfor.monthgone.selectedIndex]) {
     lst = List2.length;
	 List2.length = 0;
	 if(date_month>document.askfor.monthgone.selectedIndex) Year_Gone++;
	 for(i=0;i<Mlong[document.askfor.monthgone.selectedIndex];i++) List2[i] = new Option(Day_num[i]);
	 tot = List2.length;
	 for(i=lst;i>0;i--) document.askfor.dategone.options[i] = null;
	 for(i=0;i<List2.length;i++) document.askfor.dategone.options[i] = List2[i];
	 document.askfor.dategone.options[date_day+1].selected = true;
   }
 TimeSet();
}
function DaySet() {
  var temp;
  var lst;
  var tot;
  if(document.askfor.datehere.selectedIndex!=List1.length-1)  return;
  if(document.askfor.monthgone.selectedIndex == Month.length-1) {
     document.askfor.monthgone.options[11].selected = false;
	 document.askfor.monthgone.options[0].selected = true;
	 document.askfor.dategone.options[0].selected = true;
	 return;
  }
  else {
	 temp = document.askfor.monthgone.selectedIndex;
	 temp++;
	 document.askfor.monthgone.options[document.askfor.monthgone.selectedIndex].selected = false;
	 document.askfor.monthgone.options[temp].selected = true;
  }
  if(List2.length!=Mlong[document.askfor.monthgone.selectedIndex]) {
     lst = List2.length;
	 List2.length = 0;
	 for(i=0;i<Mlong[document.askfor.monthgone.selectedIndex];i++) List2[i] = new Option(Day_num[i]);
	 tot = List2.length;
	 for(i=lst;i>0;i--) document.askfor.dategone.options[i] = null;
	 for(i=0;i<List2.length;i++) document.askfor.dategone.options[i] = List2[i];
	 document.askfor.dategone.options[0].selected = true;
   }
  TimeSet();
}



function ReForm() {
  var lst;
  var tot;
  document.askfor.name.value="";
  document.askfor.address.value="";
  document.askfor.city.value="";
  document.askfor.state.value="";
  document.askfor.zip.value="";
  document.askfor.area.value="";
  document.askfor.phone.value="";
  document.askfor.phtype.options[0].selected=true;
  document.askfor.email.value="";
  date_month = today.getMonth();
  document.askfor.monthhere.options[date_month].selected=true;
  document.askfor.monthgone.options[date_month].selected=true;
  if(List1.length!=Mlong[document.askfor.monthhere.selectedIndex]){
	 lst = List1.length;
	 List1.length = 0;
	 for(i=0;i<Mlong[document.askfor.monthhere.selectedIndex];i++) {
	    List1[i] = new Option(Day_num[i]);
	 }
	 tot = List1.length;
	 for(i=lst;i>0;i--) document.askfor.datehere.options[i] = null;
	 for(i=0;i<List1.length;i++) document.askfor.datehere.options[i] = List1[i];
  }
  if(List2.length!=Mlong[document.askfor.monthgone.selectedIndex]) {
     lst = List2.length;
	 List2.length = 0;
	 for(i=0;i<Mlong[document.askfor.monthgone.selectedIndex];i++) List2[i] = new Option(Day_num[i]);
	 tot = List2.length;
	 for(i=lst;i>0;i--) document.askfor.dategone.options[i] = null;
	 for(i=0;i<List2.length;i++) document.askfor.dategone.options[i] = List2[i];
   }
   date_day=today.getDate();
   document.askfor.datehere.options[date_day].selected=true;
   document.askfor.dategone.options[date_day].selected=true;
   document.askfor.hourhere.options[8].selected=true;
   document.askfor.hourgone.options[8].selected=true;
   document.askfor.minhere.options[0].selected=true;
   document.askfor.mingone.options[0].selected=true;
   document.askfor.shifthere.options[0].selected=true;
   document.askfor.shiftgone.options[0].selected=true;
   document.askfor.carhere.options[0].selected = true;
   
}

function TimeSet(){
document.askfor.inday.value="";
document.askfor.outday.value="";
document.askfor.inday.value = Month[document.askfor.monthhere.selectedIndex]+' '+List1[document.askfor.datehere.selectedIndex]+' '+Year_Here+' ';
document.askfor.inday.value = document.askfor.inday.value+Hours[document.askfor.hourhere.selectedIndex]+':'+Minutes[document.askfor.minhere.selectedIndex];
if(document.askfor.shifthere.selectedIndex==0){
  document.askfor.inday.value=document.askfor.inday.value+" AM ";
}
else {
  document.askfor.inday.value=document.askfor.inday.value+" PM ";
}
document.askfor.outday.value=Month[document.askfor.monthgone.selectedIndex]+' '+List2[document.askfor.dategone.selectedIndex]+' '+Year_Gone+' ';
document.askfor.outday.value=document.askfor.outday.value+" "+Hours[document.askfor.hourgone.selectedIndex]+':'+Minutes[document.askfor.mingone.selectedIndex];
if(document.askfor.shiftgone.selectedIndex==0){
  document.askfor.outday.value=document.askfor.outday.value+" AM ";
}
else {
  document.askfor.outday.value=document.askfor.outday.value+" PM ";
}


}

function NameMe() {
 document.askfor.realname.value="";
 document.askfor.realname.value = document.askfor.name.value;
}

function Quote() {
  document.writeln('<form method="POST" action="http://www.blackhillscarrental.net/cgi-bin/FormMail.pl" name="askfor" >');
  document.writeln('<input type="hidden" name="recipient" value="bhcarrentals@rushmore.com">');
  document.writeln('<input type="hidden" name="subject" value="Rental Inquiry">');
  document.writeln('<input type="hidden" name="realname" value="">');
  document.writeln('<input type="hidden" name="telephone" value="">');
  document.writeln('<input type="hidden" name="car_type" value="">');
  document.writeln('<input type="hidden" name="inday" value="">');
  document.writeln('<input type="hidden" name="outday" value="">');
  document.writeln('<input type="hidden" name="required" value="name,address,city,state,zip,telephone,email,inday,outday,car_type">');
  document.writeln('<input type="hidden" name="sort" value="order:realname,name,address,city,state,zip,telephone,email,inday,outday,car_type">');
  document.writeln('<table width="95%" cellspacing="2" cellpadding="2" border="0">');
  document.writeln('<tr><td align="left"valign="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name <input type="text" name="name" value="" size=35 onBlur="NameMe()">');
  document.writeln('</td></tr>');
  document.writeln('<tr><td align="left"valign="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Address <input type="text" name="address" value="" size=50><br>');
  document.writeln('<tr><td align="left"valign="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City <input type="text" name="city" value="" size=20>&nbsp;&nbsp;');
  document.writeln('State <input type="text" name="state" value=""size=2 maxlength=2>&nbsp;&nbsp;');
  document.writeln('Zip Code <input type="text" name="zip" value="" size=10 maxlength=10></td></tr>');
  document.writeln('<tr><td align="left"valign="center">Telephone ( <input type="text" name="area" value="" size=3 maxlength=3> )&nbsp;');
  document.writeln('<input type="text" name="phone" value="" size=8 maxlength=8>&nbsp;');
  document.writeln('<select name="phtype" size="1" onChange="PhoneSet();">');
  Quote1();
  document.writeln('</td></tr>');
  document.writeln('<tr><td align="left"valign="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; E-mail <input type="text" name="email" value="" size=50></td></tr>');
  document.writeln('<tr><td align="left" valign="center">&nbsp;&nbsp;&nbsp;Pick up Date <select name="monthhere" size=1 onChange="MonthSet()">');
  Quote2();
  document.writeln('</select>&nbsp;');
  document.writeln('<select name="datehere" size=1 onChange="DaySet()">');
  Quote3();
  document.writeln('</select>');
  document.writeln('&nbsp;Pick Up Time <select name="hourhere" size="1" onChange="TimeSet()">');
  Quote4();
  document.writeln('</select>');
  document.writeln(':<select name="minhere" size="1" onChange="TimeSet()">');
  Quote5();
  document.writeln('</select>');
  document.writeln('<select name="shifthere" size="1" onChange="TimeSet()"><option value="0" selected>AM</option>');
  document.writeln('<option value="1">PM</option></select></td></tr>');
  document.writeln('<tr><td align="left" valign="center">Drop Off Date <select name="monthgone" size="1" onChange="TimeSet()">');
  Quote2a();
  document.writeln('</select>&nbsp;');
  document.writeln('<select name="dategone" size="1" onChange="TimeSet()">');
  Quote3a();
  document.writeln('</select>');
  document.writeln('Drop Off Time <select name="hourgone" size="1" onChange="TimeSet()">');
  Quote4();
  document.writeln('</select>');
  document.writeln(':<select name="mingone" size="1" onChange="TimeSet()">');
  Quote5();
  document.writeln('</select>');
  document.writeln('&nbsp;<select name="shiftgone" size="1" onChange="TimeSet()"><option value="0" selected>AM</option>');
  document.writeln('<option value="1">PM</option></select></td></tr>');
  document.writeln('<tr><td align="left">I am interested in renting <select name="carhere" size=1 onChange="CarSet()">');
  Quote6();
  document.writeln('</select></td></tr><tr><td><input type="checkbox" name="contact" onClick="PhoneSet()">Please contact me at the Telephone Number listed above</td></tr><tr><td>&nbsp;</td></tr>');
  document.writeln('<tr><td align="center"><input type="submit" name="submit" value="Submit Now">&nbsp;&nbsp;');
  document.writeln('<input type="button" name="resetform" value=" Reset " onClick="ReForm()">&nbsp;&nbsp;');
  document.writeln('</td></tr>');
  document.writeln('</table></form>');
}

function PhoneSet(){
  document.askfor.telephone.value="";
  document.askfor.telephone.value=Phone_type[document.askfor.phtype.selectedIndex]+': ('+document.askfor.area.value+') '+document.askfor.phone.value;
  if(document.askfor.contact.checked==true){
    document.askfor.telephone.value = document.askfor.telephone.value +' Please contact me by telephone';
  }
  else{
    document.askfor.telephone.value = document.askfor.telephone.value +' Please contact me by E-mail only';
  }
}

function CarSet(){
  document.askfor.car_type.value="";
  document.askfor.car_type.value = Car[document.askfor.carhere.selectedIndex];
}
function LinkList(){
 var j =0;
 document.writeln('<h2 align="center" class="look1">Links</h2>');
 for(i=0;i<Cat_List.length;i++) {
	document.writeln('<table width="80%" cellpadding="3" cellspacing="4" align="center" border="0"><tr><th align="center" colspan="2" class="read2">'+Cat_List[i]+'</th></tr>');
	for(k=0;k<Llist.length;k++) {
	   if(Cat_List[i] == Llist[k][2]){
	     if(j==0){
		   document.writeln('<tr><td align="center" bgcolor="green"><a href="'+Llist[k][1]+'" target="_blank">'+Llist[k][0]+'</a></td>');
		   j = 1;
		 }
		 else {
		    document.writeln('<td align="center" bgcolor="green"><a href="'+Llist[k][1]+'" target="_blank">'+Llist[k][0]+'</a></td></tr>');
			j = 0;
		 }
	   }
     }
	 if(j==1) document.writeln('<td align="center">&nbsp;</td></tr>');
	 document.writeln('</table><br>');
 }
}

function ChangeAdd(){
   document.writeln('<address class="read1">Black Hills Car Rentals</address>');
   document.writeln('<address class="read1">1600 E Hwy 44</address>');
   document.writeln('<address class="read1">Rapid City SD 57703</address>');
   document.writeln('<address class="read1">Toll Free: 800-733-9735</address>');
   document.writeln('<address class="read1">605-342-6696</address>');
   document.writeln('<address class="read1">Fax:605-348-8796</address>');
}
