function displayHiddenContent(content) {
    if (dgbi(content).style.display != 'block') {
        dgbi(content).style.display = 'block';
    }
    else {
        dgbi(content).style.display = 'none';
    }
}

function changePrix(prixMax) {
    document.getElementById('tb_price_max').value = prixMax;
    if (prixMax == '5000') {
        document.getElementById('tb_price_min').value = '800';
    }
}

function checkForm(oForm) {
    var TP1 = document.getElementById('TP1');
    var TP2 = document.getElementById('TP2');
    var productTypes = document.getElementById('productTypes');
    productTypes.value = '';

    if (TP1.checked) productTypes.value += 'E|';
    if (TP2.checked) {
        productTypes.value += 'L|';
    }

    var l = searchForm.tab_panel_checkbox.length;
    for (var i = 0; i < l; i++) {
        if (!searchForm.tab_panel_checkbox[i].EcireDansHiddenField()) return false;
    }

    codeError = selectSejour.VerifDate();
    if (codeError > 0) {
        var msg = "";


        switch (codeError) {
        case 1:
            msg = tradPage.GetTrad('erreur_date1');
            break;
        case 2:
            msg = tradPage.GetTrad('erreur_date2');
            break;
        case 3:
            msg = tradPage.GetTrad('erreur_date3');
            break;
        case 4:
            msg = tradPage.GetTrad('erreur_date4');
            break;
        case 5:
            msg = tradPage.GetTrad('erreur_date5');
            break;
        case 6:
            msg = tradPage.GetTrad('erreur_date6');
            break;
        case 7:
            msg = tradPage.GetTrad('erreur_date7');
            break;
        }
        if (msg != "") alert(msg);
        return false;
    }

    //si on est sur la page + d'infos on cache le moteur de recherche associé pour ne pas faire de doublons
    if (document.getElementById('moteurBasicPI')) {
        document.getElementById('moteurBasicPI').innerHTML = '';
    }
    //si on est sur la page formlaire on cache le formaulaire pour ne pas créer de conflits
    if (document.getElementById('formulaire')) {
        document.getElementById('formulaire').innerHTML = '';
    }

    sendRequest(oForm);
}



function init() {
    searchForm = new SearchForm(url_result);
    searchForm.SetPopup(false);
    selectSejour = new SelectSejour('', 'cal1Date1', 'cal1Date2');
    searchForm.tab_panel_checkbox.push(new PanelCheckbox("h_sub_type", "cbSubType", false, false, "sous type"));
}



function cachepagemoteur(nbpages) {
    var cpt = 1;
    while (cpt <= nbpages) {
        document.getElementById('page_moteur_' + cpt).style.display = 'none';
        cpt = cpt + 1;
    }
    var cpt2 = 1;
    while (cpt2 <= nbpages) {
        document.getElementById('bt_page_' + cpt2).className = "boutonPageDispo";
        document.getElementById('bt_page_B' + cpt2).className = "boutonPageDispo";
        cpt2 = cpt2 + 1;
    }
}

function pagemoteur(PageaAfficher, nbPages) {
    if (PageaAfficher == nbPages) {
        document.getElementById("bouton_suivant").className = "bouton_navigationInactif";
        document.getElementById("bouton_suivantB").className = "bouton_navigationInactif";
        document.getElementById("next").style.display = "none";
        document.getElementById("nextB").style.display = "none";
        document.getElementById('bt_page_B' + PageaAfficher).className = "boutonPageEnCours";
        document.getElementById('bt_page_' + PageaAfficher).className = "boutonPageEnCours";
    }
    if (PageaAfficher == 1) {
        document.getElementById("bouton_precedent").className = "bouton_navigationInactif";
        document.getElementById("bouton_precedentB").className = "bouton_navigationInactif";
        document.getElementById("prev").style.display = "none";
        document.getElementById("prevB").style.display = "none";
    }
    if (PageaAfficher != 1) {
        document.getElementById("bouton_precedent").className = "bouton_navigationNormal";
        document.getElementById("bouton_precedent").className = "bouton_navigationNormal";
        document.getElementById("bouton_precedentB").className = "bouton_navigationNormal";
        document.getElementById("prev").style.display = "inline";
        document.getElementById("prevB").style.display = "inline";
        document.getElementById('page_moteur_' + PageaAfficher).style.display = 'block';
        document.getElementById('bt_page_' + PageaAfficher).className = "boutonPageEnCours";
        document.getElementById('bt_page_B' + PageaAfficher).className = "boutonPageEnCours";
    }
    if (PageaAfficher != nbPages) {
        document.getElementById("bouton_suivant").className = "bouton_navigationNormal";
        document.getElementById("bouton_suivantB").className = "bouton_navigationNormal";
        document.getElementById("next").style.display = "inline";
        document.getElementById("nextB").style.display = "inline";
        document.getElementById('page_moteur_' + PageaAfficher).style.display = 'block';
        document.getElementById('bt_page_' + PageaAfficher).className = "boutonPageEnCours";
        document.getElementById('bt_page_B' + PageaAfficher).className = "boutonPageEnCours";
    }
}

