	function displayDirectSearch(strBookingURL, strAffiliateID, strProviderID, strLocation, strLocationShowHide, strTownLevel,strPremType, strPremTypeShowHide, strSharing,strPremName,strGrade,strPrice,strFacilities,strChildren,strInfants,stroptional)
	{	
		document.write('<FORM id=GullDirectSearchfrm name=GullDirectSearchfrm>')

		//hidden controls to hold parameters passed in for button click event below 
		document.write('<input type= "hidden" name="hdnBookingURL" value=' + strBookingURL + ' />')
		document.write('<input type= "hidden" name="hdnAffiliateID" value=' + strAffiliateID + ' />')
		document.write('<input type= "hidden" name="hdnProviderID" value=' + strProviderID + ' />')
		document.write('<input type= "hidden" name="hdnLocation2" value=' + strLocation + ' />')
		document.write('<input type= "hidden" name="hdnLocation2" value=' + strLocation + ' />')
		document.write('<input type= "hidden" name="hdnTownLevel" value=' + strTownLevel + ' />')
		document.write('<input type= "hidden" name="hdnPremType" value=' + strPremType + ' />')
		document.write('<input type= "hidden" name="hdnSharing" value=' + strSharing + ' />')
		document.write('<input type= "hidden" name="hdnPremName" value=' + strPremName + ' />')
		document.write('<input type= "hidden" name="hdnGrade" value=' + strGrade + ' />')
		document.write('<input type= "hidden" name="hdnPrice" value=' + strPrice + ' />')
		document.write('<input type= "hidden" name="hdnFacilities" value=' + strFacilities + ' />')
		document.write('<input type= "hidden" name="hdnoptional" value=' + stroptional + ' />')
		document.write('<input type= "hidden" name="hdnPremTypeShowHide" value=' + strPremTypeShowHide + ' />')

		document.write('<div class="gullSurround"><!--outer table for border-->')

		if(strLocationShowHide=="show"){
		document.write('<div class="gullLocation"><div class="gullLocationTitle">Location:</div>')

		//location combo (mandatory)
		if(strTownLevel=="yes")
			{document.write('<select class="gullTownCombo" name=hdnLocation onchange=showTowns(this.value)>')}
		else
			{document.write('<select name=hdnLocation>')}
		
		document.write('<option value="" ' + ((strLocation=="")?"selected":"") + '>please select</option>') 
		document.write('<option value="DU,D1,,0" ' + ((strLocation=="DU,D1,,0")?"selected":"") + '>Dublin City</option>') 
		document.write('<option value="DU,D1,DCC,0" ' + ((strLocation=="DU,D1,DCC,0")?"selected":"") + '>Dublin City Centre</option>') 
		document.write('<option value="DU,N,D089,0" ' + ((strLocation=="DU,N,D089,0")?"selected":"") + '>Dublin Airport</option>') 
		document.write('<option value="DU,N,,0" ' + ((strLocation=="DU,N,,0")?"selected":"") + '>Dublin County North</option>') 
		document.write('<option value="DU,S,,0" ' + ((strLocation=="DU,S,,0")?"selected":"") + '>Dublin County South</option>') 
		document.write('<option value="DU,W,,0" ' + ((strLocation=="DU,W,,0")?"selected":"") + '>Dublin County West</option>') 
		document.write('<option value="AM,,,0" ' + ((strLocation=="AM,,,0")?"selected":"") + '>Antrim County</option>') 
		document.write('<option value="AH,,,0" ' + ((strLocation=="AH,,,0")?"selected":"") + '>Armagh County</option>') 
		document.write('<option value="AM,BC,B719,0" ' + ((strLocation=="AM,BC,B719,0")?"selected":"") + '>Belfast City</option>') 
		document.write('<option value="CW,,,0" ' + ((strLocation=="CW,,,0")?"selected":"") + '>Carlow County</option>') 
		document.write('<option value="CN,,,0" ' + ((strLocation=="CN,,,0")?"selected":"") + '>Cavan County</option>') 
		document.write('<option value="CE,,,0" ' + ((strLocation=="CE,,,0")?"selected":"") + '>Clare County</option>') 
		document.write('<option value="CK,C1,,0" ' + ((strLocation=="CK,C1,,0")?"selected":"") + '>Cork City</option>') 
		document.write('<option value="CK,N,,0" ' + ((strLocation=="CK,N,,0")?"selected":"") + '>Cork(North) County</option>') 
		document.write('<option value="CK,,,0" ' + ((strLocation=="CK,,,0")?"selected":"") + '>Cork County</option>') 
		document.write('<option value="DY,FV,L709,0" ' + ((strLocation=="DY,FV,L709,0")?"selected":"") + '>Derry City</option>') 
		document.write('<option value="DY,,,0" ' + ((strLocation=="DY,,,0")?"selected":"") + '>Derry County</option>') 
		document.write('<option value="DL,,,0" ' + ((strLocation=="DL,,,0")?"selected":"") + '>Donegal County</option>') 
		document.write('<option value="DN,,,0" ' + ((strLocation=="DN,,,0")?"selected":"") + '>Down County</option>') 
		document.write('<option value="FH,,,0" ' + ((strLocation=="FH,,,0")?"selected":"") + '>Fermanagh County</option>') 
		document.write('<option value="GY,G1,,0" ' + ((strLocation=="GY,G1,,0")?"selected":"") + '>Galway City</option>') 
		document.write('<option value="GY,,,0" ' + ((strLocation=="GY,,,0")?"selected":"") + '>Galway County</option>') 
		document.write('<option value="KY,,,0" ' + ((strLocation=="KY,,,0")?"selected":"") + '>Kerry County</option>') 
		document.write('<option value="KE,,,0" ' + ((strLocation=="KE,,,0")?"selected":"") + '>Kildare County</option>') 
		document.write('<option value="KK,,K037,0" ' + ((strLocation=="KK,,K037,0")?"selected":"") + '>Kilkenny City</option>') 
		document.write('<option value="KK,,,0" ' + ((strLocation=="KK,,,0")?"selected":"") + '>Kilkenny County</option>') 
		document.write('<option value="LS,,,0" ' + ((strLocation=="LS,,,0")?"selected":"") + '>Laois County</option>') 
		document.write('<option value="LM,,,0" ' + ((strLocation=="LM,,,0")?"selected":"") + '>Leitrim County</option>') 
		document.write('<option value="LK,L1,,0" ' + ((strLocation=="LK,L1,,0")?"selected":"") + '>Limerick City</option>') 
		document.write('<option value="LK,,,0" ' + ((strLocation=="LK,,,0")?"selected":"") + '>Limerick County</option>') 
		document.write('<option value="DY,FV,L709,0" ' + ((strLocation=="DY,FV,L709,0")?"selected":"") + '>Londonderry City</option>') 
		document.write('<option value="DY,,,0" ' + ((strLocation=="DY,,,0")?"selected":"") + '>Londonderry County</option>') 
		document.write('<option value="LD,,,0" ' + ((strLocation=="LD,,,0")?"selected":"") + '>Longford County</option>') 
		document.write('<option value="LH,,,0" ' + ((strLocation=="LH,,,0")?"selected":"") + '>Louth County</option>') 
		document.write('<option value="MO,,,0" ' + ((strLocation=="MO,,,0")?"selected":"") + '>Mayo County</option>') 
		document.write('<option value="MH,,,0" ' + ((strLocation=="MH,,,0")?"selected":"") + '>Meath County</option>') 
		document.write('<option value="MN,,,0" ' + ((strLocation=="MN,,,0")?"selected":"") + '>Monaghan County</option>') 
		document.write('<option value="OY,,,0" ' + ((strLocation=="OY,,,0")?"selected":"") + '>Offaly County</option>') 
		document.write('<option value="RN,,,0" ' + ((strLocation=="RN,,,0")?"selected":"") + '>Roscommon County</option>') 
		document.write('<option value="CE,,S020,0" ' + ((strLocation=="CE,,S020,0")?"selected":"") + '>Shannon Airport</option>') 
		document.write('<option value="SO,,,0" ' + ((strLocation=="SO,,,0")?"selected":"") + '>Sligo County</option>') 
		document.write('<option value="TI,,,0" ' + ((strLocation=="TI,,,0")?"selected":"") + '>Tipperary County</option>') 
		document.write('<option value="TE,,,0" ' + ((strLocation=="TE,,,0")?"selected":"") + '>Tyrone County</option>') 
		document.write('<option value="WD,W1,,0" ' + ((strLocation=="WD,W1,,0")?"selected":"") + '>Waterford City</option>') 
		document.write('<option value="WD,,,0" ' + ((strLocation=="WD,,,0")?"selected":"") + '>Waterford County</option>') 
		document.write('<option value="WH,,,0" ' + ((strLocation=="WH,,,0")?"selected":"") + '>Westmeath County</option>') 
		document.write('<option value="WX,,,0" ' + ((strLocation=="WX,,,0")?"selected":"") + '>Wexford County</option>') 
		document.write('<option value="WW,,,0" ' + ((strLocation=="WW,,,0")?"selected":"") + '>Wicklow County</option>') 

		document.write('</select>') 
		//document.write('<div class="gullColumn"><!-- Prem Type -->')
		document.write('</div>')
		}
		else
		{
			document.write('<input type= "hidden" name="hdnLocation"  value=' + strLocation + ' />')
		}
		if(strTownLevel=="yes"){
		//town level combo (optional) - see event on location combo - also remove event from body onload on your html page to initially display town level combo
		document.write('<div class="gullTown" id="txtTowns"></div>')
		}
		
		if(strPremTypeShowHide=="show"){
		//premises type combo (mandatory)
		document.write('<div class="gullType"><div class="gullTypeTitle">Property Type:</div>')
		document.write('<select class="gullPremType" name=selAccomType> ')
		document.write('<option value="1" ' + ((strPremType=="1" || strPremType=="")?"selected":"") + '>All serviced accommodation</option>') 
		document.write('<option value="2" ' + ((strPremType=="2")?"selected":"") + '>All self-catering accommodation</option>') 
		document.write('<option value="3" ' + ((strPremType=="3")?"selected":"") + '>Hotel</option>') 
		document.write('<option value="4" ' + ((strPremType=="4")?"selected":"") + '>Guesthouse</option>') 
		document.write('<option value="5" ' + ((strPremType=="5")?"selected":"") + '>Bed and breakfast</option>') 
		document.write('<option value="6" ' + ((strPremType=="6")?"selected":"") + '>Hostel</option>') 
		document.write('<option value="7" ' + ((strPremType=="7")?"selected":"") + '>University accommodation</option>') 
		document.write('<option value="20" ' + ((strPremType=="20")?"selected":"") + '>Hotel &amp; guesthouse</option>') 
		document.write('<option value="21" ' + ((strPremType=="21")?"selected":"") + '>Townhouse</option>') 
		document.write('<option value="22" ' + ((strPremType=="22")?"selected":"") + '>Country house</option>') 
		document.write('<option value="23" ' + ((strPremType=="23")?"selected":"") + '>Farmhouse</option>') 
		document.write('<option value="24" ' + ((strPremType=="24")?"selected":"") + '>Country house of character</option>') 
		document.write('<option value="25" ' + ((strPremType=="25")?"selected":"") + '>Entertainment</option>') 
		document.write('<option value="26" ' + ((strPremType=="26")?"selected":"") + '>Health farm</option>') 
		document.write('<option value="27" ' + ((strPremType=="27")?"selected":"") + '>Historic house</option>') 
		document.write('<option value="28" ' + ((strPremType=="28")?"selected":"") + '>Pub accommodation</option>') 
		document.write('<option value="29" ' + ((strPremType=="29")?"selected":"") + '>Residential activities</option>') 
		document.write('<option value="30" ' + ((strPremType=="30")?"selected":"") + '>Residential language school</option>') 
		document.write('<option value="31" ' + ((strPremType=="31")?"selected":"") + '>Restaurant with rooms</option>') 
		document.write('<option value="32" ' + ((strPremType=="32")?"selected":"") + '>Specialist accommodation</option>') 

		document.write('</select></div>')
		}
		else
		{
			document.write('<input type= "hidden" name="hdnPremType2"  value=' + strPremType + ' />')
		}
		
		//sharing combo (optional)
		if(strSharing=='yes')
		{
			document.write('<div class="gullShare"><div class="gullShareTitle">Sharing:</div>')
			document.write('<select name=selSharing>')
			document.write('<option value=1 selected>Sharing Bedroom</option>')
			document.write('<option value=2>Own bed</option> ')
			document.write('<option value=3>Own room</option>')
			document.write('</select></div>')
		}

		//party details (mandatory)
		//document.write('<div class="gullRow">')
		document.write('<div class="gullParty">')
		document.write('<div class="gullPartyTitle">Party:</div>')
		document.write('<div class="gullAdult">Adults')
		document.write('<select class="gullNumAdults" name=selNumAdults>')
		document.write('<option value=1>1</option> ')
		document.write('<option value=2 selected>2</option> ')
		document.write('<option value=3>3</option> ')
		document.write('<option value=4>4</option> ')
		document.write('<option value=5>5</option> ')
		document.write('<option value=6>6</option> ')
		document.write('<option value=7>7</option> ')
		document.write('<option value=8>8</option>')
		document.write('</select></div>')
	
		if(strChildren=='yes')
		{
		    document.write('<div class="gullChild">Children')
		    document.write('<select class="gullNumChildren" name=selNumChildren>')
		    document.write('<option value=0></option>')
		    document.write('<option value=0 selected>0</option> ')
		    document.write('<option value=1>1</option> ')
		    document.write('<option value=2>2</option> ')
		    document.write('<option value=3>3</option> ')
		    document.write('<option value=4>4</option> ')
		    document.write('<option value=5>5</option> ')
		    document.write('<option value=6>6</option> ')
		    document.write('<option value=7>7</option> ')
		    document.write('<option value=8>8</option>')
		    document.write('</select></div>')
		}
		if(strInfants=='yes')
		{
		    document.write('<div class="gullInfants">Infants')
		    document.write('<select class="gullNumInfants" name=selNumInfants>')
		    document.write('<option value=0></option>')
		    document.write('<option value=0 selected>0</option> ')
		    document.write('<option value=1>1</option> ')
		    document.write('<option value=2>2</option> ')
		    document.write('<option value=3>3</option> ')
		    document.write('<option value=4>4</option> ')
		    document.write('<option value=5>5</option> ')
		    document.write('<option value=6>6</option> ')
		    document.write('<option value=7>7</option> ')
		    document.write('<option value=8>8</option>')
		    document.write('</select></div>')
		}
		
		document.write('</div>')
		//document.write('</div><!-- Arrival Details -->')

		//Arrival Date (mandatory)
		document.write('<input name="date_sel" type="text" id="date_sel" class="split-date no-transparency range-low-2008-03-06 range-high-2010-03-28 lang-en" style="display:none;" />')
		document.write('<div class="gullArrival"><div class="gullArrivalTitle">Arrival:</div><select class="gullDays" id="date_sel_dd" name="date_sel_dd_Day">')
		var todaysDate = new Date();
		
		for (var counter = 1; counter<=31;counter++)
		{
			document.write('<option ')  
			document.write('value=' + counter)
			if (counter == parseInt(todaysDate.getDate())) 
				{
					document.write(' selected');
					document.GullDirectSearchfrm.date_sel.value =  counter;
				}
			document.write('>' + counter )
			document.write('</option>')
		}
		document.write('</select> ')
        
		document.write('<select class="gullMonthYear"  name="date_sel_mm" id="date_sel_mm">')
		var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

		for (var yearCounter = todaysDate.getFullYear(); yearCounter<2012; yearCounter++ )
		{
			if(yearCounter == todaysDate.getFullYear())
			{
				for (var monthCounter = todaysDate.getMonth()+1; monthCounter<=12;monthCounter++)
				{
					document.write('<option ')
					document.write('value=' + yearCounter +'|'+ ((monthCounter+= "").length < 2 ? "0" + monthCounter : monthCounter) )
					if ((monthCounter == parseInt(todaysDate.getMonth()+1)) && (yearCounter == parseInt(todaysDate.getFullYear())))
						{
							document.write(' selected')
							//document.GullDirectSearchfrm.date_sel.value =  yearCounter +'|'+ ((monthCounter+= "").length < 2 ? "0" + monthCounter : monthCounter);
						}
					document.write('>' + m_names[monthCounter-1] + '-' + yearCounter)
					document.write('</option>')
				}
			}
			else
			{
				for (var monthCounter = 1; monthCounter<=12;monthCounter++)
				{
					document.write('<option ')
					document.write('value=' + yearCounter +'|'+ ((monthCounter+= "").length < 2 ? "0" + monthCounter : monthCounter) )

					if ((monthCounter == parseInt(todaysDate.getMonth()+1)) && (yearCounter == parseInt(todaysDate.getFullYear())))
						{
							document.write(' selected');
							//document.GullDirectSearchfrm.date_sel.value =  yearCounter +'|'+ ((monthCounter+= "").length < 2 ? "0" + monthCounter : monthCounter);
						}
					document.write('>' + m_names[monthCounter-1] + '-' + yearCounter)
					document.write('</option>')
				}
			}
		}


		document.write('</select> ')
		
		//split selmonthyear which holds month-year as one value into 2 values
		////////var str=document.GullDirectSearchfrm.selMonthYear.value;
		////////var myStr = str.split("-")
		//hidden controls to hold selected year and month from split function
		//////document.write('<input type="hidden" name="hdnSelectedMonth" value=' + myStr[0] + '>')
		//////document.write('<input type="hidden" name="hdnSelectedYear" value=' + myStr[1] + '>')

        document.write('<input name="date_sel_fd_but" type="button" id="date_sel_fd_but" class="gullCalendar" style="width: 20px; height: 20px;" /></div>')
    

		
		///////document.write('<img src="http://www.resireland.com/inc/cal.gif" alt="Calendar" style="Cursor:hand;" ONCLICK="JavaScript:createCalendar(document.GullDirectSearchfrm.hdnSelectedMonth.value, document.GullDirectSearchfrm.hdnSelectedYear.value)" >')

		if(strTownLevel=="yes"){
		showTowns(document.forms['GullDirectSearchfrm'].hdnLocation.value);}
		
		//num nights (mandatory)
		document.write('<div class="gullNight"><div class="gullNightTitle">Night(s):</div>')
		document.write('<select class="gullNumNight" name=selNumNights>')
		document.write('<option value=1 selected>1</option>')
		document.write('<option value=2>2</option>')
		document.write('<option value=3>3</option>')
		document.write('<option value=4>4</option>')
		document.write('<option value=5>5</option>')
		document.write('<option value=6>6</option>')
		document.write('<option value=7>7</option>')
		document.write('<option value=8>8</option>')
		document.write('<option value=9>9</option>')
		document.write('<option value=10>10</option>')
		document.write('<option value=11>11</option>')
		document.write('<option value=12>12</option>')
		document.write('<option value=13>13</option>')
		document.write('<option value=14>14</option>')
		document.write('<option value=15>15</option>')
		document.write('<option value=16>16</option>')
		document.write('<option value=17>17</option>')
		document.write('<option value=18>18</option>')
		document.write('<option value=19>19</option>')
		document.write('<option value=20>20</option>')
		document.write('<option value=21>21</option>')
		document.write('<option value=22>22</option>')
		document.write('<option value=23>23</option>')
		document.write('<option value=24>24</option>')
		document.write('<option value=25>25</option>')
		document.write('<option value=26>26</option>')
		document.write('<option value=27>27</option>')
		document.write('<option value=28>28</option>')
		document.write('<option value=29>29</option>')
		document.write('<option value=30>30</option>')
		document.write('<option value=31>31</option>')
		document.write('</select></div>')

		//property name (optional)
		if(strPremName=='yes')
		{
			document.write('<div class="gullProperty"><div class="gullPropertyTitle">Property Name:</div>')
			document.write('<div class="gullPropName"><input maxLength=30 name=txtPremName /></div></div>')
		}

		//grade (optional)
		if(strGrade=='yes')
		{
			document.write('<div class="gullGrade"><div class="gullGradeTitle">Grade:</div>')
			
			document.write('<div class="gullGrdFive"><input type=checkbox value=Y name=chkGrade5 />5* Five Star</div>')
			document.write('<div class="gullGrdFour"><input type=checkbox value=Y name=chkGrade4 />4* Four Star</div>')
			document.write('<div class="gullGrdThree"><input type=checkbox value=Y name=chkGrade3 />3* Three Star</div>')
			document.write('<div class="gullGrdFive"><input type=checkbox value=Y name=chkGrade2 />2* Two Star</div>')
			document.write('<div class="gullGrdOne"><input type=checkbox value=Y name=chkGrade1 />1* One Star</div>')
			document.write('<div class="gullGrdAll"><input type=checkbox value=Y name=chkGradeAll checked />All Grades</div></div>')
		}
		//price (optional)
		if(strPrice=='yes')
		{
			document.write('<div class="gullPrice"><div class="gullPriceTitle">Price:</div>')
			document.write('<div class="gullPriFrom"><div class="gullPriFromTitle">From: </div><input name=txtPriceFrom class="txtPriceFrom"/></div>')
			document.write('<div class="gullPriTo"><div class="gullPriToTitle">To: </div><input name=txtPriceTo class="txtPriceFrom"/></div></div>')
		}

		//facilities (optional)
		if (strFacilities=='yes') 
		{
			document.write('<div class="gullFac"><div class="gullFacTitle">Facilities:</div>')
			document.write('<div class="gullAccDis"><input type=checkbox value=Y name=checkAccess />Access For Disabled</div>')
			document.write('<div class="gullSpa"><input type=checkbox value=Y name=checkSpa />Spa</div>')
			document.write('<div class="gullBaby"><input type=checkbox value=Y name=checkBaby />Babysitting Facilities</div>')
			document.write('<div class="gullHenStag"><input type=checkbox value=Y name=checkHenStag />Hen/Stag Welcome</div>')
			document.write('<div class="gullBed"><input type=checkbox value=Y name=checkBedroom />Ground Floor Bedrooms</div>')
			document.write('<div class="gullConf"><input type=checkbox value=Y name=checkConference />Conference Facilities</div>')
			document.write('<div class="gullFam"><input type=checkbox value=Y name=checkFamily />Family Friendly</div>')
			document.write('<div class="gullPets"><input type=checkbox value=Y name=checkPetsinside />Pets Welcome Inside</div>')
			document.write('<div class="gullWiFi"><input type=checkbox value=Y name=checkWIFI />WIFI Internet Access</div>')
			document.write('<div class="gullSwim"><input type=checkbox value=Y name=checkSwimming />Swimming pool</div>')
			document.write('<div class="gullLeis"><input type=checkbox value=Y name=checkLeisure />Leisure Complex on Property</div>')
			document.write('<div class="gullPriv"><input type=checkbox value=Y name=checkPrivate />Private Car Parking</div>')
			document.write('<div class="gullFacilHid"><input type=hidden name=strfacilities /></div>')
		}

		document.write('<input type=button class="gullBtnSearch" id=Search_Button value = "Search" alt="Check Availability" onclick="subx(document.GullDirectSearchfrm.hdnLocation2.value,document.GullDirectSearchfrm.hdnTownLevel.value,document.GullDirectSearchfrm.hdnPremType.value,document.GullDirectSearchfrm.hdnPremTypeShowHide.value,document.GullDirectSearchfrm.hdnSharing.value,document.GullDirectSearchfrm.hdnPremName.value,document.GullDirectSearchfrm.hdnGrade.value,document.GullDirectSearchfrm.hdnPrice.value,document.GullDirectSearchfrm.hdnFacilities.value,document.GullDirectSearchfrm.hdnoptional.value)" /></div>')
		
		//document.write('</div>')
		//document.write('</div>')
		document.write('</form>')
	}


	function subx(strLocation,strTownLevel,strPremType,strPremTypeShowHide,strSharing,strPremName,strGrade,strPrice,strFacilities,stroptional) 
	{
	    var GullFormStore = document.forms['GullDirectSearchfrm'];
        var gullYear = document.GullDirectSearchfrm.date_sel.value;
		var myStr = document.GullDirectSearchfrm.date_sel_mm.value.split("|");
		var gullYear = myStr[0];
		var gullMonth = myStr[1];
		
	    if(isValidDate(GullFormStore.date_sel_dd.value,gullMonth-1,gullYear))
		{
			//variable to hold our deepLink
			var deepLink

			if (( GullFormStore.hdnLocation.value == '' ))
				{
					alert('Please select a location.')
					GullFormStore.hdnLocation.focus();
					return;
				}
			

			//build the URL for deepLinking
			deepLink = GullFormStore.hdnBookingURL.value
			deepLink = deepLink + "?affiliatevisitid=1"
			deepLink = deepLink + "&affiliateid=" + GullFormStore.hdnAffiliateID.value
			deepLink = deepLink + "&ProvID=" + GullFormStore.hdnProviderID.value
			deepLink = deepLink + "&IsAdvanced=1" 

			if(strPremTypeShowHide=="show"){
				deepLink = deepLink + "&selAccomType=" + GullFormStore.selAccomType.value}
			else
			{			
				deepLink = deepLink + "&selAccomType=" + GullFormStore.hdnPremType2.value}
			deepLink = deepLink + "&selArriveDay=" + GullFormStore.date_sel_dd.value 
			deepLink = deepLink + "&selArriveMonth=" + gullMonth
			deepLink = deepLink + "&selArriveYear=" + gullYear
			deepLink = deepLink + "&selNumAdults=" + GullFormStore.selNumAdults.value 	
			
			if(GullFormStore.selNumChildren == undefined)
			{ 
			    deepLink = deepLink + "&selNumChildren=0";
			}
			else
			{
			    deepLink = deepLink + "&selNumChildren=" + GullFormStore.selNumChildren.value;
			}
			if(GullFormStore.selNumInfants == undefined)
			{ 
			    deepLink = deepLink + "&selNumInfants=0"; 
			}
			else
			{
			    deepLink = deepLink + "&selNumInfants=" + GullFormStore.selNumInfants.value;
			}
			
			
			deepLink = deepLink + "&selNumNights=" + GullFormStore.selNumNights.value 

			if(strFacilities=='yes')
			{
				var s  = new String('');
				if ((GullFormStore.checkPrivate) && (GullFormStore.checkPrivate.checked))
					s += "PC,";
				if ((GullFormStore.checkLeisure) && (GullFormStore.checkLeisure.checked))
					s += "XO,";
				if ((GullFormStore.checkAccess) && (GullFormStore.checkAccess.checked))
					s += "AD,";
				if ((GullFormStore.checkSpa) && (GullFormStore.checkSpa.checked))
					s += "S2,";
				if ((GullFormStore.checkBaby) && (GullFormStore.checkBaby.checked))
					s += "BS,";
				if ((GullFormStore.checkHenStag) && (GullFormStore.checkHenStag.checked))
					s += "HW,";
				if ((GullFormStore.checkBedroom) && (GullFormStore.checkBedroom.checked))
					s += "GB,";
				if ((GullFormStore.checkConference) && (GullFormStore.checkConference.checked))
					s += "CF,";
				if ((GullFormStore.checkFamily) && (GullFormStore.checkFamily.checked))
					s += "FF,";
				if ((GullFormStore.checkWIFI) && (GullFormStore.checkWIFI.checked))
					s += "WI,";
				if ((GullFormStore.checkSwimming) && (GullFormStore.checkSwimming.checked))
					s += "SO,";
				if ((GullFormStore.checkPetsinside) && (GullFormStore.checkPetsinside.checked))
					s += "PW,";

				//if ((GullFormStore.checkMaster) && (GullFormStore.checkMaster.checked))
				//	s += "AM,";
				//if ((GullFormStore.checkAmex) && (GullFormStore.checkAmex.checked))
				//	s += "AE,";
				//	if ((GullFormStore.checkDiners) && (GullFormStore.checkDiners.checked))
				//	s += "DE,";

				if (s!='')
				{
					GullFormStore.strfacilities.value=s;
					deepLink = deepLink + "&strfacilities=" + GullFormStore.strfacilities.value
				}
			}
			
			if(strSharing=='yes')
			{	
				deepLink = deepLink + "&selSharing=" + GullFormStore.selSharing.value
			}


			if (window.ActiveXObject)
			{		
				if(strTownLevel=='yes' && GullFormStore.selTowns.value != '')
				{
					deepLink = deepLink + "&hdnLocation=" + GullFormStore.selTowns.value
				}
				else
				{
					deepLink = deepLink + "&hdnLocation=" + GullFormStore.hdnLocation.value
				}
			}
			else if (document.implementation &&
				document.implementation.createDocument)
			{
				if(strTownLevel=='yes' && GullFormStore.selTowns.value != 'please select')
				{
					deepLink = deepLink + "&hdnLocation=" + GullFormStore.selTowns.value
				}
				else
				{
					deepLink = deepLink + "&hdnLocation=" + GullFormStore.hdnLocation.value
				}
			}

			if(strPrice=='yes')
			{

				if(GullFormStore.txtPriceTo.value == '')
					{
						deepLink = deepLink + "&selPriceUpper=5000"
					}
				else
					{
						deepLink = deepLink + "&selPriceUpper=" + GullFormStore.txtPriceTo.value
					}

				if(GullFormStore.txtPriceFrom.value == '')
					{
						deepLink = deepLink + "&selPriceLower=0" 
					}
				else
					{
						deepLink = deepLink + "&selPriceLower=" + GullFormStore.txtPriceFrom.value
					}

			}

			if(strPremName=='yes' && GullFormStore.txtPremName.value!='')
			{
				deepLink = deepLink + "&txtPremName=" + GullFormStore.txtPremName.value
			}

			if(strGrade=='yes')
			{
				if (GullFormStore.chkGradeAll.checked){
					deepLink = deepLink + "&chkGradeAll=" + GullFormStore.chkGradeAll.value}
				else{deepLink = deepLink + "&chkGradeAll=N"}
				if (GullFormStore.chkGrade1.checked){
					deepLink = deepLink + "&chkGrade1=" + GullFormStore.chkGrade1.value}
				else{deepLink = deepLink + "&chkGrade1=N"}
				if (GullFormStore.chkGrade2.checked){
					deepLink = deepLink + "&chkGrade2=" + GullFormStore.chkGrade2.value}
				else{deepLink = deepLink + "&chkGrade2=N"}
				if (GullFormStore.chkGrade3.checked){
					deepLink = deepLink + "&chkGrade3=" + GullFormStore.chkGrade3.value}
				else{deepLink = deepLink + "&chkGrade3=N"}
				if (GullFormStore.chkGrade4.checked){
					deepLink = deepLink + "&chkGrade4=" + GullFormStore.chkGrade4.value}
				else{deepLink = deepLink + "&chkGrade4=N"}
				if (GullFormStore.chkGrade5.checked){
					deepLink = deepLink + "&chkGrade5=" + GullFormStore.chkGrade5.value}
				else{deepLink = deepLink + "&chkGrade5=N"}
			}
			if (stroptional!='' && stroptional!='/')
			{
				deepLink = deepLink + "&" + stroptional
			}
			deepLink = deepLink + "&strAction=" + "search"
			
			//redirect page to our deepLink URL
			//document.write(deepLink);
			window.location.href = deepLink;
		}

	}
