// instanQuote 3 - daily pricing routines
// ======================================

function wherethefok(){if (collectpt == endpt){fok="<p>"+stationcodes[collectpt]+"="+stations[collectpt]+"<p>";}else{fok="<p><u>Código oficinas :</u><br>"+stationcodes[collectpt]+"="+stations[collectpt]+"<br>"+stationcodes[endpt]+"="+stations[endpt]+"<p>";}}function catch99(){obtenEMIN();if (emin == 99){alert("instanQuote : help : error minutos recogida\n\nNo nos ha indicado a que hora termina el alquiler.\n\nPor favor, corregir antes de oprimir el boton enviar.\n\n");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(hoursmat2[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="confirmadas y prepagadas";}else{theclause="confirmadas";}
if (generalbookbeforedate != "ALL"){thelimit="antes del día "+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=""+"Costo alquiler para "+diff+" días : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+generaldiscount+".00% descuento**<br><u>Precio con descuento = <B>EUR "+eurnettprice+",00 + EUR "+onewaycharge+",00(*) = EUR "+eurow+",00 = "+currencycode+" "+garfield+" "+ukow+".00</B> a cambio de hoy</u><p>**Oferta especial valido para reservas "+theclause+" "+thelimit+"<br>(*) Suplemento solo ida incluído"+fok;



}else{

newpriceoutputzone=""+"Costo alquiler para "+diff+" días : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+generaldiscount+".00% descuento**<br><u>Oferta especial = <B>EUR "+eurnettprice+",00 = "+currencycode+" "+garfield+" "+uknettprice+".00</B> a cambio de hoy</u><p>**Oferta especial valido para reservas "+theclause+" "+thelimit+fok;}

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="confirmadas y prepagadas";}else{theclause="confirmadas";}
if (generalbookbeforedate != "ALL"){thelimit="antes del día "+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=""+"Costo alquiler para "+diff+" días : <U><B>EUR "+eurgrossprice+",00 + EUR "+onewaycharge+",00 = EUR "+eurow+",00(*) = "+currencycode+" "+garfield+uknettrate+".00</B></U><br>(*) One-way charge included<P>"+fok;

}
else{

newpriceoutputzone=""+"Costo alquiler para "+diff+" días : <U><B>EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00</B></U><P>"+fok;
}
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="confirmadas y prepagadas";}else{theclause="confirmadas";}
if (Aspecificbookbeforedate != "ALL"){thelimit="antes del día "+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=""+"Costo alquiler para "+diff+" días : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+generaldiscount+".00% descuento**<br><u>Oferta especial = <B>EUR "+eurnettprice+",00 + EUR "+onewaycharge+",00(*) = EUR "+eurow+",00 = "+currencycode+" "+garfield+" "+ukow+".00</B> at todays rate</u><p>**Oferta especial válido reservas "+theclause+" "+thelimit+"<br>(*) One-way surcharge included"+fok;

}
else{


newpriceoutputzone=""+"Costo alquiler para "+diff+" días : EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00<br>-"+Aspecificdiscountvalue+".00% descuento**<br><u>Oferta especial = <B>EUR "+eurnettprice+",00 = "+currencycode+" "+garfield+" "+uknettprice+".00 at todays rate</u></B><p>**Oferta especial válido reservas "+theclause+" "+thelimit+fok; }
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="confirmadas y prepagadas";}else{theclause="confirmadas";}
if (generalbookbeforedate != "ALL"){thelimit="antes del día "+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=""+"Costo alquiler para "+diff+" días : <U><B>EUR "+eurgrossprice+",00 + EUR "+onewaycharge+",00 = EUR "+eurow+",00(*) = "+currencycode+" "+garfield+uknettrate+".00</B></U><br>(*) One-way charge included<P>"+fok;}

else{


newpriceoutputzone=""+"Costo alquiler para "+diff+" días : <B><U>EUR "+eurgrossprice+",00 = "+currencycode+" "+garfield+uknettrate+".00</B></U><P>"+fok;}

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 : indicar nombre completo\n\nPor favor, indicar su nombre completo.\n\n");
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 : error en nombre cliente\n\nIndicar su nombre completo.\n\n");
document.instanQuote.TITLE[1].selected=true;}}

