// JavaScript Document
/// <!-- <![CDATA[
// Set the initial date.





var jsAllDates = ''; 
var arrJsAllDates;



var ds_i_date = new Date();
var ds_c_month = ds_i_date.getMonth() + 1;
var ds_c_year = ds_i_date.getFullYear();
//Used to display current date at bottom side of calendar.
var ds_curr_date = new Date();
ds_curr_day1 = ds_curr_date.getDate();
ds_curr_month1 = ds_curr_date.getMonth() + 1;
ds_curr_year1 = ds_curr_date.getFullYear();
var dateFormatUK= true; 
var chkPage;
var lockDate=false;
var clkDate;
var headDate;
var curr_Sel_Mon;
var combo_DepartureWeek;
var totDateTD=0;  //store current month calendar Table TDs (only dates TDs) .
var count_TdId=0; //store current month dates TDs (used in for loop).
var frstOnloadCal=true; //Check calendar opens first time.
var gStr_calDates ="";   //store prev ,current ,next month dates.
var gStr_calTds=""; //store current month calendar Table TDs in cocncatibated string format (only dates TDs) .
var gArry_CalDates; //date aaray
var gArry_CalTDs; // DAtes Tds array
var gfrstWkClked_Date=""; //Store first week date
var gsecWkClked_Date="";//Store second week date
var gfrstWkClked_Day=-1;//Store first week date day.
var gsecWkClked_Day=-1;  ////Store second week date day
var gCmbWeek; //Holds week combo box object
var gWeekText;  //Store week text like 1 week  or 2 week
var gstrSelDate; //holds selected date sting. 
var hiddenTxtforSecWeek_date; //hidden text boxe of ASP pages used to store sec week date
var hiddenTxtforSecWeek_day; //hidden text boxe of ASP pages used to store sec week day
hiddenTxtforSecWeek_date = document.getElementById("selSecWeekDate_1");
hiddenTxtforSecWeek_day = document.getElementById("selSecWeekDay_1");
var objDepYear;				//Holds selected year drop down value
var displayTextName;
var centreStartYear; //Holds the Starts Year for Selected Destination
var centreStartMonth;//Holds the Starts month for Selected Destination
var centreEndMonth; //Holds the End month for Selected Destination
var centreEndYear;//Holds the End Year for Selected Destination
var tmpStratYear;

var seasonStartDate = '';
var seasonEndDate = '';

var YearStartEndMonths = new Array(); 

function SetDatesArray(centreCode)
{
    var destCtrl = document.getElementById(ddDestinationsId);

    var forms=document.forms[0];
    seasonStartDate = '';
    seasonEndDate = '';
    jsAllDates = '';
    var arrGroups= js_Groups.split('|');
    var arrGroupCenters;
    arrGroupCenters = '';
    for (i=0; i<arrGroups.length;i++)
    {
        var arrGroup = arrGroups[i].split('=')  ;
        if (arrGroup[0].split("-")[0].toUpperCase() == Trim(destCtrl.options[destCtrl.selectedIndex].value.toUpperCase()))
        {
            arrGroupCenters = arrGroup[1].split(',');
            break;
        }
    }
    
   var jsAllCentreDatesArr = jsAllCentreDates.split("|")
  
   if (arrGroupCenters != '')
    {
            for (j=0; j<arrGroupCenters.length;j++)
            {
                for (i=0; i<jsAllCentreDatesArr.length;i++)
                {
                    if (arrGroupCenters[j].toUpperCase() == jsAllCentreDatesArr[i].split('=')[0].toUpperCase() )
                    {
                        if (jsAllDates == '')
                        {
                            jsAllDates = jsAllCentreDatesArr[i].split('=')[1];
                        }
                        else
                        {
                            jsAllDates = jsAllDates + "," + jsAllCentreDatesArr[i].split('=')[1];
                        }
                        
                        SetStartDateEndDate(jsAllCentreDatesArr[i].split('=')[1]);
                        break;
                    }
                }
            }
    }
    else
    {
        
        if (centreCode == "any")
        {
            for (i=0; i<jsAllCentreDatesArr.length;i++)
            {
                if (jsAllDates == '')
                {
                    jsAllDates = jsAllCentreDatesArr[i].split('=')[1];
                }
                else
                {
                    jsAllDates = jsAllDates + "," + jsAllCentreDatesArr[i].split('=')[1];
                }
                SetStartDateEndDate();
            }
        }
        else
        {
            for (i=0; i<jsAllCentreDatesArr.length;i++)
            {
                if (centreCode.toUpperCase()== jsAllCentreDatesArr[i].split('=')[0].toUpperCase() )
                {
                    jsAllDates = jsAllCentreDatesArr[i].split('=')[1];
                    break;
                }
            }
            SetStartDateEndDate(jsAllDates);
        }
    }
    
    
   
    
    arrJsAllDates=jsAllDates.split(",");
    arrJsAllDates.sort();
            
    
}

function SetStartDateEndDate(jsCentreDates)
{
        var tempAllDates = jsCentreDates.split(',')
        if (seasonStartDate== '')
        {
            seasonStartDate = tempAllDates[0];
            seasonEndDate= tempAllDates[tempAllDates.length-1];
        }
        else
        {
            
            tempStartDate = tempAllDates [0];
            tempEndDate = tempAllDates[tempAllDates.length-1];
            
            var tmpFullStartDate = tempStartDate.split("-");
	        var tmpstartYear = tmpFullStartDate[0];
	        var tmpstartMonth = tmpFullStartDate[1];
    	
	        var tmpFullEndDate = tempEndDate.split("-");
	        var tmpEndYear = tmpFullEndDate[0];
	        var tmpEndMonth = tmpFullEndDate[1];
	        
            var startMonth = seasonStartDate.split("-")[1];
            var startYear= seasonStartDate.split("-")[0];
	        	        	        
	        var endMonth = seasonEndDate.split("-")[1];
	        var endYear= seasonEndDate.split("-")[0];
	        
	        
	        if (endYear >tmpEndYear)
	        {
	        }
	        else
	        {
	            if(tmpEndYear>endYear )	        	        
	            {
	                seasonEndDate = tempEndDate;
	            }
	            else
	            {   
	                if (endMonth >tmpEndMonth)
	                {
	                }
	                else
	                {
	                     seasonEndDate = tempEndDate;
	                }
	            }
	        }
	        
	        if (startYear <tmpstartYear)
	        {
	        }
	        else
	        {
	            if(tmpstartYear <startYear)
	            {
	                seasonStartDate = tempStartDate;
	            }
	            else
	            {
	                if (startMonth <tmpstartMonth)
	                {
	                }
	                else
	                {
	                    seasonStartDate = tempStartDate;
	                }
	            }
	        }
        }
        
}

