function setURLAnchor(value)
{
    url = document.location.href;
    base = url.split("#")[0];
    //base = base.split("/V-")[0];
    url = base+"#"+value;
    document.location.href = url;
}

String.prototype.startsWith = function(str)
{
    return (this.match("^"+str) == str)
}

function isset(variable)
{
    if ( typeof( window[variable] ) != "undefined" )
    {
        return true;
    }
    else
    {
        return false;
    }
}

$(document).ready(function()
{
    var url = document.location.toString();
    if (url.match('#')) {
        var myAnchor = url.split('#')[1];
        if (myAnchor.startsWith("Vehicle-"))
        {
            var immat = myAnchor.split("-")[1];
            OpenVehicleDetail("vehicle-detail.php?numero_immat="+immat, myAnchor);
        }
        else if (myAnchor == "SiteMap")
        {
            InitBodyContent();
            jQuery.ajax({
                type: "GET",
                url: "sitemap.php",
                success: function(response) {
                    HideContent("content");
                    SetContent("detail", response);
                },
                error: function(xhr, ajaxOptions, thrownError) {
                    SetContent("detail", thrownError);
                }
            });
        }
        //$('ol#nav li a[href="' + myAnchor + '"]').parent().click();
    } else {
        if ((searchModele))
        {
           SearchMarqueModele((searchMarque.split("-").join(" ")),searchModele.split("-").join(" "));
        }
        else if ((searchMarque))
        {
           SearchMarque(searchMarque.split("-").join(" "));
        }
        else if (goVehicle)
        {
            OpenVehicleDetail("vehicle-detail.php?numero_immat="+goVehicle, goVehicle);
        }
        
        
        //$('ol#nav li:first').click();
    }
});
