function Promo3(id_promotie, comanda){
  var f=document.Promotii;
  f.comanda.value = comanda;
  f.action += "&id_promotie=" + id_promotie + "&action=InsertProducts";
  f.submit();
}

function Left(){
  old_index=index;
  index=index-1;
  if (index<0) index = titluri.length-1;
  NewItemSelect(index);
}

function Right(){
  old_index=index;
  index=index+1;
  if (index==titluri.length) index = 0;
  NewItemSelect(index);
}

function NewItemSelect(idx){
  index=idx;
  if (index != -1) {
    document.getElementById('content_td_2').style.display='';
    document.getElementById('content_table').style.display='none';
  var titlu = document.getElementById("titlu");
  var subtitlu = document.getElementById("subtitlu");
  var poza = document.getElementById("poza");
  var text = document.getElementById("text");
  var sel1 = document.getElementById("sel" + old_index);
  var sel2 = document.getElementById("sel" + index);

  poza.src=poze[idx];
  poza.alt = alts[idx];
  /* alert("images/skin/buton-" + old_index + "a.gif");
  alert("images/skin/buton-" + idx + "b.gif"); */
  sel1.src="images/skin/buton-" + old_index + "a.gif";
  sel2.src="images/skin/buton-" + idx + "b.gif";
  titlu.innerHTML = titluri[idx];
  subtitlu.innerHTML = subtitluri[idx];
  text.innerHTML = texte[idx];
  } else {
    //Modificat Cristi
                if (document.getElementById('content_td_2').style.display=='none' && z==1) {
                   document.getElementById('content_td_2').style.display='';
                   document.getElementById('content_table').style.display='none';
                } else {
    document.getElementById('content_td_2').style.display='none';
    document.getElementById('content_table').style.display='';
    var in0 = '<div class="text_articol_home_page" style="text-align: center;">';
    in1='';
    for (var i=1; i<=pagini; i++) {
        in1 += '&nbsp;<span><a onMouseOver=\'SelTemp(-1)\' onMouseOut=\'DeSelTemp(-1)\' href=\'javascript: pg='+i+';z=0;old_index=index;NewItemSelect(-1);\' target=\'_self\'><img border=\'0\' src=\'images/skin/buton-'+(i-1); if (i==pg) {in1 += 'b';}else{in1 += 'c';} in1 += '.gif\' onmouseover=\'this.src="images/skin/buton-'+(i-1)+'b.gif"\' onmouseout=\'this.src="images/skin/buton-'+(i-1); if (i==pg) {in1 += 'b';}else{in1 += 'c';} in1 += '.gif"\' align=\'bottom\' /></a></span> ';
    }
    in1 += '</div>';
    var in2 = '<div style=\"margin-bottom: 25px;\"><span class=\"titlu_produs_home_page2\">Toate articolele</span></div>';
    document.getElementById('content_td').innerHTML = in2;
    document.getElementById('content_td').innerHTML += articole[pg];
    document.getElementById('content_td').innerHTML += in0+in1;
                }
    //End modificat Cristi
  }
}

function SelTemp(idx){
  if (idx != -1) {
  var sel = document.getElementById("sel" + idx);
  var ptitlu = document.getElementById("preview_titlu");
  ptitlu.innerHTML = "<b>" + ReplaceTags(titluri[idx]).substring(0, 40) + "</b>";

  sel.src="images/skin/buton-" + idx + "b.gif";
  } else {
    document.getElementById('preview_titlu').innerHTML='<b>Toate articolele</b>';
  }
}

function DeSelTemp(idx){
  if (idx != -1) {
  var sel = document.getElementById("sel" + idx);
  var ptitlu = document.getElementById("preview_titlu");
  //ptitlu.innerHTML = "";

  if(idx!=index) sel.src="images/skin/buton-" + idx + "a.gif";
  } else {
    document.getElementById('preview_titlu').innerHTML='';
  }
}

//Functie Cristi, pentru a deselecta numerele care nu sunt egale cu index, e un bug, raman selectate
function DeSelOther(idx) {
         //deselecteaza toate cifrele pana la 5 in afara de idx
         if (idx==-1) {
           if (document.getElementById('span_cifre').style.display=='none') {
              document.getElementById('span_cifre').style.display='';
              document.getElementById('sageata').src='images/Arrows.gif';
           } else {
             document.getElementById('span_cifre').style.display='none';
             document.getElementById('sageata').src='images/Arrows_back.gif';
           }
         }
         for (var i=0; i<5; i++) {if (i!=idx) {document.getElementById("sel" + i).src="images/skin/buton-" + i + "a.gif";}}
}