// Get Element By Id
function ds_getel(id) 
{
    
    return document.getElementById(id);
}

// Get the left and the top of the element.
function ds_getleft(el) 
{
	var tmp = el.offsetLeft;
	el = el.offsetParent
	
	while(el) {
		tmp += el.offsetLeft;
		el = el.offsetParent;
	}
	return tmp; 
}
function ds_gettop(el) 
{
	var tmp = el.offsetTop;
	el = el.offsetParent
	while(el) {
		tmp += el.offsetTop;
		el = el.offsetParent;
	}
	return tmp;
}

// Output Element

var ds_oe = ds_getel('ds_calclass');
// Container
var ds_ce = ds_getel('ds_conclass');

// Output Buffering
var ds_ob = ''; 
function ds_ob_clean() 
{
	ds_ob = '';
}
function ds_ob_flush() 
{
	
	ds_oe.innerHTML = ds_ob;
	ds_ob_clean();
}
function ds_echo(t) 
{
	ds_ob += t;
}

var ds_element; // Text Element...
var ds_monthnames = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
]; 
var ds_monthnames1 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
// You can translate it for your language.
//this array is used to display day names on the calendar.
var ds_daynames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat','Sun']; 
var ds_dayDispNames = ['Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday'];
//this array is used for comparision with database or hidden controls values.
var ds_daynames1 = ['Sunday','Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
// Calendar template

var selectedYYMM;

function Month_onchange()
{
    var element = document.getElementById("AllMonths");
    var value = element.options[element.selectedIndex].value.split("-");
    selectedYYMM = element.options[element.selectedIndex].value;
    ds_c_month = value[0];
    ds_c_year = value[1];
    
    gStr_calDates ="";
    gStr_calTds="";
    
    ds_draw_calendar(ds_c_month, ds_c_year);
	setCalTxtDay(ds_c_month, ds_c_year);
}
//THIS FUNCTION CREATES THE ARROWS
function ds_template_main_above(t,m, y) 
{
      imgPath=gSTR_IMG_PATH + "buttons/";
        
      var inactiveArwPath = "http://" + js_serverName + "/imgs/vp/buttons/";         
      GetAllMonthAndYearOfSeason(t,m,y);        

	  var strt =  '<table cellpadding="0" cellspacing="1" class="ds_tbl" border="0" width="160"><tr>';
				
		if (ds_c_year > centreStartYear)
		{		  		    
		   strt = strt + '<td width="18" align="center" height="14" style="cursor: pointer; background-color: '+ tblColor +'" onclick="ds_py();">';
		   strt = strt + '<img src="' + imgPath +'leftarrow.gif" /><img src="' +imgPath +'leftarrow.gif" /></td>'
		}
		else
		{
		    strt = strt + '<td width="18" align="center" height="14" style="background-color: '+ tblColor +'">';		    
		    strt = strt + '<img src="' + inactiveArwPath + 'leftarrow_inactive.gif" />';
		    strt = strt + '<img src="' + inactiveArwPath  + 'leftarrow_inactive.gif" /></td>';
		}
				
	  if (ds_c_year > centreStartYear)
	  {
	        strt = strt + '<td width="20" align="center" style="cursor: pointer; background-color: '+ tblColor +'"" onclick="ds_pm();">';
	        strt = strt + '<img src="' +imgPath +'leftarrow.gif" /></td>'	      	      
	  }
	  else
	  {	   
	     if (ds_c_month > centreStartMonth )
	     {
	        strt = strt + '<td width="20" align="center" style="cursor: pointer; background-color: '+ tblColor +'"" onclick="ds_pm();">';
	        strt = strt + '<img src="' +imgPath +'leftarrow.gif" /></td>'
	     }
	     else
	     {
	        strt = strt + '<td width="20" align="center" style="background-color: '+ tblColor +'">';
	        strt = strt + '<img src="' + inactiveArwPath + 'leftarrow_inactive.gif" /></td>'
	      }
	  
	  }
			
		strt = strt +'<td width="89" align="center" style="cursor: pointer; background-color: '+ tblColor +'"" class="ds_subhead" id="headDate"><select id="AllMonths" name="AllMonths" class="month_box" style="color:' + calTxtColor + '; background-color:'+ tblColor +'; width: 85px; font-weight: bold; text-align: left;" onChange="Javascript:Month_onchange();">'
		+ GetAllMonthAndYearOfSeason(t,m,y)
		+'</select>'
		+'</td>';
		
      if (ds_c_year < centreEndYear)
      {

	      strt = strt + '<td width="18" align="center" style="cursor: pointer; background-color: '+ tblColor +'" onclick="ds_nm();"><img src="' +imgPath +'rightarrow.gif" alt="" /></td>';
	  }
	  else
	   {
	        if(ds_c_month < centreEndMonth)
		        {
		          strt = strt + '<td width="18" align="center" style="cursor: pointer; background-color: '+ tblColor +'" onclick="ds_nm();"><img src="' +imgPath +'rightarrow.gif" alt="" /></td>';
		        }
		        else
		        {
	                strt = strt + '<td width="18" align="center" style=" background-color: '+ tblColor +'"><img src="' +inactiveArwPath +'rightarrow_inactive.gif" alt="" /></td>';
	            }
	    }
		
		if (ds_c_year < centreEndYear)
		{
		 strt = strt +  '<td width="20" align="center" style="cursor: pointer; background-color: '+ tblColor +'" onclick="ds_ny();">';
		 strt = strt +  '<img src="' +imgPath +'rightarrow.gif" alt="" /><img src="' +imgPath +'rightarrow.gif" alt="" /></td>';
		}
		else
		{
		  strt = strt +  '<td width="20" align="center" style="background-color: '+ tblColor +'">';
		  strt = strt +  '<img src="' + inactiveArwPath +'rightarrow_inactive.gif" alt="" />';
		  strt = strt +  '<img src="' + inactiveArwPath +'rightarrow_inactive.gif" alt="" /></td>'
		}
		
		strt = strt + '</tr>'
		+ '</table>'
		+ '<table cellpadding="0" cellspacing="1" width="161px" class="ds_tbl" border="0">'
		+ '<tr>';
		
		
		
	return strt; 
}

function GetAllMonthAndYearOfSeason(t,m,y)
{
    var strMonthYearCombo;
    
    //var tmpStartDate = seasonStartDate.split("-");
	//var startYear = tmpStartDate[0];
	
	 tmpStartDate = seasonStartDate.split("-");
	 startYear = tmpStartDate[0];
	 centreStartYear=tmpStartDate[0];
	
	var startMonth = tmpStartDate[1];
	centreStartMonth = tmpStartDate[1];
	
	selectedYYMM = getFullDayMonth(ds_c_month)+'-'+ds_c_year;
	var tmpEndDate = seasonEndDate.split("-");
	var EndYear = tmpEndDate[0];
	var EndMonth = tmpEndDate[1];	
	
	centreEndYear = tmpEndDate[0];
	centreEndMonth = tmpEndDate[1];
    

	var keyValue;
	var i=0;
	while (EndYear >= startYear)
	{
	    YearStartEndMonths[i] = new Array(3) ;
	    YearStartEndMonths[i][0] = startYear;
	   
	    
	    
	    if (EndYear == startYear)
	    {
	        YearStartEndMonths[i][1] = startMonth;
	        YearStartEndMonths[i][2] = EndMonth;
	        while(EndMonth >= startMonth)
	        {
	            
	            keyValue=getFullDayMonth(startMonth) + '-' +  startYear;
	            
	            if (selectedYYMM == keyValue)
	            {
	                strMonthYearCombo = strMonthYearCombo + '<option value="'+ keyValue+'" selected>' + ds_monthnames1[startMonth-1] + ' ' +  startYear  +'</option>'
	            }
	            else
	            {
	                strMonthYearCombo = strMonthYearCombo + '<option value="'+ keyValue +'">' + ds_monthnames1[startMonth-1] + ' ' +  startYear  +'</option>'
	            }
	            startMonth ++ ;
	        }
	        
	    }
	    else
	    {
	        YearStartEndMonths[i][1] = startMonth;
	        YearStartEndMonths[i][2] = 12;
	        while(12 >= startMonth)
	        {
	            keyValue=getFullDayMonth(startMonth) + '-' +  startYear;
	            if (selectedYYMM == keyValue)
	            {
	                
	                strMonthYearCombo = strMonthYearCombo + '<option value="'+ keyValue +'" selected>' + ds_monthnames1[startMonth-1] + ' ' +  startYear  +'</option>'
	            }
	            else
	            {
	                strMonthYearCombo = strMonthYearCombo + '<option value="'+ keyValue  +'">' + ds_monthnames1[startMonth-1] + ' ' +  startYear  +'</option>'
	            }
	            startMonth ++ ;
	        }
	        
	       
	    }
	    startYear++ ;
	    startMonth = 1;
	    i=i+1;
	   
	}
    
    return strMonthYearCombo;
}

function ds_template_day_row(t,m,y) 
{
	var M=paddZero(m);
	for (var selD=0 ;selD < arrJsAllDates.length;selD++)
	{
		arrJsAllDates[selD];
		var tmpArryDay = arrJsAllDates[selD].split("-");
		tmpArryDay[0];
		tmpArryDay[1];
		tmpArryDay[2];
		var tmpDbDate = new Date(tmpArryDay[0],tmpArryDay[1]-1,tmpArryDay[2])
		
		
		if(y==tmpArryDay[0])
		{	
			 if((tmpDbDate.getDay()-1)==-1)
			 {
				if (t == ds_daynames[6])
				 { 
	                return '<td class="ds_subheadSelected" bgcolor='+ menuColor +' style="color:' + gSTR_VB_BLUE + '">' + t + '</td>';
	                //return '<td class="ds_subheadSelected" bgcolor='+ menuColor +' style="color:' + gSTR_VB_BLUE + '">' + t + '</td>';
				 } 
			 }
			 else
			 {
				if (t == ds_daynames[tmpDbDate.getDay()-1])
				 { 
				    return '<td class="ds_subheadSelected" bgcolor='+ menuColor +' style="color:' + gSTR_VB_BLUE + '">' + t + '</td>';
				    //return '<td>' + t + '</td>';
				 }
			 }
		 }
	}
	
	//NON AVAILABLE DAY HEAERS
	return '<td class="ds_subhead" bgcolor='+ tblColor +' style="color:' + gSTR_VB_BLUE + '">' + t + '</td>';
	//return '<td>' + t + '</td>';
	// Define width in CSS, XHTML 1.0 Strict doesn't have width property for it.
}

function ds_template_new_week() 
{
	return '</tr><tr>';
}
//Display previous month days in current month calendar.
function ds_template_blank_cell(prevMdays,mn,yr,tdID) 
{
   	return '<td class="ds_preMNonClickCell" id="t'+tdID+'"></td>';
}

function ds_template_day(d, m, y,tdID) 
{
    
	var calDate = (y +"-"+m+"-"+d);
	if(gStr_calDates=="")
	{
		gStr_calDates = calDate;
		gStr_calTds = tdID;
	}
	else
	{
		gStr_calDates = gStr_calDates +","+ calDate; 
		gStr_calTds = gStr_calTds+","+tdID;
	}
	for(var chk=0;chk < arrJsAllDates.length;chk++)
	{	
	  
		if(calDate == arrJsAllDates[chk])
		{
			return '<td class="ds_cell" id="t'+tdID+'" bgcolor='+ menuColor +' onclick="javascript:clickedDate(this,' + d + ',' + m + ',' + y + ',' + tdID + ');"'
			+'onMouseOver="javascript:ds_onMouseOver('+ d + ',' + m + ',' + y +');">'
			+'<font color='+gSTR_VB_BLUE+'><b><u>'+d+'</u></b></font></td>';
		}
	}
			return '<td class="ds_cellNonClick" id="t'+tdID+'">'+d+'</td>';
	// Define width the day row.
}

function ds_template_main_below() 
{
	return '</tr><tr><td colspan="7" align="left" nowrap>&nbsp;</td></tr>'
			+'<tr><td class="ds_footer" colspan="7" bgcolor='+ tblColor +' align="left" nowrap="nowrap" height="30"><font color="#666666">&nbsp;Note: The dates that are bold and &nbsp;<br>&nbsp;highlighted are the available dates.</font></td></tr>'
			+'</table>';
}
// This one draws calendar...
function ds_draw_calendar(m,y) 
{
	//initialise td id counter.
	
	count_TdId =0;
	//store current month
	curr_Sel_Mon = m;
	// First clean the output buffer.
	ds_ob_clean();
	
	// Here we go, do the header
	ds_echo (ds_template_main_above(ds_monthnames1[m - 1] + ' ' + y, m, y));
	
	for (i = 0; i < 7; i ++) 
	{
	    
		ds_echo (ds_template_day_row(ds_daynames[i],m,y));
	}
	// Make a date object.
	
	var ds_dc_date = new Date();
	var tmpMon = m - 1;
	ds_dc_date.setMonth(tmpMon);
	ds_dc_date.setFullYear(y,tmpMon,1);
	ds_dc_date.setDate(1);
	
	if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) 
	{
		days = 31;
	} else if (m == 4 || m == 6 || m == 9 || m == 11) {
		days = 30;
	} else 
	{
		days = (y % 4 == 0) ? 29 : 28;
	}
	
	
	var first_day = (ds_dc_date.getDay()-1);
	if(first_day==-1)
	{
		first_day =6;
	}
	var first_loop = 1;
	// Start the first week
	ds_echo (ds_template_new_week());
	// If sunday is not the first day of the month, make a blank cell...
	var tmp_first_day = first_day ;
	var print_prevMDays;
	var mn;
	mn=m;
	var retDays;
	
	if((mn-1)==0)
	{
		retDays= totMonthDays(12,y);
	}
	else
	{
		retDays= totMonthDays((mn-1),y);
	}
	print_prevMDays=(retDays - first_day);
	
	if (first_day != 0) 
	{
		//This loop is used to display previous month dates
		for(var prevMCell=1;prevMCell <= tmp_first_day;prevMCell++)
		{			
			count_TdId= (count_TdId + 1);
			print_prevMDays = print_prevMDays+1;
			ds_echo (ds_template_blank_cell(print_prevMDays,(mn-1),y,count_TdId));
		}
	}
	var j = first_day;
	for (i = 0; i < days; i ++) 
	{
		// Today is sunday, make a new week.
		// If this sunday is the first day of the month,
		// we've made a new row for you already.
		count_TdId = count_TdId+1;
		if (j == 0 && !first_loop) 
		{
			// New week!!
			ds_echo (ds_template_new_week());
		}
		// Make a row of that day!
		var day1 = ""+(i+1)+"";
		var mon1 = ""+m+"";
		var chkDayChar=day1.indexOf('0'); //check first digit is zero
		var chkMonChar = mon1.indexOf('0'); //check first digit is zero
		if((i+1) <=9 && chkDayChar!=0)
		{
			var day = ("0"+(i+1));
		}
		else
		{
			day = i + 1;
		}
		if(m <= 9 && chkMonChar!=0)
		{
			mont = ("0"+m);
		}
		else
		{
			mont = m;
		}
		//This loop is used to display current month dates
		//ds_echo (ds_template_day(i + 1, m, y));
		
		ds_echo (ds_template_day(day, mont, y,count_TdId));
		// This is not first loop anymore...
		first_loop = 0;
		// What is the next day?
		j ++;
		j %= 7;
		
	}
	
	//Display next month days
	var mon_lstDate = totMonthDays(mn,y);
	var tmpCalDate = new Date(y,(mn-1),mon_lstDate); 
	var totNxtMDays = (7-(tmpCalDate.getDay()));
	if(totNxtMDays==7)
	{
		totNxtMDays=0;
	}
	var nxt_mn;
	nxt_mn= m;
	//This loop is used to display next month dates.
	for(var nxtMCell=1;nxtMCell <= totNxtMDays;nxtMCell++)
	{
		count_TdId = count_TdId+1;
		ds_echo (print_nxtMDays(nxtMCell,nxt_mn,y,count_TdId));
	}
	totDateTD = count_TdId;
	// Do the footer
	ds_echo (ds_template_main_below());
	// And let's display..
	ds_ob_flush();
	gArry_CalDates = gStr_calDates.split(",");
    gArry_CalTDs = gStr_calTds.split(",");
	//Hight light first week and second weeks.
	
	if( gfrstWkClked_Date!="" )
	{
	   	var passFWSaveDate = gfrstWkClked_Date.split("-");
		highlightWeeksTD(passFWSaveDate[2],passFWSaveDate[1],passFWSaveDate[0],0);
	}
	//alert("Draw calendar"+gsecWkClked_Date +" ::"+ gsecWkClked_Day);
	if( gsecWkClked_Date!="" )
	{
		var SWSaveDate = gsecWkClked_Date.split("-");
		highlightWeeksTD(SWSaveDate[2],SWSaveDate[1],SWSaveDate[0],0);
	}
	// Scroll it into view.
	//Fds_ce.scrollIntoView();
	//Following conditions are used to set selected dates BG color when user navigate on calendar
}
//--------------------------------------
	var tmpArryDay;
	var ds_c_day1;
	var hiddenDeparturedate;
	var txtSelDepDateShow;
	var txtHiddenDay ; 
	var txtHiddenYear; 
	txtSelDepDateShow = document.getElementById("txtSelDepDateShow");		