function displayProductSup(idProductSup) {
    document.getElementById(idProductSup).style.display = 'block';
    document.getElementById('produit_supplementaires1' + idProductSup).style.display = 'none';
    document.getElementById('produit_supplementaires2' + idProductSup).style.display = 'block';
}

function maskProductSup(idProductSup) {
    document.getElementById(idProductSup).style.display = 'none';
    document.getElementById('produit_supplementaires1' + idProductSup).style.display = 'block';
    document.getElementById('produit_supplementaires2' + idProductSup).style.display = 'none';
}

function pagemoteurSuivant(nbPages) {
    tabNumeros = getElementsByClassName('page_moteur');
    for (i = 0; i < tabNumeros.length; i++) {
        if (tabNumeros[i].style.display == 'block') {
            hiddenPageEnCours = 'num_' + tabNumeros[i].id;
            numPageEnCours = eval(document.getElementById(hiddenPageEnCours).value);
            numPageEnCours = numPageEnCours + 1;
            String(numPageEnCours);
            if (numPageEnCours > nbPages) {
                break;
            }
            else {
                cachepagemoteur(nbPages);
                pagemoteur(numPageEnCours, nbPages);
                break;
            }
        }
    }
}

function pagemoteurPrecedent(nbPages) {
    tabNumeros = getElementsByClassName('page_moteur');
    for (i = 0; i < tabNumeros.length; i++) {
        if (tabNumeros[i].style.display == 'block') {
            hiddenPageEnCours = 'num_' + tabNumeros[i].id;
            numPageEnCours = eval(document.getElementById(hiddenPageEnCours).value);
            numPageEnCours = numPageEnCours - 1;
            String(numPageEnCours);
            if (numPageEnCours > 0) {
                cachepagemoteur(nbPages);
                pagemoteur(numPageEnCours, nbPages);
                break;
            }
        }
    }
}

function initSearchResult() {


    if (document.getElementById("bt_page_1")) {
        document.getElementById('bt_page_1').className = "boutonPageEnCours";
        document.getElementById('bt_page_B1').className = "boutonPageEnCours";
    }

    if (document.getElementById('bouton_precedent')) {
        document.getElementById("bouton_precedent").className = "bouton_navigationInactif";
        document.getElementById("bouton_precedentB").className = "bouton_navigationInactif";
        document.getElementById("prev").style.display = "none";
        document.getElementById("prevB").style.display = "inline";
    }

    if (document.getElementById('numPage')) {
        pageToDisplay = document.getElementById('numPage').value;
        nbPageTotal = document.getElementById('nbPages').value;
        cachepagemoteur(nbPageTotal);
        pagemoteur(pageToDisplay, nbPageTotal);
    }
};

