//requires initialisation of the following variables: //frm (form with dates controls) //curDay, curMonth (0-11), curYear //bookPeriod (number of days allowed to book in advance) var curDay = 24 var curMonth = 6 var curYear = 2008 var bookPeriod = 28 var monthArray = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") var wkdArray = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat") var objCookie var defCity //instantialise and initialise cookie object function initCookie() { objCookie = new cookieVal("", "", "", "", "") var cookieArray = unescape(document.cookie.replace(/\+/g, " ")).split("|") for (var i=0; i= out date function resetInDate(frm) { if (frm.inDate.selectedIndex > frm.outDate.selectedIndex) frm.inDate.selectedIndex = frm.outDate.selectedIndex //set weekdays and length of stay setWkd(frm) } //cookie values object constructor function cookieVal(country, city, suburb, inDate, outDate) { this.country = country this.city = city this.suburb = suburb this.inDate = inDate this.outDate = outDate } //save selected dates and location to cookie function setSelCookie(country, city, suburb, inDate, outDate) { document.cookie = escape("|SearchEng|") + "=" + escape("|" + country + "|" + city + "|" + suburb + "|" + inDate + "|" + outDate + "|") + ";path=/" } //reload page with new in/out dates function changeDates(frm) { setSelCookie(objCookie.country, objCookie.city, objCookie.suburb, getVal(frm.inDate), getVal(frm.outDate)) var qString = location.search.substr(1) qString = setQStringName(qString, "inDate", new Array(getVal(frm.inDate))) qString = setQStringName(qString, "outDate", new Array(getVal(frm.outDate))) location = location.pathname + "?" + qString } //replace or add a name/value pairs in url-encoded querystring function setQStringName(qString, name, arrVal) { var i var qStringNew = "" if (qString != "") { var curName var arrNameVal = qString.split("&") for (i in arrNameVal) { curName = arrNameVal[i].split("=")[0] curName = unescape(curName).replace(/\+/g, " ") if (curName != name) qStringNew += "&" + arrNameVal[i] } } for (i in arrVal) { qStringNew += "&" + escape(name) + "=" + escape(arrVal[i]) } return qStringNew.substr(1) } //populate Cities function populateCities(frm) { ClearOptions(frm.city); AddToOptionList(frm.city, "Adelaide", "Adelaide"); AddToOptionList(frm.city, "Agnes Water", "Agnes Water"); AddToOptionList(frm.city, "Airlie Beach", "Airlie Beach"); AddToOptionList(frm.city, "Albany", "Albany"); AddToOptionList(frm.city, "Albury", "Albury"); AddToOptionList(frm.city, "Alice Springs", "Alice Springs"); AddToOptionList(frm.city, "Angelsea", "Angelsea"); AddToOptionList(frm.city, "Apollo Bay", "Apollo Bay"); AddToOptionList(frm.city, "Armidale", "Armidale"); AddToOptionList(frm.city, "Atherton Tablelands", "Atherton Tablelands"); AddToOptionList(frm.city, "Ayers Rock", "Ayers Rock"); AddToOptionList(frm.city, "Bairnsdale, VC", "Bairnsdale, VC"); AddToOptionList(frm.city, "Ballarat", "Ballarat"); AddToOptionList(frm.city, "Ballina", "Ballina"); AddToOptionList(frm.city, "Bargara", "Bargara"); AddToOptionList(frm.city, "Barossa Valley", "Barossa Valley"); AddToOptionList(frm.city, "Batemans Bay", "Batemans Bay"); AddToOptionList(frm.city, "Bathurst", "Bathurst"); AddToOptionList(frm.city, "Beechworth", "Beechworth"); AddToOptionList(frm.city, "Bendigo", "Bendigo"); AddToOptionList(frm.city, "Blackheath, NSW", "Blackheath, NSW"); AddToOptionList(frm.city, "Blue Mountains", "Blue Mountains"); AddToOptionList(frm.city, "Bridgetown (AU)", "Bridgetown (AU)"); AddToOptionList(frm.city, "Brisbane", "Brisbane"); AddToOptionList(frm.city, "Broken Hill", "Broken Hill"); AddToOptionList(frm.city, "Broome", "Broome"); AddToOptionList(frm.city, "Bunbury", "Bunbury"); AddToOptionList(frm.city, "Bundaberg", "Bundaberg"); AddToOptionList(frm.city, "Burnie", "Burnie"); AddToOptionList(frm.city, "Busselton", "Busselton"); AddToOptionList(frm.city, "Byron Bay", "Byron Bay"); AddToOptionList(frm.city, "Byron Bay Surrounds", "Byron Bay Surrounds"); AddToOptionList(frm.city, "Cairns", "Cairns"); AddToOptionList(frm.city, "Cairns Beaches", "Cairns Beaches"); AddToOptionList(frm.city, "Canberra", "Canberra"); AddToOptionList(frm.city, "Cape Tribulation", "Cape Tribulation"); AddToOptionList(frm.city, "Carnarvon", "Carnarvon"); AddToOptionList(frm.city, "Central Coast", "Central Coast"); AddToOptionList(frm.city, "Clare Valley", "Clare Valley"); AddToOptionList(frm.city, "Coffs Harbour", "Coffs Harbour"); AddToOptionList(frm.city, "Coles Bay", "Coles Bay"); AddToOptionList(frm.city, "Coober Pedy", "Coober Pedy"); AddToOptionList(frm.city, "Cooma", "Cooma"); AddToOptionList(frm.city, "Coonabarabran", "Coonabarabran"); AddToOptionList(frm.city, "Coonawarra", "Coonawarra"); AddToOptionList(frm.city, "Cootamundra", "Cootamundra"); AddToOptionList(frm.city, "Cowra", "Cowra"); AddToOptionList(frm.city, "Cradle Mountain", "Cradle Mountain"); AddToOptionList(frm.city, "Dandenong", "Dandenong"); AddToOptionList(frm.city, "Dandenong Ranges", "Dandenong Ranges"); AddToOptionList(frm.city, "Darwin", "Darwin"); AddToOptionList(frm.city, "Daylesford", "Daylesford"); AddToOptionList(frm.city, "Deloraine", "Deloraine"); AddToOptionList(frm.city, "Deniliquin", "Deniliquin"); AddToOptionList(frm.city, "Denmark (AU)", "Denmark (AU)"); AddToOptionList(frm.city, "Derwent Valley, TAS", "Derwent Valley, TAS"); AddToOptionList(frm.city, "Devonport", "Devonport"); AddToOptionList(frm.city, "Dubbo", "Dubbo"); AddToOptionList(frm.city, "Dunk Island", "Dunk Island"); AddToOptionList(frm.city, "Echuca", "Echuca"); AddToOptionList(frm.city, "Eden", "Eden"); AddToOptionList(frm.city, "Esperance", "Esperance"); AddToOptionList(frm.city, "Exmouth (AU)", "Exmouth (AU)"); AddToOptionList(frm.city, "Far North Coast, NSW", "Far North Coast, NSW"); AddToOptionList(frm.city, "Fraser Coast", "Fraser Coast"); AddToOptionList(frm.city, "Fraser Island", "Fraser Island"); AddToOptionList(frm.city, "Geelong", "Geelong"); AddToOptionList(frm.city, "Geraldton", "Geraldton"); AddToOptionList(frm.city, "Gippsland, VIC", "Gippsland, VIC"); AddToOptionList(frm.city, "Gladstone", "Gladstone"); AddToOptionList(frm.city, "Gold Coast", "Gold Coast"); AddToOptionList(frm.city, "Goolwa", "Goolwa"); AddToOptionList(frm.city, "Goulburn", "Goulburn"); AddToOptionList(frm.city, "Grafton", "Grafton"); AddToOptionList(frm.city, "Great Ocean Road, VIC", "Great Ocean Road, VIC"); AddToOptionList(frm.city, "Halls Creek", "Halls Creek"); AddToOptionList(frm.city, "Halls Gap", "Halls Gap"); AddToOptionList(frm.city, "Hamilton (AU)", "Hamilton (AU)"); AddToOptionList(frm.city, "Hawkesbury", "Hawkesbury"); AddToOptionList(frm.city, "Hay, NSW", "Hay, NSW"); AddToOptionList(frm.city, "Hervey Bay", "Hervey Bay"); AddToOptionList(frm.city, "Hobart", "Hobart"); AddToOptionList(frm.city, "Holbrook", "Holbrook"); AddToOptionList(frm.city, "Horsham (AU)", "Horsham (AU)"); AddToOptionList(frm.city, "Hunter Valley", "Hunter Valley"); AddToOptionList(frm.city, "Huon Valley", "Huon Valley"); AddToOptionList(frm.city, "Ingham", "Ingham"); AddToOptionList(frm.city, "Innisfail", "Innisfail"); AddToOptionList(frm.city, "Kakadu National Park", "Kakadu National Park"); AddToOptionList(frm.city, "Kalbarri", "Kalbarri"); AddToOptionList(frm.city, "Kalgoorlie", "Kalgoorlie"); AddToOptionList(frm.city, "Kangaroo Island", "Kangaroo Island"); AddToOptionList(frm.city, "Katherine", "Katherine"); AddToOptionList(frm.city, "Kings Canyon", "Kings Canyon"); AddToOptionList(frm.city, "Kingscliff", "Kingscliff"); AddToOptionList(frm.city, "Kooralbyn", "Kooralbyn"); AddToOptionList(frm.city, "Kununurra", "Kununurra"); AddToOptionList(frm.city, "Lake Macquarie", "Lake Macquarie"); AddToOptionList(frm.city, "Lakes Entrance", "Lakes Entrance"); AddToOptionList(frm.city, "Lancelin", "Lancelin"); AddToOptionList(frm.city, "Launceston", "Launceston"); AddToOptionList(frm.city, "Lismore", "Lismore"); AddToOptionList(frm.city, "Lorne", "Lorne"); AddToOptionList(frm.city, "Mackay", "Mackay"); AddToOptionList(frm.city, "Magnetic Island", "Magnetic Island"); AddToOptionList(frm.city, "Mallacoota", "Mallacoota"); AddToOptionList(frm.city, "Mandurah", "Mandurah"); AddToOptionList(frm.city, "Mansfield, VIC", "Mansfield, VIC"); AddToOptionList(frm.city, "Margaret River Wine Region", "Margaret River Wine Region"); AddToOptionList(frm.city, "Marysville", "Marysville"); AddToOptionList(frm.city, "McLaren Vale", "McLaren Vale"); AddToOptionList(frm.city, "Melbourne", "Melbourne"); AddToOptionList(frm.city, "Mildura", "Mildura"); AddToOptionList(frm.city, "Mission Beach", "Mission Beach"); AddToOptionList(frm.city, "Monkey Mia", "Monkey Mia"); AddToOptionList(frm.city, "Mornington Peninsula", "Mornington Peninsula"); AddToOptionList(frm.city, "Mount Beauty", "Mount Beauty"); AddToOptionList(frm.city, "Mount Gambier", "Mount Gambier"); AddToOptionList(frm.city, "Mount Isa", "Mount Isa"); AddToOptionList(frm.city, "Mt Buller", "Mt Buller"); AddToOptionList(frm.city, "Mudgee", "Mudgee"); AddToOptionList(frm.city, "Murwillumbah", "Murwillumbah"); AddToOptionList(frm.city, "New England", "New England"); AddToOptionList(frm.city, "Newcastle", "Newcastle"); AddToOptionList(frm.city, "Noosa Heads", "Noosa Heads"); AddToOptionList(frm.city, "Norfolk Island", "Norfolk Island"); AddToOptionList(frm.city, "North Coast, NSW", "North Coast, NSW"); AddToOptionList(frm.city, "North Stradbroke Island", "North Stradbroke Island"); AddToOptionList(frm.city, "Northern Rivers", "Northern Rivers"); AddToOptionList(frm.city, "Orange (AU)", "Orange (AU)"); AddToOptionList(frm.city, "Orford", "Orford"); AddToOptionList(frm.city, "Pemberton", "Pemberton"); AddToOptionList(frm.city, "Perth", "Perth"); AddToOptionList(frm.city, "Phillip Island", "Phillip Island"); AddToOptionList(frm.city, "Port Arthur", "Port Arthur"); AddToOptionList(frm.city, "Port Augusta", "Port Augusta"); AddToOptionList(frm.city, "Port Douglas", "Port Douglas"); AddToOptionList(frm.city, "Port Lincoln", "Port Lincoln"); AddToOptionList(frm.city, "Port Macquarie", "Port Macquarie"); AddToOptionList(frm.city, "Port Pirie", "Port Pirie"); AddToOptionList(frm.city, "Port Stephens", "Port Stephens"); AddToOptionList(frm.city, "Portland", "Portland"); AddToOptionList(frm.city, "Queenscliff", "Queenscliff"); AddToOptionList(frm.city, "Queenstown (AU)", "Queenstown (AU)"); AddToOptionList(frm.city, "Richmond", "Richmond"); AddToOptionList(frm.city, "Robe", "Robe"); AddToOptionList(frm.city, "Rockhampton", "Rockhampton"); AddToOptionList(frm.city, "Roma", "Roma"); AddToOptionList(frm.city, "Ross", "Ross"); AddToOptionList(frm.city, "Sale", "Sale"); AddToOptionList(frm.city, "Scamander", "Scamander"); AddToOptionList(frm.city, "Seymour", "Seymour"); AddToOptionList(frm.city, "Smithton", "Smithton"); AddToOptionList(frm.city, "Snowy Mountains", "Snowy Mountains"); AddToOptionList(frm.city, "South Burnett", "South Burnett"); AddToOptionList(frm.city, "South Coast, NSW", "South Coast, NSW"); AddToOptionList(frm.city, "Southern Highlands", "Southern Highlands"); AddToOptionList(frm.city, "St Helens", "St Helens"); AddToOptionList(frm.city, "Stanley", "Stanley"); AddToOptionList(frm.city, "Stanthorpe", "Stanthorpe"); AddToOptionList(frm.city, "Stawell, VIC", "Stawell, VIC"); AddToOptionList(frm.city, "Strahan", "Strahan"); AddToOptionList(frm.city, "Sunshine Coast", "Sunshine Coast"); AddToOptionList(frm.city, "Swansea (AU)", "Swansea (AU)"); AddToOptionList(frm.city, "Sydney", "Sydney"); AddToOptionList(frm.city, "Tamworth", "Tamworth"); AddToOptionList(frm.city, "Taree", "Taree"); AddToOptionList(frm.city, "Tenterfield, NSW", "Tenterfield, NSW"); AddToOptionList(frm.city, "Tom Price", "Tom Price"); AddToOptionList(frm.city, "Toowoomba", "Toowoomba"); AddToOptionList(frm.city, "Torquay (AU)", "Torquay (AU)"); AddToOptionList(frm.city, "Townsville", "Townsville"); AddToOptionList(frm.city, "Tweed Heads, NSW", "Tweed Heads, NSW"); AddToOptionList(frm.city, "Victor Harbor", "Victor Harbor"); AddToOptionList(frm.city, "Wagga Wagga", "Wagga Wagga"); AddToOptionList(frm.city, "Wangaratta", "Wangaratta"); AddToOptionList(frm.city, "Warrnambool", "Warrnambool"); AddToOptionList(frm.city, "Whitsundays", "Whitsundays"); AddToOptionList(frm.city, "Whyalla", "Whyalla"); AddToOptionList(frm.city, "Wodonga, VIC", "Wodonga, VIC"); AddToOptionList(frm.city, "Wollongong", "Wollongong"); AddToOptionList(frm.city, "Yackandandah", "Yackandandah"); AddToOptionList(frm.city, "Yamba", "Yamba"); AddToOptionList(frm.city, "Yarra Valley", "Yarra Valley"); AddToOptionList(frm.city, "Yarrawonga", "Yarrawonga"); AddToOptionList(frm.city, "Zeehan", "Zeehan"); frm.city[0].selected = true frm.city.selectedIndex = 0 } function ClearOptions(OptionList) { // Always clear an option list from the last entry to the first OptionList.length = 0 } function AddToOptionList(OptionList, OptionValue, OptionText) { // Add option to the bottom of the list OptionList[OptionList.length] = new Option(OptionText, OptionValue); }