//instanQuote routines

function wherethefok(){

if (collectpt == endpt)
{fok="<p>"+stationcodes[collectpt]+"="+stations[collectpt]+"<p>";}
	else{fok="<p><u>Station abbreviations used:</u><br>"+stationcodes[collectpt]+"="+stations[collectpt]+"<br>"+stationcodes[endpt]+"="+stations[endpt]+"<p>";
}}


function catch99(){obtenEMIN();if (emin == 99){alert("instanQuote : help : end minutes not selected\n\nYou have not selected correctly the time that this rental ends. The end time will reset to default times of 30 minutes past the hour.");document.instanQuote.EMIN[31].selected = true;}}function masher(potato){tempAMopenHRS=potato.substring(0,2);tempAMopenHRS*1;
tempAMopenMIN=potato.substring(2,4);tempAMopenMIN*1;tempAMclosHRS=potato.substring(5,7);tempAMclosHRS*1;tempAMclosMIN=potato.substring(7,9);tempAMclosMIN*1;tempPMopenHRS=potato.substring(10,12);tempPMopenHRS*1;tempPMopenMIN=potato.substring(12,14);tempPMopenMIN*1;tempPMclosHRS=potato.substring(15,17);tempPMclosHRS*1;
tempPMclosMIN=potato.substring(17,19);tempPMclosMIN*1;}function shop1COLLECTclosedallday(){
shop1open=true;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();todaysthedaythat=stdate.getDay(); i=todaysthedaythat;masher(hoursmat1[i]);if (tempAMopenHRS == 0 && tempAMopenMIN == 0 && tempAMclosHRS == 0 && tempAMclosMIN == 0 && tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 & tempPMclosMIN == 0){shop1open=false;}}function shop2COLLECTclosedallday(){shop2open=true;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();todaysthedaythat=stdate.getDay(); i=todaysthedaythat;
masher(hoursmat2[i]);if (tempAMopenHRS == 0 && tempAMopenMIN == 0 && tempAMclosHRS == 0 && tempAMclosMIN == 0 && tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 & tempPMclosMIN == 0){shop2open=false;}}function shop1RETURNclosedallday(){shop1close=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();todaysthedaythat=endate.getDay(); i=todaysthedaythat;masher(hoursmat1[i]);
if (tempAMopenHRS == 0 && tempAMopenMIN == 0 && tempAMclosHRS == 0 && tempAMclosMIN == 0 && tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 & tempPMclosMIN == 0){shop1close=true;}}function shop2RETURNclosedallday(){shop2close=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();todaysthedaythat=endate.getDay(); i=todaysthedaythat;
masher(hoursmat1[i]);if (tempAMopenHRS == 0 && tempAMopenMIN == 0 && tempAMclosHRS == 0 && tempAMclosMIN == 0 && tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 & tempPMclosMIN == 0){shop2close=true;}}function shop1VALIDATEHOURScollection(){
if (stationmatrix[collectpt] == 1){shop1close=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();todaysthedaythat=stdate.getDay(); i=todaysthedaythat;
masher(hoursmat1[i]);if (tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 && tempPMclosMIN == 0 && tempAMopenHRS !=0 && tempAMclosHRS !=0){intensivOPEN=new Date(sy,smurf,sd,tempAMopenHRS,tempAMopenMIN);intensivOPENtime=intensivOPEN.getTime();intensivCLOS=new Date(sy,smurf,sd,tempAMclosHRS,tempAMclosMIN);intensivCLOStime=intensivCLOS.getTime();if (sttime < intensivOPENtime || sttime > intensivCLOStime){shop1close=true;}}else{morningOPEN=new Date(sy,smurf,sd,tempAMopenHRS,tempAMopenMIN);morningOPENtime=morningOPEN.getTime();morningCLOS=new Date(sy,smurf,sd,tempAMclosHRS,tempAMclosMIN);morningCLOStime=morningCLOS.getTime();afternoonOPEN=new Date(sy,smurf,sd,tempPMopenHRS,tempPMopenMIN);afternoonOPENtime=afternoonOPEN.getTime();afternoonCLOS=new Date(sy,smurf,sd,tempPMclosHRS,tempPMclosMIN);afternoonCLOStime=afternoonCLOS.getTime();if (sttime < morningOPENtime){shop1close=true;}if (sttime > morningCLOStime && sttime < afternoonOPENtime){shop1close=true;}if (sttime > afternoonCLOStime){shop1close=true;}}}}function shop2VALIDATEHOURScollection(){if (stationmatrix[collectpt] == 2){shop2close=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();todaysthedaythat=stdate.getDay(); i=todaysthedaythat;masher(hoursmat1[i]);if (tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 && tempPMclosMIN == 0 && tempAMopenHRS !=0 && tempAMclosHRS !=0){ intensivOPEN=new Date(sy,smurf,sd,tempAMopenHRS,tempAMopenMIN);
	intensivOPENtime=intensivOPEN.getTime();intensivCLOS=new Date(sy,smurf,sd,tempAMclosHRS,tempAMclosMIN);intensivCLOStime=intensivCLOS.getTime();if (sttime < intensivOPENtime || sttime > intensivCLOStime){shop2close=true;}
}

else{ 

     morningOPEN=new Date(sy,smurf,sd,tempAMopenHRS,tempAMopenMIN);
     morningOPENtime=morningOPEN.getTime();
     morningCLOS=new Date(sy,smurf,sd,tempAMclosHRS,tempAMclosMIN);
     morningCLOStime=morningCLOS.getTime();

     afternoonOPEN=new Date(sy,smurf,sd,tempPMopenHRS,tempPMopenMIN);
     afternoonOPENtime=afternoonOPEN.getTime();
     afternoonCLOS=new Date(sy,smurf,sd,tempPMclosHRS,tempPMclosMIN);
     afternoonCLOStime=afternoonCLOS.getTime();

     if (sttime < morningOPENtime){shop2close=true;}
     if (sttime > morningCLOStime && sttime < afternoonOPENtime){shop2close=true;}
     if (sttime > afternoonCLOStime){shop2close=true;}
}}}



function shop1VALIDATEHOURSreturn(){
shop1close=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();
todaysthedaythat=stdate.getDay(); 
i=todaysthedaythat;
masher(hoursmat1[i]);

if (tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 && tempPMclosMIN == 0 && tempAMopenHRS !=0 && tempAMclosHRS !=0)

{

	intensivOPEN=new Date(ey,emurf,ed,tempAMopenHRS,tempAMopenMIN);
	intensivOPENtime=intensivOPEN.getTime();
	intensivCLOS=new Date(ey,emurf,ed,tempAMclosHRS,tempAMclosMIN);
	intensivCLOStime=intensivCLOS.getTime();

	if (entime < intensivOPENtime || entime > intensivCLOStime){shop1close=true;}
}

else{ 

     morningOPEN=new Date(ey,emurf,ed,tempAMopenHRS,tempAMopenMIN);
     morningOPENtime=morningOPEN.getTime();
     morningCLOS=new Date(ey,emurf,ed,tempAMclosHRS,tempAMclosMIN);
     morningCLOStime=morningCLOS.getTime();

     afternoonOPEN=new Date(ey,emurf,ed,tempPMopenHRS,tempPMopenMIN);
     afternoonOPENtime=afternoonOPEN.getTime();
     afternoonCLOS=new Date(ey,emurf,ed,tempPMclosHRS,tempPMclosMIN);
     afternoonCLOStime=afternoonCLOS.getTime();

     if (entime < morningOPENtime){shop1close=true;}
     if (entime > morningCLOStime && entime < afternoonOPENtime){shop1close=true;}
     if (entime > afternoonCLOStime){shop1close=true;}



}


}

function shop2VALIDATEHOURSreturn(){
shop2close=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();
todaysthedaythat=stdate.getDay(); 
i=todaysthedaythat;
masher(hoursmat1[i]);

if (tempPMopenHRS == 0 && tempPMopenMIN == 0 && tempPMclosHRS == 0 && tempPMclosMIN == 0 && tempAMopenHRS !=0 && tempAMclosHRS !=0)

{

	intensivOPEN=new Date(ey,emurf,ed,tempAMopenHRS,tempAMopenMIN);
	intensivOPENtime=intensivOPEN.getTime();
	intensivCLOS=new Date(ey,emurf,ed,tempAMclosHRS,tempAMclosMIN);
	intensivCLOStime=intensivCLOS.getTime();

	if (entime < intensivOPENtime || entime > intensivCLOStime){shop2close=true;}
}

else{ 

     morningOPEN=new Date(ey,emurf,ed,tempAMopenHRS,tempAMopenMIN);
     morningOPENtime=morningOPEN.getTime();
     morningCLOS=new Date(ey,emurf,ed,tempAMclosHRS,tempAMclosMIN);
     morningCLOStime=morningCLOS.getTime();

     afternoonOPEN=new Date(ey,emurf,ed,tempPMopenHRS,tempPMopenMIN);
     afternoonOPENtime=afternoonOPEN.getTime();
     afternoonCLOS=new Date(ey,emurf,ed,tempPMclosHRS,tempPMclosMIN);
     afternoonCLOStime=afternoonCLOS.getTime();

     if (entime < morningOPENtime){shop2close=true;}
     if (entime > morningCLOStime && entime < afternoonOPENtime){shop2close=true;}
     if (entime > afternoonCLOStime){shop2close=true;}



}


}


function availchecker(){
availstate=true;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);
sttime = stdate.getTime(); entime=endate.getTime();for (var i=0; i < availblocks.length; i++)


{
tempSD=availblocks[i].substring(0,2);
tempSM=availblocks[i].substring(3,5);
tempSY=availblocks[i].substring(6,10);
tempED=availblocks[i].substring(11,13);
tempEM=availblocks[i].substring(14,16);
tempEY=availblocks[i].substring(17,21);
tempstartOPEN = new Date (tempSY, ((tempSM*1)-1), tempSD,0,0);tempstartTIME = tempstartOPEN.getTime();
tempstartCLOSE = new Date (tempEY, ((tempEM*1)-1), tempED,23,59);tempcloseTIME = tempstartCLOSE.getTime();

// if rental starts during blocked period
if(sttime > tempstartTIME && sttime < tempcloseTIME && opciones[cual+1] == availblocks[i].substring(22,27) && (availblocks[i].substring(28,31) == "ALL" || availblocks[i].substring(28,31) == stationcodes[collectpt])){availstate=false; break;}

// if rental ends during blocked period

if(entime > tempstartTIME && entime < tempcloseTIME && opciones[cual+1] == availblocks[i].substring(22,27) && (availblocks[i].substring(28,31) == "ALL" || availblocks[i].substring(28,31) == stationcodes[collectpt])){availstate=false; break;}

//if rental crosses the blocked period

if(sttime < tempstartTIME && entime > tempcloseTIME && opciones[cual+1] == availblocks[i].substring(22,27) && (availblocks[i].substring(28,31) == "ALL" || availblocks[i].substring(28,31) == stationcodes[collectpt])){availstate=false; break;}


}}


function daychecks(){if (sd > 1 || sd < 31){daycheckstate=true;}else{daycheckstate=false;}}




