function loadQS(){
	frm = document.quicksearch;
	
	//load Destinations
	j = 1;
	for(i=0;i<dests.length;i++){
		frm.dests[j] = new Option(dests[i][0],dests[i][1]);
		j++;	
	}
	
	//load Dates
	j = 1;
	for(i=0;i<dates.length;i++){
		frm.dates[j] = new Option(dates[i][1],dates[i][0]);
		j++;	
	}
	
	//load Lines
	j = 1;
	for(i=0;i<lines.length;i++){
		frm.lines[j] = new Option(lines[i][1],lines[i][0]);
		j++;	
	}
	
	//load Lengths
	j = 1;
	for(i=0;i<lens.length;i++){
		frm.lens[j] = new Option(lens[i][1],lens[i][0]);
		j++;	
	}
}

function loadShips(){
	frm = document.quicksearch;
	
	line = frm.lines[frm.lines.selectedIndex].value;
	
	frm.ships.options.length = 0;
	frm.ships[0] = new Option("Choose A Ship","",true);
	
	//load Ships
	j = 1;
	for(i=0;i<ships.length;i++){
		if (ships[i][2] == line){
			frm.ships[j] = new Option(ships[i][1],ships[i][0]); 	
			j++;
		}	
	}
}

function loadShipsStatic(){
	frm = document.quicksearch;
	
	line = frm.lines.value;
	
	frm.ships.options.length = 0;
	frm.ships[0] = new Option("Choose A Ship","",true);
	
	//load Ships
	j = 1;
	for(i=0;i<ships.length;i++){
		if (ships[i][2] == line){
			frm.ships[j] = new Option(ships[i][1],ships[i][0]); 	
			j++;
		}	
	}
}

function subSearch(){
	frm = document.quicksearch;
	subfrm = document.subQS;
	
	dest = frm.dests[frm.dests.selectedIndex].value;
	sdate = frm.dates[frm.dates.selectedIndex].value;
	try{
		line = frm.lines[frm.lines.selectedIndex].value;
	}catch(err){
		line = frm.lines.value;	
	}
	ship = frm.ships[frm.ships.selectedIndex].value;
	len = frm.lens[frm.lens.selectedIndex].value;
	
	sURL = "https://my.bestpricecruises.com/clublogin/club_search.php?search_type=cruise_search";
	
	dests = dest.split("|");
	for(i=0;i<dests.length;i++){
		sURL = sURL + "&destination_list[]=" + dests[i];	
	}
	
	sURL = sURL + "&VendorID=" + line;
	sURL = sURL + "&ShipID=" + ship;
	sURL = sURL + "&cruise_duration=" + len;
	
	if(sdate != ""){
		sdate = sdate.split("-");
		smonth = sdate[1];
		syear = sdate[0];
		emonth = parseFloat(smonth) + 1;
		eyear = syear;
		if (emonth > 12){
			emonth = 1;
			eyear++;	
		}
		sURL = sURL + "&date_search_type=1&cruise_month=" + smonth + "&cruise_day=1" + "&cruise_year=" + syear + "&cruise_month2=" + emonth + "&cruise_day2=1" + "&cruise_year2=" + eyear;
	}else{
		now = new Date();
		smonth = now.getMonth() + 1;
		syear = now.getYear() + 1900;
		emonth = smonth - 1;
		eyear = syear + 1;
		if (emonth < 1){
			emonth = 12;
		}
		sURL = sURL + "&date_search_type=1&cruise_month=" + smonth + "&cruise_day=1" + "&cruise_year=" + syear + "&cruise_month2=" + emonth + "&cruise_day2=1" + "&cruise_year2=" + eyear;
	}
	
	
	//frm.debug.value = sURL;
	subfrm.action = sURL;
	subfrm.submit();
	
	
}

function advSearchLines(){
	frm = document.cruiseForm;
	
	//load Lines
	j = 1;
	for(i=0;i<lines.length;i++){
		frm.VendorID[j] = new Option(lines[i][1],lines[i][0]);
		j++;	
	}	
}

function advSearchLoadShips(){
	frm = document.cruiseForm;
	
	line = frm.VendorID[frm.VendorID.selectedIndex].value;
	
	frm.ShipID.options.length = 0;
	frm.ShipID[0] = new Option("Choose A Ship","",true);
	
	//load Ships
	j = 1;
	for(i=0;i<ships.length;i++){
		if (ships[i][2] == line){
			frm.ShipID[j] = new Option(ships[i][1],ships[i][0]); 	
			j++;
		}	
	}
}

function clSearchLines(){
	frm = document.searchByCL;
	
	//load Lines
	j = 1;
	for(i=0;i<lines.length;i++){
		frm.VendorID[j] = new Option(lines[i][1],lines[i][0]);
		j++;	
	}	
}

function hpSpecLoadShips(){
	frm = document.addSpecial;
	
	cline = frm.cl[frm.cl.selectedIndex].value.split("|");
	line = cline[0];
	
	frm.apShips.options.length = 0;
	//frm.apShips[0] = new Option("Choose A Ship","",true);
	//see if we load vendors instead of ships
	if(line != "BPC"){
		//load Ships
		j = 0;
		for(i=0;i<ships.length;i++){
			if (ships[i][2] == line){
				frm.apShips[j] = new Option(ships[i][1],ships[i][0]); 	
				j++;
			}	
		}
	}else{
		j = 0;
		for(i=0;i<lines.length;i++){
			frm.apShips[j] = new Option(lines[i][1],lines[i][0]);
			j++;	
		}
	}
}