      var menu;
      var coid;
      var countySE;
      var townSE;


       function selectRateType(rateType)
       {
       
      
         var XMLHttpRequestObject = false; 
 
         if (window.XMLHttpRequest) {
           XMLHttpRequestObject = new XMLHttpRequest();
         } else if (window.ActiveXObject) {
           XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
         }
 
         if(XMLHttpRequestObject) {
             var now = new Date();
             XMLHttpRequestObject.open("GET", "http://www.lidl-breaks.ie/updaterate.cgi?rateType=" + rateType + "&time=" + now.getTime());
          
 
           XMLHttpRequestObject.onreadystatechange = function() 
           { 
             if (XMLHttpRequestObject.readyState == 4 && 
               XMLHttpRequestObject.status == 200) { 
             var xmlDocument = XMLHttpRequestObject.responseXML;
             } 
           } 
 
           XMLHttpRequestObject.send(null); 
         }
       }


      
      function CountyListing(menuNumber)
      {
        var XMLHttpRequestObject = false; 

        if (window.XMLHttpRequest) {
          XMLHttpRequestObject = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
          XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
        }

        if(XMLHttpRequestObject) {
            var now = new Date();
            XMLHttpRequestObject.open("GET", "http://www.lidl-breaks.ie/county_list.cgi?menu=" + menuNumber + "&time=" + now.getTime());
         

          XMLHttpRequestObject.onreadystatechange = function() 
          { 
            if (XMLHttpRequestObject.readyState == 4 && 
              XMLHttpRequestObject.status == 200) { 
            var xmlDocument = XMLHttpRequestObject.responseXML;
            menu = xmlDocument.getElementsByTagName("menuitem");
            coid = xmlDocument.getElementsByTagName("coiditem");
            countySE = xmlDocument.getElementsByTagName("countyselected");
            countymenu();
            } 
          } 

          XMLHttpRequestObject.send(null); 
        }
      }

      function countymenu ()
      {
        var loopIndex;
        var selectControl = document.getElementById('CountyBox');

        for (loopIndex = 0; loopIndex < menu.length; loopIndex++ )
        {
        	
		if(countySE[0].firstChild.data == loopIndex)
		{
			var selected_id = coid[loopIndex].firstChild.data;
		}

        	
            selectControl.options[loopIndex] = new 
               Option(menu[loopIndex].firstChild.data,coid[loopIndex].firstChild.data);
        }

       	if(countySE[0].firstChild.data)
 	{
       		var CountySelectionId = countySE[0].firstChild.data;
		selectControl.options[CountySelectionId].selected=true;
		TownListing(selected_id);
	}
      }
    

 
       function TownListing(menuNumber)
       {
         var XMLHttpRequestObject = false; 
 	 
 	 var dropdownIndex = document.getElementById('CountyBox').selectedIndex;
	 var CountyValue = document.getElementById('CountyBox')[dropdownIndex].value;
	
	 if(menuNumber)
	 	{
	 	CountyValue = menuNumber; 	
	 	}
		
		
 	
         if (window.XMLHttpRequest) {
           XMLHttpRequestObject = new XMLHttpRequest();
         } else if (window.ActiveXObject) {
           XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
         }
 
         if(XMLHttpRequestObject) {
            var now = new Date();
            XMLHttpRequestObject.open("GET", "http://www.lidl-breaks.ie/town_list.cgi?countyname=" + CountyValue + "&time=" + now.getTime());
    		
           XMLHttpRequestObject.onreadystatechange = function() 
           { 
             if (XMLHttpRequestObject.readyState == 4 && 
               XMLHttpRequestObject.status == 200) { 
             var xmlDocument = XMLHttpRequestObject.responseXML;
             townname = xmlDocument.getElementsByTagName("townitem");
             townid = xmlDocument.getElementsByTagName("townid");
             townSE = xmlDocument.getElementsByTagName("townselected");

// alert(townSE);
            townmenu();
             
             
             } 
           } 
 
           XMLHttpRequestObject.send(null); 
         }
       }
 
       function townmenu ()
       {
         document.getElementById('TownBox').length=null;
         var loopIndex;
         var selectControl = document.getElementById('TownBox');
 
         for (loopIndex = 0; loopIndex < townname.length; loopIndex++ )
         {
            selectControl.options[loopIndex] = new 
               Option(townname[loopIndex].firstChild.data,townid[loopIndex].firstChild.data);
         }

       	if(townSE[0].firstChild.data)
 	{
       		var TownSelectionId = townSE[0].firstChild.data;
		
		selectControl.options[TownSelectionId].selected=true;
	
	}
       }



	var DayNo;
	var DaySE;
	var NightsNo;
	var NightsSE;
	var YearNo;
	var YearSE;
	var MonthNo;
	var MonthSE;
	var MonthVa;

 
      function FillSearchDate(menuNumber)
      {
        var XMLHttpRequestObject = false; 

        if (window.XMLHttpRequest) {
          XMLHttpRequestObject = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
          XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
        }

        if(XMLHttpRequestObject) {

            var now = new Date();
            XMLHttpRequestObject.open("GET", "http://www.lidl-breaks.ie/searchdate_list.cgi?time=" + now.getTime());

          XMLHttpRequestObject.onreadystatechange = function() 
          { 
            if (XMLHttpRequestObject.readyState == 4 && 
              XMLHttpRequestObject.status == 200) { 
            var xmlDocument = XMLHttpRequestObject.responseXML;

            MonthNo = xmlDocument.getElementsByTagName("monthitem");
            MonthSE = xmlDocument.getElementsByTagName("monthselectitem");
            MonthVa = xmlDocument.getElementsByTagName("monthselectname");
            YearNo = xmlDocument.getElementsByTagName("yearitem");
            YearSE = xmlDocument.getElementsByTagName("yearselectitem");
            DayNo = xmlDocument.getElementsByTagName("dayitem");
            DaySE = xmlDocument.getElementsByTagName("dayselectitem");
            NightsNo = xmlDocument.getElementsByTagName("nightsitem");
            NightsSE = xmlDocument.getElementsByTagName("nightselectitem");
            DayMenu();
//            MonthMenu();
            YearMenu();
            NightsMenu();
            } 
          } 

          XMLHttpRequestObject.send(null); 
        }
      }

      
        function DayMenu ()
        {
         var loopIndex;
         var selectControl = document.getElementById('d');
         for (loopIndex = 0; loopIndex < DayNo.length; loopIndex++ )
         {

                selectControl.options[loopIndex] = new 
                Option(DayNo[loopIndex].firstChild.data,DayNo[loopIndex].firstChild.data);
         }
        	if(DaySE[0].firstChild.data)
         		{
         		var DaySelectionId = DaySE[0].firstChild.data - 1;
 			selectControl.options[DaySelectionId].selected=true;
      			}
        }      

 
        function MonthMenu ()
        {
         var loopIndex;
         var selectControl = document.getElementById('m');
         for (loopIndex = 0; loopIndex < MonthNo.length; loopIndex++ )
         {
             selectControl.options[loopIndex] = new 
                Option(MonthVa[loopIndex].firstChild.data,MonthNo[loopIndex].firstChild.data);
         }
         	if(MonthSE[0].firstChild.data)
         		{
         		var MonthSelectionId = MonthSE[0].firstChild.data - 1;
 			selectControl.options[MonthSelectionId].selected=true;
      			}
        }      

 
        function YearMenu ()
        {
         var loopIndex;
         var selectControl = document.getElementById('y');
         for (loopIndex = 0; loopIndex < YearNo.length; loopIndex++ )
         {
             selectControl.options[loopIndex] = new 
             Option(YearNo[loopIndex].firstChild.data,YearNo[loopIndex].firstChild.data);
         }
         	if(YearSE[0].firstChild.data)
         		{
         		var YearSelectionId = YearSE[0].firstChild.data - 1;
 			selectControl.options[YearSelectionId].selected=true;
      			}
        }      
             
      
       function NightsMenu ()
       {
        var loopIndex;
        var selectControl = document.getElementById('nights');
        for (loopIndex = 0; loopIndex < NightsNo.length; loopIndex++ )
        {
            selectControl.options[loopIndex] = new 
               Option(NightsNo[loopIndex].firstChild.data,NightsNo[loopIndex].firstChild.data);
        }
        	if(NightsSE[0].firstChild.data)
        		{
        		var NightSelectionId = NightsSE[0].firstChild.data - 1;
			selectControl.options[NightSelectionId].selected=true;
     			}
       }      
            
      