function checkFormPI(oForm) {
    searchForm.UrlRechercheDispo = "";
    selectSejourP = new SelectSejour('', 'in', 'out');

    var TP1P = document.getElementById('TP1P');
    var TP2P = document.getElementById('TP2P');
    var productTypesP = document.getElementById('productTypesP');
    productTypesP.value = '';

    if (TP1P.checked) productTypesP.value += 'E|';
    if (TP2P.checked) {
        productTypesP.value += 'L|';
    }

    var codeError = selectSejourP.VerifDate();
    if (codeError > 0) {
        var msg = "";
        switch (codeError) {
        case 1:
            msg = tradPage.GetTrad('erreur_date1');
            break;
        case 2:
            msg = tradPage.GetTrad('erreur_date2');
            break;
        case 3:
            msg = tradPage.GetTrad('erreur_date3');
            break;
        case 4:
            msg = tradPage.GetTrad('erreur_date4');
            break;
        case 5:
            msg = tradPage.GetTrad('erreur_date5');
            break;
        case 6:
            msg = tradPage.GetTrad('erreur_date6');
            break;
        case 7:
            msg = tradPage.GetTrad('erreur_date7');
            break;
        }
        if (msg != "") alert(msg);
        return false;
    }
    if (document.getElementById('skin3')) {
        document.getElementById('skin3').innerHTML = '';
    }
    sendRequest(oForm);
}



/*Options*/

function retrouveOptions() {
    var ClassSelecteurOption = 'SelectOption';
    var IdDivAssurance = 'CGV';
    var IdDivPrixTotal = 'TotalPrice';
    var IdDivDeposit = 'TotalDeposit';
    var IdDescShareVariable = 'montantVariable';
    var IdDescShareFixe = 'montantFixe';
    var IdDivBalance = 'BalanceDue';
    var IdDivFD = 'BookingFees';
    var IdDivNbPers = 'TotalPers';
    var IDDivMontant = 'MontantSejour';
    var IDCBAccepte = 'checkConditions';
    var IDHiddenCrc = 'crcChoosenOption';
    optionForm = new OptionForm(infoResa, ClassSelecteurOption, IdDivPrixTotal, IdDivDeposit, IdDescShareVariable, IdDescShareFixe, IdDivBalance, IdDivFD, IdDivNbPers, IDDivMontant, IDCBAccepte, IdDivAssurance, IDHiddenCrc);
    optionForm.SetOptionSelected(optionsSelected);
    optionForm.MajOutput('NO', optionsResult)
}

optionsResult = function (MyShOptions) {
    var BookingFees = MyShOptions.BookingFees;
    var TotalPers = MyShOptions.TotalPers;
    var TotalPrice = MyShOptions.TotalPrice;
    var TotalDeposit = MyShOptions.TotalDeposit;
    var BalanceDue = MyShOptions.BalanceDue;
    var VariableShare = MyShOptions.VariableShare;
    var RegularShare = MyShOptions.RegularShare;
    var StringChoosenOptions = MyShOptions.StringChoosenOptions;
    var IdError = MyShOptions.IdError;
    var MsgError = MyShOptions.MsgError;
    var IsCancellationInsurance = MyShOptions.IsCancellationInsurance;

    if (IdError != 0) {
        alert(MsgError);
    }
    else {
        var currency = '';

        var montantduSejour = TotalPrice - BookingFees;

        document.getElementById('TotalPriceHidden').value = TotalPrice;
        document.getElementById('TotalDepositHidden').value = TotalDeposit;
        document.getElementById('lg').value = isoLangue;
        document.getElementById('BalanceDueHidden').value = Math.round(BalanceDue * 100) / 100;
        document.getElementById('BookingFeesHidden').value = BookingFees;
        document.getElementById('TotalPersHidden').value = TotalPers;
        document.getElementById('PersTotal').value = TotalPers;
        //acompte variable et acompte fixe

        var ChaineOptions = optionForm.GetChaineOption();
        document.getElementById('options_choisies').value = ChaineOptions;
        document.getElementById('total_payer_today').value = TotalDeposit;
        document.getElementById('total_restant_du').value = Math.round(BalanceDue * 100) / 100;
        var ChaineOptionsIncluded = "";
        tabOptionIncluded = getElementsByClassName('optionsIncluded');
        for (i = 0; i < tabOptionIncluded.length; i++) {
            if (i == tabOptionIncluded.length - 1) {
                ChaineOptionsIncluded = ChaineOptionsIncluded + tabOptionIncluded[i].id + 'x' + tabOptionIncluded[i].name;
            }
            else {
                ChaineOptionsIncluded = ChaineOptionsIncluded + tabOptionIncluded[i].id + 'x' + tabOptionIncluded[i].name + ';';
            }

        }
        document.getElementById('chaine_option_incluses').value = ChaineOptionsIncluded;
    }

    document.getElementById('chaine_paiement').value = chaine_paiement;
}