//Initialised date when first time form loads.


function getSelectedIndex_2(objSelect,strValue)
{
	var intSelectedIndex=0;
	for(var intIndex=0;intIndex < objSelect.options.length ; intIndex ++)
	{
		if(objSelect.options[intIndex].value == strValue)
		{
			intSelectedIndex=intIndex;
			break;
		}
	}
	return intSelectedIndex;
}


	
function setInitialDate(strDate)
{

    var strDateArr
    strDateArr = strDate.split("-")
    ds_c_day1 = strDateArr[2];
    ds_c_month = strDateArr[1];
    ds_c_year =  strDateArr[0];
    
	ds_onclick(ds_c_day1,ds_c_month,ds_c_year );
	
}
// A function to show the calendar.
// When user click on the date, it will set the content of t.
var initSaveFW_Date; 
var centreCode ;
var initialDate;
function ds_shChanged (tName, displayText)
{
    var isRsultPageLoading = true
    try
    {
        isRsultPageLoading = isPageLoaded 
    }
    catch(e)
    {
    }
    seasonStartDate = '';
    seasonEndDate = '';
    centreCode ='AL'; 
    if (document.getElementById(ddDestinationsId)  != null)
    {
        centreCode = document.getElementById(ddDestinationsId).options[document.getElementById(ddDestinationsId).options.selectedIndex].value;
    }
    
    SetDatesArray(centreCode);
    selectedYYMM = '';
    gfrstWkClked_Date=''; 
    initialDate = arrJsAllDates[0];
    
    displayTextName = document.getElementById(displayText);
    var t = document.getElementById(tName)  ;
    ds_element = t;
    var selectedDate = document.getElementById(hiddenDateId).value;
    if (isRsultPageLoading == false)
    {
        if (selectedDate == "")
        {
            selectedDate =initialDate ;
        }
        gfrstWkClked_Date=selectedDate;
        setInitialDate(selectedDate );
    }
    else
    {
        selectedDate =initialDate ;
        gfrstWkClked_Date=selectedDate;
        setInitialDate(selectedDate );
    }
    
    ds_sh(tName, displayText);                
    //Bug 2234 - Calender should be in closed state on load or destination change - Start
    ds_hi();
    //Bug 2234 - Calender should be in closed state - End
}
function ds_sh(tName, displayText) 
{   
    
    displayTextName = document.getElementById(displayText);
    var t = document.getElementById(tName)  ;
    ds_element = t;
    
    ds_oe = ds_getel('ds_calclass');
    ds_ce = ds_getel('ds_conclass');
    
	chkPage = "bgSearch";
	//var isPageLoaded  = true //Temp declared here. Should come from the page.
	
	if (isPageLoaded == true)
	{
	 	initSaveFW_Date = gfrstWkClked_Date.split("-");
		gStr_calDates ="";
	 	gStr_calTds="";
		
		if(ds_ce.style.display == 'none')
		{
			if(arrJsAllDates.length !=0 && arrJsAllDates[0]!="") //check main array in not empty
			{
			    tmpArryDay = arrJsAllDates[0].split("-");
				
				if(gfrstWkClked_Date!="" && gfrstWkClked_Day!=-1)
				{
					ds_c_day1 = initSaveFW_Date[2]; //day
					ds_c_month =initSaveFW_Date[1] // Month
					ds_c_year=initSaveFW_Date[0] // year
				}
				else if(tmpArryDay.length != 0  && tmpArryDay[0]!="" && tmpArryDay[1]!=undefined &&tmpArryDay[2]!=undefined)
				{
			        
		    		ds_c_day1 = tmpArryDay[2];
					ds_c_month = tmpArryDay[1];
					ds_c_year =  tmpArryDay[0];

				}
				else
				{
					var ds_sh_date = new Date();
					ds_c_day1 = ds_sh_date.getDate();
					ds_c_month = ds_sh_date.getMonth() + 1;
					ds_c_year = ds_sh_date.getFullYear();	
				}
				
				// Draw the calendar
				 
				if (gfrstWkClked_Date != '')
                {
                    setInitialDate(gfrstWkClked_Date );
                }
				ds_draw_calendar(ds_c_month, ds_c_year);
				
				
				//headDate = document.getElementById("headDate");
				//headDate.innerHTML=ds_c_day1+" "+ds_monthnames1[(ds_c_month-1)]+" "+ds_c_year;
				// Move the calendar container!
				the_left = ds_getleft(t);
				the_top = ds_gettop(t) + t.offsetHeight;
				
				var objMenuBarCord;
				objMenuBarCord =getAnchorPosition(tName);
				
				if(chkPage=="bgSearch" || chkPage=="VillAv")
				{
					ds_ce.style.left = (objMenuBarCord.x ) + 'px';
					ds_ce.style.top = (objMenuBarCord.y + 20) + 'px';
				}
				// To change the position properly, we must show it first.
				ds_ce.style.display = '';
				ds_ce.style.visibility ='visible';
				//document.getElementById('ctl00_Search1_cmbAirport').style.display='none'  ;
			}
			else
			{
				alert("No availability for the selected villa. Please select another villa.");
			}			
		}
		else
		{	
		    
			ds_hi();
		}
	    
	   // gCmbWeek = document.getElementById("ctl00_Search1_cmbDuration");
		
		
	}
}