function premium(){

premiumstate=false;premiumvalue=0;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);
sttime = stdate.getTime(); entime=endate.getTime();for (var i=0; i < premiumdays.length; i++){tempSD=premiumdays[i].substring(0,2);tempSM=premiumdays[i].substring(3,5);tempSY=premiumdays[i].substring(6,10);tempFROM=premiumdays[i].substring(11,15);tempTHRU=premiumdays[i].substring(16,20);tempRULE=premiumdays[i].substring(21,26);tempCHARGE=premiumdays[i].substring(27,30);tempstartOPEN = new Date (tempSY, ((tempSM*1)-1), tempSD, tempFROM.substring(0,2), tempFROM.substring(2,4));tempstartTIME = tempstartOPEN.getTime();tempstartCLOSE = new Date (tempSY, ((tempSM*1)-1), tempSD, tempTHRU.substring(0,2), tempTHRU.substring(2,4));tempcloseTIME = tempstartCLOSE.getTime();if(sttime > tempstartTIME && sttime < tempcloseTIME){premiumstate=true; premiumvalue=1*tempCHARGE; break;}}}

function promoter(normalprice,diff){

wherethefok();

if (generaldiscount !=0){ // general discounts apply

	// validation that booking meets reservations date criteria
	// ========================================================
	if (generalbookfromdate != "ALL"){prommystart= new Date (generalbookfromdate.substring(6,10),((generalbookfromdate.substring(3,5)*1)-1),generalbookfromdate.substring(0,2),0,00); pst=prommystart.getTime();}else{pst=0;}
	if (generalbookbeforedate != "ALL"){prommyend= new Date (generalbookbeforedate.substring(6,10),((generalbookbeforedate.substring(3,5)*1)-1),generalbookbeforedate.substring(0,2),0,00); pet=prommyend.getTime();}else{pet=0;}


	// validation that booking also meets departure date criteria for general promotions
      // =================================================================================
	rentalstartdatetime=new Date(sy,sm-1,sd,sh,smin);RSTime=rentalstartdatetime.getTime();
	tst=0; tet=0;
	if (generaldiscountfirstrentaldate != "ALL"){
trafficstartdate=new Date(generaldiscountfirstrentaldate.substring(6,10), ((generaldiscountfirstrentaldate.substring(3,5)*1)-1),generaldiscountfirstrentaldate.substring(0,2),0,0);tst = trafficstartdate.getTime();}
	if (generaldiscountlastrentaldate != "ALL"){
trafficenddate=new Date(generaldiscountlastrentaldate.substring(6,10), ((generaldiscountlastrentaldate.substring(3,5)*1)-1), generaldiscountlastrentaldate.substring(0,2),0,0);tet=trafficenddate.getTime();}

	// logic to only apply discounts if both criteria are met
      // ======================================================

if ((((hnoutime > pst && hnoutime < pet) || (generalbookfromdate == "ALL" && generalbookbeforedate == "ALL")) && ((generaldiscountfirstrentaldate == "ALL" && generaldiscountlastrentaldate == "ALL") || (RSTime > tst && RSTime <tet)) && (diff > generaldiscountdaysrule))){

normalprice=Math.ceil(normalprice);
discountvalue=(100-generaldiscount)/100;
eurgrossprice=normalprice; eurnettprice=(eurgrossprice*discountvalue);
ukfinalprice=eurgrossprice*myrate;eurnettprice=Math.ceil(eurnettprice); ukfinalprice=Math.ceil(ukfinalprice);
getrate(currencycode);uknettprice=eurnettprice*myrate; uknettprice=Math.ceil(uknettprice);
if (generaldiscountrule == "P"){theclause="booked and paid";}else{theclause="booked";}
if (generalbookbeforedate != "ALL"){thelimit="before "+generalbookbeforedate;}else{thelimit="while stocks last!";}
garfield="";
if (currencycode == "GBP" || currencycode == "IEP"){garfield ="&#163;";}
if (currencycode == "USD" || currencycode == "CAD" || currencycode == "SGD"){garfield ="$";}

if (onewaysuppmatrix[endpt] == 1 && onewaycharge !=0){
eurow=eurnettprice+onewaycharge; ukow=eurow*myrate; ukow=Math.ceil(ukow);

newpriceoutputzone=""+"Rental cost for "+diff+" days : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+generaldiscount+".00% discount**<br><u>Special offer price = <B>EUR "+eurnettprice+",00 + EUR "+onewaycharge+",00(*) = EUR "+eurow+",00 = "+currencycode+" "+garfield+" "+ukow+".00</B> at todays rate</u><p>**Special offer valid for reservations "+theclause+" "+thelimit+"<br>(*) One-way surcharge included"+fok;
document.instanQuote.PASTEPRICE.value=eurow;


}else{

newpriceoutputzone=""+"Rental cost for "+diff+" days : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+generaldiscount+".00% discount**<br><u>Special offer price = <B>EUR "+eurnettprice+",00 = "+currencycode+" "+garfield+" "+uknettprice+".00</B> at todays rate</u><p>**Special offer valid for reservations "+theclause+" "+thelimit+fok;
document.instanQuote.PASTEPRICE.value=eurnettprice;
}

document.instanQuote.NEWPRICEOUTPUTZONE.value=newpriceoutputzone;


} else{
normalprice=Math.ceil(normalprice);
discountvalue=(100-generaldiscount)/100;
eurgrossprice=normalprice; eurnettprice=eurgrossprice*discountvalue;ukfinalprice=eurgrossprice*myrate;eurnettprice=Math.ceil(eurgrossprice); ukfinalprice=Math.ceil(ukfinalprice);
getrate(currencycode);
if (generaldiscountrule == "P"){theclause="booked and paid";}else{theclause="booked";}
if (generalbookbeforedate != "ALL"){thelimit="before "+generalbookbeforedate;}else{thelimit="while stocks last!";}
garfield="";
if (currencycode == "GBP" || currencycode == "IEP"){garfield ="&#163;";}
if (currencycode == "USD" || currencycode == "CAD" || currencycode == "SGD"){garfield ="$";}

if (onewaysuppmatrix[endpt] == 1 && onewaycharge !=0){
eurow=eurgrossprice+onewaycharge; ukow=eurow*myrate; ukow=Math.ceil(ukow);
newpriceoutputzone=""+"Rental cost for "+diff+" days : <U><B>EUR "+eurgrossprice+",00 + EUR "+onewaycharge+",00 = EUR "+eurow+",00(*) = "+currencycode+" "+garfield+uknettrate+".00</B></U><br>(*) One-way charge included<P>"+fok;
document.instanQuote.PASTEPRICE.value=eurow;
}
else{

newpriceoutputzone=""+"Rental cost for "+diff+" days : <U><B>EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00</B></U><P>"+fok;
document.instanQuote.PASTEPRICE.value=eurgrossprice;
}
document.instanQuote.NEWPRICEOUTPUTZONE.value=newpriceoutputzone;









}
}


else{ // vehicle specific discounts apply


// vehicle specific promotions
// ===========================


prommystart=""; prommyend="";
if (Aspecificbookfromdate != "ALL"){prommystart= new Date (Aspecificbookfromdate.substring(6,10),((Aspecificbookfromdate.substring(3,5)*1)-1),Aspecificbookfromdate.substring(0,2),0,00); pst=prommystart.getTime();}else{pst=0;}
if (Aspecificbookbeforedate != "ALL"){prommyend= new Date (Aspecificbookbeforedate.substring(6,10),((Aspecificbookbeforedate.substring(3,5)*1)-1),Aspecificbookbeforedate.substring(0,2),0,00); pet=prommyend.getTime();}else{pet=0;}


// validation that booking also meets departure date criteria for general promotions
rentalstartdatetime=new Date(sy,sm-1,sd,sh,smin);RSTime=rentalstartdatetime.getTime();
tst=0; tet=0;
if (Aspecificdiscountfirstrentaldate != "ALL"){
trafficstartdate=new Date(Aspecificdiscountfirstrentaldate.substring(6,10), ((Aspecificdiscountfirstrentaldate.substring(3,5)*1)-1),Aspecificdiscountfirstrentaldate.substring(0,2),0,0);tst = trafficstartdate.getTime();}
if (Aspecificdiscountlastrentaldate != "ALL"){
trafficenddate=new Date(Aspecificdiscountlastrentaldate.substring(6,10), ((Aspecificdiscountlastrentaldate.substring(3,5)*1)-1), Aspecificdiscountlastrentaldate.substring(0,2),0,0);tet=trafficenddate.getTime();}



if (((((hnoutime > pst && hnoutime < pet) || (Aspecificbookfromdate == "ALL" && Aspecificbookbeforedate == "ALL")) && ((Aspecificdiscountfirstrentaldate == "ALL" && Aspecificdiscountlastrentaldate == "ALL") || (RSTime > tst && RSTime <tet)) && (diff > Aspecificdiscountdaysrule) && specificdiscounts[cual+1] !=0))){
normalprice=Math.ceil(normalprice);
discountvalue=(100-Aspecificdiscountvalue)/100; 
eurgrossprice=normalprice; eurnettprice=(eurgrossprice*discountvalue);
ukfinalprice=eurgrossprice*myrate;eurnettprice=Math.ceil(eurnettprice); ukfinalprice=Math.ceil(ukfinalprice);
getrate(currencycode);uknettprice=eurnettprice*myrate; uknettprice=Math.ceil(uknettprice);
if (Aspecificdiscountrule == "P"){theclause="booked and paid";}else{theclause="booked";}
if (Aspecificbookbeforedate != "ALL"){thelimit="before "+Aspecificbookbeforedate;}else{thelimit="while stocks last!";}
garfield="";
if (currencycode == "GBP" || currencycode == "IEP"){garfield ="&#163;";}
if (currencycode == "USD" || currencycode == "CAD" || currencycode == "SGD"){garfield ="$";}

if (onewaysuppmatrix[endpt] == 1 && onewaycharge !=0){
eurow=eurgrossprice+onewaycharge; ukow=eurow*myrate; ukow=Math.ceil(ukow);
newpriceoutputzone=""+"Rental cost for "+diff+" days : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+generaldiscount+".00% discount**<br><u>Special offer price = <B>EUR "+eurnettprice+",00 + EUR "+onewaycharge+",00(*) = EUR "+eurow+",00 = "+currencycode+" "+garfield+" "+ukow+".00</B> at todays rate</u><p>**Special offer valid for reservations "+theclause+" "+thelimit+"<br>(*) One-way surcharge included"+fok;
document.instanQuote.PASTEPRICE.value=eurow;
}
else{


newpriceoutputzone=""+"Rental cost for "+diff+" days : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+Aspecificdiscountvalue+".00% discount**<br><u>Special offer price = <B>EUR "+eurnettprice+",00 = "+currencycode+" "+garfield+" "+uknettprice+".00 at todays rate</u></B><p>**Special offer valid for reservations "+theclause+" "+thelimit+fok;
document.instanQuote.PASTEPRICE.value=eurnettprice;

 }
document.instanQuote.NEWPRICEOUTPUTZONE.value=newpriceoutputzone;
}

else{ 

normalprice=Math.ceil(normalprice);
discountvalue=(100-generaldiscount)/100;
eurgrossprice=normalprice; eurnettprice=eurgrossprice*discountvalue;ukfinalprice=eurgrossprice*myrate;eurnettprice=Math.ceil(eurgrossprice); ukfinalprice=Math.ceil(ukfinalprice);eurgrossprice=Math.ceil(eurgrossprice);
getrate(currencycode);
if (generaldiscountrule == "P"){theclause="booked and paid";}else{theclause="booked";}
if (generalbookbeforedate != "ALL"){thelimit="before "+generalbookbeforedate;}else{thelimit="while stocks last!";}
garfield="";
if (currencycode == "GBP" || currencycode == "IEP"){garfield ="&#163;";}
if (currencycode == "USD" || currencycode == "CAD" || currencycode == "SGD"){garfield ="$";}

if (onewaysuppmatrix[endpt] == 1 && onewaycharge !=0){
eurow=eurgrossprice+onewaycharge; ukow=eurow*myrate; ukow=Math.ceil(ukow);
newpriceoutputzone=""+"Rental cost for "+diff+" days : <U><B>EUR "+eurgrossprice+",00 + EUR "+onewaycharge+",00 = EUR "+eurow+",00(*) = "+currencycode+" "+garfield+uknettrate+".00</B></U><br>(*) One-way charge included<P>"+fok;
document.instanQuote.PASTEPRICE.value=eurow;
}

else{


newpriceoutputzone=""+"Rental cost for "+diff+" days : <B><U>EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00</B></U><P>"+fok;
document.instanQuote.PASTEPRICE.value=eurgrossprice;
}

document.instanQuote.NEWPRICEOUTPUTZONE.value=newpriceoutputzone;



}





}}