function emptyname(){
obtenrenterid();
if (document.instanQuote.CUSTFIRSTNAME.value == "" && rentertit != "Anon."){alert("instanQuote : help : error en nombre cliente\n\nPor favor, entrar su nombre completo.\n\n");
document.instanQuote.TITLE[0].selected=true;
document.instanQuote.TITLE.focus();}}

function emptysurname(){}

function nameval(){
obtenrenterid();
if (rentertit == "Anon."){alert("instanQuote : help : nombre del cliente\n\n.Entrar su nombre completo.\n\n");
document.instanQuote.TITLE.focus();}}

// Age of driver verification
// ==========================

function ageofclient(){
obtenage();if (renterage == 1){alert("instanQuote : help : edad conductor\n\nNo ha indicado su edad utlizando la barra de selección.\n\nPor favor, indicar su edad antes de continuar.\n\n");document.instanQuote.DRIVERAGES.focus();}
else{document.instanQuote.CURRENCY.focus();}}

// Currency choice
// ===============

function currencychoice(){
obtencurr();if (currencycode == "ZZZ"){alert("instanQuote : help : selección de divisa\n\nNo ha indicado en que divisa le preparamos este presupuesto.\n\n"); document.instanQuote.CURRENCY[0].selected=true; document.instanQuote.CURRENCY.focus();}

else{getrate(currencycode); if (currencycode == "EUR"){null;} 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"){null;}
else{alert("instanQuote : help : selección de divisa no-euro\n\nHa seleccionado  "+currencyname+"\npara este presupuesto.\n\nEsta divisa es ajena al Euro por lo tanto tiene un contra valor sujeto                   \na posibles cambios con el Euro. Cambio vigente es\n\n1 Euro = "+myrate+" "+currencyname+"   \n\nNuestros cambios se realicen en euros y serán cambiados a "+currencyname+"     \npor su banco emisor.\n\n");}}document.instanQuote.COLLECTIONPOINT.focus();}}

// Collection location
// ===================

function collectVerify(){
obtenStartPt();
if (collectpt == 0){alert("instanQuote : help : especificar lugar recogida.\n\nPor favor, indicar donde quiere iniciar el alquiler antes de continuar.");
document.instanQuote.COLLECTIONPOINT.focus();}
alert("Lugar de inicio de alquiler : "+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 : falta fecha de inicio alquiler\n\nPor favor, indicar la fecha de inicio del alquiler antes de continuar.");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 : falta hora de inicio alquiler\n\nPor favor, indicar la hora de inicio de este alquiler antes de continuar.");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 : falta hora de inicio alquiler\n\nFalta la hora completa del inicio del alquiler. El problema parece ser su selección de los minutos pasado la hora.");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 : falta lugar devolución\n\nFalta indicar el lugar de devolución para el presente alquiler");document.instanQuote.RETURN.focus();}