// Hide the calendar.
function ds_hi() 
{
    if (ds_ce == null)
    {
        ds_ce = ds_getel('ds_conclass');
    }
	ds_ce.style.display = 'none';
	//document.getElementById('ctl00_Search1_cmbAirport').style.display=''  ;
}
// Moves to the next month...
function ds_nm() 
{
	// Increase the current month.
	gStr_calDates ="";
    gStr_calTds="";
	ds_c_month++ ;
	// We have passed December, let's go to the next year.
	// Increase the current year, and set the current month to January.
	if (ds_c_month > 12) 
	{
		ds_c_month = 1; 
		ds_c_year++;
	}
   // Redraw the calendar.
   //alert(ds_c_month + ' ds_c_month ' + ds_c_year);
 	ds_draw_calendar(ds_c_month, ds_c_year);
	setCalTxtDay(ds_c_month, ds_c_year);
}
// Moves to the previous month...
function ds_pm() 
{
	 gStr_calDates ="";
	 gStr_calTds="";
	tmp_ds_c_year = ds_i_date.getFullYear();
	tmp_ds_c_month =tmpArryDay[1];
	
	//tmp_ds_c_month =  ds_i_date.getMonth() + 1;
	ds_c_month = ds_c_month - 1; // Can't use dash-dash here, it will make the page invalid.
	// We have passed January, let's go back to the previous year.
	// Decrease the current year, and set the current month to December.
	if (ds_c_month < 1) 
	{
		ds_c_month = 12;
		ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid.
	}
	if(ds_c_month < tmp_ds_c_month && tmp_ds_c_year==ds_c_year)
	{
		ds_c_month =tmp_ds_c_month;
		ds_c_year = tmp_ds_c_year;
	}
	if(ds_c_year < tmp_ds_c_year)
	{
		ds_c_month =  1;
		ds_c_year = tmp_ds_c_year;
	}
	// Redraw the calendar.
	ds_draw_calendar(ds_c_month, ds_c_year);
	setCalTxtDay(ds_c_month, ds_c_year)
}


