/* Zobrazit tipy */
function tipHostShow(urlmodul,valueType,idHosting,nameHosting,isLogin){
   var url = urlmodul;
   var timeStamp = "casotisk=" + new Date().getTime();
   var urlPost = url + '?' + timeStamp;

   // Nastavit pocet prvku
   $('app_info_text').set('text','Pracuji');
   // Zobrazit info box
   ShowAppBox.showBox($('app_info'));
   /* Zobrazit info */
   ViewPort.centerObject($('app_info'), 300, 100);

   // Nastavit hodnotu typu hostingu
   $('id_tiptype').setProperty('value',valueType);
   // Nastavit hodnotu id hostingu
   $('id_tiphosting').setProperty('value',idHosting);
   // Nastavit nazev hostingu
   $('id_tipname').set('text',nameHosting);

   var postData = 'tiphosting=' + idHosting + '&tiptype=' + valueType;

   var myAjax = new Request({method: 'post', url: urlPost,data:postData,onComplete: resultTipHostShow}).send();
}
/* Zpracovat pozadavek */
function resultTipHostShow(){
   //alert(this.response.text);
   workTipHostShow(this.response.xml);
}
/* Zpracovat pozadavek */
function workTipHostShow(xmlDoc){

   // Zobrazit info box
   ShowAppBox.showBox($('app_info'));

   // Poznamka
   var note = xmlDoc.getElementsByTagName('note')[0].firstChild.data;
   // Login
   var login = xmlDoc.getElementsByTagName('login')[0].firstChild.data;

   if(login == 1){
      // Nastavit hodnotu poznamky
      $('id_tipdes').set('value',note);
   }

   // Zobrazit info box
   ShowAppBox.showBox($('hosting_utip'));
   /* Zobrazit info */
   ViewPort.centerObject($('hosting_utip'), 500, 300);

}

/* Zavrit tipy */
function tipHostClose(){
   // Zobrazit info box
   ShowAppBox.showBox($('hosting_utip'));
}
/* Odeslat hodnoceni */
function tipHostSend(urlmodul,msg){
   var url = urlmodul;
   var timeStamp = "casotisk=" + new Date().getTime();
   var urlPost = url + '?' + timeStamp;

   var postData = 'tiphosting=' + $('id_tiphosting').get('value') + '&tipdes=' + $('id_tipdes').get('value') + '&tiptype=' + $('id_tiptype').get('value');

   var myAjax = new Request({method: 'post', url: urlPost,data:postData,onComplete: resultTipHostSend}).send();
}
/* Zpracovat pozadavek */
function resultTipHostSend(){
   //alert(this.response.text);
   workTipHostSend(this.response.xml);
}
/* Zpracovat pozadavek */
function workTipHostSend(xmlDoc){
   // Indikace hodnoceni
   var state = parseInt(xmlDoc.getElementsByTagName('state')[0].firstChild.data);
   // Zprava
   var msg = xmlDoc.getElementsByTagName('msg')[0].firstChild.data;

   // Zavrit box
   if(state){
      ShowAppBox.showBox($('hosting_utip'));
      // Schovat tlacitko tipu
   }
   alert(msg);
}
/* Odeslat smazani typu */
function tipHostRemove(urlmodul,idRecord,valueType,msg){
   var url = urlmodul;
   var timeStamp = "casotisk=" + new Date().getTime();
   var urlPost = url + '?' + timeStamp;

   if(confirm(msg)){
      var postData = 'idrecord=' + idRecord + '&tiptype=' + valueType;

      var myAjax = new Request({method: 'post', url: urlPost,data:postData,onComplete: resultTipHostRemove}).send();
   }
}
/* Zpracovat pozadavek */
function resultTipHostRemove(){
   //alert(this.response.text);
   workTipHostRemove(this.response.xml);
}
/* Zpracovat pozadavek */
function workTipHostRemove(xmlDoc){
   // Indikace uspechu
   var state = parseInt(xmlDoc.getElementsByTagName('state')[0].firstChild.data);
   var idRecord = parseInt(xmlDoc.getElementsByTagName('idrecord')[0].firstChild.data);
   var msg = xmlDoc.getElementsByTagName('msg')[0].firstChild.data;
   // Odstranit tip
   if(state == 1) $('id_tip'+idRecord).destroy();
   else alert(msg);
}
