function getSlot(page, action, opcode, id, admin){
  admin = (admin)? gBaseAdmin : gBase
  qStr = "page="+page+"&action="+action+"&opcode="+opcode+"&id="+id
  sbAjax.addQuery("POST", admin+"getSlot.php", qStr, true, "getSlotComplete('"+page+"', '"+action+"', '"+opcode+"', '"+id+"')", "moduleSetLoader_user()", "moduleSetLoader_user()", true)
}

function getSlotComplete(page, action, opcode, id, rText, rXml){
  rText = rText.split("||")
  modSuffix = rText[1]
  rText = rText[0]
  //if (rText == "modul" || rText == "modul_form"){
    ajaxCall(page, action, opcode, id, "showModul('"+rText+"')", false, false, modSuffix, "moduleSetLoader_user()")
  //}else{
    //if (!gDSlot){
  //    gDSlot = rText.replace(/widget/g, "")
    //}
  //  ajaxCall(page, action, opcode, id, "showWidget('"+gDPage+"', '"+gDSlot+"')", false, false, modSuffix, "moduleSetLoader_user()")
  //}
}

function openModul(page, action, opcode, id){
  slot = getSlot(page, action, opcode, id)
}

function openModulNoAjax(page, action, opcode, id){
  if (getCookie("has_ajax") == "true"){
    openModul(page, action, opcode, id)
  }else{
    window.location = createUrl(page, action, opcode, id, true, false, true)
  }
}

function showModul(slot, rText, rXml){
  temp = rText.slice(rText.indexOf("|menu_start|::"), rText.indexOf("::|menu_end|")+12)
  temp2 = rText.split(temp)
  temp4= temp2[1].slice(temp2[1].indexOf("|hiba_start|::"), temp2[1].indexOf("::|hiba_end|")+12)
  hiba = temp4.replace(/\|hiba_start\|::/g, "").replace(/::\|hiba_end\|/g, "")
  if (hiba){
    throwError(hiba)
  }
  temp2 = temp2[1].split(temp4)
  temp5 = temp2[1].slice(temp2[1].indexOf("|success_start|::"), temp2[1].indexOf("::|success_end|")+15)
  temp2 = temp2[1].split(temp5)
  temp5 = temp2[1].slice(temp2[1].indexOf("|mtitle_start|::"), temp2[1].indexOf("::|mtitle_end|")+14)
  mTitle = temp5.replace(/\|mtitle_start\|::/g, "").replace(/::\|mtitle_end\|/g, "")
  temp2 = temp2[1].split(temp5)
  temp5 = temp2[1].slice(temp2[1].indexOf("|mftitle_start|::"), temp2[1].indexOf("::|mftitle_end|")+15)
  mfTitle = temp5.replace(/\|mftitle_start\|::/g, "").replace(/::\|mftitle_end\|/g, "")
  temp2 = temp2[1].split(temp5)
  temp5 = temp2[1].slice(temp2[1].indexOf("|widget_start|::"), temp2[1].indexOf("::|widget_end|")+14)
  doFunction = temp5.replace(/\|widget_start\|::/g, "").replace(/::\|widget_end\|/g, "")
  temp2 = temp2[1].split(temp5)
  document.getElementById(slot).innerHTML = temp2[1]
  if (document.getElementById(slot).getElementsByTagName("textarea")){
    fTemp = document.getElementById(slot).getElementsByTagName("textarea")
    for (xJ in fTemp){
      if (fTemp[xJ] && fTemp[xJ].lang == "fckeditor" && navigator.appName != "Opera"){
        oFCKeditor = new FCKeditor( fTemp[xJ].name ) 
        oFCKeditor.BasePath = gBase+"plugins/fckeditor/"
        oFCKeditor.Height = fTemp[xJ].style.height
        oFCKeditor.ToolbarSet = "Basic"
        oFCKeditor.ReplaceTextarea() ;
      }
    }
    fTemp = document.getElementById(slot).getElementsByTagName("input")
    for (xJ in fTemp){
      if (fTemp[xJ] && fTemp[xJ].lang == "sb_calendar"){
        calName = fTemp[xJ].id.replace(/_clndDefVal/g, "")
        eval(calName+" = new sb_calendar('"+calName+"')")
        eval(calName+".init('cont_"+calName+"', '"+calName+"')")
      }
    }
  }
  if (doFunction){
    eval(doFunction)
  }
}

function getModuleContent(rText){
  temp = rText.slice(rText.indexOf("|menu_start|::"), rText.indexOf("::|menu_end|")+12)
  temp2 = rText.split(temp)
  temp4= temp2[1].slice(temp2[1].indexOf("|hiba_start|::"), temp2[1].indexOf("::|hiba_end|")+12)
  hiba = temp4.replace(/\|hiba_start\|::/g, "").replace(/::\|hiba_end\|/g, "")
  if (hiba){
    throwError(hiba)
  }
  temp2 = temp2[1].split(temp4)
  temp5 = temp2[1].slice(temp2[1].indexOf("|success_start|::"), temp2[1].indexOf("::|success_end|")+15)
  temp2 = temp2[1].split(temp5)
  temp5 = temp2[1].slice(temp2[1].indexOf("|mtitle_start|::"), temp2[1].indexOf("::|mtitle_end|")+14)
  mTitle = temp5.replace(/\|mtitle_start\|::/g, "").replace(/::\|mtitle_end\|/g, "")
  temp2 = temp2[1].split(temp5)
  temp5 = temp2[1].slice(temp2[1].indexOf("|mftitle_start|::"), temp2[1].indexOf("::|mftitle_end|")+15)
  mfTitle = temp5.replace(/\|mftitle_start\|::/g, "").replace(/::\|mftitle_end\|/g, "")
  temp2 = temp2[1].split(temp5)
  temp5 = temp2[1].slice(temp2[1].indexOf("|widget_start|::"), temp2[1].indexOf("::|widget_end|")+14)
  doFunction = temp5.replace(/\|widget_start\|::/g, "").replace(/::\|widget_end\|/g, "")
  if (doFunction){
    eval(doFunction)
  }
  temp2 = temp2[1].split(temp5)
  return temp2[1]
}

function throwError(){
  
}