// Moves to the next year...
function ds_ny() 
{
	 gStr_calDates ="";
	 gStr_calTds="";
	// Increase the current year.
	//if (ds_c_year <2010)
	if (ds_c_year < centreEndYear)	
	{
	    var temp_ds_c_year = parseInt(ds_c_year)+ 1;
	    ds_c_year++;
	   
	    //Check if for the next year, same month is available. If not show first available month of next year
	    var stp = YearStartEndMonths.length;
	    for(var i=0;i<=stp;i++)
	    {
	        if (parseInt(YearStartEndMonths[i][0]) == ds_c_year) 
	        {
	            if (ds_c_month > parseInt(YearStartEndMonths[i][2]) )
	            {
	                ds_c_month=YearStartEndMonths[i][1];
	            }
	            break;
	        }
	    }
	  
	    // Redraw the calendar.
	    ds_draw_calendar(ds_c_month, ds_c_year);
	    setCalTxtDay(ds_c_month, ds_c_year);
	 }
}

// Moves to the previous year...
function ds_py() 
{
	gStr_calDates ="";
	gStr_calTds="";
	tmp_ds_c_year = ds_i_date.getFullYear();
	// Decrease the current year.
	ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid.
	if(ds_c_year < tmp_ds_c_year)
	{
		ds_c_year = tmp_ds_c_year;
		// Redraw the calendar.
		ds_draw_calendar(ds_c_month, ds_c_year);
		setCalTxtDay(ds_c_month, ds_c_year);
	}
	else
	{
		//Check if for the next year, same month is available. If not show first available month of next year
	    var stp = YearStartEndMonths.length;
	    for(var i=0;i<=stp;i++)
	    {
	        if (parseInt(YearStartEndMonths[i][0]) == ds_c_year) 
	        {
	            if (ds_c_month < parseInt(YearStartEndMonths[i][1]) )
	            {
	                ds_c_month=YearStartEndMonths[i][1];
	            }
	            break;
	        }
	    }
		ds_draw_calendar(ds_c_month, ds_c_year);
		setCalTxtDay(ds_c_month, ds_c_year);
	}
	
}
//-------------Format the date to output.
function ds_format_date(d, m, y) 
{
	// 2 digits month.
	m2 = '00' + m;
	m2 = m2.substr(m2.length - 2);
	// 2 digits day.
	d2 = '00' + d;
	d2 = d2.substr(d2.length - 2);
	// YYYY-MM-DD
	//return y + '-' + m2 + '-' + d2;
	// MM-DD-YYYY
	if (dateFormatUK == true)
	{
	    //return d2 + '/' + m2 + '/' + y;
	    return y + '-' + m2 + '-' + d2;
	}
	else
	{
	    return m2 + '/' + d2 + '/' + y;
	}
}

