﻿
function getDestinations(w) {
    var callback = function (data) {
        $("#DestinationsHolder").empty();
        for (var i = 0; i < data.length; i++) {
            placeDestinationLink(data[i].PageName, data[i].PageNameSeo);
        }
    }
    $("#DestinationsHolder").html("<img src='" + imgAjaxLoaderUrl + "'/>");
    var franchiseId = 0;
    if ($('#StoreBoundId').length > 0) {
        franchiseId = $('#StoreBoundId').val();
        $.getJSON('services/werelddelenxml.ashx?continent=' + w + '&franchise=' + franchiseId, callback);
    }
    else {
        $.getJSON('services/werelddelenxml.ashx?continent=' + w, callback);
    }
    
}

function placeDestinationLink(name, linkname) {
    var linkNameSrc = linkname
    $('<a href="/' + linkNameSrc + '">&raquo; ' + name + '</a><br/>').hide().prependTo('#DestinationsHolder').fadeIn('slow');
}

String.prototype.capitalize = function () {
    return this.replace(/(^|\s)([a-z])/g, function (m, p1, p2) { return p1 + p2.toUpperCase(); });
};
