﻿// JScript File
var ships = new Array();
var allships = new Array();
var dest = new Array();
var cline = new Array();
//Cruise Destination Array List
dest[0] = new Array();
dest[0][0] = new Array('Any Destination','Africa','Alaska','Australasia','Canaries','Caribbean','Central America','Europe','Far East & Indian Ocean','Hawai','Mediterranean','Middle East','North America','Pacific','Polar Regions','Scandinavia','South America','Transatlantic','United Kingdom','Worldwide');
dest[0][1] = new Array('%','17','13','14','1','2','3','4','5','6','7','19','8','15','18','9','10','11','16','12');
//Cruiseline Array List
cline[1] = new Array();
cline[1][0] = new Array('Any Cruise Line','Azamara Cruises','Carnival','Celebrity Cruises','Costa','Cunard','Holland America','Island Cruises','MSC','NCL','Ocean Village','Oceania Cruises','P & O Cruises','Princess','Pullmantur Cruises','Regent Seven Seas','Royal Caribbean','Thomson');
cline[1][1] = new Array('%','66','8','3','9','5','15','2','16','17','4','48','1','20','69','21','22','28');


ships[6] = new Array(); 
ships[6][0] = new Array('M.S. Davinci','M.S. Fleurette'); 
ships[6][1] = new Array('356','453'); 
ships[66] = new Array(); 
ships[66][0] = new Array('Journey','Quest'); 
ships[66][1] = new Array('414','415'); 
ships[8] = new Array(); 
ships[8][0] = new Array('Conquest','Destiny','Dream','Ecstasy','Elation','Fantasy','Fascination','Freedom','Glory','Holiday','Imagination','Inspiration','Legend','Liberty','Miracle','Paradise','Pride','Sensation','Spirit','Splendor','Triumph','Valor','Victory'); 
ships[8][1] = new Array('34','41','466','35','31','36','38','364','39','40','33','30','28','246','27','21','26','32','25','409','24','245','22'); 
ships[3] = new Array(); 
ships[3][0] = new Array('Century','Constellation','Eclipse','Equinox','Galaxy','Infinity','Mercury','Millennium','Solstice','Summit','Xpedition'); 
ships[3][1] = new Array('9','8','476','442','7','13','14','6','427','12','205'); 
ships[9] = new Array(); 
ships[9][0] = new Array('Costa Allegra','Costa Atlantica','Costa Classica','Costa Concordia','Costa Deliziosa','Costa Europa','Costa Fortuna','Costa Luminosa','Costa Magica','Costa Mediterranea','Costa Pacifica','Costa Romantica','Costa Serena','Costa Victoria'); 
ships[9][1] = new Array('49','50','48','334','475','47','52','438','42','45','439','43','365','51'); 
ships[5] = new Array(); 
ships[5][0] = new Array('Queen Mary 2','Queen Victoria','Queen Elizabeth'); 
ships[5][1] = new Array('56','57','472'); 
ships[15] = new Array(); 
ships[15][0] = new Array('Amsterdam','Eurodam','Maasdam','Noordam','Oosterdam','Prinsendam','Rotterdam','Ryndam','Statendam','Veendam','Volendam','Westerdam','Zaandam','Zuiderdam'); 
ships[15][1] = new Array('73','399','82','81','80','79','78','83','77','76','75','72','74','84'); 
ships[2] = new Array(); 
ships[2][0] = new Array('Island Escape'); 
ships[2][1] = new Array('5'); 
ships[16] = new Array(); 
ships[16][0] = new Array('Armonia','Fantasia','Lirica','Magnifica','Melody','Musica','Opera','Orchestra','Poesia','Sinfonia','Splendida'); 
ships[16][1] = new Array('185','458','89','463','88','326','86','379','428','244','462'); 
ships[17] = new Array(); 
ships[17][0] = new Array('Norwegian Dawn','Norwegian Dream','Norwegian Epic','Norwegian Gem','Norwegian Jade','Norwegian Jewel','Norwegian Majesty','Norwegian Pearl','Norwegian Spirit','Norwegian Star','Norwegian Sun','Pride of America'); 
ships[17][1] = new Array('94','95','478','371','410','248','96','368','268','99','100','103'); 
ships[4] = new Array(); 
ships[4][0] = new Array('Ocean Village','Ocean Village 2'); 
ships[4][1] = new Array('106','363'); 
ships[48] = new Array(); 
ships[48][0] = new Array('Insignia','Nautica','Regatta'); 
ships[48][1] = new Array('261','260','259'); 
ships[1] = new Array(); 
ships[1][0] = new Array('Arcadia','Artemis','Aurora','Azura','Oceana','Oriana','Ventura'); 
ships[1][1] = new Array('180','181','3','471','2','4','396'); 
ships[20] = new Array(); 
ships[20][0] = new Array('Caribbean Princess','Coral Princess','Crown Princess','Dawn Princess','Diamond Princess','Emerald Princess','Golden Princess','Grand Princess','Island Princess','Ocean Princess','Pacific Princess','Royal Princess','Ruby Princess','Sapphire Princess','Sea Princess','Star Princess','Sun Princess','Tahitian Princess'); 
ships[20][1] = new Array('117','121','269','120','119','367','118','110','116','456','122','115','416','114','179','113','112','111'); 
ships[69] = new Array(); 
ships[69][0] = new Array('Holiday Dream','Pacific Dream','Sky Wonder','Sovereign','Zenith'); 
ships[69][1] = new Array('430','434','433','1000','432'); 
ships[21] = new Array(); 
ships[21][0] = new Array('Paul Gauguin','Seven Seas Mariner','Seven Seas Navigator','Seven Seas Voyager'); 
ships[21][1] = new Array('127','125','123','124'); 
ships[22] = new Array(); 
ships[22][0] = new Array('Adventure of the Seas','Allure of the Seas', 'Brilliance of the Seas','Enchantment of the Seas','Explorer of the Seas','Freedom of the Seas','Grandeur of the Seas','Independence of the Seas','Jewel of the Seas','Legend of the Seas','Liberty of the Seas','Majesty of the Seas','Mariner of the Seas','Monarch of the Seas','Navigator of the Seas','Oasis of the Seas','Radiance of the Seas','Rhapsody of the Seas','Serenade of the Seas','Splendour of the Seas','Vision of the Seas','Voyager of the Seas'); 
ships[22][1] = new Array('140','481', '147','146','136','270','144','393','145','143','369','142','141','148','130','457','138','137','135','133','132','131'); 
ships[28] = new Array(); 
ships[28][0] = new Array('Emerald','The Calypso','Thomson Celebration','Thomson Destiny','Thomson Spirit'); 
ships[28][1] = new Array('173','366','183','184','174'); 

