function ajax(idmain,idloader){this.objAjax=null;this.idmain=idmain;this.idloader=idloader;this.debug=true;this.aborta=true;this.working=false;this.noajax='Su navegador no es compatible para trabajar con esta web.';this.Request=
function(data){var parent=this;data=this.Default(data);this.objAjax.open(data.method,data.url,data.async);if(data.headers)
for(var i=0;i<data.headers.length;i+=2)
this.objAjax.setRequestHeader(data.headers[i],data.headers[i+1])
if(data.async){this.working=true;this.Cargador(true);this.objAjax.onreadystatechange=
function(){if(parent.objAjax.readyState==4){if(parent.aborta){if(data.onComplete)
data.onComplete(parent.objAjax,data);if((parent.objAjax.status==200||parent.objAjax.status==304)&&data.onOK)
data.onOK(parent.objAjax,data);else if(data.onError)
data.onError(parent.objAjax,data);else if(parent.debug)
alert('Error: '+parent.objAjax.status+' '+parent.objAjax.statusText);}
else
parent.aborta=true;parent.Cargador(false);parent.working=false;}
};}
this.objAjax.send(data.param);};this.Actualiza=
function(objAjax,data){switch(data.type){case 1:{if(data.iner==0)
$(data.id).innerHTML=objAjax.responseText+$(data.id).innerHTML;else if(data.iner==1)
$(data.id).innerHTML=$(data.id).innerHTML+objAjax.responseText;else
$(data.id).innerHTML=objAjax.responseText;break;}
case 2:{var objxml=new jxml(objAjax.responseXML);data.id(objxml.Query(data.query),objAjax);break;}
case 3:{if(data.iner==0)
$(data.id).value=objAjax.responseText+$(data.id).value;else if(data.iner==1)
$(data.id).value=$(data.id).value+objAjax.responseText;else
$(data.id).value=objAjax.responseText;break;}
case 4:{var obj=$(data.id);var objxml=new jxml(objAjax.responseXML);var resultado=objxml.Query('SELECT node.value, atrib.value');var total=obj.options.length;if(total > 0)
for(var i=0;i<=total;++i)
obj.remove(obj.options[i])
for(var i=0;i<resultado.length;++i){var newone=new Option(resultado[i][0],resultado[i][1]);try{obj.add(newone,obj.options.length);}
catch(ex){obj.add(newone,obj.options[obj.options.length]);}
}
break;}
case 5:{eval(objAjax.responseText);break;}
}
};this.Link=
function(url,id,iner){this.Request({url:this.Url(url),
id:id,
async:(id)? true:false,
iner:iner,
type:1,
onOK:this.Actualiza
});};this.Form=
function(idform,id,iner){var form=$(idform);this.Request({url:this.Url(form.action),
method:form.method,
id:id,
param:this.DataForm(form),
async:(id)? true:false,
iner:iner,
type:1,
onOK:this.Actualiza
});};this.XML=
function(url,funcion,query){this.Request({url:this.Url(url),
id:funcion,
query:query,
type:2,
onOK:this.Actualiza
});};this.Value=
function(url,id,iner){this.Request({url:this.Url(url),
id:id,
iner:iner,
type:3,
onOK:this.Actualiza
});};this.Select=
function(url,id){this.Request({url:this.Url(url),
id:id,
type:4,
onOK:this.Actualiza
});};this.Run=
function(url){this.Request({url:this.Url(url),
type:5,
onOK:this.Actualiza
});};this.Img=
function(url,id,w,h){var temp=new Image();var parent=this;this.working=true;this.Cargador(true);temp.onload=function(){if(parent.aborta){$(id).src=temp.src;if(w)$(id).width=w;if(h)$(id).height=h;}
parent.Cargador(false);parent.aborta=true;parent.working=false;};temp.onerror=function(){parent.Cargador(false);parent.aborta=true;parent.working=false;if(parent.debug)
alert('Error: 404 Not Found');};temp.src=url;};this.Cancel=
function(){if(this.working){this.Cargador(false);this.aborta=false;this.working=false;this.objAjax.abort();}
else
this.aborta=true;};this.DataForm=
function(obj){var resultado='';this.Add=
function(nombre,valor){resultado+=nombre+'='+valor;if((i+1)< obj.length)
resultado+='&';};for(i=0;i<obj.length;i++){var tipo=obj[i].type;var nombre=obj[i].name;if(tipo=='select-multiple'){var n=0;for(j=0;j<obj[i].options.length;j++)
if(obj[i].options[j].selected)
this.Add(nombre+'['+(n++)+']',obj[i].options[j].value);}
else if(tipo=='radio'||tipo=='checkbox'){if(obj[i].checked)
this.Add(nombre,obj[i].value);}
else
this.Add(nombre,obj[i].value);}
return(resultado);};this.CSS=
function(obj,atributo){if(obj.style[atributo])
return(obj.style[atributo]);else if(obj.currentStyle)
return(obj.currentStyle[atributo]);else if(document.defaultView&&document.defaultView.getComputedStyle)
return document.defaultView.getComputedStyle(obj,"").getPropertyValue(atributo);else
return(null);};this.Default=
function(obj){var argumentos={url:this.homepage,
method:'GET',
async:true
};for(var i in argumentos)
if(obj[i]==null)
obj[i]=argumentos[i];if(obj.method.toUpperCase()=='GET'&&obj.param){obj.url+=(obj.url.indexOf('?')==-1)? '?'+obj.param:'&'+obj.param;obj.param=null;}
else if(obj.method.toUpperCase()=='POST'&&obj.headers==null)
obj.headers=['Content-Type','application/x-www-form-urlencoded; charset=ISO-8859-1'];return(obj);};this.Url=
function(str){var resultado='',obj=str.split('#');if(obj.length > 1){for(var i=1;i<obj.length;++i){resultado+=obj[i];if((i+1)< obj.length)
resultado+='#';}
}
else
resultado=obj[0];return(resultado);};this.Cargador=
function(onoff,id){if(id==null)
id=this.idloader;if(id)
$(id).style.visibility=(onoff)? 'visible':'hidden';};this.Cargador(false);if(typeof XMLHttpRequest!='undefined')
this.objAjax=new XMLHttpRequest();else if(typeof ActiveXObject!='undefined')
this.objAjax=(Number(navigator.appVersion.substr(0,3))>=5)? new ActiveXObject('Msxml2.XMLHTTP'):new ActiveXObject('Microsoft.XMLHTTP');if(this.objAjax==null)
alert(this.noajax);else if(this.idmain&&window.location.hash!=''&&window.location.hash!='#')
this.Link(window.location.href,this.idmain);}
function $(id){return(document.getElementById(id));}