// General routines
// ================

function getrate(currencycode){
myrate=1;
if (currencycode == "GBP"){myrate=EXGBP;}
if (currencycode == "USD"){myrate=EXUSD;}
if (currencycode == "CHF"){myrate=EXCHF;}
if (currencycode == "JPY"){myrate=EXJPY;}
if (currencycode == "CAD"){myrate=EXCAD;}
if (currencycode == "DKK"){myrate=EXDKK;}
if (currencycode == "ISK"){myrate=EXISK;}
if (currencycode == "NZD"){myrate=EXNZD;}
if (currencycode == "NOK"){myrate=EXNOK;}
if (currencycode == "SGD"){myrate=EXSGD;}
if (currencycode == "SEK"){myrate=EXSEK;}
if (currencycode == "AUD"){myrate=EXAUD;}
if (currencycode == "DEM"){myrate=EXDEM;}
if (currencycode == "NLG"){myrate=EXNLG;}
if (currencycode == "BEF"){myrate=EXBEF;}
if (currencycode == "IEP"){myrate=EXIEP;}
if (currencycode == "ITL"){myrate=EXITL;}
if (currencycode == "FFR"){myrate=EXFFR;}
if (currencycode == "PTE"){myrate=EXPTE;}
if (currencycode == "ATS"){myrate=EXATS;}
if (currencycode == "LUF"){myrate=EXLUF;}
if (currencycode == "FIM"){myrate=EXFIM;}
if (currencycode == "ESP"){myrate=EXESP;}
if (currencycode == "FRF"){myrate=EXFRF;}}

function obtenSD(){
sd = "";for (var i=0; i < document.instanQuote.SD.length; i++) {if (document.instanQuote.SD[i].selected) {sd = document.instanQuote.SD[i].value; break;}}}
function obtenED(){
ed = "";for (var i=0; i < document.instanQuote.ED.length; i++) {if (document.instanQuote.ED[i].selected) {ed = document.instanQuote.ED[i].value; break;}}}
function obtenSM(){
sm = "";for (var i=0; i < document.instanQuote.SM.length; i++) {if (document.instanQuote.SM[i].selected) {sm = document.instanQuote.SM[i].value; break;}}}
function obtenEM(){
em = "";for (var i=0; i < document.instanQuote.EM.length; i++) {if (document.instanQuote.EM[i].selected) {em = document.instanQuote.EM[i].value; break;}}}
function obtenSY(){
sy = "";for (var i=0; i < document.instanQuote.SY.length; i++) {if (document.instanQuote.SY[i].selected) {sy = document.instanQuote.SY[i].value; break;}}}
function obtenEY(){
ey = "";for (var i=0; i < document.instanQuote.EY.length; i++) {if (document.instanQuote.EY[i].selected) {ey = document.instanQuote.EY[i].value; break;}}}
function obtenSH(){
sh = "";for (var i=0; i < document.instanQuote.SH.length; i++) {if (document.instanQuote.SH[i].selected) {sh = document.instanQuote.SH[i].value; break;}}}
function obtenEH(){
eh = "";for (var i=0; i < document.instanQuote.EH.length; i++) {if (document.instanQuote.EH[i].selected) {eh = document.instanQuote.EH[i].value; break;}}}
function obtenSMIN(){
smin = "";for (var i=0; i < document.instanQuote.SMIN.length; i++) {if (document.instanQuote.SMIN[i].selected) {smin = document.instanQuote.SMIN[i].value; break;}}}
function obtenEMIN(){
emin = "";for (var i=0; i < document.instanQuote.EMIN.length; i++) {if (document.instanQuote.EMIN[i].selected) {emin = document.instanQuote.EMIN[i].value; break;}}}
function obtenrenterid(){
rentertit = "";for (var i=0; i < document.instanQuote.TITLE.length; i++) {if (document.instanQuote.TITLE[i].selected) {rentertit = document.instanQuote.TITLE[i].text; break;}}}
function obtenage(){
renterage = "";for (var i=0; i < document.instanQuote.DRIVERAGES.length; i++) {if (document.instanQuote.DRIVERAGES[i].selected) {renterage = document.instanQuote.DRIVERAGES[i].value; agepos=i; document.instanQuote.RENTERAGEOUT.value=document.instanQuote.DRIVERAGES[i].text; break;}}}
function obtencurr(){
currencyname=""; currencycode = "";for (var i=0; i < document.instanQuote.CURRENCY.length; i++) {if (document.instanQuote.CURRENCY[i].selected) {currencyname = document.instanQuote.CURRENCY  [i].text; currencycode = document.instanQuote.CURRENCY[i].value; break;}}}
function obtenStartPt(){
collectpt = "";for (var i=0; i < document.instanQuote.COLLECTIONPOINT.length; i++) {if (document.instanQuote.COLLECTIONPOINT[i].selected) {collectpt = document.instanQuote.COLLECTIONPOINT[i].value; break;}}}
function obtenEndPt(){
endpt = "";for (var i=0; i < document.instanQuote.RETURN.length; i++) {if (document.instanQuote.RETURN[i].selected) {endpt = document.instanQuote.RETURN[i].value; break;}}}
function obtencar(){cual = "";for (var i=0; i < document.instanQuote.VEHICLES.length; i++) {if (document.instanQuote.VEHICLES[i].selected) {cual = document.instanQuote.VEHICLES[i].value-1; break;}}}
function obtenroof(){roof = "";for (var i=0; i < document.instanQuote.ROOF.length; i++) {if (document.instanQuote.ROOF[i].selected) {roof = document.instanQuote.ROOF[i].value; break;}}}
function obtenbaby(){baby = "";for (var i=0; i < document.instanQuote.BABY.length; i++) {if (document.instanQuote.BABY[i].selected) {baby = document.instanQuote.BABY[i].value; break;}}}
function obtenbooster(){booster = "";for (var i=0; i < document.instanQuote.BOOSTER.length; i++) {if (document.instanQuote.BOOSTER[i].selected) {booster = document.instanQuote.BOOSTER[i].value; break;}}}


// title bar & customer name verification
// ======================================

function trial(){
obtenrenterid();
if (rentertit == "Anon."){
document.instanQuote.CUSTFIRSTNAME.value="";
document.instanQuote.CUSTLASTNAME.value="";}}

function renterid(){
obtenrenterid();
if ((document.instanQuote.CUSTFIRSTNAME.value == "" || document.instanQuote.CUSTLASTNAME.value == "") && rentertit != "Anonymous Quote"){
alert("instanQuote : help : error in Renter identity\n\nYou have not shown your full name at the beginning of the form although you have selected -"+rentertit+"- as a courtesy handle. If you'd like your quotation to be personalised with your name ready for booking or printing, please enter your initial or first name in the box provided.\n\nTip : Leave the title bar as  Anon., not Mr. or Mrs. etc to request a quotation anonymously.\n\nThe form will reset to leave the title, first name and surname boxes empty for an anonymous transaction.");
document.instanQuote.CUSTFIRSTNAME.value="";
document.instanQuote.CUSTLASTNAME.value="";
document.instanQuote.TITLE[0].selected=true;}

if (document.instanQuote.CUSTFIRSTNAME.value != "" && document.instanQuote.CUSTLASTNAME.value != "" && rentertit == "Anon.")
{
alert("instanQuote : help : no title or courtesy handle\n\nYou are requesting an anonymous quotation but the following data is entered as first and last name : \n\n"+document.instanQuote.CUSTFIRSTNAME.value+", "+document.instanQuote.CUSTLASTNAME.value+"\n\nWe will automatically reset your title using Mr. as a default value but if this is incorrect please reset this before proceeding.\n\nTip : Set the title select bar to Anon. and you may proceed without using your name at all.");
document.instanQuote.TITLE[1].selected=true;}}

function emptyname(){
obtenrenterid();
if (document.instanQuote.CUSTFIRSTNAME.value == "" && rentertit != "Anon."){alert("instanQuote : help : no initial or first name entered\n\nYou have not entered your first name or initial in the space provided at the top of this form. This would not be a problem for an anonymous quotation but you have selected -"+rentertit+"- as your title or courtesy handle.\n\nPlease verify the input and try again.\n\nTip : To obtain an anonymous quote, simply select Anon. as the title and leave the name fields blank.");
document.instanQuote.TITLE[0].selected=true;
document.instanQuote.TITLE.focus();}}

function emptysurname(){}

function nameval(){
obtenrenterid();
if (rentertit == "Anon."){alert("instanQuote : help : no title selected\n\nBefore entering your name into this field, please select a courtesy handle or title from the selector above.\n\nAn acceptable option might be Mr. or, Ms.\n\nWhen you have selected the title, please return to this box and enter your name.");
document.instanQuote.TITLE.focus();}}

// Age of driver verification
// ==========================

function ageofclient(){
obtenage();if (renterage == 1){alert("instanQuote : help : driver age\n\nYou have not entered a valid driver age. This field is required for insurance assessment purposes.\n\nPlease select a valid age range.");document.instanQuote.DRIVERAGES.focus();}
else{document.instanQuote.CURRENCY.focus();}}

// Currency choice
// ===============