/**Assurances**/

function initAssurances() {
    //pour le formulaire SecureHoliday
    document.getElementById('options_choisies').value = options_choisies_post;
    document.getElementById('PersTotal').value = PersTotal_post;
    document.getElementById('total_restant_du').value = total_restant_du_post;
    document.getElementById('chaine_option_incluses').value = chaine_option_incluses_post;
    document.getElementById('chaine_paiement').value = chaine_paiement_post;

    //pour le recap du paiement
    var totalSejour = totalSejour_post;
    var fraisDossier = fraisDossier_post;
    var montantSejour = totalSejour - fraisDossier;
    document.getElementById('MontantSejour').innerHTML = harmonise_prix_avec_langue(ProductCurrency, montantSejour, isoLangue);

    AssurancesChoisies();
}

function AssurancesChoisies() {
    var ChaineAssurances = '';
    tabAssurances = getElementsByClassName('checkBoxAssurances');
    for (i = 0; i < tabAssurances.length; i++) {
        if (tabAssurances[i].checked == true) {
            ChaineAssurances = ChaineAssurances + tabAssurances[i].id + ';';
        }
    }
    verifier_assurance(engineNum, isoLangue, ChaineAssurances, check);
}

assurancesResult = function (MyShAssurances) {
    var InsuranceTotalPrice = MyShAssurances.InsuranceTotalPrice;
    var InsuranceIdDetail = MyShAssurances.InsuranceIdDetail;
    var CodeError = MyShAssurances.CodeError;
    var MsgError = MyShAssurances.MsgError;

    if (CodeError > 0) {
        affichage_base();
        alert(MsgError);
    }
    else {

        var total_a_payer_today = parseFloat(total_payer_today_post, 10) + eval(InsuranceTotalPrice);
        var currency = ProductCurrency;
        var langue = isoLangue;

        document.getElementById('InsuranceTotalPrice').innerHTML = harmonise_prix_avec_langue(currency, InsuranceTotalPrice, langue);
        document.getElementById('TotalDeposit').innerHTML = harmonise_prix_avec_langue(currency, total_a_payer_today, langue);

        document.getElementById('montant_assurance').value = InsuranceTotalPrice;
        document.getElementById('total_payer_today').value = total_a_payer_today;
        document.getElementById('string_ID_assurance').value = InsuranceIdDetail;
    }
}

function affichage_base() {
    document.getElementById('InsuranceTotalPrice').innerHTML = 'XXX';
    document.getElementById('TotalDeposit').innerHTML = total_payer_today_post;
    tabAssurances = getElementsByClassName('checkBoxAssurances');
    for (i = 0; i < tabAssurances.length; i++) {
        tabAssurances[i].checked = false;
    }
}

function etapeSuivante(classCheckBox) {

    var actionForm = domaineSSL + 'customer_form.aspx?idM=' + engineNum + '&idE=' + idE + '&spec=' + spec + '&tac=' + tac;
    document.forms[0].action = actionForm;
    document.forms[0].submit();
}

function harmonise_prix_avec_langue(Hmonnaie, Hprix, Hlg) {
    Hlg = Hlg.toLowerCase();
    var result_harmonise = "";
    if (Hlg == "nl") {
        result_harmonise = Hmonnaie + "&#160;" + formatNumber(Hprix, 2, false);
        result_harmonise = replace(result_harmonise, ".", ",");
    }
    else {
        if ((Hlg == "en") || (Hlg == "de")) {
            result_harmonise = Hmonnaie + "&#160;" + formatNumber(Hprix, 2, false);
        }
        else {
            result_harmonise = replace(formatNumber(Hprix, 2, false) + "&#160;" + Hmonnaie, ".", ",");
        }
    }
    return (result_harmonise)
}

function replace(string, text, by) {
    var strLength = string.length,
        txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;
    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0, txtLength))) return string;
    if (i == -1) return string;
    var newstr = string.substring(0, i) + by;
    if (i + txtLength < strLength) newstr += replace(string.substring(i + txtLength, strLength), text, by);
    return newstr
}