//-----This function set the hidden controls values when the user clicks on date.
function ds_onclick(d, m, y) 
{  
	var myDate = new Date(y,(m - 1),d);
	
	ds_element.value = ds_format_date(d, m, y);
	
	var dayint = myDate.getDay();
	
	if (dayint != 0)
	{
	    dayint = dayint-1;
	}
	else
	{
	    dayint = 6;
	}
	displayTextName.value = myDate.getDate() + ' ' + ds_monthnames1[myDate.getMonth()] + ' ' +  myDate.getFullYear() + ' ' + ds_daynames[dayint];   
	fillDurationComboBox(ddDurationId,myDate);
	initialDate == myDate.getFullYear() + '-' + ds_monthnames1[myDate.getMonth()] +'-'+ myDate.getDate() ;
	
}

//returns the month 1 as 01 - appends 0
function getFullDayMonth(intValue)
{
	if(intValue.toString().length==1)return "0"+intValue.toString();
			else return intValue;
}

function getFullDayMonth(intValue)
{
	if(intValue.toString().length==1)return "0"+intValue.toString();
			else return intValue;
}

function fillDurationComboBox(ddDuration,dtWeekOne)
{
       dtWeekOne.setDate(dtWeekOne.getDate()+7);
        
        var strSecondWeekDate =dtWeekOne.getFullYear()
										+"-"
										+getFullDayMonth((dtWeekOne.getMonth()+1))
										+"-"
										+getFullDayMonth(dtWeekOne.getDate());
		
		dtWeekOne.setDate(dtWeekOne.getDate()+7);
		var strThirdWeekDate =dtWeekOne.getFullYear()
										+"-"
										+getFullDayMonth((dtWeekOne.getMonth()+1))
										+"-"
										+getFullDayMonth(dtWeekOne.getDate());
										
	    dtWeekOne.setDate(dtWeekOne.getDate()+7);
		var strFourthWeekDate =dtWeekOne.getFullYear()
										+"-"
										+getFullDayMonth((dtWeekOne.getMonth()+1))
										+"-"
										+getFullDayMonth(dtWeekOne.getDate());
	    
	    var bln2Week = false;
	    var bln3Week = false;
	    var bln4Week = false;
	    
	    for(var intArryIndex=0;intArryIndex < arrJsAllDates.length ; intArryIndex ++)
		{
			if(arrJsAllDates[intArryIndex] == strSecondWeekDate)
			{
				bln2Week=true;
			}
			if(arrJsAllDates[intArryIndex] == strThirdWeekDate)
			{
				bln3Week=true;
			}
			if(arrJsAllDates[intArryIndex] == strFourthWeekDate)
			{
				bln4Week=true;
				break;
			}
		}	
		
		ClearDropDown(ddDurationId);
		var optionIsSelected = true ;
	    
	    var SelectDuration=1;
	    if (duration!= ''){SelectDuration = duration;}
	    
	    AddOptionsToDrowDown(ddDuration, "7 nights", 1, optionIsSelected); 
        optionIsSelected = false;
        if (bln2Week == true)
		{
		    if (SelectDuration ==2){optionIsSelected = true;}
		    AddOptionsToDrowDown(ddDuration, "14 nights", 2, optionIsSelected);
		     optionIsSelected = false;
		   
		}
		if (bln3Week == true && bln2Week == true)
		{
		    if (SelectDuration ==3){optionIsSelected = true;}
		    AddOptionsToDrowDown(ddDuration, "21 nights", 3, optionIsSelected);
		    optionIsSelected = false;
		}
		if (bln4Week == true && bln3Week == true && bln2Week == true)
		{
		     if (SelectDuration ==4){optionIsSelected = true;}
            AddOptionsToDrowDown(ddDuration, "28 nights", 4, optionIsSelected);
            optionIsSelected = false;
		}
										
	   // alert(strSecondWeekDate + 'Umehs  ' + strThirdWeekDate);
}
//This function checks and concatinate zero before day and month.
function chkDayMonth(day,month)
{
		var day1 = ""+day+"";
		var mon1 = ""+month+"";
		var chkDayChar=day1.indexOf('0'); //check first digit is zero
		var chkMonChar = mon1.indexOf('0'); //check first digit is zero
		
		if(parseInt(day) <=9 && chkDayChar!=0)
		{
			var retDay = ("0"+day);
		}
		else
		{
			retDay = day;
		}
		if(month <= 9 && chkMonChar!=0)
		{
			retMonth = ("0"+month);
		}
		else
		{
			retMonth = month;
		}
		return [retDay,retMonth];
}

