if(!Array.indexOf){ Array.prototype.indexOf = function(obj){ for(var i=0; i 0) { document.getElementById('comparebutton').value = "Comparer " + selectionLength + " produit"; if (selectionLength > 1) { document.getElementById('comparebutton').value += "s"; } document.getElementById('cancelselection').style.display = "inline"; }else{ document.getElementById('comparebutton').value = "Comparer"; document.getElementById('cancelselection').style.display = "none"; } } compare = function(action){ selection = getSelection(); query = ""; for (i = 0; i < selection.length; i++){ query += "&selection" + (i + 1) + "=" + selection[i]; } destination = action + "?" + query; if (selection.length == 0 ){ alert("Selectionnez jusqu'à 4 produits"); }else if (selection.length > 4){ alert("Vous pouvez comparer 4 produits au maximum"); }else{ location.href = destination; } } switchFormSection = function(selected){ for (var id = 1; document.getElementById('tab' + id) != null; id++){ tab = document.getElementById('tab' + id); section = document.getElementById('section' + id); tab.className = "off"; section.style.display = "none"; } for (var id = 1; document.getElementById('tab' + id) != null; id++){ tab = document.getElementById('tab' + id); section = document.getElementById('section' + id); if (id == selected){ tab.className = "on"; section.style.display = "block"; section.style.visible = "true"; section.style.visible = "false"; } } } switchFormSection2 = function(selected){ for (var id = 1; document.getElementById('tab' + id) != null; id++){ tab = document.getElementById('tab' + id); section = document.getElementById('section' + id); if (id == selected){ tab.className = "on"; section.style.display = "block"; }else{ tab.className = "off"; section.style.display = "none"; } } } discloseSubmenu = function(id){ submenu = document.getElementById(id); submenuOn = document.getElementById(id + "on"); submenuOff = document.getElementById(id + "off"); if (submenu.style.display == "none"){ submenu.style.display = "block"; submenuOn.style.display = "block"; submenuOff.style.display = "none"; }else{ submenu.style.display = "none"; submenuOn.style.display = "none"; submenuOff.style.display = "block"; } } deleteProduct = function(id){ if (confirm('Ce produit sera supprimé définitivement')){ window.location = "products?action=delete&id=" + id; } } deleteMatch = function(id){ if (confirm('Ce match sera supprimé définitivement')){ window.location = "http://www.ecolocompare.com/matches/delete?id=" + id; } } deleteCategory = function(id){ if (confirm('Cette catégorie sera supprimée définitivement')){ window.location = "categories?action=delete&id=" + id; } } deleteArticle = function(id){ if (confirm('Cet article sera supprimée définitivement')){ window.location = "articles?action=delete&id=" + id; } }