function formatNumber(nombre, apresVirgule, GarderEntier) {
    var NB = nombre + '';
    var positionVirgule = NB.indexOf(".");
    if (positionVirgule >= 0) {
        TAB_NB = NB.split('.');
        var partie_decimale = TAB_NB[1] + '';
        if (partie_decimale.length >= apresVirgule) {
            partie_decimale = partie_decimale.substring(0, 2);
        }
        else {
            for (var z = 0; z < apresVirgule - partie_decimale.length; z++) {
                partie_decimale = partie_decimale + '0';
            }
            NB = TAB_NB[0] + '.' + partie_decimale;
        }
    }
    else {
        if (!GarderEntier) {
            NB = NB + '.00';
        }
    }
    return (NB);
}


/**Formulaire client**/

function previousPageOpt() {
    MyCustomerForm.Precedent();
}

var FocusPositionne = false;
ArrayOfError = new Array();

OnError = function (obj) {
    if (obj) {
        if ((obj.attributes.typeData) && (obj.attributes.typeData.nodeValue == "Date")) {
            var MyDay = document.getElementById("day_" + obj.id);
            var MyMonth = document.getElementById("month_" + obj.id);
            var MyYear = document.getElementById("year_" + obj.id);
            if ((MyDay) && (MyMonth) && (MyYear)) {
                MarqueInputErrone(MyDay);
                MarqueInputErrone(MyMonth);
                MarqueInputErrone(MyYear);
                putFocus(MyYear);
            }
        }
        else {
            putFocus(obj);
            MarqueInputErrone(obj);
        }

    }
}

OnErrorCheckWS = function (Result_String) {
    alert(Result_String["myBsError"]["myCustumerInputFieldList"][0]["message"]);
}

function MarqueInputErrone(obj) {
    var borderError = "2px red solid";
    obj.style.border = borderError;
    ArrayOfError.push(obj);
}

function EffaceMarqueInputErrone(obj) {
    var borderError = "2px inset threedhighlight"; //"2px black inset";
    obj.style.border = borderError;
}

function EffaceAllMarqueInputErrone() {
    for (i = 0; i < ArrayOfError.length; i++) {
        var MyObj = ArrayOfError[i];
        if (MyObj) {
            if ((MyObj.attributes.typeData) && (MyObj.attributes.typeData.nodeValue == "Date")) {
                var MyDay = document.getElementById("day_" + MyObj.id);
                var MyMonth = document.getElementById("month_" + MyObj.id);
                var MyYear = document.getElementById("year_" + MyObj.id);
                if ((MyDay) && (MyMonth) && (MyYear)) {
                    EffaceMarqueInputErrone(MyDay);
                    EffaceMarqueInputErrone(MyMonth);
                    EffaceMarqueInputErrone(MyYear);
                }
            }
            else {
                EffaceMarqueInputErrone(MyObj);
            }
        }
    }
    ArrayOfError = new Array();
}

function putFocus(obj) {
    if (!FocusPositionne) obj.focus();
    FocusPositionne = true;
}

function checkFormResa() {
    FocusPositionne = false;
    EffaceAllMarqueInputErrone();
    MyCustomerForm.Check(OnError, OnErrorCheckWS);
}

function formateDateForCheck(nameFieldDate) {
    var InputHidden = document.getElementById(nameFieldDate);
    var inputDay = document.getElementById("day_" + nameFieldDate);
    var inputMonth = document.getElementById("month_" + nameFieldDate);
    var inputYear = document.getElementById("year_" + nameFieldDate);
    var MyDate = null;
    if ((inputDay) && (inputMonth) && (inputYear)) {
        if ((inputDay.value != "") && (inputMonth.value != "") && (inputYear.value != "")) {
            MyDate = normaliseDate(inputDay.value, inputMonth.value, inputYear.value);
        }
    }
    if (InputHidden) InputHidden.value = MyDate;
}

function normaliseDate(day, month, year) {
    var formatDate = "jj/mm/yyyy";
    day = colle_zero(day, 2);
    month = colle_zero(month, 2);
    formatDate = formatDate.replace("jj", day);
    formatDate = formatDate.replace("mm", month);
    formatDate = formatDate.replace("yyyy", year);
    return formatDate;
}

function colle_zero(x, nb_chiffres) {
    x = x + '';
    for (i = x.length + 1; i <= nb_chiffres; i++) x = '0' + x;
    return (x);
}