var retDVal;
//---------------This function change heading date and arrival date on mouse over.
function ds_onMouseOver(d,m,y)
{
	retDVal = chkDayMonth(d ,-1);
	//headDate = document.getElementById("headDate");
	//headDate.innerHTML=(retDVal[0]+" "+ds_monthnames1[m-1]+" "+y);
}
//----------This funtion chage selected date background
function clickedDate(obj,clk_d,clk_m,clk_y,tdID)
{
	var highLightTD0; 
	var remHighLightTD0;
	clkDate = new Date(clk_y,(clk_m-1),clk_d);
	

//SAVIO: 24 June 2007 STARTS HERE
/*
REQUIREMENT WAS THE WHICHEVER DATE WAS CLICKED WILL BE THE SELECTED DATE
NUMBER OF WEEKS WILL SELECTED FROM THE DROP DOWN
*/
		var frstWStr_Date = gfrstWkClked_Date.split("-");
		
		frstWStr_Date[2];  //Date
		frstWStr_Date[1];  //Month
		frstWStr_Date[0];  //Year
		remHighlightWeeksTD(frstWStr_Date[2],frstWStr_Date[1],frstWStr_Date[0],0);
		if(parseInt(gsecWkClked_Day)!=-1)
		{
			var secWStr_Date = gsecWkClked_Date.split("-");
			secWStr_Date[2];  //Date
			secWStr_Date[1];  //Month
			secWStr_Date[0];  //Year
			
			remHighlightWeeksTD(secWStr_Date[2],secWStr_Date[1],secWStr_Date[0],0);
			gsecWkClked_Date="";
			gsecWkClked_Day =-1;
			if(chkPage!="VillAv")
			{
				hiddenTxtforSecWeek_date.value="";
				hiddenTxtforSecWeek_day.value=-1;
			}
		}
		gfrstWkClked_Date = clk_y+"-"+paddZero(clk_m)+"-"+paddZero(clk_d);
		gfrstWkClked_Day =clkDate.getDay();
		obj.style.backgroundColor="#CCCCCC";
		
		highlightWeeksTD(clk_d,clk_m,clk_y,tdID);
		//alert(gCmbWeek); 
		//gCmbWeek.selectedIndex=0;
	
		ds_onclick(clk_d, clk_m, clk_y);
	
		//Close calendar
		ds_hi();
	
		return;
	

}

//--------when user change month ,this function set day above the days row TD. 
function setCalTxtDay(m,y)
{
	M=chkDayMonth(-1,m);
	for (var c=0 ;c < arrJsAllDates.length;c++)
	{
		arrJsAllDates[c];
		var tmpArryDay = arrJsAllDates[c].split("-");
		tmpArryDay[0];
		tmpArryDay[1];
		tmpArryDay[2];
		var tmpDbDate = new Date(tmpArryDay[0],tmpArryDay[1]-1,tmpArryDay[2])
		var tmpDispDate;
		if(M[1]==tmpArryDay[1] && y==tmpArryDay[0])
		{	
			 retDVal = chkDayMonth(tmpArryDay[2],-1);
			 //headDate = document.getElementById("headDate");
		     //headDate.innerHTML=(tmpArryDay[2]+" "+ds_monthnames1[(tmpArryDay[1]-1)]+" "+tmpArryDay[0]);
			 break;
		}
	}
}

