// JavaScript Document
//alert("managefood online");
var myajax=new ajaxObject("","admin/includes/db-ops.php","returFunction"); 
var curid=0;
var curnr=0;

var running=false;
var requests=new Array();

function setrequest(what){
  requests.push(what);  
  if(!running){
    running=true;
    sendMore();
    
  }
}

function sendMore(){
   if(requests.length>0){
     myajax.setDataToSend(requests[0]);
     myajax.sendData();
     requests.shift();
  }else{
    running=false;
  }
}




function loadtxtinpage(myfile,divname){
   //cureditor=who;
  
   setrequest("op=incarcatxtinpagina&file="+myfile+"&divname="+divname+"&opcode=1");
  
}

function extractNumber(respobj,mystring){
  var cnt=0;
  while(mystring[cnt]!=";" && cnt<mystring.length){
    cnt++;
  }
  var nr=mystring.substring(0,cnt)*1;
  mystring=mystring.substring(cnt+1,mystring.length);
  respobj.val=nr;
  respobj.rest=mystring;
  
  //extractNumber.caller.call(eval,nrname+"="+nr);
  
}

function returFunction(resp){
  
 
  var extrobj=new Object();
  extractNumber(extrobj,resp);
  
  var opid=extrobj.val;
  resp=extrobj.rest;
  
  switch(opid){
    
      
      case 1:
        
       var cnt=0;
        while(resp[cnt]!=";" && cnt<resp.length){
          cnt++;
        }
        var mydivname=resp.substring(0,cnt);
        var mesaj=resp.substring(cnt+1,resp.length);
        
        document.getElementById(mydivname).innerHTML=mesaj;
        //cureditor.putHTML(myajax.retur);
        break;
        
  }
  sendMore();
}


function uploadCallback(ok,newname){
 //alert(newname+","+ok);
 if(ok=="1" || newname==""){
  if(newname!=""){
     var cecaut="image"+curnr;
     var tmpimg=document.getElementById(cecaut);
     tmpimg.src="../pics/"+newname+".jpg";
   } 
 }else{
   alert("eroare la incarcarea imaginii");
 }
 //alert(ok+","+curid+","+curnr);
 
  salveazaDatele();
  
}


// initializare editor text

/*oEdit1 = new InnovaEditor("oEdit1");
		//oEdit1.width=350;
		//oEdit1.height=350;		
oEdit1.features=["Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|", "ForeColor","BackColor","|", "Numbering","Bullets","|","Indent","Outdent","|","Table","|", "Guidelines","|","Absolute","|", "Paragraph","FontName","FontSize","|", "Bold","Italic","Underline", "Superscript", "Subscript","|", "JustifyLeft","JustifyCenter","JustifyRight","JustifyFull"];
		oEdit1.customColors=["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"];
        //oEdit1.cmdAssetManager="modalDialogShow(\'../../assetmanager/assetmanager.php\',640,445);";
oEdit1.REPLACE("contenttxttxt");
*/
//--------------------------

