var IsIndex  = window.location.href.indexOf("/index.html") != -1;
var IsSearch = window.location.href.indexOf("/search.html") != -1;
var ProdFolder = location.pathname.split('/')[1];
var SearchPath = '/' + ProdFolder + '/search.html';
if (IsWKHostedImpStrat){ SearchPath = '/' + 'WK-Hosted-Expere/Implementation-Strategies/' + 'search.html'; }
if (IsWKHostedChangelog){ SearchPath = '/' + 'WK-Hosted-Expere/Change-Log/' + 'search.html'; }
if (IsWKHostedToolSuite){ SearchPath = '/' + 'WK-Hosted-Expere/Tool-Suite/' + 'search.html'; }


console.log(SearchPath);

if (!IsIndex && !IsSearch){
    $('#searchForm').attr('action', SearchPath);
    // // Remove existing search form
    // $("form").eq(1).remove();
    // $("form").eq(0).remove();

    // $('<div/>', {class: 'divSearchNew input-group'})
    //     .appendTo('.wh_logo_and_publication_title');
    // $('<form/>', { action: SearchPath })
    //     .append(
    //         $('<label>', {id: 'inputLabel', for: 'name', class: 'input-label'}).text('Search'))
    //     .append(
    //         $('<input>', {type: 'search', class: 'wh_search_textfield input ui-autocomplete-input', id: 'textToSearch-new', name: 'searchQuery',
    //         label: 'Search query', required: 'required'})            )
    //     .appendTo('.divSearchNew');
    // $('.divSearchNew').css({
    //     'margin-left': '100px',
    //     'display': 'inline-flex'});
    // $('#inputLabel').css('display','inline-block');



     // $('#textToSearch').remove();

    // Create search input field
    // $('<input/>')
    //     .attr("id", "textToSearch-new")
    //     .attr("type", "search")
    //     .addClass("wh_search_textfield ui-autocomplete-input input")
    //     .text("asdfasdfasdf")
    //     .insertAfter('.divSearch>.input-label');

    // $("input").keypress(function (e){
    //     if (e.which == 13) {
    //         e.preventDefault(); // Keep the form from submitting
    //         var QueryVal = $('#textToSearch-new').val();
    //         // // $("#searchForm").submit(); // Submit the form
    //         window.location.replace(SearchPath + '?searchQuery=' + QueryVal);
    //         // // window.location.href = "www.google.com";
    //     }
    // });
}


// if (!IsIndex && !IsSearch){
//     $('#searchForm').attr('action', window.location = SearchPath + '?searchQuery=' + QueryVal);
//     // if (e.which == 13) {
//     //     e.preventDefault();
//     // }
// }



// if (IsWrongSearchPath){
//     console.log('Is Wrong Search Path');
//     var url = window.location.toString();
//     window.location = url.replace(/topic/search, '/search');
// }
