
function changeColor(colorName,colorCode,imageURL,heightSmall) {
    if (lastColorCode != colorCode) {
        document.getElementById('product-image').src = imageURL;
        document.getElementById('color_'+lastColorCode).style.height = heightSmall+'px';
        document.getElementById('color-name').innerHTML = colorName;

        if (document.getElementById('link-add') != null) {
            reg = new RegExp(lastColorCode+"$",'g');
            url = document.getElementById('link-add').href;
            url = url.replace(reg,colorCode) ;
            document.getElementById('link-add').href = url;
        }

        lastColorCode = colorCode;
    }
}

function deletePurchase(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer cet achat ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

function deleteOrder(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer cette commande?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

function deleteCode(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer ce code promotionnel ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

function deleteDistributor(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer ce distributeur ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

function deleteStore(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer ce point de vente ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

function deleteProject(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer ce projet ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

function deletePhoto(parent,id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer cette photo ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id+'&parent='+parent;
    }
}

function deletePress(id) {
    if (confirm('Êtes-vous sûr de vouloir supprimer cette publication ?     ')) {
        url = window.location.href;
        tmp = url.split('?');
        url = tmp[0];

        window.location.href = url+'supprimer.html?id='+id;
    }
}