function currencychoice(){
obtencurr();if (currencycode == "ZZZ"){alert("instanQuote : help : currency selection\n\nIn order to prepare your quotation we obviously need to know in what currency you'd like your price.\n\nOur quote will be delivered in Euros (our home currency) and the currency you choose.\n\n   "); document.instanQuote.CURRENCY[0].selected=true; document.instanQuote.CURRENCY.focus();}

else{getrate(currencycode); if (currencycode == "EUR"){alert("instanQuote : help : currency selection\n\nYou have chosen the Euro as the currency to be used in this quotation.\n\nSince our rates are published in Euros and we charge in Euros, the rates quoted are fixed and not subject to any fluctuation.");} else{if (currencycode == "DEM" || currencycode == "NLG" || currencycode == "BEF" || currencycode == "IEP" || currencycode == "ITL" || currencycode == "FFR" || currencycode == "PTE" || currencycode == "ATS" || currencycode == "LUF" || currencycode == "FIM" || currencycode == "ESP" || currencycode == "FRF"){
alert("instanQuote : help : currency selection\n\nYou have selected "+currencyname+"\nfor this quotation.\n\nThis currency is tied to the Euro so the exchange rate of\n\n1 Euro = "+myrate+ "\n\nis a fixed rate. Our charges will be made to your credit card       \nin Euros at this fixed rate.");}
else{alert("instanQuote : help : currency selection\n\nYou have selected "+currencyname+"\nfor this quotation.\n\nThis currency is not tied to the Euro. Todays rate of exchange of\n\n1 Euro = "+myrate+" "+currencyname+"   \n\nis obviously subject to possible variations. Our charges will be made     \nto your credit card in Euros and will be converted into "+currencyname+"     \nby your credit card issuer.\n\nAlthough the variations are small and we endeavour to report fairly\nthe rate of exchange, we are unable to fix the rate that your bank,\nor credit card issuer, will ultimately use.");}}document.instanQuote.COLLECTIONPOINT.focus();}}

// Collection location
// ===================

function collectVerify(){
obtenStartPt();
if (collectpt == 0){alert("instanQuote : help : No collection point\n\nYou have omitted to indicate where you wish to start the rental, please rectify this by choosing a location now.\n\nAn acceptable option might be : "+stations[1]+".");
document.instanQuote.COLLECTIONPOINT.focus();}
alert("Start of rental : "+stations[collectpt]);
if (stations[collectpt] == "Hotel"){document.instanQuote.ARRFLIGHT.value="Hotel t.b.a";}
document.instanQuote.RETURN[collectpt].selected = true;}

// Start date routines
// ===================

function startVerify(){
obtenSD();obtenSM();obtenSY();obtenED();obtenEM();obtenEY();
if (sd == 99 && sm == 99 && sy == 1999){
alert("instanQuote : help : missing start date\n\nPlease enter the date that the rental is due to start.");document.instanQuote.SD.focus();}
		else{
	if (sd !=99 && sm!=99 && sy!=1999){
	smm=sm-1;
	hoystart=new Date(sy,smm,sd,9,30,0);
	hoysd=hoystart.getDate(); hoysm=hoystart.getMonth(); hoysy=hoystart.getFullYear();
	hoysd=hoysd*1; hoysm=((hoysm*1)+1); hoysy=hoysy*1;
	document.instanQuote.SD[hoysd].selected=true;
	document.instanQuote.SM[hoysm].selected=true;
      if (hoysy == 2000){document.instanQuote.SY[0].selected = true;}
      if (hoysy == 2001){document.instanQuote.SY[1].selected = true;}
      if (hoysy == 2002){document.instanQuote.SY[2].selected = true;}
      if (hoysy == 2003){document.instanQuote.SY[3].selected = true;}
      if (hoysy == 2004){document.instanQuote.SY[4].selected = true;}

if (ed == 99 || em == 99 || ey == 1999){
endofrental=hoysd+7; endm=hoysm-1;
terminar=new Date(hoysy, endm, endofrental , 9, 30, 0);
newed=terminar.getDate(); newem=terminar.getMonth(); newey=terminar.getFullYear();
newed=newed*1; newem=newem*1; newey=newey*1; newem=newem+1;
	document.instanQuote.ED[newed].selected=true;
	document.instanQuote.EM[newem].selected=true;
      daysVerify();
      if (newey == 2000){document.instanQuote.EY[0].selected = true;}
      if (newey == 2001){document.instanQuote.EY[1].selected = true;}
      if (newey == 2002){document.instanQuote.EY[2].selected = true;}
      if (newey == 2003){document.instanQuote.EY[3].selected = true;}
      if (newey == 2004){document.instanQuote.EY[4].selected = true;}}}}}

function shVerify(){obtenSH();obtenSMIN();obtenEMIN();if (smin == 99){document.instanQuote.SMIN[30].selected = true;if (emin == 99){document.instanQuote.EMIN[30].selected = true;}
}if (sh == 99){alert("instanQuote : help : missing start time!\n\nPlease indicate the expected collection time of the vehicle. You can notify changes in the time of collection later if necessary.\n\nTip : If you have no idea what time the arrival is, use 09:30 am as the collection times. Our system will double check all arrival times set as 09:30 against flight numbers on arrival.");document.instanQuote.SH.focus();}else{ ww=sh*1+1;document.instanQuote.EH[ww].selected = true;}daysVerify();}function sminVerify(){obtenSMIN();if (smin == 99){alert("instanQuote : help : select minutes\n\nIn order to prepare a quotation we need to know the times     \of the start and end of hire.\n\nPlease select time for the rental to start.");document.instanQuote.SMIN[31].selected = true;}else{document.instanQuote.EMIN[smin].selected = true ;}daysVerify();}function nightowl(){if ((sh > 15 && sh < 24) && nightsuppsvalue !=0){tempHRS=nightsuppsstart.substring(0,2); tempHRS*1;tempMIN=nightsuppsstart.substring(2,4); tempMIN*1;if ((sh > tempHRS) || ((sh == tempHRS) && (smin > tempMIN))){nightsuppstate=true;}}else{if ((sh > -1) && nightsuppsvalue !=0){tempHRS = nightsuppsend.substring(0,2); tempHRS*1;tempMIN = nightsuppsend.substring(2,4); tempMIN*1;if ((sh < tempHRS) || ((sh == tempHRS) && (smin < tempMIN))){nightsuppsstate=true;}}}}
function arrflightVerify(){if (document.instanQuote.ARRFLIGHT.value == ""){document.instanQuote.ARRFLIGHT.value="t.b.a.";}else{document.instanQuote.ARRFLIGHT.value=document.instanQuote.ARRFLIGHT.value.toUpperCase();}}function returnVerify(){obtenEndPt();obtenStartPt();if (endpt == 1000){alert("return value exceeds 1000");}if (endpt != 0 && collectpt == 0){document.instanQuote.COLLECTIONPOINT[endpt].selected = true;}else{if (endpt == 0){alert("instanQuote : help : Missing return location!\n\nYou have not specified the location where you wish to return the vehicle at the end of the rental.\n\nAn acceptable option might be : "+stations[1]+".");document.instanQuote.RETURN.focus();}

else{
if (endpt != collectpt && onewaycharge !=0 && onewaysuppmatrix[endpt] == 1){alert("instanQuote : help : one-way rental verification\n\nAt this time you have selected : \n\nRental Starts : "+stations[collectpt]+"\nRental ends : "+stations[endpt]+"\n\nThis information may be valid, if it is not please ammend this prior to        \nproceeding with the quotation.\n\nPlease note if you collect a vehicle from "+stations[collectpt]+" and return\nit to "+stations[endpt]+", there is a surcharge of EUR "+onewaycharge+",00 to\ncover our additional costs in returning the vehicle to its base.\n\n");}
else{

if (endpt != collectpt && onewaysuppmatrix[endpt] == 0){
alert("instanQuote : help : one-way rental verification\n\nAt this time you have selected : \n\nRental Starts : "+stations[collectpt]+"\nRental ends : "+stations[endpt]+"\n\nThis information may be valid, if it is not please ammend this prior to        \nproceeding with the quotation.\n\nThere are no additional charges for rentals one-way between these\nrental stations providing you comply with a "+minoneway+" day hire period.\n\n");

}
}


}}}

// End date routines
// =================

function endVerify(){
obtenSD();obtenSH();obtenSY();obtenED();obtenEM();obtenEY();}

// Rental days
// ===========

function daysVerify(){
obtenSD();obtenSM();obtenSY();obtenSH();obtenSMIN();
obtenED();obtenEM();obtenEY();obtenEH();obtenEMIN();
if (sd == 99 || sm == 99 || sy == 1999 || sh == 99 || smin == 99 || ed == 99 || em == 99 || ey == 1999 || sh == 99 || emin == 99){
document.instanQuote.RENTDAYS.value=0;}
else{smonth=sm-1; emonth=em-1;
sdate = new Date(sy,smonth,sd,sh,smin);
sdayofweek=sdate.getDay();
edate = new Date(ey,emonth,ed,eh,emin);
edayofweek=edate.getDay();
stime = sdate.getTime();
etime = edate.getTime();
diff  = (etime-stime-3600000);
diff = (diff/(1000*60*60*24));diff=Math.ceil(diff);
document.instanQuote.RENTDAYS.value=diff;
}}


// Show vehicle features & image
// =============================

