/* Nastaveni indikace archivu */
function navSetArchive(el,urlmodul,message){
   // Indikace archivu
   var setArchive = 0;
   if($(el).checked){
      setArchive = 1;
   }

   // Url katalogu
   var urlCatalog = $('id_eshop_arch_url').value;

   var url = urlmodul;
   var timeStamp = "casotisk=" + new Date().getTime();
   var urlPost = url + '?' + timeStamp;
   var postData = 'setarchive=' + setArchive + '&url=' + urlCatalog;

   // Nastavit text
   $('order_info_text').setText(message);

   // Zobrazit info
   if($('order_info').hasClass('hidden')) {
      $('order_info').removeClass('hidden');
   }
   ViewPort.centerObject($('order_info'), 400, 100);


   var myAjax = new Ajax(urlPost, {method: 'post',postBody: postData,onComplete: resultNavSetArchive }).request();
}

/* zpracovani onComplete nastaveni archivu */
function resultNavSetArchive(){
   // zapracovat vysledek
   //alert(this.response.text);
   workNavSetArchive(this.response.xml);
   //alert(this.response.text);
}

/* Zpracovani vysledku pridani do kosiku */
function workNavSetArchive(xmlDoc){
   // schovat info
   $('order_info').addClass('hidden');

   // Ziskat dat url
   var url = xmlDoc.getElementsByTagName("url")[0].firstChild.data;

   // Pokud je nejaka url presmerovat
   if(url != 0){
      window.location.href = url;
   }
}
