	
	function displayDirectSearch(strBookingURL, strAffiliateID, strProviderID, strLocation, strLocationShowHide, strTownLevel,strPremType, strPremTypeShowHide, strSharing,strPremName,strGrade,strPrice,strFacilities,strChildren,strInfants,stroptional, strBackgroundImage,strBackgroundColor)
	{	
		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 + ' />')

        var strGullSurroundStyle
       
        strGullSurroundStyle = "";
        if(strBackgroundColor!="")
        {
           strGullSurroundStyle = 'style="background-color:' + strBackgroundColor + '"';
        }
        if(strBackgroundImage!="")
        {
           strGullSurroundStyle = 'style="background:transparent url(' + strBackgroundImage + ') no-repeat 0 0"';
        }
        
		document.write('<div class="gullSurround" '+ strGullSurroundStyle + '><!--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="CK,S,C139,0" ' + ((strLocation=="CK,S,C139,0")?"selected":"") + '>Cobh</option>')
		document.write('<option value="CK,S,M021,0" ' + ((strLocation=="CK,S,M021,0")?"selected":"") + '>Midleton</option>')
		document.write('<option value="CK,S,Y001,0" ' + ((strLocation=="CK,S,Y001,0")?"selected":"") + '>Youghal</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;			
		}
	}