function $(id){
return document.getElementById(id);
}
function STO(_24,_25){
return window.setTimeout(_24,_25);
}
function DecToHexa(_26){
var _27=parseInt(_26).toString(16);
if(_26<16){
_27="0"+_27;
}
return _27;
}
function addslashes(str){
str=str.replace(/\"/g,"\\\"");
str=str.replace(/\'/g,"\\'");
return str;
}
function $toggle(id){
if(act_height(id)==0){
$blinddown(id);
}else{
$blindup(id);
}
}
function act_height(id){
height=$(id).clientHeight;
if(height==0){
height=$(id).offsetHeight;
}
return height;
}
function act_width(id){
width=$(id).clientWidth;
if(width==0){
width=$(id).offsetWidth;
}
return width;
}
function max_height(id){
var ids=$(id).style;
ids.overflow="hidden";
if(act_height(id)!=0){
return act_height(id);
}else{
origdisp=ids.display;
origheight=ids.height;
origpos=ids.position;
origvis=ids.visibility;
ids.visibility="hidden";
ids.height="";
ids.display="block";
ids.position="absolute";
height=act_height(id);
ids.display=origdisp;
ids.height=origheight;
ids.position=origpos;
ids.visibility=origvis;
return height;
}
}
function $blindup(id,_2f){
if(!_2f){
_2f=200;
}
acth=act_height(id);
maxh=max_height(id);
if(acth==maxh){
$(id).style.display="block";
var _30;
_30=Math.ceil(_2f/acth);
for(i=0;i<=acth;i++){
newh=acth-i;
STO("$('"+id+"').style.height='"+newh+"px'",_30*i);
}
}
}
function $blinddown(id,_32){
if(!_32){
_32=200;
}
acth=act_height(id);
if(acth==0){
maxh=max_height(id);
$(id).style.display="block";
$(id).style.height="0px";
var _33;
_33=Math.ceil(_32/maxh);
for(i=1;i<=maxh;i++){
STO("$('"+id+"').style.height='"+i+"px'",_33*i);
}
}
}
function $opacity(id,_35,_36,_37){
if($(id).style.width==0){
$(id).style.width=act_width(id);
}
var _38=Math.round(_37/100);
var _39=0;
if(_35>_36){
for(i=_35;i>=_36;i--){
STO("changeOpac("+i+",'"+id+"')",(_39*_38));
_39++;
}
}else{
if(_35<_36){
for(i=_35;i<=_36;i++){
STO("changeOpac("+i+",'"+id+"')",(_39*_38));
_39++;
}
}
}
}
function $pulsate(id,num,speed){
if (!speed) speed = 300;
for(i = 1; i <= num; i++) {
numx=i*((speed*2)+100)-(speed*2);
STO("$opacity('"+id+"', 100, 0, "+speed+")",numx);
STO("$opacity('"+id+"', 0, 100, "+speed+")",numx+speed+100);
}
}
function changeOpac(_3a,id){
var ids=$(id).style;
ids.opacity=(_3a/100);
ids.MozOpacity=(_3a/100);
ids.KhtmlOpacity=(_3a/100);
ids.filter="alpha(opacity="+_3a+")";
}
function $shiftOpacity(id,_3e){
if($(id).style.opacity<0.5){
$opacity(id,0,100,_3e);
}else{
$opacity(id,100,0,_3e);
}
}
function currentOpac(id,_40,_41){
var _42=100;
if($(id).style.opacity<100){
_42=$(id).style.opacity*100;
}
$opacity(id,_42,_40,_41);
}
function $highlight(id,_44,_45,_46){
if(_44){
milli=_44;
}else{
milli=900;
}
if(_45){
endcol=_45;
}else{
endcol="#FFFFFF";
}
if(_46){
origcol=_46;
}else{
origcol="#FFFFA6";
}
$colorize(origcol,endcol,id,milli,"high");
}
function $textColor(id,_48,_49,_4a){
if(_4a){
milli=_4a;
}else{
milli=900;
}
$colorize(_48,_49,id,milli,"text");
}
function $morphColor(id,_4c,_4d,_4e,_4f,_50,_51,_52){
if(_52){
milli=_52;
}else{
milli=900;
}
$colorize(_4c,_4d,id,milli,"text");
$colorize(_4e,_4f,id,milli,"back");
if(_50!=false){
$colorize(_50,_51,id,milli,"border");
}
}
function $colorize(_53,end,id,_56,_57){
dr=parseInt(_53.substring(1,3),16);
dg=parseInt(_53.substring(3,5),16);
db=parseInt(_53.substring(5,7),16);
fr=parseInt(end.substring(1,3),16);
fg=parseInt(end.substring(3,5),16);
fb=parseInt(end.substring(5,7),16);
steps=_56/10;
cr=dr;
cg=dg;
cb=db;
sr=(fr-dr)/steps;
sg=(fg-dg)/steps;
sb=(fb-db)/steps;
var zzi=10;
for(var x=0;x<steps;x++){
color="#"+DecToHexa(cr)+DecToHexa(cg)+DecToHexa(cb);
if(x==(steps-1)){
if(_57=="high"){
color="";
}else{
color=end;
}
}
mytime=(x);
if(_57=="back"||_57=="high"){
newfonc="$(\""+id+"\").style.backgroundColor=\""+color+"\";";
}else{
if(_57=="text"){
newfonc="$(\""+id+"\").style.color=\""+color+"\";";
}else{
if(_57=="border"){
newfonc="$(\""+id+"\").style.borderColor=\""+color+"\";";
}
}
}
STO(newfonc,zzi);
cr+=sr;
cg+=sg;
cb+=sb;
zzi+=10;
}
}