// JavaScript Document
function insertOffers(){
  var myHTML = '<iframe src="/offers/boating-holiday-offers.asp" width="100%" height="1490" scrolling="Auto" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="margin-top:3px;"></iframe>';
	   
document.write(myHTML);
}

function insertOffersCruiser(duration,base,people,children,babies,month,day,region,regionCode){
  var myHTML = '<iframe src="/offers/boating-holiday-offers.asp?duration=' + duration + '&base=' + base + '&people=' + people + '&children=' + children + '&babies=' + babies + '&month=' + month + '&day=' + day + '&region=' + regionCode + '" width="100%" height="1700" scrolling="Auto" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="margin-top:1px;"></iframe>';
	   
document.write(myHTML);
}
function insertOffersBroads(duration,base,people,children,babies,month,day,region,regionCode){
  var myHTML = '<iframe src="/broads-holiday-offers.asp?Broads=Broads&duration=' + duration + '&base=' + base + '&people=' + people + '&children=' + children + '&babies=' + babies + '&month=' + month + '&day=' + day + '&region=' + regionCode + '" width="100%" height="820" scrolling="Auto" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="margin-top:1px;"></iframe>';
	   
document.write(myHTML);
}
function insertOffersBarge(duration,base,people,children,babies,month,day,region,regionCode){
  var myHTML = '<iframe src="/offers/boating-holiday-offers.asp?duration=' + duration + '&search=barge&base2=' + base + '&people=' + people + '&children=' + children + '&babies=' + babies + '&month=' + month + '&day=' + day + '&region2=' + region + '" width="100%" height="1700" scrolling="Auto" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="margin-top:1px;"></iframe>';
	   
document.write(myHTML);
}
function insertOffersUK(duration,base,people,children,babies,month,day,region,regionCode){
  var myHTML = '<iframe src="/offers/boating-holiday-offers.asp?UK=UK&duration=' + duration + '&base=' + base + '&people=' + people + '&month=' + month + '&day=' + day + '&region=' + regionCode + '" width="100%" height="1700" scrolling="Auto" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="margin-top:3px;"></iframe>';
	   
document.write(myHTML);
}
//--------------------------------------------------------------------------------

// JavaScript Document

/*
0	ORDER BY Sleeps DESC, Sleeps_Max DESC, Boat_Name

	ORDER BY SIZE Small - Big
1	ORDER BY Sleeps ASC, Sleeps_Max ASC, Boat_Name

	ORDER BY SIZE Big - Small (Default)
2	ORDER BY Sleeps DESC, Sleeps_Max DESC, Boat_Name

	ORDER BY PRICE Small - Big
3	ORDER BY Hire_Charge ASC, Boat_Name

	ORDER BY PRICE Big - Small
4	ORDER BY Hire_Charge DESC, Boat_Name

	ORDER BY RATING Small - Big
5	ORDER BY Anchors ASC, Boat_Name

	ORDER BY RATING Big - Small 
6	ORDER BY Anchors DESC, Boat_Name
*/

function selectedItemChange(myPageIs){
var myDDL = document.getElementById("orderDDL");
	
createCookie('boatListing',"'" + myDDL.options[myDDL.selectedIndex].value + '|' + myPageIs + "'",1);
	
window.location=(myPageIs);


//+ "?OrderBy=" + myDDL.options[myDDL.selectedIndex].value


}

function writeOrderList(myPage){

var myDDL = document.getElementById("orderDDL");
var myWrapper = document.getElementById("ddlWrapper");
var myQuery = location.search.substring(1); 

var myCookie = readCookie("boatListing");
var myOrder = ""
var mySize = ""


if (myCookie != null){
myOrder = myCookie.split("|");
};

var sel1,sel2,sel3,sel4,sel5,sel6;
var myURL = "'" + location + "'";

if (myURL.indexOf('small-boat-holidays.asp')!=-1){mySize = '2 - 4 berth boats'};
if (myURL.indexOf('medium-boat-holidays.asp')!=-1){mySize = '4 - 6 berth boats '};
if (myURL.indexOf('large-boat-holidays.asp')!=-1){mySize = '6 - 8 berth boats '};
if (myURL.indexOf('group-boat-holidays.asp')!=-1){mySize = '8 or more berth boats'};
if (myURL.indexOf('barge-holidays.asp')!=-1){mySize = 'Penichette barges'};

if(myOrder[0]=="'1"){sel1='selected="selected"',sel2='',sel3='',sel4='',sel5='',sel6=''};
if(myOrder[0]=="'2"){sel1='',sel2='selected="selected"',sel3='',sel4='',sel5='',sel6=''};
if(myOrder[0]=="'3"){sel1='',sel2='',sel3='selected="selected"',sel4='',sel5='',sel6=''};
if(myOrder[0]=="'4"){sel1='',sel2='',sel3='',sel4='selected="selected"',sel5='',sel6=''};
if(myOrder[0]=="'5"){sel1='',sel2='',sel3='',sel4='',sel5='selected="selected"',sel6=''};
if(myOrder[0]=="'6"){sel1='',sel2='',sel3='',sel4='',sel5='',sel6='selected="selected"'};

var myHTML = '<table cellpadding="0" cellspacing="0" width="582" style="margin-bottom:2px;"><tr><td class="orderBoats" valign="top" style="text-align:center;">Order ' + mySize + ' by <select id="orderDDL" name="orderDDL" onchange="selectedItemChange(' + "'" + myPage + "'" + ');" style="width:218px; font-size:10px; font-weight:bold;">';
myHTML += '<option value="1" ' + sel1 + '>Size: Bigger --> Smaller</option>';
myHTML += '<option value="2" ' + sel2 + '>Size: Smaller --> Bigger</option>';
myHTML += '<option value="3" ' + sel3 + '>Price: Lower --> Higher</option>';
myHTML += '<option value="4" ' + sel4 + '>Price: Higher --> Lower</option>';
myHTML += '<option value="5" ' + sel5 + '>Rating: Lower --> Higher</option>';
myHTML += '<option value="6" ' + sel6 + '>Rating: Higher --> Lower</option>';
myHTML += '</select></td></tr></table>';
	   
myWrapper.innerHTML = myHTML;
}