if((typeof(HTMLElement)!="undefined")&&(!HTMLElement.prototype.insertAdjacentHTML))
  {
  HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr) { var r=this.ownerDocument.createRange();r.setStartBefore(this);var parsedHTML=r.createContextualFragment(htmlStr);this.appendChild(parsedHTML); }
  }

      function SetProperties(xElem,xHidden,xserverCode,
        xignoreCase,xmatchAnywhere,xmatchTextBoxWidth,
        xshowNoMatchMessage,xnoMatchingDataMessage,xuseTimeout,
        xtheVisibleTime,xCryptQ,xFieldsQ,xMyForm){
          var props={
            elem: xElem,
            hidden: xHidden,
            serverCode: xserverCode,
            regExFlags: ( (xignoreCase) ? "i" : "" ),
            regExAny: ( (xmatchAnywhere) ? "" : "^" ),
            matchAnywhere: xmatchAnywhere,
            matchTextBoxWidth: xmatchTextBoxWidth,
            theVisibleTime: xtheVisibleTime,
            showNoMatchMessage: xshowNoMatchMessage,
            noMatchingDataMessage: xnoMatchingDataMessage,
            useTimeout: xuseTimeout,
            cryptQ:xCryptQ,
            fieldsQ:xFieldsQ,
            myForm:xMyForm
          };
          AddHandler(xElem);
          return props;
      }