else{
if (endpt != collectpt && onewaycharge !=0 && onewaysuppmatrix[endpt] == 1){alert("instanQuote : help : reserva SOLO IDA\n\nActualmente tiene seleccionado: \n\nLugar recogida : "+stations[collectpt]+"\nLugar devolución : "+stations[endpt]+"\n\nEsta información puede ser perfectamente válido. De no ser asi,           \nrogamos indicar el lugar correcto de devolución antes de continuar.\n\nTenga en cuenta que la recogida de un vehículo en "+stations[collectpt]+" devolviendo el mismo a "+stations[endpt]+" conlleva un suplemento de "+onewaycharge+",00 en concepto de nuestros gastos en devolver el vehículo a su base una vez haya terminado su alquiler.\n\n");}
else{

if (endpt != collectpt && onewaysuppmatrix[endpt] == 0){
alert("instanQuote : help : reserva SOLO IDA\n\nActualmente tiene seleccionado: : \n\nLugar recogida : "+stations[collectpt]+"\nLugar devolución : "+stations[endpt]+"\n\nEsta información puede ser perfectamente válido. De no ser asi,          \nrogamos indicar el lugar correcto de devolución antes de continuar.\n\nUn alquiler de SOLO IDA, recogiendo en un lugar con devolución a\notra estación no conlleva suplementos o gastos adicionales en\nnuestra tarifa SIEMPRE Y CUANDO se cumple un periodo de alquiler\nminimo.\n\nEn este caso el minimo es de "+minoneway+" días de alquiler.\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 : help : escoger fechas\n\nAntes de seleccionar un vehículo, le rogamos indicar primero las fechas del aqluiler propuesto. Asi podemos ofrecerle vehículos disponibles en las fechas que nos indica.");
document.instanQuote.VEHICLES[0].selected=true;
document.instanQuote.SD.focus();}
else{

availchecker();
if (availstate == false){
alert("instanQuote : help : Disponibilidad\n\nActualmente ha escogido "+opciones[cual+1]+"-"+nombreopcion[cual+1]+" para este alquiler.\n\nNuestro sistema de reservas nos indica que este modelo no esta disponible desde "+stations[collectpt]+"\npara las fechas indicadas. Rogamos escoger otro modelo, o bien contactar nos por correo electrónico para más información.\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 : falta de edad del conductor\n\nAntes de escoger un vehículo, le rogamos indicar la edad del conductor");
document.instanQuote.VEHICLES[0].selected=true;
document.instanQuote.DRIVERAGES.focus();}
else{

alert("instanQuote : help : edad inferior al minimo\n\nActualmente ha seleccionado el ("+nombreopcion[cual+1]+"). Este vehiculo requiere conductores que tienen mas de "+thelowestage+" años para cumplir las normativas de su aseguradora.\n\nHa indicado su edad a ser de "+document.instanQuote.DRIVERAGES[agepos].text+" .\n\nPor favor, seleccionar otro vehículo que permite conductores mas jovenes o rectifcar su edad antes de continuar.\n\n");
document.instanQuote.VEHICLES[0].selected=true;
document.instanQuote.DRIVERAGES.focus();}



}else{

if (cual >opciones.length){alert("instanQuote : help : error en selección\n\nPor favor, seleccionar un vehículo para su presupuesto.\n\nActualmente ha escogido un titulo en lugar de un vehículo concreto. Rectifique su selección antes de continuar.\n\n");}

else{

if (availstate == false){document.forms.instanQuote.TV.src="../../../common/artwork/cars_soldout.gif";}else{
document.forms.instanQuote.TV.src="../../../common/artwork/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 : Descuento especial\n\nEl vehículo seleccionado  (el "+nombreopcion[cual+1]+") está sujeto a una promoción            \nespecial para las fechas que acaba de indicar.\n\nHay un descuento de "+generaldiscount+".00% - le mandaremos más información con su presupuesto.\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 : Descuento especial\n\nEl vehículo seleccionado  (el "+nombreopcion[cual+1]+") está sujeto a una promoción            \nespecial para las fechas que acaba de indicar.\n\nHay un descuento de "+Aspecificdiscountvalue+".00%\n\nMandaremos más información por correo electrónico con su presupuesto.\n\n");}}}}}}}function roofing(){alert("instanQuote : help : baca no disponible\n\nHa seleccionado el "+nombreopcion[cual+1]+" para este presupuesto    \ncon una baca/portaequipajes.\n\nNo es posible pedir una baca para este modelo.\n\nPor favor, seleccionar otro vehículo o contactenos por correo electrónico para más información.");document.instanQuote.ROOF.focus();}function nocandoo(nameofcar){alert("instanQuote : help : vehículo no disponible.\n\nEl vehículo seleccionado, "+nameofcar+", no está disponible para las fechas indicadas.\n\nPor favor, seleccionar otro vehículo.");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(){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);rentcost=0;if (rentalduration < 3){rentcost=euband1[cual+1]*rentalduration;}if (rentalduration > 2 && rentalduration < 7){rentcost=euband2[cual+1]*rentalduration;}if (rentalduration > 6){rentcost=euband3[cual+1]*rentalduration;}}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 selección de fechas\n\nHa seleccionado una fecha de devolución inferior a la duración minima de alquiler para esta localidad :\n\nminimo =  "+minhire+" dias de alquiler.\n\nPor favor, modificar estas fechas antes de continuar. Si realmente desea un alquiler para las fechas indicadas, tendrá que indicar una fecha de devolución que cumple el minimo de "+minhire+" dias establecidas. No hay penalización para devolver el vehiculo antes de la fecha prevista, sencillamente pagará la tarifa de "+minhire+" dias como el minimo.");} else{deliverydaysEXTRACT();if (hoteldeliverylimit == "YES" && stations[collectpt] == "Hotel" && delivAMopenHRS == 0){alert ("instanQuote : help : Entrega hotel un "+daysoftheweek[sdayofweek]+"\n\nHa seleccionado quye su alquiler se inicia el "+daysoftheweek[sdayofweek]+", "+sd+" "+meses[sm]+" "+sy+".\n\nNo podemos gestionar entrega en hoteles en ningun momento los "+daysoftheweek[sdayofweek]+". Podrá contemplar recogida en otra fecha.");}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 : Entrega hotel no posible\n\nHa intentado pedir entrega a hotel "+daysoftheweek[sdayofweek]+", "+sd+" "+meses[sm]+" "+sy+"       \nat "+sh+":"+smin+" hrs.\n\nSólo podemos gestionar entrega a hotel en este lugar los "+daysoftheweek[sdayofweek]+" entre las "+delivAMopenHRSOUT+":"+delivAMopenMINOUT+" y las "+delivAMclosHRSOUT+":"+delivAMclosMINOUT+" hrs.\n\nModificar su hora de recogida.");}else{alert("instanQuote : Entrega hotel no posible.");}}else{if (collectpt != endpt && diff < minoneway){alert ("instanQuote : help : minimo dias alquiler\n\nExiste un minimo de dias para alquileres de SOLO IDA (recogida en"+stations[collectpt]+" y devolución a otro lugar).\n\nPor favor, modificar su selección.");}else{if (minexcepts[cual+1] !=0 && minexcepts[cual+1] > renterage){alert("instanQuote : help : driver age for this vehicle\n\nEl vehículo seleccionado tiene una exigencia de edad minimo de conductor de "+minexcepts[cual+1]+" años.\n\nSu edad, según su selección es de "+renterage+" años.\n\nConsidere seleccionando otro vehículo o bien rectifique su edad antes de continuar.");}else{if (endpt == 0){returnVerify();}else{if (ed == 99 || em == 99 || ey == 1999){alert("instanQuote : help : fecha devolución\n\nPor favor, indicar la fecha de la devolución del vehículo antes de continuar.");document.instanQuote.ED.focus();}else{if (cual == "998" ){alert("instanQuote : help : seleccionar un vehículo\n\nPor favor, seleccionar un vehículo antes de continuar.");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 : demasiados dias\n\nEstá intentando realizar un presupuesto de "+document.instanQuote.RENTDAYS.value+" days. Nuestro sistema sólo puede prepararle presupuestos para alquileres de hasta "+maxrent+"\ndias\n\nSi realmente quiere un presupuesto para esta duración, lo rogamos que nos contacte por correo electrónico para un presupuesto especial.");}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 en fecha inicio\n\nEstá intentando obtener un presupuesto con fecha de inicio antes del día de hoy\n\nNo podemos presupuestarle para las fechas indicadas.");
document.instanQuote.SD.focus();}else{latebooking=(sttime-hnout)/86400000;latebooking=Math.ceil(latebooking);if (latebooking < minwin){alert("instanQuote : help : reserva última hora\n\nNos ha pedido un presupuesto para un alquiler con fecha de inicio "+sd+" "+meses[sm-1]+" "+sy+"at "+stations[collectpt]+".\n\nNo aceptamos reservas nuevas realizadas con menos de "+minwin+" ias de antelación debido a los altos costos de confirmación\n\nContactenos por teléfono para más información o asistencia.\n\n ");}else{
if (sttime > hnout+(maxbookingwindow*86400000)){alert("instanQuote : help : fecha de inicio\n\nNos ha pedido un presupuesto para las fechas : "+sd+"/"+sm+"/"+sy+".\n\nSólo podemos ofrecer presupuestos para alquileres comenzando dentro de "+maxbookingwindow+" dias.");document.instanQuote.SD.focus();}else{prix();crimbo();
if (crimborules == false){alert("instanQuote : help : Restricciones en alquileres\n\nHa esochido un alquiler de "+rentalduration+" días.\n\nActualmente sólo estamos aceptando reservas con un mínimo de "+specialminhire+" días.\n\nEstas restricciones se aplican sólo a reservas que se inician o terminan en el periodo\n\n "+specSD+"/"+specSM+"/"+specSY+" hasta  "+specED+"/"+specEM+"/"+specEY+" inclusive.\n\n");document.instanQuote.ED.focus();
} else{premiumline="";premium();if (premiumstate == true && tempRULE == "block"){alert("instanQuote : help : cerrado por dia festivo\n\nHa escogifo recogida desde "+stations[collectpt]+" el día "+sd+" "+meses[sm-1]+" "+sy+".\n\nTenemos esta fecha marcada como festivo local.\n\nEsta oficina está cerrada desde las "+tempFROM.substring(0,2)+":"+tempFROM.substring(2,4)+" - "+tempTHRU.substring(0,2)+":"+tempTHRU.substring(2,4)+" horas.\n\nPor favor, escoger otras fechas, o bien contemplarse cambiar el lugar de recogida a otra base.\nPuede contactar con nosotros por correo electrónico para mas información.\n\n");}else{if (premiumstate == true && tempRULE == "allow"){alert("instanQuote : help : Recogida en festivo\n\nHa escogida recogida de su coche desde "+stations[collectpt]+" el día "+sd+" "+meses[sm-1]+" "+sy+".\n\nEsta fecha esta marcada como festivo local.\n\nPodrá recoger el vehículo desde "+stations[collectpt]+" a la hora que ha solicitado, pero su recogida estará sujeto a \nun recargo pagadero en llegada de  EUR"+premiumvalue+",00 para poder recoger en día festivo.\n\nEl valor del recargo será indicado en el presupuesto que le mandamos por correo.\n\n");
premiumline="Recargo de EUR "+premiumvalue+",00 pagadero en destino por recogida en festivo.";}availchecker();if (availstate == false){alert("instanQuote : help : Coche no disponible\n\nHa escogido el "+opciones[cual+1]+"-"+nombreopcion[cual+1]+" para su alquiler.\n\nNuestro sistema indica que el vehículo no está disponible desde "+stations[collectpt]+"            \npor las fechas solicitadas.\n\nContactenos por correo electrónico o teléfono para mas asistencia.\n\n");}else{shop1COLLECTclosedallday();if (shop1open == false && stationmatrix[collectpt] == 1){alert("instanQuote : help : oficina cerrada todo el día\n\nHa escogido recogida de su vehículo desde             \n"+stations[collectpt]+" el día "+daysoftheweek[todaysthedaythat]+", "+sd+" "+meses[sm-1]+" "+sy+"\n\nNuestra oficina en "+stations[collectpt]+" cierre todo el dia los  "+daysoftheweek[todaysthedaythat]+".\n\nConsidere recogida en otra fecha, o contactenos por correo electrónico para mas información\n\n");}else{shop2COLLECTclosedallday();if (shop2open == false && stationmatrix[collectpt] == 2)
{alert("instanQuote : help : oficina cerrada todo el día\n\nHa escogido recogida recogida de su vehículo desde              \n"+stations[collectpt]+" el día "+daysoftheweek[todaysthedaythat]+", "+sd+" "+meses[sm-1]+" "+sy+"\n\nNuestra oficina en "+stations[collectpt]+" cierre todo el día los "+daysoftheweek[todaysthedaythat]+".\n\nConsidere recogida en otra fecha, o contactenos por correo electrónico para más información.\n\n");}else{shop1RETURNclosedallday();
if (shop1close == true && restrictreturn[endpt] == 1){alert("instanQuote : help : Oficina de devolución cerrada\n\nHa escogido la devolución de este vehiculo a \n"+stations[collectpt]+" el día "+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[em-1]+" "+ey+".\n\nNuestra oficina está cerrado el dia que desea devolver su coche.\nNo es posible devolver el vehículo en esta localidad fuera de horas de oficina.\n\nContactenos por correo electronico para más información.\n\n");}else{shop2RETURNclosedallday();if (shop2close == true && restrictreturn[endpt] == 2)
{alert("instanQuote : help : Oficina de devolución\n\nHa escogido la devolución del vehículo a \n"+stations[collectpt]+" el día "+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[em-1]+" "+ey+".\n\nNuestra oficina en esta localidad está cerrado el día que desea devolver el coche.\nNo existe la posibilidad de devólver coches fuera de horas de oficina en esta localidad.\n\n");}else{shop1VALIDATEHOURScollection();
if (shop1close == true && stationmatrix[collectpt] == 1){alert("instanQuote : help : Cierre oficina recogida\n\nHa escogido la recogida de su coche desde       \n"+stations[collectpt]+" el día "+daysoftheweek[todaysthedaythat]+" "+sd+" "+meses[smurf]+" "+sy+".\n\nNos ha indicado su hora de recogida a las "+sh+":"+smin+" hrs\n\nEsta oficina abre desde las  "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+".\n\nConsidere otra hora de inicio o contactenos para más información.\n\n");}else{shop2VALIDATEHOURScollection();
//whoops
if (shop2close == true && stationmatrix[collectpt] == 2){alert("instanQuote : help : Cierre oficina recogida\n\nHa ecogido recogida desde       \n"+stations[collectpt]+" el día "+daysoftheweek[todaysthedaythat]+" "+sd+" "+meses[smurf]+" "+sy+".\n\nNos ha indicado la hora de recogida como "+sh+":"+smin+" hrs\n\nNuestra oficina abre desde  "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+" el día en cuestión.\n\nConsidere otra hora de inicio de su alquiler, o contactenos por correo electrónico para mayor información.\n\n");}else{shop1VALIDATEHOURSreturn();
if (shop1close == true && restrictreturn[endpt] == 1){alert("instanQuote : help : Cierre oficina devolución\n\nHa escogido devolución de su vehículo a "+stations[endpt]+" el día             \n"+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[emurf]+" "+ey+" a las "+eh+":"+emin+" horas.\n\nEsta localidad abre : \n\nMañanas : "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+"\nTardes : "+tempPMopenHRS+":"+tempPMopenMIN+" - "+tempPMclosHRS+":"+tempPMclosMIN+"\n\nNo existe facilidades para devólver el vehículo fuera de las horas indicadas.\n\n");}else{shop2VALIDATEHOURSreturn();
if (shop2close == true && restrictreturn[endpt] == 2){alert("instanQuote : help : Cierre oficina devolución\n\nHa escogido devólver su vehículo a "+stations[endpt]+" el día             \n"+daysoftheweek[todaysthedaythat]+" "+ed+" "+meses[emurf]+" "+ey+" a las "+eh+":"+emin+" horas.\n\nEsta localidad abre : \n\nMañanas : "+tempAMopenHRS+":"+tempAMopenMIN+" - "+tempAMclosHRS+":"+tempAMclosMIN+"\nTardes : "+tempPMopenHRS+":"+tempPMopenMIN+" - "+tempPMclosHRS+":"+tempPMclosMIN+"\n\nNo existe la posibilidad de devólver el vehículo fuera de las horas indicadas.\n\n");}else{document.instanQuote.NIGHTCHARGE.value="";nightsuppstate=false;nightowl();

if (nightsuppstate == true){

document.instanQuote.NIGHTCHARGE.value="Recargo de EUR "+nightsuppsvalue+",00 pagadero en destino por servicio nocturno entre las "+nightsuppsstart+"-"+nightsuppsend+" horas.";}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 ="Muy buenas";
if (xxhour >4 && xxhour <13){ shallam="Bueños días";}
if (xxhour >12 && xxhour <15){ shallam="Muy buenas";}
if (xxhour >14 && xxhour <18){ shallam="Bueñas tardes";}
if (xxhour >17 && xxhour<24){ shallam="Hola";}
if (xxhour <4){shallam="Hola";}
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 : min. dias no cumplido\n\nHa escogido un alquiler de SOLO IDA entre oficinas : \n\nRecoger desde : \n\nDevólver a : \n\nExiste un mínimo de "+minoneway+" días para alquileres entre oficinas que, actualmente, no está cumpliendo.\n\nCorregir las fechas de recogida/devolucíon para cumplir esta regla.\n\nSi dessea el coche para menos tiempo siempre puede devólver el vehículo antes de la fecha indicada, sin recargo.\n\nDevolviendo anticipadamente el vehículo sólo pagará el precio de los "+minoneway+" días minimo para este alquiler.\n\n");
document.instanQuote.ED.focus();}

else{

/*
alert("Please ignore this service message\n\nap status ="+isanairport[collectpt]+"\nhmat ="+stationmatrix[collectpt]+"\n\nThis message is an internal service report, please accept our apologies for the inconvenince.");
*/

//chase-up arrival flight number or hotel name

if (emaillength>5){

if (document.instanQuote.ARRFLIGHT.value == "t.b.a." && isanairport[collectpt] == 1){newfly = prompt("Indicar su vuelo de llegada.\nSi no lo sabe, dejar como 't.b.a' y se lo recordaremos más tarde.", "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="Falta numero de Vuelo - ¡avisar!";}}
else{document.instanQuote.FLIGHTNUMBEROUT.value="WALK IN (presentación a pie)";}

if (document.instanQuote.ARRFLIGHT.value == "Hotel t.b.a." || stations[collectpt] == "Hotel"){hotelname = prompt("Indicar nombre de su hotel.\nSi no lo sabe, dejar como 'Hotel t.b.a' y se lo recordaremos mas tarde", "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("Indicar de que hotel se lo recogeremos.\nSi no lo sabe, dejar como 'Hotel t.b.a.'", "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 ("Nos gustaria tener su nombre para enviar un prespupuesto más personalizado\nInidcar su nombre o dejar en blanco como prefiere.", "");
if (onemoretime == "" || onemoretime == null){document.instanQuote.RENTERNAMEOUT.value="(falta su nombre ¡avisar!)";}
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 : falta su e-mail\n\nNecesitamos su dirección de correo electrónico para poder enviar su presupuesto.\n\nEl presupuesto le llegará en unos 5 minutos");document.instanQuote.EMAILADDRESS.focus();}else{
	
document.instanQuote.PASTEPRICE.value=eurnettprice;
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 == "Falta numero de Vuelo - ¡avisar!"){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();



}

