      function setCurrentDate(){
         checkin = new Date();
         checkout = new Date();
         checkin.setDate(checkin.getDate()+1);
         checkout.setDate(checkout.getDate()+2);
         selectElement(window.document.checka.daysI,checkin.getDate());
         selectElement(window.document.checka.monthsI,checkin.getMonth()+1);
         selectElement(window.document.checka.yearI,checkin.getYear());
         selectElement(window.document.checka.daysS,checkout.getDate());
         selectElement(window.document.checka.monthsS,checkout.getMonth()+1);
         selectElement(window.document.checka.yearS,checkout.getYear());
      }

      function setDateS(data,nform){
         var a = data.split("/");
         document.forms[nform].monthsS.options[a[1]-1].selected=true;
         document.forms[nform].daysS.options[a[0]-1].selected=true;
         for(var i=0;i< document.forms[nform].yearS.options.length;i++){
            if(document.forms[nform].yearS.options[i].value==a[2]){
               document.forms[nform].yearS.options[i].selected=true;
            }
         }
      }

      function setDateI(data,nform){
         var a = data.split("/");
         document.forms[nform].monthsI.options[a[1]-1].selected=true;
         document.forms[nform].daysI.options[a[0]-1].selected=true;
         for(var i=0;i< document.forms[nform].yearI.options.length;i++){
            if(document.forms[nform].yearI.options[i].value==a[2]){
               document.forms[nform].yearI.options[i].selected=true;
            }
         }
      }

      function openC(frm,nform) {
         window.open('calendar.php?frm=' + frm + '&nform=' + nform + '&ln=en','in','scrollbars=yes,status=no,width=265,height=270,top=100,left=250,menubar=no');
         return false;
      }


      function selectElement(param,testValue){
         for (var i = 0; i < param.length; i++) {
            if (param.options[i].value == testValue) {
               param.options[i].selected = true;
            }
         }
      }

      function verifica() {
         var data1,data2,d,dat1,dat2;
         data1 = new Date();
         data2 = new Date();
         if (window.document.checka.yearI.options[window.document.checka.yearI.selectedIndex].value == "0" ||
            window.document.checka.monthsI.options[window.document.checka.monthsI.selectedIndex].value == "0" ||
            window.document.checka.daysI.options[window.document.checka.daysI.selectedIndex] == "0" ||
            window.document.checka.yearS.options[window.document.checka.yearS.selectedIndex] == "0" ||
            window.document.checka.monthsS.options[window.document.checka.monthsS.selectedIndex] == "0" ||
            window.document.checka.daysS.options[window.document.checka.daysS.selectedIndex] == "0")
         {
            alert ("Invalid date! Please check.");
            return false;
         }
         d = new Date();
         dc = new Date(d.getFullYear(),d.getMonth(), d.getDate());
         dataC = Date.parse(dc.toUTCString());

         dat1 = new Date(window.document.checka.yearI.options[window.document.checka.yearI.selectedIndex].value, parseInt(window.document.checka.monthsI.options[window.document.checka.monthsI.selectedIndex].value) -1 ,window.document.checka.daysI.options[window.document.checka.daysI.selectedIndex].value);
         dat2 = new Date(window.document.checka.yearS.options[window.document.checka.yearS.selectedIndex].value, parseInt(window.document.checka.monthsS.options[window.document.checka.monthsS.selectedIndex].value) -1 ,window.document.checka.daysS.options[window.document.checka.daysS.selectedIndex].value);
         data1 = Date.parse(dat1.toUTCString());
         data2 = Date.parse(dat2.toUTCString());

         if(dataC > data1){
            alert("'Check-in' date cannot be earlier than current date!");
            return false;
         }
         if (data1 >= data2){
            alert ("'Check-in' date cannot be later than 'Check-out' date");
            return false;
         }
         return true;
      }

      function openW(){
         if (verifica()){
            var width = screen.Width - 50;
            var height = screen.Height - 200;
            var str = "height=" + height + ",innerHeight=" + height;
            str += ",width=" + width + ",innerWidth=" + width;
            if (window.screen) {
               var ah = screen.availHeight - 100;
               var aw = screen.availWidth - 10;
               var xc = (aw - width) / 2;
               var yc = (ah - height) / 2;
               str += ",left=" + xc + ",screenX=" + xc;
               str += ",top=" + yc + ",screenY=" + yc;
            }
            window.open('','obmp30','scrollbars=yes,status=yes,menubar=no,toolbar=yes,resizable=yes,');
            window.document.checka.submit();
         }else{
            return false;
         }
      }

      // Checks if browser is Netscape 2.0x since the options array properties don't work with Netscape 2.0x
      function isBrowserSupp() {
         // Get the version of the browser
         version =  parseFloat( navigator.appVersion );
         if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {
            return false;
         }else {
            return true;
         }
         return true;
      }

      function isLeapYear( yrStr ) {
         var leapYear = false;
         var year = parseInt( yrStr, 10 );
         if ( year % 4 == 0 ) {
            leapYear = true;
            if( year % 100 == 0 ) {
               leapYear = false;
               if( year % 400 == 0 ) {
                  leapYear=true;
               }
            }
         }
         return leapYear;
      }

      function getDaysInMonth( mthIdx, YrStr ) {
         var maxDays = 31
         if( mthIdx == 1 ) {
            if( isLeapYear( YrStr ) ) {
               maxDays=29;
            } else {
               maxDays=28;
            }
         }

         if( mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10 ) {
            maxDays=30;
         }
         return maxDays;
      }

      function adjustDate( monthObj, dayObj, yearObj ) {
         var value = 0;
         var mthIdx = monthObj.options.selectedIndex;
         var Dt = dayObj;
         var theYear = yearObj.options[yearObj.options.selectedIndex].value;
         var numDays = getDaysInMonth( mthIdx, theYear );
         if( mthIdx == 1 ) {
            if( Dt.options.selectedIndex + 2 < numDays ) {
               return 0;
            } else {
               if( Dt.options.selectedIndex + 1 > numDays) {
                  Dt.options.selectedIndex=numDays - 1;
               }
               if( (Dt.options.selectedIndex + 1) == numDays ) {
                  return 1;
               } else {
                  return 4;
               }
            }
         }
         if( Dt.options.selectedIndex + 2 < numDays ) {
            value = 0;
         } else {
            if ( Dt.options.selectedIndex + 1 > numDays ) {
               Dt.options.selectedIndex--;
               value = 3;
            } else if ( Dt.options.selectedIndex + 1 == numDays ) {
               value = 2;
            } else {
               value = 4;
            }
         }
         return value;
      }

      function amadChange( inM, inD, inY ) {
         if ( !isBrowserSupp() ) {
            return;
         }
         var res = adjustDate( inM.options.selectedIndex, inD, inY.options[inY.options.selectedIndex].value );
         return;
      }

      function dmddChange( outM, outD, outY ) {
         if ( !isBrowserSupp() ) {
            return;
         }
         adjustDate( outM.options.selectedIndex, outD, outY.options[outY.options.selectedIndex].value );
         return;
      }

      function showHideChildrenAge(formName){
         var nrChildren = window.document.forms[formName].childs.options[window.document.forms[formName].childs.selectedIndex].value;
         var nrMaxChildren = 7;
         for (var i=1; i <= nrChildren; i++){
            window.document.getElementById("childAgeTable" + i).className = "classshown";
         }
         nrChildren ++;
         for (var j= nrChildren ; j <= nrMaxChildren; j++){
            window.document.getElementById("childAgeTable" + j).className = "classhidden";
         }
      }