var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!= -1);
      
      function AddHandler(objText){
      	objText.onkeypress= function(e) { intKey=(window.event?event.keyCode:e.which); if(intKey==13) { GrabHighlighted(); theTextBox.blur(); frm=theTextBox.form;inp=document.createElement("input");inp.type="hidden";inp.name="find";inp.value=1;frm.appendChild(inp); frm.submit(); } } 
        objText.onkeyup = GiveOptions;
        objText.onblur = function(){
          if(this.obj.useTimeout) { StartTimeout(); }
          HideTheBox();
         }
        // if(isOpera)objText.onkeypress = GiveOptions;
      }
      var aO = new Array();
      var strLastValue = "";
      var bMadeRequest;
      var theTextBox;
      var objLastActive;
      var currentValueSelected = -1;
      var bNoResults = false;
      var isTiming = false;
	  var bPermitRequest = true;
      
      function GiveOptions(e){
        var intKey = -1;
        if(window.event){
          intKey = event.keyCode;
          theTextBox = event.srcElement;
        }
        else{
          intKey = e.which;
          theTextBox = e.target;
        }
        if(theTextBox.obj.useTimeout){
          if(isTiming)EraseTimeout();
          StartTimeout();
        }
        if(theTextBox.value.length == 0 && !isOpera){
          aO = new Array();
          bNoResults = false;          
          HideTheBox();
          strLastValue = "";
          return false;
        }
        if(objLastActive == theTextBox){
          if(intKey == 13){
			GrabHighlighted();
			theTextBox.blur();
            return false;
            /**/
          }
          else if(intKey == 38){
            MoveHighlight(-1);
            return false;
          }
          else if(intKey == 40){
            MoveHighlight(1);
            return false;
          }
          else{}
        }
        if (theTextBox.value.length > 3){
			if(objLastActive != theTextBox ||((aO.length==0 || aO.length==15 ) && !bNoResults)){
	         objLastActive = theTextBox;
             bMadeRequest = true;
             TypeAhead();
			}
			else if(!bMadeRequest){
			BuildList(theTextBox.value);
			}
        }
        else{
			document.getElementById("DivCombo").style.display="none";
			document.getElementById("IFrCombo").style.display="none";
			bPermitRequest = true;
        }
        strLastValue = theTextBox.value;
      }

      function TypeAhead(){
      	// Compone relación de campos de control
      	cFieldsQ=theTextBox.obj.fieldsQ; aFieldsQ=cFieldsQ.split(",");
      	var strParams ="fieldsQ="+cFieldsQ+"&";
      	for (n=0;n<aFieldsQ.length;n++) strParams+=aFieldsQ[n]+'='+document.getElementById(aFieldsQ[n]).value+'&';
      	strParams += theTextBox.obj.cryptQ;
        var strParams1 = strParams.replace(/ñ/gi,"_n_");
        var reg = /\s+/gi;
        strParams = strParams1.replace(reg,"+");
		if (bPermitRequest == true){
			var loader1 = new net.ContentLoader(theTextBox.obj.serverCode,BuildChoices,null,"POST",strParams);
			bPermitRequest = false;
		}	
      }

      
      function BuildChoices(){
		var strText = this.req.responseText;
		 eval(strText);
//		 alert('devueltas ' + aO.length +' filas');
        BuildList(strLastValue);
       theTextBox.disabled=0;
       document.getElementById("DivCombo").style.display="block";        
        bMadeRequest = false;
      }

      var inumshow
      function BuildList(theText){
        SetElementPosition(theTextBox);
        var theMatches = MakeMatches(theText);
        var atoshow = new Array();
        var sshow;
        
        if (theMatches.length < 25){
			inumshow = theMatches.length;
			}
        else{
			inumshow = 25;
          }
        atoshow[0]="<span style='width:100%;display:block;' class='spanTitleElement'>Se han encontrado estas coincidencias...</span>";
        for(i=0;i<inumshow;i++){  
			atoshow[atoshow.length]=theMatches[i];
        }
        sshow = atoshow.join().replace(/\,/gi,"");
        bPermitRequest = true;
        if(atoshow.length > 1){
        	fillDivCombo(sshow);
          document.getElementById("OptionsList_0").className="spanHighElement";
          currentValueSelected = 0;
          bNoResults = false;
 
        }
        else{
          currentValueSelected = -1;
          bNoResults = true;
          if(theTextBox.obj.showNoMatchMessage)
            fillDivCombo("<span class='noMatchData'>" + theTextBox.obj.noMatchingDataMessage + "</span>");
            
          else { HideTheBox(); }
        }
      }

      
      function SetElementPosition(theTextBoxInt){
        var selectedPosX = 0;
        var selectedPosY = 0;
        var theElement = theTextBoxInt;
        if (!theElement) return;
        var theElemHeight = theElement.offsetHeight;
        var theElemWidth = theElement.offsetWidth-2; // border*2
        while(theElement != null){
          selectedPosX += theElement.offsetLeft;
          selectedPosY += theElement.offsetTop;
          theElement = theElement.offsetParent;
        }
        xPosElement = document.getElementById("DivCombo");
        xPosElement.style.left = selectedPosX+'px';
        if(theTextBoxInt.obj.matchTextBoxWidth)
           xPosElement.style.width = theElemWidth+'px';
        xPosElement.style.top = (selectedPosY + theElemHeight)+'px';
        xPosElement.style.display = "block";

        if(theTextBoxInt.obj.useTimeout){
          xPosElement.onmouseout = StartTimeout;
          xPosElement.onmouseover = EraseTimeout;
        }
        else{
          xPosElement.onmouseout= function() {theTextBox.onblur = function(){ StartTimeout(); HideTheBox(); } }
          xPosElement.onmouseover = function(){ theTextBox.onblur = null; }      
        }
      }
      var countForId = 0;
      
      function MakeMatches(xCompareStr){
        countForId = 0;
        var matchArray = new Array();
        xCompareStr=xCompareStr.removeAccents();
        var regExp = new RegExp(theTextBox.obj.regExAny + xCompareStr,theTextBox.obj.regExFlags);
        if(typeof(aO[0])!="string") {
          for(i=0;i<aO.length;i++){
             var theMatch = aO[i][0].match(regExp);
             if(theMatch){
                matchArray[matchArray.length]= CreateUnderline(aO[i][0],xCompareStr,i);
                }
             }
          }
        else {
          for(i=0;i<aO.length;i++){
          	 var v=aO[i];
          	 v=v.removeAccents();
             var theMatch = v.match(regExp);
//             var theMatch = aO[i].match(regExp);
             if(theMatch){
                matchArray[matchArray.length]= CreateUnderline(aO[i],xCompareStr,i);
                }
      	
             }
        }
        return matchArray;
      }

      var undeStart = "<span class='spanMatchText'>";
      var undeEnd = "</span>";
      var selectSpanStart = "<span style='width:100%;display:block;' class='spanNormalElement' onmouseover='SetHighColor(this)' ";
      var selectSpanEnd ="</span>";
      
      function CreateUnderline(xStr,xTextMatch,xVal){
		selectSpanMid = "onclick='SetText(" + xVal + ")' " + "id='OptionsList_" + countForId + "' theArrayNumber='"+ xVal +"'>";
        var regExp = new RegExp(theTextBox.obj.regExAny + xTextMatch,theTextBox.obj.regExFlags);
        var aStart = xStr.search(regExp);
        var matchedText = xStr.substring(aStart,aStart + xTextMatch.length);
        countForId++;
        return selectSpanStart + selectSpanMid + xStr.replace(regExp,undeStart + matchedText + undeEnd) + selectSpanEnd;
      }

      function MoveHighlight(xDir){
		if(currentValueSelected >= 0){
          newValue = parseInt(currentValueSelected) + parseInt(xDir);
          if(newValue > -1 && newValue < inumshow){
            currentValueSelected = newValue;
            SetHighColor (null);
          }
        }
      }
      function SetHighColor(theTextBox){
        if(theTextBox){
			currentValueSelected = theTextBox.id.slice(theTextBox.id.indexOf("_")+1,theTextBox.id.length);
        }
        for(i = 0; i < inumshow; i++){
          document.getElementById('OptionsList_' + i).className = 'spanNormalElement';
        }
		  document.getElementById('OptionsList_' + currentValueSelected).className = 'spanHighElement';
      }
      function SetText(xVal){
      document.getElementById("DivCombo").style.display = "none";
      document.getElementById("IFrCombo").style.display = "none";
      currentValueSelected = -1;
	  theTextBox.value=(typeof(aO[0])!="string"?aO[xVal][0]:aO[xVal]);
      }

      
      function GrabHighlighted(){
        if(currentValueSelected >= 0){
          xVal = document.getElementById('OptionsList_' + currentValueSelected).getAttribute("theArrayNumber");
          SetText(xVal);
          HideTheBox();
        }
      }
      function HideTheBox(){
        document.getElementById("DivCombo").style.display = "none";
        document.getElementById("IFrCombo").style.display = "none";
        currentValueSelected = -1;
        if(theTextBox.obj.useTimeout){ EraseTimeout(); }
      }

      function EraseTimeout(){
        theTextBox.onblur = null;
        clearTimeout(isTiming);
        isTiming = false;
      }
      function StartTimeout(){
        theTextBox.onblur = function(){ StartTimeout(); HideTheBox(); }
        isTiming = setTimeout("HideTheBox()",theTextBox.obj.theVisibleTime);
      }
      function fillDivCombo(cShow){
      document.getElementById("DivCombo").innerHTML = cShow;
      xIFrame=document.getElementById("IFrCombo");
      xIFrame.style.left=document.getElementById("DivCombo").style.left;
      xIFrame.style.top=document.getElementById("DivCombo").style.top;
      xIFrame.style.width=document.getElementById("DivCombo").offsetWidth+2;
      xIFrame.style.height=document.getElementById("DivCombo").offsetHeight+2;          
      xIFrame.style.display="block";
      }
      