function emptyList( box, start ) {
	var size = box.options.length;
	for (i = size; i >= start; i--) {
		box.options[i] = null;
	}
}

function fillListNew( box, arr, selecteditem ) {
	for ( i = 0; i < arr[0].length; i++ ) {
		option = new Option( arr[0][i], arr[1][i] );
		box.options[box.length] = option;
	}
	if (selecteditem) {
		box.value = selecteditem;
	} 
}

function updatecrlineships(box ,selecteditem,ctrl ) {
    if (box.value == "%") {
        list = allships[0];
        emptyList( document.getElementById(ctrl), 1 );
    } else {
        list = ships[box.options[box.selectedIndex].value];
        emptyList( document.getElementById(ctrl), 1 );
        fillListNew( document.getElementById(ctrl), list, selecteditem );
    }
}


function fn_LoadDates(ctrlName)
{   
    opt = document.createElement("option");
    for (var j=document.getElementById(ctrlName).options.length-1; j>=0; j--) {
    document.getElementById(ctrlName).options[j] = null; }   
    opt.text="Please Select Month";
    opt.value="";
    document.getElementById(ctrlName).options.add(opt);
    var currentDate = new Date(); 
    
    var intMonth = currentDate.getMonth();
    var intYear =currentDate.getFullYear();
    
    
    for( i = 0 ; i < 27 ; i++) 
    {
        if (intMonth<=11)
        {
            var mvalue = fn_getMonthValue(intMonth); 
            var opt1 = document.createElement("option");
            opt1.text  = mvalue + " " + intYear;
            opt1.value = mvalue + " " + intYear;
            document.getElementById(ctrlName).options.add(opt1); 
        }
        if (intMonth>11)
        {
            intMonth = 0;
            intYear = intYear + 1
        }
        else
        {
           intMonth=intMonth + 1;
        }
    }  
}

function fn_getMonthValue(dateValue)
{
    var mvalue;
    switch(dateValue){
    case 0: mvalue="January"; break;
    case 1: mvalue="February"; break;
    case 2: mvalue="March"; break;
    case 3: mvalue="April"; break;
    case 4: mvalue="May"; break;
    case 5: mvalue="June"; break;
    case 6: mvalue="July"; break;
    case 7: mvalue="August"; break;
    case 8: mvalue="September"; break;
    case 9: mvalue="October"; break;
    case 10: mvalue="November"; break;
    case 11: mvalue="December"; break;
    }
    return mvalue;
}

function fn_LoadDestination(ctrl)
{
    list = dest[0];
    emptyList(document.getElementById(ctrl), 1 );
    fillListNew( document.getElementById(ctrl), list, 0);
}

function fn_LoadCruiseLine(ctrl)
{
    list = cline[1];
    emptyList(document.getElementById(ctrl), 1 );
    fillListNew( document.getElementById(ctrl), list, 0);
}

function fnBindHiddenValue(arg_CLId,arg_ShipId,arg_HdnControl)
{    
    var hdnControl = document.getElementById(arg_HdnControl).value;
    opt = document.createElement("option");
    for (var j=document.getElementById(arg_ShipId).options.length-1; j>=0; j--) {
    document.getElementById(arg_ShipId).options[j] = null; }   
    document.getElementById(arg_ShipId).options.add(opt);
   
    opt.text = "Any Cruise Ship";
    opt.value = ""; 
    var strHValue =hdnControl.split(","); 
    for(i=0;i<strHValue.length-1;i++) {
     var strValue = strHValue[i].split("@");
     if (strValue[0] ==document.getElementById(arg_CLId).value){
        var opt = document.createElement("option");
        opt.text = strValue[2];
        opt.value =strValue[1];
        document.getElementById(arg_ShipId).options.add(opt); }
    }
}
function fnBindShipName(arg_ship,arg_HdnShipName)
{
    if (document.getElementById(arg_ship).value =="0") {
        document.getElementById(arg_HdnShipName).value="All Cruise Ship"; }
    else {
        document.getElementById(arg_HdnShipName).value=document.getElementById(arg_ship).options[document.getElementById(arg_ship).selectedIndex].text; }    
}

