var daysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

if (document.mainForm) {
    WinId = window.open('','newwin','height=1,width=1');
    WinId.close();
}

Last = new Date();
LastSubmit = Last.getTime();
LastSubmit = LastSubmit - 25000;

function setDates() {

    if (!document.mainForm) {
        return;
    }

    var dCurDate= new Date();
    var dCurTime=dCurDate.getTime();
    
    var tempStart=dCurTime + (1000 * 60 * 60 * 24);
    var dStartDate= new Date(tempStart);
    var dStartMonth = dStartDate.getMonth();
    var dStartDay= dStartDate.getDate();
    var dStartYear = dStartDate.getFullYear();
    var today=dStartDate.getDay();
    
    var tempEnd = tempStart + (1000 * 60 * 60 * 24 * 7);
    var dReturnDate= new Date(tempEnd);
    var dReturnYear=dReturnDate.getYear();
    var dReturnMonth=dReturnDate.getMonth();
    var dReturnDay=dReturnDate.getDate();
    
    if(dStartDay+1>daysInMonth[dStartMonth]){dStartDay=0;dStartMonth=dStartMonth+1;}
     document.mainForm.day1.selectedIndex = dStartDay;
     document.mainForm.month1.selectedIndex = dStartMonth;
    if(dReturnDay+1>daysInMonth[dReturnMonth]){dReturnDay=0;dReturnMonth=dReturnMonth+1;}
     document.mainForm.day2.selectedIndex = dReturnDay;
     document.mainForm.month2.selectedIndex = dReturnMonth;
}

function popUp(inmessage) {
  WinId = window.open('','newwin','width=360,height=350,resizable=0,status=no');
  WinId.document.write('<html><head>');
  WinId.document.write('</head>');
  WinId.document.write('<body leftmargin=0 topmargin=0 bgcolor="#0000CE">');
  WinId.document.write('<center>');
  WinId.document.write('<table cellpadding=0 cellspacing=0 border=0 width=100% height=100% bgcolor=#0000CE><tr><td>');
  WinId.document.write('<link rel="stylesheet" type="text/css" href="http://www.travelselect.com/stylesheets/index_ie.css">');
  WinId.document.write('<table border=0 cellpadding=0 cellspacing=0 align=center width=98%>');
  WinId.document.write('<tr><td align=center><br><img src="http://www.travelselect.com/images/V3/logo.gif" border=0></td></tr>');
  WinId.document.write('<tr><td> </td></tr>');
  WinId.document.write('<tr><td class=lbluelarge align=center>'+inmessage+'</td></tr>');
  WinId.document.write('<tr><td> </td></tr>');
  WinId.document.write('<tr><td align=center><img src="http://www.travelselect.com/images/V3/dots6.gif"></td></tr>');
  WinId.document.write('<tr><td align=center> </td></tr>');
  WinId.document.write('<tr><td align=center>');
  WinId.document.write('<table bgcolor="#abccff" border=0 cellspacing=0 cellpadding=0>');
  WinId.document.write('<tr>');   WinId.document.write('<td width=10 align=left valign=top bgcolor="#abccff"><img src="http://www.travelselect.com/images/V3/cornerdkblue1.gif"></td>');
  WinId.document.write('<td colspan=2 bgcolor="#abccff" class=tiny> </td>');
  WinId.document.write('<td width=10 align=right valign=top bgcolor="#abccff"><img src="http://www.travelselect.com/images/V3/cornerdkblue2.gif"></td>');
  WinId.document.write('</tr>');
  WinId.document.write('<tr>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('<td colspan=2 align=center class=boldred>For Your Peace of Mind & Consumer Protection We Are Members Of</td>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('</tr>');
  WinId.document.write('<tr>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('<td align=left class=boldred>ABTA : </td><td align=left><span class=highbold>Ensuring the highest standards of service and quality.</span></td>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('</tr>');
  WinId.document.write('<tr>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('<td align=left class=boldred>ATOL : </td><td align=left><span class=highbold>Protecting you against financial loss once your booking has been made.</span></td>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('</tr>');
  WinId.document.write('<tr>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('<td align=left class=boldred>VERISIGN : </td><td align=left><span class=highbold>Guaranteeing secure credit card transactions.</span></td>');
  WinId.document.write('<td width=10> </td>');
  WinId.document.write('</tr>');
  WinId.document.write('<tr>');
  WinId.document.write('<td width=10 valign=bottom align=left><img src="http://www.travelselect.com/images/V3/cornerdkblue4.gif"></td>');
  WinId.document.write('<td colspan=2 class=tiny> </td>');
  WinId.document.write('<td width=10 valign=bottom align=right><img src="http://www.travelselect.com/images/V3/cornerdkblue3.gif"></td>');
  WinId.document.write('</tr>');
  WinId.document.write('</table>');
  WinId.document.write('</td></tr>');
  WinId.document.write('<tr><td> </td></tr>');
  WinId.document.write('<tr><td class=lemonlarge align=center>We have access to 527 Airlines,<br>200 Hotel Chains and over 45 Car Rental companies.</td></tr>');
  WinId.document.write('</table>');
  WinId.document.write('</center>');
  WinId.document.write('</td></tr></table>');
  WinId.document.write('</body>');
  WinId.document.close();
}

function CheckSubmit(popup,message) {
  This = new Date();
  ThisSubmit = This.getTime();
  Diff=ThisSubmit-LastSubmit; // how long ago?
  if (Diff<10000) {
    alert('Please be patient. The server is handling your request!');
    return false; // block submit after less than 10 seconds !
  }
  else {
    count = 0;
  }
  if(popup) {
    popUp(message);
  }
  LastSubmit=ThisSubmit;
  return true;
}