function showcar(){
obtencar();
obtenSD();obtenSM();obtenSY();obtenSH();obtenSMIN();obtenED();obtenEM();obtenEY();obtenEH();obtenEMIN();obtenrenterid();obtencurr();obtenStartPt();obtenEndPt();obtencar();obtenage();

if(sd == 99 || sm == 99 || sy == 99 || sh == 99 || sm == 99 || ed == 99 || em == 99 || ey == 99 || eh == 99 || emin == 99){alert("instanQuote : vehicle selection : dates not selected\n\nBefore selecting a vehicle, indicate the dates of hire and the location so we can                \noffer you vehicles based on actual availability and incorporate any special offers.\n\nThank you.");
document.instanQuote.VEHICLES[0].selected=true;
document.instanQuote.SD.focus();}
else{

availchecker();
if (availstate == false){
alert("instanQuote : help : Vehicle Availability\n\nYou have currently selected the "+opciones[cual+1]+"-"+nombreopcion[cual+1]+" for this rental.\n\nOur system is currently flagging this car as unavailable from "+stations[collectpt]+"            \n for the dates requested.\n\nPlease consider an alternative vehicle, try collecting the car you require from a\nnearby location or contact us by email for assistance.\n\n");}


if ( renterage < minagest || (minexcepts[cual+1] !=0 && renterage < minexcepts[cual+1])){
thelowestage=minagest;
if (minexcepts[cual+1] != 0){thelowestage=minexcepts[cual+1];}

if (document.instanQuote.DRIVERAGES[agepos].value == 1){
alert("instanQuote : help : driver age not selected\n\nBefore selecting a vehicle please indicate your age.\n\nDriver age may affect your eligibility to drive a particular vehicle.");
document.instanQuote.VEHICLES[0].selected=true;
document.instanQuote.DRIVERAGES.focus();}
else{

alert("instanQuote : help : driver age minimum exceeded\n\nYou have selected a vehicle ("+nombreopcion[cual+1]+") which has a minimum driver age            \nrequirement of "+thelowestage+" years.\n\nYou have currently shown your age to be "+document.instanQuote.DRIVERAGES[agepos].text+" .\n\nPlease select an alternative vehicle from the list available, or correct          \nthe drive age on the form to continue.\n\n");
document.instanQuote.VEHICLES[0].selected=true;
document.instanQuote.DRIVERAGES.focus();}



}else{

if (cual >opciones.length){alert("instanQuote : help : error in vehicle selection\n\nPlease select a valid vehicle type from the vehicle selector. You have selected a heading from the pull-down bar rather than an actual model!\n\nAn example of a correct choice might be "+opciones[0]+" - "+nombreopcion[0]+"\n\nPlease make a new selection now.\n\n");}

else{

if (availstate == false){document.forms.instanQuote.TV.src="http://www.carjet.com/artwork/cars_soldout.gif";}else{
document.forms.instanQuote.TV.src="http://www.carjet.co.uk/common/revamp/common/cars/fullsize/cars_"+imgref[cual+1]+".gif";}
document.forms.instanQuote.IMAGEREFERENCE.value=imgref[cual+1];if (generaldiscount !=0){roolword="book and pay"; if (generaldiscountrule != "P"){roolword="book";}prommystart=""; prommyend="";if (generalbookfromdate != "ALL"){prommystart= new Date (generalbookfromdate.substring(6,10),((generalbookfromdate.substring(3,5)*1)-1),generalbookfromdate.substring(0,2),0,00); pst=prommystart.getTime();}else{pst=0;}if (generalbookbeforedate != "ALL"){prommyend= new Date (generalbookbeforedate.substring(6,10),((generalbookbeforedate.substring(3,5)*1)-1),generalbookbeforedate.substring(0,2),0,00); pet=prommyend.getTime();}else{pet=0;}rentalstartdatetime=new Date(sy,sm-1,sd,sh,smin);RSTime=rentalstartdatetime.getTime();tst=0; tet=0;if (generaldiscountfirstrentaldate != "ALL"){trafficstartdate=new Date(generaldiscountfirstrentaldate.substring(6,10), ((generaldiscountfirstrentaldate.substring(3,5)*1)-1),generaldiscountfirstrentaldate.substring(0,2),0,0);tst = trafficstartdate.getTime();}if (generaldiscountlastrentaldate != "ALL"){trafficenddate=new Date(generaldiscountlastrentaldate.substring(6,10), ((generaldiscountlastrentaldate.substring(3,5)*1)-1), generaldiscountlastrentaldate.substring(0,2),0,0);tet=trafficenddate.getTime();}if ((((hnoutime > pst && hnoutime < pet) || (generalbookfromdate == "ALL" && generalbookbeforedate == "ALL")) && availstate !=false && ((generaldiscountfirstrentaldate == "ALL" && generaldiscountlastrentaldate == "ALL") || (RSTime > tst && RSTime <tet)) && (diff > generaldiscountdaysrule))){alert("instanQuote : Special Offer!\n\nThe vehicle selected, (the "+nombreopcion[cual+1]+") is currently subject to a special           \n offer for the dates selected.\n\nThere's an EXTRA "+generaldiscount+".00% DISCOUNT OFF our published rates for this vehicle.\n\nWe'll include full details when we send your quotation!\n\n");}else{null;}}else{if (specificdiscounts[cual+1] ==1){prommystart=""; prommyend="";if (Aspecificbookfromdate != "ALL"){prommystart= new Date (Aspecificbookfromdate.substring(6,10),((Aspecificbookfromdate.substring(3,5)*1)-1),Aspecificbookfromdate.substring(0,2),0,00); pst=prommystart.getTime();}else{pst=0;}if (Aspecificbookbeforedate != "ALL"){prommyend= new Date (Aspecificbookbeforedate.substring(6,10),((Aspecificbookbeforedate.substring(3,5)*1)-1),Aspecificbookbeforedate.substring(0,2),0,00); pet=prommyend.getTime();}else{pet=0;}
rentalstartdatetime=new Date(sy,sm-1,sd,sh,smin);RSTime=rentalstartdatetime.getTime();
tst=0; tet=0;if (Aspecificdiscountfirstrentaldate != "ALL"){
trafficstartdate=new Date(Aspecificdiscountfirstrentaldate.substring(6,10), ((Aspecificdiscountfirstrentaldate.substring(3,5)*1)-1),Aspecificdiscountfirstrentaldate.substring(0,2),0,0);tst = trafficstartdate.getTime();}
if (Aspecificdiscountlastrentaldate != "ALL"){trafficenddate=new Date(Aspecificdiscountlastrentaldate.substring(6,10), ((Aspecificdiscountlastrentaldate.substring(3,5)*1)-1), Aspecificdiscountlastrentaldate.substring(0,2),0,0);tet=trafficenddate.getTime();}if ((((hnoutime > pst && hnoutime < pet) || (Aspecificbookfromdate == "ALL" && Aspecificbookbeforedate == "ALL")) && availstate !=false && ((Aspecificdiscountfirstrentaldate == "ALL" && Aspecificdiscountlastrentaldate == "ALL") || (RSTime > tst && RSTime <tet)) && (diff > Aspecificdiscountdaysrule))){alert("instanQuote : Special Offer!\n\nThe vehicle selected, (the "+nombreopcion[cual+1]+") is currently subject to a special promotion              \nfor the dates selected.\n\nThere's an extra "+Aspecificdiscountvalue+".00% discount off our published rates for this vehicle.\n\nWe'll include full details when we send your quotation!");}}}}}}}function roofing(){alert("instanQuote : help : Roof rack not available\n\nYou have selected the "+nombreopcion[cual+1]+" for this quotation           \nwith a roof rack. Regrettably, we are unable to offer roof racks on the\n"+nombreopcion[cual+1]+".\n\nPlease select an alternative vehicle or proceed with this quotation without\nthe roof rack.");document.instanQuote.ROOF.focus();}function nocandoo(nameofcar){alert("instanQuote : help : unavailable vehicle\n\nThe vehicle selected, "+nameofcar+", is not available for rental               \nfrom "+sd+"/"+sm+"/"+sy+".\n\nPlease select another vehicle for this quotation.\n\nTip : You may find it useful to look at our weekly price tables above on this\nweb page before requesting another quotation.\n\nVery occasionally, new vehicle types are incorporated into our fleet and are\nnot available during low season.\n\nPlease e-mail us at "+corpemail+" for assistance.");document.instanQuote.VEHICLES.focus();}function crimbo(){crimborules=true;if (applyspecialperiod == true && rentalduration < specialminhire){crimborules=false;smurf=sm-1;emurf=em-1;stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);sttime = stdate.getTime(); entime=endate.getTime();rentalduration = ((entime-sttime)/86400000); rentalduration=Math.ceil(rentalduration);specSD=specialperiod.substring(0,2);specSM=specialperiod.substring(3,5);specSY=specialperiod.substring(6,10);specED=specialperiod.substring(11,13);specEM=specialperiod.substring(14,16);specEY=specialperiod.substring(17,21);specSFECHA=new Date(specSY, ((specSM*1)-1), specSD, 01, 00);specEFECHA=new Date(specEY, ((specEM*1)-1), specED, 23, 59);specSTIM=specSFECHA.getTime();specETIM=specEFECHA.getTime();if ((sttime > specSTIM && sttime < specETIM) || (entime > specSTIM && entime < specETIM)){crimbrules=false;}else{crimborules=true;}}}

function prix(){

// calculation of price
// ====================

smurf=sm-1;emurf=em-1;
stdate = new Date(sy,smurf,sd,sh,smin);endate = new Date(ey,emurf,ed,eh,emin);
sttime = stdate.getTime(); entime=endate.getTime();
rentalduration = ((entime-sttime)/86400000); rentalduration=Math.ceil(rentalduration);
seasoncodetimes = new Array (temporadas.length);
seasoncodehandle = new Array( temporadas.length);

	for (a=0; a<temporadas.length; a++){
	tempday=temporadas[a].substring(0,2);
	tempmes=temporadas[a].substring(3,5);
	tempano=temporadas[a].substring(6,10);
	seasoncodehandle[a]=temporadas[a].substring(11,12);
	tempmes=tempmes*1;tempmes=tempmes-1;
	fechastime =new Date(tempano,tempmes,tempday,0,1,0);
	seasoncodetimes[a]=fechastime.getTime();}

rentdaysplits = new Array(rentalduration);
rentdaytimevalues = new Array (rentalduration);
timeforbreakfast=sttime;

	for (y=0; y<rentalduration; y++){
		for (i=0; i<temporadas.length; i++){
			if  (timeforbreakfast >=seasoncodetimes[i] && timeforbreakfast <=seasoncodetimes[i+1]){ rentdaysplits[y] = seasoncodehandle[i]; break; }}
			rentdaytimevalues[y] = timeforbreakfast;
			timeforbreakfast=timeforbreakfast+86400000;}

eqlow=0; eqmid=0; eqhigh=0;
firstseason=""; secondseason="";

	for (q=0; q<rentdaysplits.length; q++){
	if (firstseason == ""){firstseason=rentdaysplits[q];}
	if (secondseason =="" && rentdaysplits[q] != firstseason){secondseason=rentdaysplits[q];}
	if (rentdaysplits[q] == "L"){eqlow++}
	if (rentdaysplits[q] == "M"){eqmid++}
	if (rentdaysplits[q] == "H"){eqhigh++}}

	firstseasondays=0; secondseasondays=0;
	if ( firstseason == "L"){ firstseasondays=eqlow;}
	if ( firstseason == "M"){ firstseasondays=eqmid;}
	if ( firstseason == "H"){ firstseasondays=eqhigh;}
	if ( secondseason == "L") { secondseasondays=eqlow;}
	if ( secondseason == "M") { secondseasondays=eqmid;}
	if ( secondseason == "H") { secondseasondays=eqhigh;}

allone=true;
for (t=0; t<rentdaysplits.length-1; t++){
if (rentdaysplits[t] != rentdaysplits[t+1]){allone=false; break; t=t+1; }}
}