var net=new Object();

net.READY_STATE_UNINITIALIZED=0;
net.READY_STATE_LOADING=1;
net.READY_STATE_LOADED=2;
net.READY_STATE_INTERACTIVE=3;
net.READY_STATE_COMPLETE=4;

net.ContentLoader=function(url,onload,onerror,method,params,contentType){
  this.req=null;
  net.currentLoader=this;
  this.onload=onload;
  this.onerror=(onerror) ? onerror : this.defaultError;
  this.loadXMLDoc(url,method,params,contentType);
}

net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){
//	alert(url);	alert(params);
  if (!method){
    method="GET";
  }
  if (!contentType && method=="POST"){
     contentType='application/x-www-form-urlencoded; charset=ISO-8859-1';
  }
  if (window.XMLHttpRequest){
    this.req=new XMLHttpRequest();
  } else if (window.ActiveXObject){
    this.req=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (this.req){
    try{
      var loader=this;
      this.req.onreadystatechange=function(){
        net.ContentLoader.onReadyState.call(loader);
      }
      this.req.open(method,url,true);
      if (contentType){
        this.req.setRequestHeader('Content-Type', contentType);
      }
      this.req.send(params);
    }catch (err){
      this.onerror.call(this);
    }
  }
}


net.ContentLoader.onReadyState=function(){
  var req=this.req;
  var ready=req.readyState;
  try{var httpStatus=req.status;
  if (ready==net.READY_STATE_COMPLETE){
    if (httpStatus==200 || httpStatus==0){
      this.onload.call(this);
    }else{
      this.onerror.call(this);
    }
  }
  }
  catch(e){}
}

net.ContentLoader.prototype.defaultError=function(){
  alert("Error recuperando datos!"
    +"\n\nreadyState:"+this.req.readyState
    +"\nstatus: "+this.req.status
    +"\nheaders: "+this.req.getAllResponseHeaders());
}

/***  Subsistema locprov ***/
// var mylname=''; var mypname=''; var myModule=''; var myVar; var myQuery=''; myfldprov=''; myfldloc='';myfldcp='';
var myModule='/hw/tools/vsajax.php';
var myVar='IdProv';
var myQuery='vscv=01050404D393D2E27202Cr030015040C1Ad24253820332435282B2F2Bhs17263660ky2C212B3D2E273B31297Cr0A7Ej7F0237203E263835j7Cw3D2E36233126302E21k7D0Edfx7B60kyj7Cxhs172C3F21292E3C3A2E21df0Cuwnd7Dwj7Fvq7Di60k023F212D212037263F2B7Csve0E1Ej242032293822262121f0706001Dn3A2E2B2728223224202331382D2A3Da3D2E36233126302E212B3Cf161C0A0200r282B3E3D22373D21332C38d7C0Ajyq1D2B00373637';
var myfldprov='IdProvincia';
var myfldloc='IdLocalidad';
var myfldcp='CPostal';
var myuname=''; var myumsg='';var myumsq='';

function chkpLOC(clname) {
if (document.getElementById(clname).options.length<=2) {
   mylname=clname;	
   alname = clname.split("_"); mypname=alname.slice(0,alname.length-1).join("_")+"_"+myfldprov;
   goBuildList()
   }
}
// Establece valores alternativos de llamada LocProv: Módulo, variable del query, query crypt, campos de provincia, localidad y cpostal
function setLocProvCall(cModule,cVar,cQuery,cFieldProv,cFieldLoc,cFieldCP) {
myVar=cVar;
myModule=cModule;
myQuery=cQuery;
myfldprov=cFieldProv;
myfldloc=cFieldLoc;
myfldcp=cFieldCP;
}

// Actualiza el código postal, si procede
function pCP(clname) {
alname = clname.split("_"); cpname=alname.slice(0,alname.length-1).join("_")+"_"+myfldcp;
oLoc=document.getElementById(clname);oCP=document.getElementById(cpname);
if (!oCP==null) {
   var cOld=oCP.value;var xVal=oLoc.options[oLoc.selectedIndex].text;xVal=xVal.split('(');
   if(xVal.length>1) {	cCP=xVal[xVal.length-1]; oCP.value=cCP.substr(0,cCP.length-1); } else {	oCP.value=''; }
   fchanged(oCP,cOld);
  }
}

// Actualiza la lista de localidades al cambiar la provincia
function pLOC(cname) {
mypname=cname;
alname = cname.split("_"); mylname=alname.slice(0,alname.length-1).join("_")+"_"+myfldloc;
goBuildList();
fchanged(document.getElementById(mypname),document.getElementById(mypname).defaultValue);
fchanged(document.getElementById(mylname),document.getElementById(mylname).defaultValue);
}

// Actualiza la lista de localidades al entrar en localidad, si está vacía
function goBuildList() {
var to=document.getElementById("advice");
var cl=document.getElementById(mylname); cl.disabled=1;
var sX = 0; var sY = 0; var sW=cl.offsetWidth;
while(cl != null){ sX += cl.offsetLeft; sY += cl.offsetTop; cl = cl.offsetParent;  }
to.style.top=sY+'px'; to.style.left=sX+sW+'px'; to.style.display="block";
var provList = document.getElementById(mypname);
new net.ContentLoader(myModule,BuildListP,null,"POST","fieldsQ="+myVar+"&"+myVar+"="+provList.options[provList.selectedIndex].value+"&"+myQuery);
}

function BuildListP() {
var strText = this.req.responseText;
eval(strText);
var locList = document.getElementById(mylname); var defValue=locList.value;
for (var count = locList.options.length-1; count >0; count--) { locList.options[count] = null; }
if (typeof aO[count]!="string")	{
   for (var count = 0; count < aO.length; count++)
	   { 
	     if (aO[count][0]!=defValue) {
    	   optionItem = new Option( aO[count][1],aO[count][0],false,false); locList.options[locList.length] = optionItem;
          }
     }
   }
else {
   optionItem = new Option( aO[count],aO[count],false,false); locList.options[locList.length] = optionItem;	  
	}
var to=document.getElementById("advice"); to.style.display="none";
locList.disabled=0;
}

/***** Funciones hint ******/
function starthint() {
document.body.insertAdjacentHTML("AfterBegin",'<table><tr><td id="IFrHint" style="z-index:98;position:absolute;display:none;">'+
'<table border=0 cellspacing=0 cellpadding=0>'+
'<tr><td><img src="/hw/img/sys/gltl.gif"></td><td id="tdglt" style="background-image:url(\'/hw/img/sys/glt2.gif\');"><img width=34 height=31 id="glt" src="/hw/img/sys/glt2.gif"></td><td><img src="/hw/img/sys/gltr.gif"></td></tr>'+
'<tr><td style="width:10px;background-image:url(\'/hw/img/sys/gll.gif\');">&nbsp;</td><td id="TxHint" style="font-family:Verdana,Helvetica;font-size:12px;background-color:#FFFFCC;"></td><td style="width:7px;background-image:url(\'/hw/img/sys/glr.gif\');">&nbsp;</td></tr>'+
'<tr><td><img src="/hw/img/sys/glbl.gif"></td><td id="tdglb" style="background-image:url(\'/hw/img/sys/glb2.gif\');"><img width=34 height=31 id="glb" src="/hw/img/sys/glb2.gif"></td><td><img src="/hw/img/sys/glbr.gif"></td></tr></table>'+
'</td></tr></table>');
}

function showhint(tE,Txt) {
var selectedPosX = 0; var selectedPosY = 0; if (!tE) return; var nMinWidth=200;
var teH = tE.offsetHeight;
while(tE != null){ selectedPosX += tE.offsetLeft; selectedPosY += tE.offsetTop; tE = tE.offsetParent; }
xPE = document.getElementById("IFrHint");
xPE.style.left = selectedPosX+"px";
xPE.style.top = (selectedPosY + teH)+"px";
doclastleft=(document.all?document.body.clientWidth:window.innerWidth)+document.body.scrollLeft;
doclasttop=(document.all?document.body.clientHeight:window.innerHeight)+document.body.scrollTop;  
nSetWidth=doclastleft-selectedPosX-20; if (nSetWidth<nMinWidth) { nSetWidth=nMinWidth; }
xPE.style.width=nSetWidth+"px";
document.getElementById("TxHint").innerHTML=Txt;
xPE.style.display = "block";
objlastleft=selectedPosX+nSetWidth;
objlasttop=(selectedPosY+teH+xPE.offsetHeight)
if(doclastleft<objlastleft+20) {
	nOW=xPE.offsetWidth;selectedPosX=selectedPosX-xPE.offsetWidth+30; xPE.style.left = selectedPosX+"px";xPE.style.width=nOW+"px";
  nH="R";
  }
else {nH="L";}
if(doclasttop<objlasttop) {
	nV="B";
	selectedPosY=selectedPosY-xPE.offsetHeight; xPE.style.top = (selectedPosY)+"px";	
  }
else {nV="T";}
document.getElementById("tdglt").innerHTML='<img width=34 height=31 align="'+(nH=="L"?"left":"right")+'" src="/hw/img/sys/glt'+(nV=="T"?(nH=="L"?"1":"3"):"2")+'.gif">';
document.getElementById("tdglb").innerHTML='<img width=34 height=31 align="'+(nH=="L"?"left":"right")+'" src="/hw/img/sys/glb'+(nV=="B"?(nH=="L"?"1":"3"):"2")+'.gif">';
}
function hidehint() { document.getElementById("IFrHint").style.display = "none"; }

String.prototype.removeAccents1 = function () {
var str = ""+this+""; var a = "àâäáÀÁÄÂëèéêÊÉÈËïîíìÌÍÎÏüùûúÚÙÛÜãõñÃÕÑç"; var b = "aaaaAAAAeeeeEEEEiiiiIIIIooooOOOOuuuuUUUUaonAONc";
for (var i=0; i < a.length; i++) { str = str.split(a.charAt(i)).join(b.charAt(i)); }
return str;
}


String.prototype.removeAccents = function ()
{
	var __r = {
			'À':'A','Á':'A','Â':'A','Ã':'A','Ä':'A','Å':'A','Æ':'E',
			'È':'E','É':'E','Ê':'E','Ë':'E',
			'Ì':'I','Í':'I','Î':'I','Ï':'I',
			'Ò':'O','Ó':'O','Ô':'O','Ö':'O',
			'Ù':'U','Ú':'U','Û':'U','Ü':'U',
			'Ñ':'N','Ç':'C'};
	
	return this.replace(/[ÀÁÂÃÄÅÆÈÉÊËÌÍÎÏÒÓÔÖÙÚÛÜÑÇ]/gi, function(m){
		var ret = __r[m.toUpperCase()];
		if (m === m.toLowerCase()) ret = ret.toLowerCase();
		return ret;
	  });
};


/***  Subsistema unique ***/
// Testea qu el campo tenga contenido único de acuerdo con myQuery en formularios htmgen
function chkUnique(cname,myQuery,cerrormsg) {
myuname=cname;
myumsg=cerrormsg;
var to=document.getElementById("advice");
var cl=document.getElementById(cname); cval=cl.value;cl.disabled=1;
var sX = 0; var sY = 0; var sW=cl.offsetWidth;
while(cl != null){ sX += cl.offsetLeft; sY += cl.offsetTop; cl = cl.offsetParent;  }
to.style.top=sY+'px'; to.style.left=sX+sW+'px'; to.style.display="block";
new net.ContentLoader(myModule,checkUnique,null,"POST","fieldsQ="+cname+"&"+cname+"="+cval+"&vsajax="+myQuery);
}

function checkUnique() {
var strText = this.req.responseText;
eval(strText);
cl=document.getElementById(myuname);
var to=document.getElementById("advice"); to.style.display="none";
if (aO[0]==cl.value) {
	alert ("["+aO[0]+"]: "+(myumsg?myumsg:"Ya hay un registro con este valor. El valor del campo debe ser único"));
	cl.value=cl.defaultValue;
}
document.getElementById(myuname).disabled=0;
fchanged(cl,cl.defaultValue);
}


/***  Subsistema confirm ***/
// Pregunta al usuario cuando sospecha de coincidencia de contenidos de acuerdo con la consulta que se envía
function chkConfirm(cname,ccheck,myQuery,cintro,cquestion) {
myuname=cname;
myumsg=cintro;
myumsq=cquestion;
var to=document.getElementById("advice");
var cl=document.getElementById(cname); if(!ccheck) { ccheck=cl.value; } cl.disabled=1;
var sX = 0; var sY = 0; var sW=cl.offsetWidth;
while(cl != null){ sX += cl.offsetLeft; sY += cl.offsetTop; cl = cl.offsetParent;  }
to.style.top=sY+'px'; to.style.left=sX+sW+'px'; to.style.display="block";
aO=new Array();
new net.ContentLoader(myModule,checkConfirm,null,"POST","fieldsQ=check&check="+ccheck.removeAccents()+"&vsajax="+myQuery);
}

function checkConfirm() {
var strText = this.req.responseText;
eval(strText);
cl=document.getElementById(myuname);
var to=document.getElementById("advice"); to.style.display="none";
var cC='';
for (n=0;n<aO.length;n++) { cC+=aO[n]+"\n"; }
if (cC) {
   if (!confirm ((myumsg?myumsg:"Se han encontrado estos valores coincidentes.\n")+cC+(myumsq?myumsq:"¿Desea continuar?"))) {
      cl.value=cl.defaultValue;
      }
   }
document.getElementById(myuname).disabled=0;
fchanged(cl,cl.defaultValue);
}


/**** Subsistema refreshlist ***/
// Refresca los valores de un combo a partir de un select con o sin parámetros fieldsQ
function goRefreshList(myselect,myQuery) {
mylname=myselect;
var to=document.getElementById("advice");
var cl=document.getElementById(mylname); cl.disabled=1;
var sX = 0; var sY = 0; var sW=cl.offsetWidth;
while(cl != null){ sX += cl.offsetLeft; sY += cl.offsetTop; cl = cl.offsetParent;  }
to.style.top=sY+'px'; to.style.left=sX+sW+'px'; to.style.display="block";
new net.ContentLoader(myModule,RefreshList,null,"POST",myQuery);
}

function RefreshList() {
var strText = this.req.responseText;
eval(strText);
var locList = document.getElementById(mylname); var defValue=locList.value;
var nDelStart=(locList.options[0].value?0:1);
for (var count = locList.options.length-1; count >=nDelStart; count--) { locList.options[count] = null; }
if (typeof aO[count]!="string")	{
   for (var count = 0; count < aO.length; count++)
	   { optionItem = new Option( aO[count][1],aO[count][0],false,false); locList.options[locList.length] = optionItem; }
   }
else {
   optionItem = new Option( aO[count],aO[count],false,false); locList.options[locList.length] = optionItem;	  
	}
locList.value=defValue;
var to=document.getElementById("advice"); to.style.display="none";
locList.disabled=0;
}

// Clone entre select
function goCloneList(mysrc,mydst) {
var locList = document.getElementById(mydst);var srcList=document.getElementById(mysrc);var defValue=locList.value; locList.disabled=1;
for (var count = locList.options.length-1; count >=0; count--) { locList.options[count] = null; }
for (var count = 0; count < aO.length; count++)
    { optionItem = new Option( srcList.options[count].text,srcList.options[count].value,false,false); locList.options[locList.length] = optionItem; }
locList.value=defValue;
locList.disabled=0;
}