function add_test() {
    var valeur = "";
    var Xmail = "";
    var Xpays = "";
    if (document.form1.surName.value == "") {
        valeur = "test";
        Xmail = "contact@ctoutvert.com";
        Xpays = "FR";
    }
    var param = "surName;firstName;adress;postCode;town;tel;fax";
    var tab_param = param.split(";");
    if ((document.form1.surName.value == "") || (document.form1.surName.value == "test")) {
        document.form1.country.value = Xpays;
        for (var pp = 0; pp < tab_param.length; pp++) {
            eval("document.form1." + tab_param[pp] + ".value='" + valeur + "'");
        }
        document.form1.email.value = Xmail;
        document.form1.day_birthDate.value = "15";
        document.form1.month_birthDate.value = "1";
        document.form1.year_birthDate.value = "1985";
        if (document.form1.selectAdditionalPers) {
            document.form1.selectAdditionalPers.value = '0';
        }
    }
}

function ChangeNbAccompagningPersons(PersChoice, PersMax) {
    if ((PersMax == "") || (PersMax < 1)) PersMax = 0;
    PersMax -= 2; // Pour tetirer la valeur vide et la valeur 0 de la liste
    if (PersMax < 0) PersMax = 0;
    if ((PersChoice == "") || (PersChoice < 1)) PersChoice = 0;
    var headAccompagnant = document.getElementById("HeadAccompagningPersons");

    if (headAccompagnant) {
        if (PersChoice == 0) headAccompagnant.style.display = "none";
        else headAccompagnant.style.display = "";
    }

    for (i = 1; i <= Number(PersChoice); i++) {
        var ligne_acc = document.getElementById("AccompagningPersons_" + i);
        if (ligne_acc) ligne_acc.style.display = "";
    }
    for (i = Number(PersChoice) + 1; i <= Number(PersMax); i++) {
        var ligne_acc = document.getElementById("AccompagningPersons_" + i);
        if (ligne_acc) ligne_acc.style.display = "none";
    }
}


function initCustomerForm() {

    var infoResa = InitInfoResaFormCustomerForm(idEngine, idEtablissement, isoLanguageCode, tac, spec, crcChoosenOption, StringIdAssurance)
    MyCustomerForm = new CustomerForm(infoResa);
    MyCustomerForm.SetForInfoPerso("surName", "firstName", "birthDate", "adress", "postCode", "town", "country", "tel", "fax", "email", "specialRequest");
    MyCustomerForm.SetAccompanyingPerson("surName_AP", "firstName_AP", "birthDate_AP", "selectAdditionalPers");
    MyCustomerForm.SetForPitch("itemsInfosForPitch", "pitchLength", "pitchWidth");
    MyCustomerForm.SetForAirport("OptAirport", "airportTransfertCustumerComment");
    var ObjNbAcc = document.getElementById("selectAdditionalPers");
    if (ObjNbAcc) {
        ChangeNbAccompagningPersons(ObjNbAcc.value, 0);
    }
}


/**Récapitulatif**/

function previousFormCustomer() {

    document.forms[0].action = "customer_form.aspx";
    document.forms[0].submit();
}

function goPayment(x) {

    switch (language) {
    case "FR":
        var lg = "f";
        break;

    case "NL":
        var lg = "h";
        break;

    case "DE":
        var lg = "a";
        break;

    case "EN":
        var lg = "u";
        break;

    case "ES":
        var lg = "e";
        break;

    case "IT":
        var lg = "i";
        break;

    default:
        var lg = "";
        break;
    }

    var param = "ggh=1&nc=" + nc + "&bscrc=" + bscrc + "&lg=" + lg;
    if (numAffilie != "") param += "&naap=" + numAffilie;
    if (x == "ssl/caddy_ssl.asp?") deburl = replace(deburl, "http://", "https://");
    var url = deburl + x + param;
    var mypopup = window.open(url, "payment", "height=650,width=660,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes");
    mypopup.focus();
}

function replace(string, text, by) {
    var strLength = string.length,
        txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0, txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0, i) + by;

    if (i + txtLength < strLength) newstr += replace(string.substring(i + txtLength, strLength), text, by);
    return newstr;
}
