var d_desde = -400;
var stInit;
function mover_destacado() {
	obj = document.getElementById('destacado_img');
	if(d_desde < -80) {
		obj.style.marginRight = d_desde + 'px';
		d_desde += 30;
		stInit = self.setTimeout("mover_destacado()", "30");
	} else {
		clearTimeout(stInit);
	}
}
var hex=255;
function fadetext(num) {
	if(hex>0) {
		hex-=11;
		document.getElementById('destacado_txt').style.color="rgb("+hex+","+hex+","+hex+")";
		setTimeout("fadetext()",20);
	} else {
		hex=255 //reset hex value
		document.getElementById('destacado_txt').style.color="#444B6C";
	}
}
function ejec_destacado(num) {
	d_desde = -400;
	document.getElementById('destacado_txt').innerHTML=document.getElementById('destacado_txt_' + num).innerHTML;
	fadetext();
	document.getElementById('destacado_img').style.backgroundImage = 'url(img/destacado_'+num+'.jpg)';
	mover_destacado();
}

imageObj = new Image();
for(i=1; i<=3; i++) {
	imageObj.src = 'img/destacado_'+i+'.jpg';
}
pic1= new Image(361,239);
pic1.src="img/destacado_1.jpg";
pic2= new Image(361,239);
pic2.src="img/destacado_2.jpg";
pic3= new Image(361,239);
pic3.src="img/destacado_3.jpg";

function nwf(app, foto) {
	top.nw=window.open('','captura','left=0,top=0,width=1024,height=600,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0')
	top.nw.document.writeln('<html><head><title>Capturas</title><style>body {margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;}</style></head>'
		+'<body bgcolor=white onLoad="self.focus()">'
		+'<div align="center"><a href="javascr'
		+'ipt:;" onclick="self.close();"><img src="/demos/'+app+'/capturas/'+foto+'.png" border="0"></a></div></body></html>');
	top.nw.document.close()
}

function requrl(pagina,elemento, datos) {
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }                   
    self.xmlHttpReq.open('GET', pagina + '?desde=ajax&' + datos, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			document.getElementById(elemento).innerHTML=self.xmlHttpReq.responseText;
        }
    }
    self.xmlHttpReq.send(null);
}
function traercel() {
	requrl('/demos/smsweb/index.php', 'celdep', 'area='+document.getElementById('area').value+'&nro='+document.getElementById('nro').value);
}