function clickVerify(){

obtenSD();obtenSM();obtenSY();obtenSH();obtenSMIN();obtenED();obtenEM();obtenEY();obtenEH();obtenEMIN();obtenrenterid();obtencurr();obtenStartPt();obtenEndPt();obtencar();obtenage();
trial();obtenroof();obtenbaby();obtenbooster();if (renterage == 1){ageofclient();}else{if (currencycode == "ZZZ"){currencychoice();}else{if (collectpt == 0){collectVerify();}else{if (sd == 99 || sm == 99 || sy == 1999){startVerify();}else{if (sh == 99 || smin == 99){shVerify();}else{if (document.instanQuote.RENTDAYS.value <minhire){alert("instanQuote : help : date selection\n\nYou have currently selected a return date that is below the minimum    \nhire duration of "+minhire+" days for this location. You have selected : \n\nCollection : "+sd+"/"+sm+"/"+sy+" at "+sh+":"+smin+"\nReturn : "+ed+"/"+em+"/"+ey+" at "+eh+":"+emin+"\n\nPlease verify these dates to show a minimum hire duration of "+minhire+" before\nproceeding.\n\nTip : If you were trying to get a quotation for a rental duration under\n"+minhire+" days, request the quotation for the minimum "+minhire+" day period. You may\nfind our quote is still competitive with rates for shorter durations     \nelsewhere!");} else{deliverydaysEXTRACT();if (hoteldeliverylimit == "YES" && stations[collectpt] == "Hotel" && delivAMopenHRS == 0){alert ("instanQuote : help : Hotel delivery on a "+daysoftheweek[sdayofweek]+"\n\nYou have requested that your hire starts on "+daysoftheweek[sdayofweek]+", "+sd+" "+meses[sm]+" "+sy+".\n\nWe are unable to arrange hotel deliveries at any time on "+daysoftheweek[sdayofweek]+"s. Consider starting your rental a day earlier or later. You might also consider collecting from an airport location which is open on "+daysoftheweek[sdayofweek]+"s.");}else{deliverydaysEXTRACT();rentalstartdatetime=new Date(sy,sm,sd,sh,smin);RSTime=rentalstartdatetime.getTime();delivAMopenDate = new Date (sy,sm,sd,delivAMopenHRS,delivAMopenMIN);delivAMopenTime=delivAMopenDate.getTime();
delivAMclosDate = new Date (sy,sm,sd,delivAMclosHRS,delivAMclosMIN);delivAMclosTime=delivAMclosDate.getTime();delivPMopenDate = new Date (sy,sm,sd,delivPMopenHRS,delivPMopenMIN);delivPMopenTime=delivPMopenDate.getTime();
delivPMclosDate = new Date (sy,sm,sd,delivPMclosHRS,delivPMclosMIN);delivPMclosTime=delivPMclosDate.getTime();if (hoteldeliverylimit == "YES" && stations[collectpt] == "Hotel" && ((RSTime < delivAMopenTime) || (RSTime > delivAMclosTime && RSTime < delivPMopenTime) || (RSTime > delivPMclosTime))){intensiveshift="NO";if ( delivPMopenHRS == 0){intensiveshift="YES";alert("instanQuote : Hotel delivery not possible at selected time\n\nYou have tried to request a Hotel delivery starting on "+daysoftheweek[sdayofweek]+", "+sd+" "+meses[sm]+" "+sy+"       \nat "+sh+":"+smin+" hrs.\n\nWe are only able to arrange hotel delivery at this location on "+daysoftheweek[sdayofweek]+"s between "+delivAMopenHRSOUT+":"+delivAMopenMINOUT+" and "+delivAMclosHRSOUT+":"+delivAMclosMINOUT+" hrs on "+daysoftheweek[sdayofweek]+"s.\n\nPlease reschedule the delivery time before continuing.");}else{alert("instanQuote : Hotel delivery not possible at selected time\n\nYou have tried to request a Hotel delivery starting "+sd+" "+meses[sm]+" "+sy+"      \nat "+sh+":"+smin+" hrs.\n\nWe are only able to arrange hotel delivery at this location on "+daysoftheweek[sdayofweek]+"s\nbetween the following times :\n\nMornings : "+delivAMopenHRSOUT+":"+delivAMopenMINOUT+" - "+delivAMclosHRSOUT+":"+delivAMclosMINOUT+"\nAfternoons : "+delivPMopenHRSOUT+":"+delivPMopenMINOUT+" - "+delivPMclosHRSOUT+":"+delivPMclosMINOUT+" hrs.\n\nPlease reselect your hotel delivery within these times in order to proceed.");}}else{if (collectpt != endpt && diff < minoneway){alert ("instanQuote : help : minimum hire period\n\nThere is a minimum hire period of "+minoneway+" days applicable to rentals one-way between "+stations[collectpt]+"        \nand other locations or hotels.\n\nPlease make a new selection or contact us by email for assistance.");}else{if (minexcepts[cual+1] !=0 && minexcepts[cual+1] > renterage){alert("instanQuote : help : driver age for this vehicle\n\nThe vehicle selected, the "+nombreopcion[cual+1]+" has a minimum driver age of "+minexcepts[cual+1]+" years of age.\n\nYour age is currently selected as "+renterage+" years.\n\nConsider selecting another vehicle with a lower driver age requirement or correct your age before         \nproceeding.\n\nTip : The standard minimum age for drivers at this location is "+minagest+" years. Age restrictions apply to additional drivers as well.");}else{if (endpt == 0){returnVerify();}else{if (ed == 99 || em == 99 || ey == 1999){alert("instanQuote : help : return dates\n\nPlease select the return date of the vehicle before proceeding.");document.instanQuote.ED.focus();}else{if (cual == "998" ){alert("instanQuote : help : select a vehicle!\n\nPlease select a vehicle from the pull-down selector before proceeding.");document.instanQuote.VEHICLES.focus();}else{if (roofposs[cual+1] == 0 && document.instanQuote.ROOF[1].selected == true){roofing();}else{if (document.instanQuote.RENTDAYS.value >maxrent){alert("instanQuote : help : maximum quote period\n\nYou are currently trying to obtain a quotation for a rental of "+document.instanQuote.RENTDAYS.value+" days. The                 \ninstanQuote system is currently instructed to prepare quotations of up to "+maxrent+"\ndays maximum duration only.\n\nIf you DO require a quotation for this period, please contact us by e-mail at\n"+corpemail+" for assistance.\n\nAlternatively, please revise the rental dates before requesting your quotation.");}else{hnout=hnou.getTime();smurf=sm-1;emurf=em-1;
stdate = new Date(sy,smurf,sd,sh,smin);sttime=stdate.getTime();
if (sttime < hnout){alert("instanQuote : help : error in start date\n\nYou are attempting to start the rental earlier than               \ntodays date!\n\nPlease revise the rental start date and try again.\n\nPlease note we are unable to assist you with reservations       \nstarting on the same day as hire.");
document.instanQuote.SD.focus();}else{latebooking=(sttime-hnout)/86400000;latebooking=Math.ceil(latebooking);if (latebooking < minwin){alert("instanQuote : help : too close to arrival time\n\nYou have requested a quotation for a rental starting on       \n"+sd+" "+meses[sm-1]+" "+sy+"at "+stations[collectpt]+".\n\nFor operational reasons we are unable to provide quotations                \ninside a "+minwin+" day window prior to the start of hire.\n\nPlease contact us by telephone, or choose a start of rental      \nthat is at least "+minwin+" days from todays date.\n\n ");}else{
if (sttime > hnout+(maxbookingwindow*86400000)){alert("instanQuote : help : start date verification\n\nYou are attempting to get a quotation for a rental starting on "+sd+"/"+sm+"/"+sy+".                 \nOur system is only allowed to quote for rentals starting within "+maxbookingwindow+" days\nof today.\n\nIf the start date is incorrect then please modify this now.\n\nAlternatively, please contact our sales department on "+corpemail+"\nfor further advice.\n\n");document.instanQuote.SD.focus();}else{
prix();

// verification against unpriced rental segments

if (firstseason == "L" && euband1[cual+1] == 0){nocandoo(nombreopcion[cual+1]);}   else{
if (secondseason == "L" && euband1[cual+1] == 0){nocandoo(nombreopcion[cual+1]);}  else{
if (firstseason == "M" && euband2[cual+1] == 0){nocandoo(nombreopcion[cual+1]);}   else{
if (secondseason == "M" && euband2[cual+1] == 0){nocandoo(nombreopcion[cual+1]);}  else{
if (firstseason == "H" && euband3[cual+1] == 0){nocandoo(nombreopcion[cual+1]);}  else{
if (secondseason == "H" && euband3[cual+1] == 0){nocandoo(nombreopcion[cual+1]);}else{




// ##########################################
// PRICE CALCULATION ACCORDING TO HIRE PERIOD
// ##########################################

if (rentalduration<7){



bajante=false;
if (firstseason == "H" && secondseason == "M"){bajante=true;}
if (firstseason == "M" && secondseason == "L"){bajante=true;}
if (firstseason == "H" && secondseason == "L"){bajante=true;}

if (bajante == false){

rentcost=( ((euband1[cual+1]/subweek)*eqlow)+((euband2[cual+1]/subweek)*eqmid)+((euband3[cual+1]/subweek)*eqhigh));


if (firstseason == "H" && rentcost >euband3[cual+1] && weeklyoveridesubweeks == true){rentcost=euband3[cual+1];}
if (firstseason == "M" && rentcost >euband2[cual+1] && weeklyoveridesubweeks == true){rentcost=euband2[cual+1];}
if (firstseason == "L" && rentcost >euband1[cual+1] && weeklyoveridesubweeks == true){rentcost=euband1[cual+1];}



} else{

if (firstseason == "H"){ rentcost=(euband3[cual+1]/subweek)*(eqhigh+eqmid+eqlow);}
if (firstseason == "M"){ rentcost=(euband2[cual+1]/subweek)*(eqhigh+eqmid+eqlow);}
if (firstseason == "L"){ rentcost=(euband1[cual+1]/subweek)*(eqhigh+eqmid+eqlow);}



}





}

else{


if (rentalduration>6){

// ##############
// WEEKLY RENTALS
// ##############



bajante=false;
if (firstseason == "H" && secondseason == "M"){bajante=true;}
if (firstseason == "M" && secondseason == "L"){bajante=true;}
if (firstseason == "H" && secondseason == "L"){bajante=true;}

if (seasoncalc == 1 && bajante == true && smartalec == "YES"){


if (firstseason == "L"){ rentcost=((euband1[cual+1]/7)*rentalduration);}
if (firstseason == "M"){ rentcost=((euband2[cual+1]/7)*rentalduration);}
if (firstseason == "H"){ rentcost=((euband3[cual+1]/7)*rentalduration);}
seasoncalc=2;

}



if (seasoncalc == 1){

// seasoncalc1 method
// ==================

rentcost = ((euband1[cual+1]/7)*eqlow)+((euband2[cual+1]/7)*eqmid)+((euband3[cual+1]/7)*eqhigh);


}

else{

if (allone == true || (allone == false && rentalduration <= cutoff)){

// THE RENTAL DURATION IS LESS THAN CUTOFF OR ALL DAYS SAME SEASON
// ###############################################################

if (firstseason == "L"){ rentcost=((euband1[cual+1]/7)*rentalduration);}
if (firstseason == "M"){ rentcost=((euband2[cual+1]/7)*rentalduration);}
if (firstseason == "H"){ rentcost=((euband3[cual+1]/7)*rentalduration);}





}


else{



// THE RENTAL IS AFFECTED BY THE CUTOFF VALUE CREATED
// ##################################################

if (seasoncalc != 2){
overspill=rentalduration-firstseasondays;
remainder=overspill-cutoff;

	if (firstseason == "L"){eqlow=eqlow+cutoff;
		if (secondseason == "M") {eqmid=eqmid-cutoff;}
		if (secondseason == "H") {eqhigh=eqhigh-cutoff;}}

	if (firstseason == "M"){eqmid=eqmid+cutoff;
		if (secondseason == "L") {eqlow=eqlow-cutoff;}
		if (secondseason == "H") {eqhigh=eqhigh-cutoff;}}

	if (firstseason == "H"){eqhigh=eghigh+cutoff;
		if (secondseason == "L") {eqlow=eqlow-cutoff;}
		if (secondseason == "M") {eqmid=eqmid-cutoff;}}
	
	if (firstseason == "L" && secondseason == "M")
		{rentcost=((euband1[cual+1]/7)*eqlow)+((euband2[cual+1]/7)*remainder);}
	if (firstseason == "L" && secondseason == "H")
		{rentcost=((euband1[cual+1]/7)*eqlow)+((euband3[cual+1]/7)*remainder);}
	if (firstseason == "M" && secondseason == "L")
		{rentcost=((euband2[cual+1]/7)*eqmid)+((euband1[cual+1]/7)*remainder);}
	if (firstseason == "M" && secondseason == "H")
		{rentcost=((euband2[cual+1]/7)*eqmid)+((euband3[cual+1]/7)*remainder);}
	if (firstseason == "H" && secondseason == "L")
		{rentcost=((euband3[cual+1]/7)*eqhigh)+((euband1[cual+1]/7)*remainder);}
	if (firstseason == "H" && secondseason == "M")
		{rentcost=((euband3[cual+1]/7)*eqhigh)+((euband2[cual+1]/7)*remainder);}



alert("The rent cost is "+rentcost+" in a total of "+rentalduration+" days.\n\nThe breakdown calculated is : \n\nLow Season  : "+eqlow+" days\nMid Season  : "+eqmid+" days\nHigh Season : "+eqhigh+" days.");

}

}}}}






crimbo();
if (crimborules == false){alert("instanQuote : help : Rental restrictions apply\n\nYou have currently selected a car rental of "+rentalduration+" days.\n\nUnfortunately we are currently only able to accept reservations during this           \nperiod for a minimum of "+specialminhire+" days.\n\nThese restrictions apply to reservations that start or end during the period\n "+specSD+"/"+specSM+"/"+specSY+" thru "+specED+"/"+specEM+"/"+specEY+" inclusive.\n\nTip : If you do require the car for only "+rentalduration+" days you should consider adjusting\nthe quotation to show a minimum "+specialminhire+" day rental period and simply  return the\ncar earlier, paying the "+specialminhire+" day price.\n\nThere are NO penalties for early return!\n\n");document.instanQuote.ED.focus();
} else{premiumline="";premium();if (premiumstate == true && tempRULE == "block"){alert("instanQuote : help : Closed for Public Holiday\n\nYou have currently chosen start of rental from "+stations[collectpt]+" on "+sd+" "+meses[sm-1]+" "+sy+".\n\nThis date is flagged as a public holiday.\n\nThis station is closed from "+tempFROM.substring(0,2)+":"+tempFROM.substring(2,4)+" - "+tempTHRU.substring(0,2)+":"+tempTHRU.substring(2,4)+" hrs.\n\nSelect another date/time for collection, or consider collection from another station nearby.              \nPlease don't hesitate to contact us by email for further assistance.\n\n");}else{if (premiumstate == true && tempRULE == "allow"){alert("instanQuote : help : Collection on a Public Holiday\n\nYou have currently chosen start of rental from "+stations[collectpt]+" on "+sd+" "+meses[sm-1]+" "+sy+".\n\nThis date is flagged as a public holiday.\n\nYou may collect a car from "+stations[collectpt]+" at the time selected, however there is a             \nsurcharge payable on arrival of EUR"+premiumvalue+",00 to cover our increased operating costs.\n\nThe value of the surcharge will be shown on our quotation.\n\n");
premiumline="Surcharge of EUR "+premiumvalue+",00 payable on arrival for service on a public holiday";}availchecker();if (availstate == false){alert("instanQuote : help : Vehicle Availability\n\nYou have currently selected the "+opciones[cual+1]+"-"+nombreopcion[cual+1]+" for this rental.\n\nOur system is currently flagging this car as unavailable from "+stations[collectpt]+"            \n for the dates requested.\n\nPlease consider an alternative vehicle, try collecting the car you require from a\nnearby location or contact us by email for assistance.\n\n");}else{shop1COLLECTclosedallday();if (shop1open == false && stationmatrix[collectpt] == 1){alert("instanQuote : help : Station closed all day!\n\nYou have currently selected collection of your car from              \n"+stations[collectpt]+" on "+daysoftheweek[todaysthedaythat]+", "+sd+" "+meses[sm-1]+" "+sy+"\n\nOur station at "+stations[collectpt]+"is closed on "+daysoftheweek[todaysthedaythat]+" all day\nlong.\n\nConsider collecting the car from another station or\ncollecting the vehicle the day before.\n\n");}else{shop2COLLECTclosedallday();if (shop2open == false && stationmatrix[collectpt] == 2)
{alert("instanQuote : help : Station closed all day!\n\nYou have currently selected collection of your car from              \n"+stations[collectpt]+" on "+daysoftheweek[todaysthedaythat]+", "+sd+" "+meses[sm-1]+" "+sy+"\n\nOur station at "+stations[collectpt]+"is closed on "+daysoftheweek[todaysthedaythat]+" all day\nlong.\n\nConsider collecting the car from another station or\ncollecting the vehicle the day before.\n\n");}else{shop1RETURNclosedallday();
if (shop1close == true && restrictreturn[endpt] == 1){alert("instanQuote : help : Return Station closed\n\nYou have selected the return location of this hire as\n"+stations[collectpt]+" on "+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[em-1]+" "+ey+".\n\nThis station is closed on the proposed day of return\nand there are NO facilities for return out-of-hours.\n\nConsider returning to another location or a day earlier\nor later to resolve this problem.\n\n");}else{shop2RETURNclosedallday();if (shop2close == true && restrictreturn[endpt] == 2)
{alert("instanQuote : help : Return Station closed\n\nYou have selected the return location of this hire as\n"+stations[collectpt]+" on "+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[em-1]+" "+ey+".\n\nThis station is closed on the proposed day of return\nand there are NO facilities for return out-of-hours.\n\nConsider returning to another location or a day earlier\nor later to resolve this problem.\n\n");}else{shop1VALIDATEHOURScollection();
if (shop1close == true && stationmatrix[collectpt] == 1){alert("instanQuote : help : Collection office closed\n\nYou have selected the collection of your car from       \n"+stations[collectpt]+" on "+daysoftheweek[todaysthedaythat]+" "+sd+" "+meses[smurf]+" "+sy+".\n\nYou've shown collection time at "+sh+":"+smin+" hrs\n\nThis rental station opens from "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+" on the\nday in question.\n\nConsider starting the hire at a different time or even\nchanging the day of collection.\n\n");}else{shop2VALIDATEHOURScollection();if (shop2close == true && stationmatrix[collectpt] == 2){alert("instanQuote : help : Collection office closed\n\nYou have selected the collection of your car from       \n"+stations[collectpt]+" on "+daysoftheweek[todaysthedaythat]+" "+sd+" "+meses[smurf]+" "+sy+".\n\nYou've shown collection time at "+sh+":"+smin+" hrs\n\nThis rental station opens from "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+" on the\nday in question.\n\nConsider starting the hire at a different time or even\nchanging the day of collection.\n\n");}else{shop1VALIDATEHOURSreturn();
if (shop1close == true && restrictreturn[endpt] == 1){alert("instanQuote : help : Return location closed\n\nYou have selected the vehicle return to "+stations[endpt]+" on            \n"+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[emurf]+" "+ey+" at "+eh+":"+emin+" hours.\n\nThis location is only open during the following times : \n\nMornings : "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+"\nAfternoons : "+tempPMopenHRS+":"+tempPMopenMIN+" - "+tempPMclosHRS+":"+tempPMclosMIN+"\n\nThere is no facility for out-of-hours return at this station.\n\nPlease select a new return time or consider changing the\nreturn date or location.\n\n");}else{shop2VALIDATEHOURSreturn();
if (shop2close == true && restrictreturn[endpt] == 2){alert("instanQuote : help : Return location closed\n\nYou have selected the vehicle return to "+stations[endpt]+" on            \n"+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[emurf]+" "+ey+" at "+eh+":"+emin+" hours.\n\nThis location is only open during the following times : \n\nMornings : "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+"\nAfternoons : "+tempPMopenHRS+":"+tempPMopenMIN+" - "+tempPMclosHRS+":"+tempPMclosMIN+"\n\nThere is no facility for out-of-hours return at this station.\n\nPlease select a new return time or consider changing the\nreturn date or location.\n\n");}else{document.instanQuote.NIGHTCHARGE.value="";nightsuppstate=false;nightowl();

if (nightsuppstate == true){

document.instanQuote.NIGHTCHARGE.value="Surcharge of EUR "+nightsuppsvalue+",00 payable locally for night time service for arrivals between "+nightsuppsstart+"-"+nightsuppsend+" hrs.";}else
{document.instanQuote.NIGHTCHARGE.value="<br>";}



// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// READY TO START CGI'S FROM HERE
// &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

roundup=Math.ceil(rentcost);
getrate(currencycode);ukgrossrate=rentcost*myrate;ukgrossrate=Math.ceil(ukgrossrate);
garfield="";
if (currencycode == "GBP" || currencycode == "IEP"){garfield="£ ";}
if (currencycode == "USD" || currencycode == "CAD"){garfield="$ ";}

document.instanQuote.PRICEPANEL.value="EUR "+(roundup)+",00 = "+currencycode+"  "+garfield+ukgrossrate+".00";
sdout=sd*1; if (sdout<10){sdout="0"+sdout;}else{sdout=""+sdout;}
edout=ed*1; if (edout<10){edout="0"+edout;}else{edout=""+edout;}
shout=sh*1; if (shout<10){shout="0"+shout;}else{shout=""+shout;}
ehout=eh*1; if (ehout<10){ehout="0"+ehout;}else{ehout=""+ehout;}
recoger=""+stations[collectpt];
devolver=""+stations[endpt];
sminout=smin*1; if (sminout<10){sminout="0"+sminout;}else{sminout=""+sminout;}
eminout=emin*1; if (eminout<10){eminout="0"+eminout;}else{eminout=""+eminout;}
carcodeout=opciones[cual+1]; carnameout=nombreopcion[cual+1];

if (rentalduration <5){
nettcost=roundup; uknettrate=ukgrossrate;}
else{

document.instanQuote.DISCOUNT.value="0";
document.instanQuote.CONDITIONS.value=bookinglimit;
nettcost=(roundup*1);nettcost=Math.ceil(nettcost);uknettrate=nettcost*myrate;uknettrate=Math.ceil(uknettrate);}
promoter(rentcost,diff);
document.instanQuote.NETT.value="EUR "+nettcost+",00 = "+currencycode+" "+garfield+uknettrate+".00";


// time
 xxhour=xxhour*1; shallam ="Hello";
if (xxhour >4 && xxhour <13){ shallam="Good Morning";}
if (xxhour >12 && xxhour <15){ shallam="Hello";}
if (xxhour >14 && xxhour <18){ shallam="Good Afternoon";}
if (xxhour >17 && xxhour<24){ shallam="Good Evening";}
if (xxhour <4){shallam="Good Evening";}
openingline=shallam+", ";
if (rentertit != "Anon." && rentertit != "Other title"){

      if (document.instanQuote.CUSTFIRSTNAME.value != "" && document.instanQuote.CUSTLASTNAME.value == ""){
 	openingline=shallam+" "+document.instanQuote.CUSTFIRSTNAME.value+", ";} else {if (document.instanQuote.CUSTLASTNAME.value != ""){openingline=shallam+" "+rentertit+" "+document.instanQuote.CUSTLASTNAME.value+" -  ";}}

}
// reformat names if required
decorum();
// fullblown intro

document.instanQuote.OPENINGLINE.value=""+openingline;


// dates and times of rentals 

document.instanQuote.INICIO.value=stationcodes[collectpt];
document.instanQuote.FECHAHORAINICIO.value=""+sdout+" "+mezez[sm-1]+" "+sy+" "+shout+":"+sminout;
document.instanQuote.PARRDATE.value=""+sdout+" "+mezez[sm-1]+" "+sy; //transfer variables
document.instanQuote.PARRTIME.value=""+shout+" "+sminout;            //to instanQuote.com
document.instanQuote.FINICIO.value=stationcodes[endpt];
document.instanQuote.FECHAHORAFINICIO.value=""+edout+" "+mezez[em-1]+" "+ey+" "+ehout+":"+eminout;
document.instanQuote.PDEPDATE.value=""+edout+" "+mezez[em-1]+" "+ey; //transfer variables
document.instanQuote.PDEPTIME.value=""+ehout+" "+eminout;            //to instanQuote.com
customeremailaddress=document.instanQuote.EMAILADDRESS.value;
emaillength=customeremailaddress.length;


// apply min hire to one-way rentals

if (endpt != collectpt && rentalduration<minoneway){

alert("instanQuote : help : minimum one-way hire period\n\nYou have currently selected a rental which is one-way : \n\nCollect from : \n\nReturn to : \n\nThere is a minimum hire period of "+minoneway+" days for one-way rentals which, at present, you are not meeting.\n\nPlease correct the rental start & end locations or show a rental hire period of at least "+minoneway+" days. You may return the car without penalty earlier providing you pay the "+minoneway+" day price.\n\n");
document.instanQuote.ED.focus();}

else{

//chase-up arrival flight number or hotel name

if (emaillength>5){

if (document.instanQuote.ARRFLIGHT.value == "t.b.a." && isanairport[collectpt] == 1){newfly = prompt("Please enter your arrival flight number if known below.\nAlternatively, please leave as 't.b.a' and we'll remind you later.", "t.b.a.");

if (newfly == null) {newfly="t.b.a.";}
if (newfly != "t.b.a."){document.instanQuote.FLIGHTNUMBEROUT.value=""+newfly.toUpperCase();}else{document.instanQuote.FLIGHTNUMBEROUT.value="Flight number missing - please advise";}}
else{document.instanQuote.FLIGHTNUMBEROUT.value="WALK IN";}

if (document.instanQuote.ARRFLIGHT.value == "Hotel t.b.a." || stations[collectpt] == "Hotel"){hotelname = prompt("Please enter the Hotel/resort name for delivery.\nAlternatively, please leave as 'Hotel t.b.a' and we'll remind you later.", "Hotel t.b.a.");
if (hotelname == null){hotelname="t.b.a.";}
document.instanQuote.FLIGHTNUMBEROUT.value=hotelname;
document.instanQuote.ARRFLIGHT.value=hotelname;}

if (stations[endpt] == "Hotel"){drophotel = prompt("Please indicate from which hotel you wish to have the car collected.", "Hotel t.b.a.");
document.instanQuote.DEPFLIGHT.value=drophotel;}
else{document.instanQuote.DEPFLIGHT.value="";}}



//submission & generation of floating quote


document.instanQuote.GROSSPRICELINE.value="EUR "+(roundup)+",00 (equivalent to : "+currencycode+" "+garfield+ukgrossrate+".00 )";
document.instanQuote.NETPRICELINE.value="EUR "+(nettcost)+",00 (equivalent to : "+currencycode+" "+garfield+uknettrate+".00 )";
document.instanQuote.BOOKINGMESSAGEOUTPUT.value=bookinglimit;
document.instanQuote.VEHICLECODENUMBER.value=carcodeout;
document.instanQuote.EXAMPLEMODELOFCAR.value=carnameout;
document.instanQuote.RENTALDURATION.value=rentalduration;
if (document.instanQuote.CUSTFIRSTNAME.value == "" && document.instanQuote.CUSTLASTNAME.value == "" && emaillength >5){

onemoretime = prompt ("It would be nice to have your name to send a more personalised quotation.\nPlease enter below or leave blank for an anonymous quotation.", "");
if (onemoretime == "" || onemoretime == null){document.instanQuote.RENTERNAMEOUT.value="(name missing please advise!)";}
if (onemoretime != ""){document.instanQuote.RENTERNAMEOUT.value=onemoretime;}

}


else{document.instanQuote.RENTERNAMEOUT.value=rentertit+" "+document.instanQuote.CUSTFIRSTNAME.value+" "+document.instanQuote.CUSTLASTNAME.value;}

document.instanQuote.ROOFRACKREQUESTEDOUT.value=roof;
document.instanQuote.BABYSEATSREQUESTED.value=baby;
document.instanQuote.BOOSTERSEATSREQUESTED.value=booster;

	if (emaillength<5){alert("instanQuote : help : Missing e-mail address\n\nPlease enter your e-mail address so that we can send          \n you a quotation.\n\nYour quote will arrive in under 10 minutes.");document.instanQuote.EMAILADDRESS.focus();}else{
	
document.instanQuote.PREMIUMLINE.value=premiumline;

// formatting for pasteout variables
if (document.instanQuote.CUSTFIRSTNAME.value == ""){document.instanQuote.PFIRSTNAME.value=" ";}else{document.instanQuote.PFIRSTNAME.value=document.instanQuote.CUSTFIRSTNAME.value+","+rentertit;}
if (document.instanQuote.CUSTLASTNAME.value == ""){document.instanQuote.PSURNAME.value=" ";}else{document.instanQuote.PSURNAME.value=document.instanQuote.CUSTLASTNAME.value;}

if (document.instanQuote.FLIGHTNUMBEROUT.value == "Flight number missing - please advise"){document.instanQuote.PFLIGHTVARIABLE.value="TBA";} else{document.instanQuote.PFLIGHTVARIABLE.value=document.instanQuote.FLIGHTNUMBEROUT.value;}
edadesdelulu=document.instanQuote.RENTERAGEOUT.value;
document.instanQuote.PAGEVARIABLE.value=edadesdelulu.substring(0,2);
if (document.instanQuote.ROOFRACKREQUESTEDOUT.value == "NO"){document.instanQuote.PROOFVARIABLE.value=0;}else{document.instanQuote.PROOFVARIABLE.value=1;}

document.instanQuote.PASTEOUT.value="$$"+document.instanQuote.PFIRSTNAME.value+"$"+document.instanQuote.PSURNAME.value+"$"+document.instanQuote.PAGEVARIABLE.value+"$"+document.instanQuote.INICIO.value+"$"+document.instanQuote.PARRDATE.value+"$"+document.instanQuote.PARRTIME.value+"$"+document.instanQuote.PFLIGHTVARIABLE.value+"$"+document.instanQuote.FINICIO.value+"$"+document.instanQuote.PDEPDATE.value+"$"+document.instanQuote.PDEPTIME.value+"$"+document.instanQuote.RENTALDURATION.value+"$"+document.instanQuote.VEHICLECODENUMBER.value+"$"+document.instanQuote.EXAMPLEMODELOFCAR.value+"$"+document.instanQuote.PASTEPRICE.value+"$"+document.instanQuote.BABYSEATSREQUESTED.value+"$"+document.instanQuote.BOOSTERSEATSREQUESTED.value+"$"+document.instanQuote.PROOFVARIABLE.value+"$"+document.instanQuote.EMAILADDRESS.value+"$"+document.instanQuote.IDIOMA.value+"$"+document.instanQuote.SHOPCODE.value+"$"+stations[collectpt]+","+stations[endpt]+"$$";






document.instanQuote.submit();

}




}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} // END OF EXCEPTIONS
}

function nogo(){
if (document.instanQuote.COMMENTS.value == ""){
document.instanQuote.COMMENTS.value="No comments added";}


}

function deliverydaysEXTRACT()
{

daysVerify();
delivAMopenHRS=hoteldeliverytimes[sdayofweek].substring(0,2);
delivAMopenHRSOUT=delivAMopenHRS;delivAMopenHRS=delivAMopenHRS*1;
delivAMopenMIN=hoteldeliverytimes[sdayofweek].substring(2,4);
delivAMopenMINOUT=delivAMopenMIN;delivAMopenMIN=delivAMopenMIN*1;
delivAMclosHRS=hoteldeliverytimes[sdayofweek].substring(5,7);
delivAMclosHRSOUT=delivAMclosHRS;delivAMclosHRS=delivAMclosHRS*1;
delivAMclosMIN=hoteldeliverytimes[sdayofweek].substring(7,9);
delivAMclosMINOUT=delivAMclosMIN;delivAMclosMIN=delivAMclosMIN*1;
delivPMopenHRS=hoteldeliverytimes[sdayofweek].substring(10,12);
delivPMopenHRSOUT=delivPMopenHRS;delivPMopenHRS=delivPMopenHRS*1;
delivPMopenMIN=hoteldeliverytimes[sdayofweek].substring(12,14);
delivPMopenMINOUT=delivPMopenMIN;delivPMopenMIN=delivPMopenMIN*1;
delivPMclosHRS=hoteldeliverytimes[sdayofweek].substring(15,17);
delivPMclosHRSOUT=delivPMclosHRS;delivPMclosHRS=delivPMclosHRS*1;
delivPMclosMIN=hoteldeliverytimes[sdayofweek].substring(17,19);
delivPMclosMINOUT=delivPMclosMIN;delivPMclosMIN=delivPMclosMIN*1;
}



function decorum(){

if (document.instanQuote.CUSTFIRSTNAME.value != ""){
christian=document.instanQuote.CUSTFIRSTNAME.value.toLowerCase();
firstletter=christian.substring(0,1);
newchristian=firstletter.toUpperCase();
newchristian=newchristian+christian.substring (1,christian.length);
document.instanQuote.CUSTFIRSTNAME.value=newchristian;
}
if (document.instanQuote.CUSTLASTNAME.value != ""){
surname=document.instanQuote.CUSTLASTNAME.value.toLowerCase();
firstletter=surname.substring(0,1);
newsurname=firstletter.toUpperCase();
newsurname=newsurname+surname.substring (1,surname.length);
document.instanQuote.CUSTLASTNAME.value=newsurname;


}

surname=document.instanQuote.CUSTLASTNAME.value.toLowerCase();



}