// WCT Scripts modified for OBM

function IsLeapYear(yrStr)
{
 var leapYear = false;
 var year = parseInt(yrStr, 10);
 if (year%4 == 0) 
  { 
	leapYear = true;
	if (year%100 == 0)
	 {
	  leapYear = false;
	  if (year%400 == 0)
	   {
	    leapYear = true;
		}
	  }
   }
  return leapYear;
 }


function getDaysInMonth(mthIdx, yrStr) 
{
 var maxDays = 31;
 if (mthIdx == 1)
	{
	 if (IsLeapYear(yrStr))
	   { 
	    maxDays = 29;
	   }
	 else
		{
		  maxDays = 28;
		}
     }
 if (mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10)
	{
	 maxDays = 30;
	 }
 return maxDays;
}

function adjustDate(mthIdx, Dt, initDate)
{
var value = 0;

var today = new Date();
var theYear = parseInt(today.getYear(),10);

if (mthIdx < today.getMonth()) {
	theYear = (parseInt(today.getYear(),10) + 1);
}

if (theYear < 100) {
	theYear = "19" + theYear;
	}
else {
	if ((theYear - 100) < 10) {
		theYear = "0" + (theYear - 100);
		}
	else 
		{
		theYear = (theYear - 100) + "";
		}
	theYear = "20" + theYear
}

var numDays = getDaysInMonth(mthIdx, theYear);

 
// checks whether to initialize date or not.
if (initDate == 1) 
	{
	  if ((numDays - Dt)==7)
		{

		//checks if month is December
		if (mthIdx==11) {
			document.checka.monthsI.options.selectedIndex = mthIdx;
			document.checka.monthsS.options.selectedIndex = 0;
			document.checka.yearS.options.selectedIndex =+1;
		} else {
			document.checka.monthsI.options.selectedIndex = mthIdx;
			document.checka.monthsS.options.selectedIndex = mthIdx+1;
		}

		//hotel search box
	    document.checka.daysI.options.selectedIndex = numDays - 1;
	    document.checka.daysS.options.selectedIndex =  7 - (numDays - Dt);

		}
		else if ((numDays-Dt)<7)
				{

				if (mthIdx==11) {
					document.checka.monthsI.options.selectedIndex = 0;
					document.checka.monthsS.options.selectedIndex = 
					document.checka.monthsI.options.selectedIndex;
					document.checka.yearI.options.selectedIndex =+1;
					document.checka.yearS.options.selectedIndex =+1;

				} else {
					document.checka.monthsI.options.selectedIndex = mthIdx + 1;
					document.checka.monthsS.options.selectedIndex = document.checka.monthsI.options.selectedIndex;	

				}					

				//hotel search box
				document.checka.daysI.options.selectedIndex = 6 - (numDays - Dt);
				document.checka.daysS.options.selectedIndex = 7 - (numDays - Dt);	

				}
		else
			{ 
			//hotel search box
			document.checka.monthsI.options.selectedIndex = mthIdx;
			document.checka.daysI.options.selectedIndex = (Dt - 1) + 7;
			document.checka.monthsS.options.selectedIndex = document.checka.monthsI.options.selectedIndex;
			document.checka.daysS.options.selectedIndex = (Dt - 1) + 8;

			}
		}
else
	{		
	if (mthIdx == 1)
		{
		if (Dt.options.selectedIndex + 1 < numDays) 
			{
			return 0;
			}
		else
			{
			Dt.options.selectedIndex=numDays - 1;
			if (numDays == 29)
				{
				return 99;
				}
			else
				{
				return 1;
				}
			}
		}
	 if (Dt.options.selectedIndex + 1 < numDays)
		{
		value = 0;
		}
	 else
		{
		if (Dt.options.selectedIndex + 1 > numDays)
			{
			Dt.options.selectedIndex--;
			value = 3;
			}
		else
			{
			value = 2;
			}
		}
	 return value;
	}
}


function amadChange(inM, inD, outM, outD)
{
 var res = adjustDate(inM.options.selectedIndex, inD, 0);
 if (res != 0 )
	{
		outD.options.selectedIndex = 0;
		if (outM.options.selectedIndex == 11) {
			outM.options.selectedIndex = 0;
			}
		else {
			outM.options.selectedIndex = inM.options.selectedIndex + 1;
			}
		}
 else
	{
	outM.options.selectedIndex = inM.options.selectedIndex;
	outD.options.selectedIndex = inD.options.selectedIndex + 1;
	}
return;
}

function initDate()
{
	var today = new Date();
	var currMth = today.getMonth();
	var currDate = today.getDate();

	var mth = document.checka.daysI.options.selectedIndex = currMth;
	var Dt = document.checka.daysI.options.selectedIndex = currDate;
	adjustDate(mth, Dt, 1);
}