//-------This function return months total days.
function totMonthDays(curr_mon,curr_yr)
{
	var ret_days;
	if (curr_mon == 1 || curr_mon == 3 || curr_mon == 5 || curr_mon == 7 || curr_mon == 8 || curr_mon == 10 || curr_mon == 12) 
	{	
		ret_days = 31;
	} else if (curr_mon == 4 || curr_mon == 6 || curr_mon == 9 || curr_mon == 11) {
		ret_days = 30;
	} else 
	{
		ret_days = (curr_yr % 4 == 0) ? 29 : 28;
	}
	return ret_days;
}
//----------print next month days.
function print_nxtMDays(nxtMDay,nxtMon,y,tdID)
{
    //	var nmDB = paddZero(parseInt(nxtMon,10) + 1);
    //	if(nmDB > 12)
    //	{
    //		nmDB ='01'; 
    //	}
    //	var nDay = paddZero(nxtMDay);
    //	var calDate = (y +"-"+nmDB+"-"+nDay);
    //	if(gStr_calDates=="")
    //	{
    //		gStr_calDates = prev_calDate;
    //		gStr_calTds = tdID;
    //	}
    //	else
    //	{
    //		gStr_calDates = gStr_calDates +","+ calDate; 
    //		gStr_calTds = gStr_calTds+","+tdID;
    //	}
    //	for(var chk=0;chk < arrJsAllDates.length;chk++)
    //	{	
    //		if(calDate == arrJsAllDates[chk])
    //		{
    //			return '<td class="ds_preMCell" id="t'+tdID+'" onclick="javascript:clickedDate(this,' + nDay + ',' + nmDB + ',' + y + ',' + tdID + ');"'
    //			+'onMouseOver="javascript:ds_onMouseOver(' + nDay + ',' + nmDB + ',' + y + ');">'
    //			+'<font color='+calTxtColor+'><b><u>'+nDay+'</u></b></font></td>';
    //		}
    //	}
	return '<td class="ds_preMNonClickCell" id="t'+tdID+'"></td>';
}
//----------This function is used to changes  background color when user selects
var remScrollDays;
//-----Padd zero
function paddZero(sndID)
{
	var retID;
	var recv_ID = ""+sndID+"";
	var chkCharIndex = recv_ID.indexOf('0'); //check first digit is zero
		
	if(parseInt(sndID)<=9 && chkCharIndex!=0)
	{
		retID = "0"+sndID;
	}
	else
	{
		retID = sndID;
	}
	return retID;
}
//-------------Calculate days between two dates
function daysBetween(fWDate,sWDate)
{
	var fD =fWDate.split("-") 
	var sD =sWDate.split("-") 
	var fDate = new Date(fD[0]+"/"+fD[1]+"/"+fD[2]);
	var sDate = new Date(sD[0]+"/"+sD[1]+"/"+sD[2]);
	var daysApart = Math.abs(Math.round((fDate-sDate)/86400000));
  	return daysApart;
}
//-----------------------------
function dateDifference(later_date,earlier_date) 
{
  	var latDate =later_date.split("-") 
	var earDate =earlier_date.split("-") 
	var laterdate=new Date(latDate[0],latDate[1],latDate[2]);
	var earlierdate=new Date(earDate[0],earDate[1],earDate[2]);
	var difference = laterdate.getTime() - earlierdate.getTime();
	var daysDifference = Math.floor(difference/1000/60/60/24);
    difference -= daysDifference*1000*60*60*24
    var hoursDifference = Math.floor(difference/1000/60/60);
    difference -= hoursDifference*1000*60*60
    var minutesDifference = Math.floor(difference/1000/60);
    difference -= minutesDifference*1000*60
    var secondsDifference = Math.floor(difference/1000);
    return daysDifference;
}
//-----------------------------Return month from string format date
function returnMonth(strDate)
{
	var storeDate =strDate.split(","); 
	return storeDate[0];
}
//--------------Return selected weeks dates td id
function returnSelDateTd_ID(selDate)
{
	for(selD=0;selD < gArry_CalDates.length;selD++)
	{
		if(selDate==gArry_CalDates[selD])
		{
			return gArry_CalTDs[selD];
		}
	}
}
//-----------------------------------
//--------------Check next month days
function highlightWeeksTD(clkDy,clkMon,clkYr,tdID) //chkNxtMonDays
{	
       
            	var myDay;
            	var myMon;
            	var myYear;
            	var nxtDayCount=0;
            	var clkedDate_TdId;
            	var hlghtDate_strtTd_Id;
            	var highLightTD;
            	
            	for(var chkNxtD=0;chkNxtD < gArry_CalDates.length;chkNxtD++)
            	{
            		for(var chkNxtD1=0;chkNxtD1 < gArry_CalDates.length;chkNxtD1++)
            	    {
            				if( nxtDayCount < 1)
            				{
            					var myDate;
            					myDate = new Date(clkYr,(clkMon)-1,clkDy);
            					myDate.setDate(myDate.getDate() + nxtDayCount);
            					myDay = myDate.getDate();
            					myMon = myDate.getMonth();
            					myYear = myDate.getFullYear();
            					
            					if((myYear+"-"+paddZero(myMon+1)+"-"+paddZero(myDay))== gArry_CalDates[chkNxtD1])
            					{
            						 highLightTD= document.getElementById("t"+parseInt(gArry_CalTDs[chkNxtD1]));	
            						 highLightTD.style.backgroundColor=menuColor ; //tblColor;//F9E0FC #F59CAA"; //#CCCCCC";
            						 break;
            						
            					}
            				}
            		}
            		nxtDayCount = nxtDayCount + 1;
                	}
}
//----------------------------Remove hilighted TD Bg color
function remHighlightWeeksTD(clkDy,clkMon,clkYr,tdID) 
{	
    //alert(tdID);
            //	var myDay;
            //	var myMon;
            //	var myYear;
            //	var nxtDayCount=0;
            //	var clkedDate_TdId;
            //	var hlghtDate_strtTd_Id;
            //	var remHighLightTD;

            //	for(var chkNxtD=0;chkNxtD < gArry_CalDates.length;chkNxtD++)
            //	{
            //		for(var chkNxtD1=0;chkNxtD1 < gArry_CalDates.length;chkNxtD1++)
            //		{
            //				if( nxtDayCount < 7)
            //				{
            //					var myDate;
            //					myDate = new Date(clkYr,(clkMon)-1,clkDy);
            //					myDate.setDate(myDate.getDate() + nxtDayCount);
            //					myDay = myDate.getDate();
            //					myMon = myDate.getMonth();
            //					myYear = myDate.getFullYear();
            //					if((myYear+"-"+paddZero(myMon+1)+"-"+paddZero(myDay))== gArry_CalDates[chkNxtD1])
            //					{
            //						remHighLightTD= document.getElementById("t"+parseInt(gArry_CalTDs[chkNxtD1]));	
            //						if(parseInt(myMon)+ 1 == curr_Sel_Mon)
            //						 {
            //							remHighLightTD.style.backgroundColor="#F9F7C6";
            //						 }
            //						 else
            //						 {
            //							 remHighLightTD.style.backgroundColor="#FCFBE3";
            //						 }
            //						 break;
            //					}
            //				}
            //		}
            //		nxtDayCount = nxtDayCount + 1;
            //	}
}

function getMonthText(monthID)
{
    
    monthID = parseInt(monthID, 10);
    
    var month=new Array(13)
    month[0]=""
    month[1]="Jan"
    month[2]="Feb"
    month[3]="Mar"
    month[4]="Apr"
    month[5]="May"
    month[6]="Jun"
    month[7]="Jul"
    month[8]="Aug"
    month[9]="Sep"
    month[10]="Oct"
    month[11]="Nov"
    month[12]="Dec"
    
    return month[monthID];
}

function ValidateDate()
{
    var selectedDate = document.getElementById(hiddenDateId).value;
    for (var i=0; i<=arrJsAllDates.length; i++) 
    {
        if (selectedDate == arrJsAllDates[i])
        {
            return true;
        }
    }
    
    var objAnchor=getAnchorPosition(ddAirportsId);
    try
    {
        if (isASP == "1")
        {
            showAlert("Incorrect input", "Please select valid date.", "OK", 250, 125, objAnchor,'','undefined');
        }
        else
        {
            showAlert("Incorrect input", "Please select valid date.", "OK", 250, 90, objAnchor,'','undefined');
        }
    }
    catch(e)
    {
        showAlertIFrame("Incorrect input", "Please select valid date.", "OK", 250, 90, objAnchor,'','undefined');
    }
    return false;
}
// ]]> -->