/*
function SplitIntoHiddenControls()
	{
		var str=document.CheckPremfrm.selMonthYear.value;
		var myStr = str.split("-")
		//hidden controls to hold selected year and month from split function
		document.forms['CheckPremfrm'].hdnSelectedMonth.value=myStr[0];
		document.forms['CheckPremfrm'].hdnSelectedYear.value=myStr[1];
	}
	*/

function isValidDate(day,month,year)
	{
		/*
		Purpose: return true if the date is valid, false otherwise

		Arguments: day integer representing day of month
		month integer representing month of year
		year integer representing year

		Variables: dteDate - date object

		*/
		var dteDate;
		var todaysDateTime;
		todaysDateTime = new Date();

		//set up a Date object based on the day, month and year arguments
		//javascript months start at 0 (0-11 instead of 1-12)
		//dteDate=new Date(year,month,day,"23","59","59");
		dteDate=new Date(year,month,day,"23","59","59");
		
		if (dteDate>=todaysDateTime)
		{
			/*
			Javascript Dates are a little too forgiving and will change the date to a reasonable guess if it's invalid. We'll use this to our advantage by creating the date object and then comparing it to the details we put it. If the Date object is different, then it must have been an invalid date to start with...
			*/
			return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()));

		}
		else
		{
			return false;			
		}
	}


