
function doNothing( ) {return true;}
window.onerror = doNothing;
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function mmLoadMenus() {
  if (window.mm_menu_0612092419_0) return;
      window.mm_menu_0612092419_0_1 = new Menu("Optional&nbsp;Extras",150,20,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#CCCCCC","#999999","left","middle",8,0,1000,-5,7,true,false,true,0,true,true);
    mm_menu_0612092419_0_1.addMenuItem("Kruse&nbsp;GPS&nbsp;Navigation","location='http://test-nz.acerentals.co.nz/Kruse_GPS_Commentary.html'");
   /* mm_menu_0612092419_0_1.addMenuItem("Baby&nbsp;Seats","location='baby_seats.htm'");
    mm_menu_0612092419_0_1.addMenuItem("Snow&nbsp;Chains","location='snow_chains.htm'");
    mm_menu_0612092419_0_1.addMenuItem("Roof&nbsp;Rack","location='roof_racks.htm'");*/
     mm_menu_0612092419_0_1.fontWeight="bold";
     mm_menu_0612092419_0_1.hideOnMouseOut=true;
     mm_menu_0612092419_0_1.bgColor='#555555';
     mm_menu_0612092419_0_1.menuBorder=1;
     mm_menu_0612092419_0_1.menuLiteBgColor='#FFFFFF';
     mm_menu_0612092419_0_1.menuBorderBgColor='#777777';
    window.mm_menu_0612092419_0 = new Menu("root",117,20,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#CCCCCC","#999999","left","middle",8,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0612092419_0.addMenuItem("Rental&nbsp;Vehicles","location='http://test-nz.acerentals.co.nz/Rental_Cars.html'");
  mm_menu_0612092419_0.addMenuItem("Get&nbsp;Quote","location='http://test-nz.acerentals.co.nz/interface/webinterface.php'");
  mm_menu_0612092419_0.addMenuItem("Optional&nbsp;Extras","location='http://test-nz.acerentals.co.nz/Rental_Car_Extras.html'");
  /*mm_menu_0612092419_0.addMenuItem(mm_menu_0612092419_0_1,"location='http://test-nz.acerentals.co.nz/optional_extras.html'");*/
  mm_menu_0612092419_0.addMenuItem("Best&nbsp;Rates","location='http://test-nz.acerentals.co.nz/Best_Rates.html'");
  mm_menu_0612092419_0.addMenuItem("Campervan&nbsp;Rental","location='http://test-nz.acerentals.co.nz/campervanhire/'");
   mm_menu_0612092419_0.fontWeight="bold";
   mm_menu_0612092419_0.hideOnMouseOut=true;
   mm_menu_0612092419_0.bgColor='#555555';
   mm_menu_0612092419_0.menuBorder=1;
   mm_menu_0612092419_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0612092419_0.menuBorderBgColor='#777777';
window.mm_menu_0612153328_0 = new Menu("root",189,20,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#CCCCCC","#999999","left","middle",8,0,1000,-5,17,true,false,true,0,true,true);
  mm_menu_0612153328_0.addMenuItem("Itineraries","location='http://test-nz.acerentals.co.nz/Itineraries.html'");
  mm_menu_0612153328_0.addMenuItem("Auckland&nbsp;Region","location='http://test-nz.acerentals.co.nz/Touring_Auckland_Region.html'");
  mm_menu_0612153328_0.addMenuItem("Northland","location='http://test-nz.acerentals.co.nz/Touring_Northland.html'");
  mm_menu_0612153328_0.addMenuItem("South&nbsp;of&nbsp;Auckland","location='http://test-nz.acerentals.co.nz/Touring_South_AKL.html'");
  mm_menu_0612153328_0.addMenuItem("The&nbsp;Volcanic&nbsp;Belt","location='http://test-nz.acerentals.co.nz/Touring_Volcanic_Belt.html'");
  mm_menu_0612153328_0.addMenuItem("Central&nbsp;North&nbsp;Island","location='http://test-nz.acerentals.co.nz/Touring_Central_North.html'");
  mm_menu_0612153328_0.addMenuItem("Lower&nbsp;North&nbsp;Island","location='http://test-nz.acerentals.co.nz/Touring_Lower_North.html'");
  mm_menu_0612153328_0.addMenuItem("Nelson&nbsp;Region","location='http://test-nz.acerentals.co.nz/Touring_Nelson_Region.html'");
  mm_menu_0612153328_0.addMenuItem("Westcoast&nbsp;and&nbsp;the&nbsp;Glaciers","location='http://test-nz.acerentals.co.nz/Touring_Westcoast.html'");
  mm_menu_0612153328_0.addMenuItem("Queenstown","location='http://test-nz.acerentals.co.nz/Touring_Queenstown.html'");
  mm_menu_0612153328_0.addMenuItem("Fjordland","location='http://test-nz.acerentals.co.nz/Touring_Fjordland.html'");
  mm_menu_0612153328_0.addMenuItem("Mt&nbsp;Cook&nbsp;and&nbsp;Lake&nbsp;Tekapo","location='http://test-nz.acerentals.co.nz/Touring_Mt_Cook.html'");
  mm_menu_0612153328_0.addMenuItem("Kaikoura&nbsp;and&nbsp;Christchurch","location='http://test-nz.acerentals.co.nz/Touring_Kaikoura_Christchurch.html'");
  mm_menu_0612153328_0.addMenuItem("South&nbsp;of&nbsp;the&nbsp;South&nbsp;Island","location='http://test-nz.acerentals.co.nz/Touring_South_South_Island.htm'");
   mm_menu_0612153328_0.fontWeight="bold";
   mm_menu_0612153328_0.hideOnMouseOut=true;
   mm_menu_0612153328_0.bgColor='#555555';
   mm_menu_0612153328_0.menuBorder=1;
   mm_menu_0612153328_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0612153328_0.menuBorderBgColor='#777777';

  window.mm_menu_0612160236_0 = new Menu("root",147,20,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#CCCCCC","#999999","left","middle",8,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0612160236_0.addMenuItem("Terms&nbsp;&&nbsp;Conditions","location='http://test-nz.acerentals.co.nz/General_Car_Rental_Information.htm'");
  mm_menu_0612160236_0.addMenuItem("Driving&nbsp;in&nbsp;NZ","location='http://test-nz.acerentals.co.nz/Driving_Rental_Cars_in_New_Zealand.htm'");
  mm_menu_0612160236_0.addMenuItem("NZ&nbsp;Travel&nbsp;Safety","location='http://test-nz.acerentals.co.nz/NZ_Travel_Safety.html'");
  mm_menu_0612160236_0.addMenuItem("Online&nbsp;Bookings","location='http://test-nz.acerentals.co.nz/Online_Bookings.html'");
   mm_menu_0612160236_0.fontWeight="bold";
   mm_menu_0612160236_0.hideOnMouseOut=true;
   mm_menu_0612160236_0.bgColor='#555555';
   mm_menu_0612160236_0.menuBorder=1;
   mm_menu_0612160236_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0612160236_0.menuBorderBgColor='#777777';

  window.mm_menu_0612160341_0 = new Menu("root",107,18,"Arial, Helvetica, sans-serif",12,"#000000","#FFFFFF","#CCCCCC","#999999","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
  mm_menu_0612160341_0.addMenuItem("Enquiry&nbsp;Form","location='http://test-nz.acerentals.co.nz/Enquiry_Form.html'");
   mm_menu_0612160341_0.fontWeight="bold";
   mm_menu_0612160341_0.hideOnMouseOut=true;
   mm_menu_0612160341_0.bgColor='#555555';
   mm_menu_0612160341_0.menuBorder=1;
   mm_menu_0612160341_0.menuLiteBgColor='#FFFFFF';
   mm_menu_0612160341_0.menuBorderBgColor='#777777';

mm_menu_0612160341_0.writeMenus();
} 


// // Date and Time code
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: William and Mari Bontrager :: http://willmaster.com/ */

<!-- Copyright 1999, 2000 by William and Mari Bontrager.

// See complete instructions in the article "Easy Time 
//   Zone Offset Calculator" in WillMaster Possibilities 
//   issue # 46: http://willmaster.com/possibilities/archives/


here_offset = 720;
// The above number must be changed to the number of minutes 
//   difference between your time and UT during STANDARD TIME 
//   -- not Daylight Savings Time. If you are in UT, (the 
//   same time zone as Greenwich, England), this number 
//   will be 0 (zero). If your time is later than UT (east 
//   of Greenwich, England), the number is negative. 
//   Otherwise, the number is positive.
// NOTE: To calculate the number automatically, go to 
//   http://willmaster.com/possibilities/demo/eztzoffset.html

DST_month_start = 0;
// If your geographical area observes daylight savings time, 
//   the above number represents the month the period begins. 
//   Otherwise, the number is 0 (zero).

DST_day_start = 0;
// If your geographical area observes daylight savings time, 
//   the above number represents day of the month the period 
//   begins. Otherwise, the number is 0 (zero).

DST_month_end = 0;
// If your geographical area observes daylight savings time, 
//   the above number represents the month the period ends. 
//   Otherwise, the number is 0 (zero).

DST_day_end = 0;
// If your geographical area observes daylight savings time, 
//   the above number represents day of the month the period 
//   ends. Otherwise, the number is 0 (zero).

clocktype = 12;
// The above number must be either 12 or 24. Use 12 if you 
//   want a 12-hour clock with "AM" or "PM" appended to the 
//   time. Use 24 if you want a 24-hour clock.
// NOTE: What you specify here is the default. You can change 
//   this value right before you use a function.

here_appt_weekday = 2;
// The day of the week in your time zone that you want 
//   calculated into your visitor's time zone. Use a 
//   number 1-7: 1=Sunday 2=Monday 3=Tuesday 
//   4=Wednesday 5=Thursday 6=Friday 7=Saturday
// NOTE: What you specify here is the default. You can change 
//   this value right before you use a function.

here_appt_hour = 10;
// The hour in your time zone that you want calculated into 
//   your visitor's time zone. Use 12 for noon and 0 for midnight.
// NOTE: What you specify here is the default. You can change 
//   this value right before you use a function.

here_appt_minute = 27;
// The number of minutes after the hour in your time zone 
//   that you want calculated into your visitor's time zone.
// NOTE: What you specify here is the default. You can change 
//   this value right before you use a function.

here_appt_ampm = 'AM';
// If the above appt_hour and appt_minute is before noon, 
//   use 'AM', otherwise use 'PM'. If your clocktype 
//   variable (above) is 24, use 'AM';
// NOTE: What you specify here is the default. You can change 
//   this value right before you use a function.

// NOTE: The above appt_... variables must have values assigned 
//       to them whether or not you plan to calculate a specific 
//       time for your visitor's time zone.

disp_dow = 'yes';
// Shall time displays include the day of the week ('yes' or 'no')?
// NOTE: What you specify here is the default. You can change 
//   it right before you use a function.

// No other customizations are required.

can_use_this = false;
if(parseInt(navigator.appVersion) >= 4) { can_use_this = true; }
vtime = new Date();
if(DST_month_start > 0) {
	var b = false;
	var m = vtime.getMonth();
	var d = vtime.getDate();
	DST_month_start--;
	DST_month_end--;
	if((m > DST_month_start) && (m < DST_month_end)) { b = true; }
	else
	{
		if((m == DST_month_start) && (d >= DST_day_start)) { b = true; }
		if((m == DST_month_end) && (d <= DST_day_end)) { b = true; }
	}
	if(b == true) { here_offset -= 60; }
}
Diff = vtime.getTimezoneOffset() - here_offset;
weekdays=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
if(! weekdays) { can_use_this = 0; }
function get_future() {
	if(can_use_this == false) { return ''; }
	var apm = 'AM';
	var rs = '';
	if((clocktype == 12) && (here_appt_ampm == 'PM')) { here_appt_hour += 12; }
	b = new Date(vtime.getYear(),1,1,here_appt_hour,here_appt_minute,0);
	var t = 0;
	if(here_appt_weekday > 0)
	{
		var tt = here_appt_weekday - 1;
		if(tt != b.getDay()) { t = tt - b.getDay(); }
	}
	if(t != 0) { b.setTime(Number(b) + (1000 * 60 * 60 * 24 * t)); }
	b.setTime(Number(b) - (Diff * 60000));
	var nowweekday = b.getDay();
	var hr = b.getHours();
	if(clocktype == 12)
	{
		if(hr > 11) { apm = 'PM'; }
		if(hr > 12) { hr -= 12; }
	}
	rs = hr + ':';
	if(b.getMinutes() < 10) { rs += '0'; }
	rs += b.getMinutes();
	if(clocktype == 12) { rs += ' ' + apm; }
	if(here_appt_weekday > 0) { rs += ', ' + weekdays[b.getDay()]; }
	return rs;
}
function get_current(s) {
	if(can_use_this == false) { return ''; }
	var apm = 'AM';
	var rs = '';
	if((s == 'here') || (s == 'Here') || (s == 'HERE'))
	{
		htime = new Date();
		htime.setTime(Number(vtime) + (Diff * 60000));
		var hr = htime.getHours();
		if(clocktype == 12)
		{
			if(hr > 11) { apm = 'PM'; }
			if(hr > 12) { hr -= 12; }
		}
		rs = hr + ':';
		if(htime.getMinutes() < 10) { rs += '0'; }
		rs += htime.getMinutes(); 
		if(clocktype == 12) { rs += ' ' + apm; }
		if((disp_dow == 'yes') || (disp_dow == 'Yes') || (disp_dow == 'YES'))
		{ rs += ', ' + weekdays[htime.getDay()]; }
	}
	else
	{
		var hr = vtime.getHours();
		if(clocktype == 12)
		{
			if(hr > 11) { apm = 'PM'; }
			if(hr > 12) { hr -= 12; }
		}
		rs = hr + ':';
		if(vtime.getMinutes() < 10) { rs += '0'; }
		rs += vtime.getMinutes();
		if(clocktype == 12) { rs += ' ' + apm; }
		if((disp_dow == 'yes') || (disp_dow == 'Yes') || (disp_dow == 'YES'))
		{ rs += ', ' + weekdays[vtime.getDay()]; }
	}
	return rs;
}
/*+++++++  end Date and Time code  +++++++++*/

/*+++++++ write a review ++++++++*/
function reviewOn(divName,reviewOf){
	var formName = divName.replace("review","reviewform");
	var content = "<form id='" + formName + "' name='" + formName + "'><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"220\"><tr bgcolor=\"#fee800\"><td><span style='color:#323084;font-weight:bold'>Write a review</span></td><td align='right'><a href='javascript:;' onClick='reviewView(\"" + divName + "\",\"" + reviewOf + "\")' style='text-decoration:none;color:#323084;font-weight:bold'>X</a></td></tr><tr><td>Your name<span style='color:red;font-weight:bold'>*</span>:</td><td><input type='text' name='revname' size=\"10\" /></td></tr><tr><td>Booking number:</td><td><input type='text' name='bookingno' size=\"5\" /></td></tr><tr><td valign='top'>Review<span style='color:red;font-weight:bold'>*</span>:</td><td><textarea name='revtext' cols=\"12\" rows=\"3\"></textarea></td></tr><tr><td><span style='color:red;font-weight:bold'>* required</span><input type='hidden' name='reviewOf' value='" + reviewOf + "' ></td><td><input type='button' value='Submit' onClick='reviewsubmit(\"" + formName + "\",\"" + reviewOf + "\")' /></td></tr></table></form>";
	el=document.getElementById(divName);
	el.innerHTML = content;
}
function reviewOff(divName,reviewOf){
	var content = "<center><a href=\"javascript:;\" onClick='reviewOn(\"" + divName + "\",\"" + reviewOf + "\")'>Click here to write a review.</a></center>";
	el=document.getElementById(divName);
	el.innerHTML = content;
}

function reviewsubmit(formName,reviewOf){
	//check form elements
	var name=document.getElementById(formName).revname.value;
	var resno=document.getElementById(formName).bookingno.value;
	var review=document.getElementById(formName).revtext.value;
	if(document.getElementById(formName).why){
		var review=review + "<br>Why: " + document.getElementById(formName).why.value;
	}
	var name=name.replace(/\n/g,"<br>");
	var resno=resno.replace(/\n/g,"<br>");
	var review=review.replace(/\n/g,"<br>");
	var el=formName.replace("reviewform","review");
	//create url to submit review to
	var url = 'http://test-nz.acerentals.co.nz/jscript/review.php?reviewOf=' + reviewOf.replace(/ /g,"_") + '&el=' + el + '&name=' + name.replace(/ /g,"_") + '&resno=' + resno.replace(/ /g,"_") + '&review=' + review.replace(/ /g,"_");
	var jsel = document.createElement('SCRIPT');
	jsel.type = 'text/javascript';
	jsel.src = url;

    // Append JS element (therefore executing the 'AJAX' call)
    document.body.appendChild (jsel);
}

function reviewView(divName,reviewOf){
	if(divName=="left_review"){
		var url = 'http://test-nz.acerentals.co.nz/jscript/review.php?el=' + divName + '&reviewOf=' + reviewOf.replace(/ /g,"_");
	} else {
		var url = 'http://test-nz.acerentals.co.nz/jscript/review.php?el=' + divName + '&reviewOf=' + reviewOf.replace(/ /g,"_");
	}
	var jsel = document.createElement("SCRIPT");
	jsel.type = "text/javascript";
	jsel.src = url;
    // Append JS element (therefore executing the 'AJAX' call)
    document.body.appendChild(jsel);
}
function rentalCarReview(){
	reviewView('review1','Super Saver');
	reviewView("review2","Premium Compact");
	reviewView("review3","Economy");
	reviewView("review4","Tourist");
	reviewView("review5","Premium Tourist");
	reviewView("review6","Station Wagon");
	reviewView("review7","4WD Station Wagon");
	reviewView("review8","People Mover");
	reviewView("review9","Holiday Van");
	reviewView("review10","10 Seater");
	reviewView("review11","Spaceship");
}
	
function rentalBranchReview(){
	reviewView('review1','Auckland');
	reviewView("review2","Auckland Airport");
	reviewView("review3","Wellington");
	reviewView("review4","Picton");
	reviewView("review5","Christchurch");
	reviewView("review6","Christchurch Airport");
	reviewView("review7","Queenstown");
	reviewView("review8","Queenstown Airport");
}
/*+++++++++++ fuel economy calculator ++++++++++++*/
function fuelCalculator(divName,carType){
	var url = 'http://test-nz.acerentals.co.nz/book/fuelCalc.php?el=' + divName + '&carType=' + carType +'&func=show';
	var jsel = document.createElement("SCRIPT");
	jsel.type = "text/javascript";
	jsel.src = url;
	document.body.appendChild(jsel);
}

	function formatCurrency(num) {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		return (((sign)?'':'-') + num + '.' + cents);
	}
	function travelTime(trvlTime){
		if(document.fuelCalc.tvlTime){
			document.fuelCalc.tvlTime.value=trvlTime;
		}
		return true;
	}
	function calcDist(){
		var a = document.fuelCalc.a.value;
		var b = document.fuelCalc.b.value;
		if(((a=='Auckland')&&(b=='Christchurch'))||((a=='Christchurch')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 990;
			travelTime("14 hours 15 minutes");
		}
		if(((a=='Auckland')&&(b=='Picton'))||((a=='Picton')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 756;
			travelTime("9 hours 15 minutes");
		}
		if(((a=='Auckland')&&(b=='Wellington'))||((a=='Wellington')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 652;
			travelTime("9 hours 15 minutes");
		}
		if(((a=='Auckland')&&(b=='Queenstown'))||((a=='Queenstown')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 1482;
			travelTime("22 hours 35 minutes");
		}
		if(((a=='Auckland')&&(b=='Paihia'))||((a=='Paihia')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 237;
			travelTime("4 hours 15 minutes");
		}
		if(((a=='Auckland')&&(b=='Nelson'))||((a=='Nelson')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 756;
			travelTime("11 hours 25 minutes");
		}
		if(((a=='Auckland')&&(b=='Greymouth'))||((a=='Greymouth')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 1002;
			travelTime("14 hours 45 minutes");
		}
		if(((a=='Auckland')&&(b=='Dunedin'))||((a=='Dunedin')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 1355;
			travelTime("19 hours 15 minutes");
		}
		if(((a=='Auckland')&&(b=='Picton'))||((a=='Picton')&&(b=='Auckland'))){
			document.fuelCalc.km.value = 756;
			travelTime("9 hours 15 minutes");
		}
		//Wellington
		if(((a=='Wellington')&&(b=='Queenstown'))||((a=='Queenstown')&&(b=='Wellington'))){
			document.fuelCalc.km.value = 830;
			travelTime("13 hours 20 minutes");
		}
		if(((a=='Wellington')&&(b=='Paihia'))||((a=='Paihia')&&(b=='Wellington'))){
			document.fuelCalc.km.value = 889;
			travelTime("13 hours 30 minutes");
		}
		if(((a=='Wellington')&&(b=='Nelson'))||((a=='Nelson')&&(b=='Wellington'))){
			document.fuelCalc.km.value = 104;
			travelTime("2 hours 10 minutes");
		}
		if(((a=='Wellington')&&(b=='Greymouth'))||((a=='Greymouth')&&(b=='Wellington'))){
			document.fuelCalc.km.value = 350;
			travelTime("5 hours 30 minutes");
		}
		if(((a=='Wellington')&&(b=='Dunedin'))||((a=='Dunedin')&&(b=='Wellington'))){
			document.fuelCalc.km.value = 703;
			travelTime("10 hours");
		}
		if(((a=='Wellington')&&(b=='Picton'))||((a=='Picton')&&(b=='Wellington'))){
			document.fuelCalc.km.value = 0;
			travelTime("Ferry crossing only");
		}
		//Queenstown
		if(((a=='Queenstown')&&(b=='Paihia'))||((a=='Paihia')&&(b=='Queenstown'))){
			document.fuelCalc.km.value = 1719;
			travelTime("26 hours 50 minutes");
		}
		if(((a=='Queenstown')&&(b=='Nelson'))||((a=='Nelson')&&(b=='Queenstown'))){
			document.fuelCalc.km.value = 861;
			travelTime("13 hours 30 minutes");
		}
		if(((a=='Queenstown')&&(b=='Greymouth'))||((a=='Greymouth')&&(b=='Queenstown'))){
			document.fuelCalc.km.value = 572;
			travelTime("10 hours 55 minutes");
		}
		if(((a=='Queenstown')&&(b=='Dunedin'))||((a=='Dunedin')&&(b=='Queenstown'))){
			document.fuelCalc.km.value = 288;
			travelTime("4 hours 25 minutes");
		}
		if(((a=='Queenstown')&&(b=='Picton'))||((a=='Picton')&&(b=='Queenstown'))){
			document.fuelCalc.km.value = 830;
			travelTime("13 hours 30 minutes");
		}
		//Paihia
		if(((a=='Paihia')&&(b=='Nelson'))||((a=='Nelson')&&(b=='Paihia'))){
			document.fuelCalc.km.value = 993;
			travelTime("15 hours 40 minutes");
		}
		if(((a=='Paihia')&&(b=='Greymouth'))||((a=='Greymouth')&&(b=='Paihia'))){
			document.fuelCalc.km.value = 1239;
			travelTime("19 hours");
		}
		if(((a=='Paihia')&&(b=='Dunedin'))||((a=='Dunedin')&&(b=='Paihia'))){
			document.fuelCalc.km.value = 1592;
			travelTime("23 hours 30 minutes");
		}
		if(((a=='Paihia')&&(b=='Picton'))||((a=='Picton')&&(b=='Paihia'))){
			document.fuelCalc.km.value = 889;
			travelTime("13 hours 30 minutes");
		}
		//Nelson
		if(((a=='Nelson')&&(b=='Greymouth'))||((a=='Greymouth')&&(b=='Nelson'))){
			document.fuelCalc.km.value = 289;
			travelTime("4 hours 35 minutes");
		}
		if(((a=='Nelson')&&(b=='Dunedin'))||((a=='Dunedin')&&(b=='Nelson'))){
			document.fuelCalc.km.value = 792;
			travelTime("11 hours 5 minutes");
		}
		if(((a=='Nelson')&&(b=='Picton'))||((a=='Picton')&&(b=='Nelson'))){
			document.fuelCalc.km.value = 104;
			travelTime("2 hours 10 minutes");
		}
		//Greymouth
		if(((a=='Greymouth')&&(b=='Dunedin'))||((a=='Dunedin')&&(b=='Greymouth'))){
			document.fuelCalc.km.value = 559;
			travelTime("8 hours 10 minutes");
		}
		if(((a=='Greymouth')&&(b=='Picton'))||((a=='Picton')&&(b=='Greymouth'))){
			document.fuelCalc.km.value = 350;
			travelTime("5 hours 30 minutes");
		}
		if(((a=='Greymouth')&&(b=='Christchurch'))||((a=='Christchurch')&&(b=='Greymouth'))){
			document.fuelCalc.km.value = 256;
			travelTime("4 hours 10 minutes");
		}
		//Dunedin
		if(((a=='Dunedin')&&(b=='Picton'))||((a=='Picton')&&(b=='Dunedin'))){
			document.fuelCalc.km.value = 703;
			travelTime("10 hours");
		}
		if(a==b){
			document.fuelCalc.km.value = 0;
			travelTime("0 hours");
		}
		calcFuelCost();
	}
	function calcFuelCost(){
		document.fuelCalc.total.value = formatCurrency((document.fuelCalc.fuelEcon.value)*(document.fuelCalc.km.value/100)*document.fuelCalc.fuelPrice.value,2);
	}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}


// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}


var needValidate = false;
var defaultVal2 = "Type your question here and click Start Chat.";
function  openchatwindow(cbForm,windowName) {
	var res = true;

	var msg = document.getElementById("lp_msgfield");

	if(needValidate){
		var validateMessage = "Before you start your chat, type in the following fields:\r\n ";

		if(msg.value.length==0 || msg.value==defaultVal2 ){
			validateMessage += "Your Question\r\n";
			res=false;
		}
		if(res==false){
			alert(validateMessage);
		}

	}

    var formurl = cbForm.action;
    if(formurl.indexOf('?')==-1)
        formurl += '?';
    var elemCol = cbForm.elements;
    for(var ie=0; ie<elemCol.length; ie++){
        var et = elemCol[ie].type;
        if(et=="text" || et=="hidden" || et=="radio" || et=="textarea"){
            formurl += elemCol[ie].name + "=" + escape(elemCol[ie].value) + "&" ;
        }
    }

	if(res==true)
		window.open(formurl, windowName,'width=472,height=320,resizable=yes');
	return res;
}

/* =========== IMAGE ROTATE ==============*/
/*var ImageArr1 = new Array("images/home_main_rotation_1.jpg","images/home_main_rotation_2.jpg","images/home_main_rotation_3.jpg");
  var ImageHolder1 = document.getElementById('Rotating1');
  var HrefArr1 = new Array("car_hire_competition.html","/interface/webinterface.php","/interface/webinterface.php");
  var HrefHolder1 = document.getElementById('RotatingLink');
  
  
  function RotateImages(whichHolder,Start)
  {
  	var a = eval("ImageArr"+whichHolder);
  	var b = eval("ImageHolder"+whichHolder);
  	var c = eval("HrefArr"+whichHolder);
  	var d = eval("HrefHolder"+whichHolder);
  	if(Start>=a.length)
  		Start=0;
  	b.src = a[Start];
	d.href = c[Start];
	comment_ajax();
  	window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+")",15000);
  }*/