
function Preview(){
CountdownTimer();
}
function getOffsetLeft (el) {
    var ol = el.offsetLeft;
    while ((el = el.offsetParent) != null)
        ol += el.offsetLeft;
    return ol;
}
function getOffsetTop (el) {
    var ot = el.offsetTop;
    while((el = el.offsetParent) != null)
        ot += el.offsetTop;
    return ot;
}
function Muestra_Layer(boton,capa){
var incx, incy;
 incx=1; incy=10;
	lax = getOffsetLeft(document.images[boton]);    
	lay = getOffsetTop(document.images[boton]) + document.images[boton].height;
	obj=document.getElementById(capa);
   		obj.style.display="block"
if (lax){

		    if (document.layers){document.layers[capa].left = lax}
	        else if (document.all){document.all[capa].style.left=lax+incx}
    	    else if (document.getElementById){document.getElementById(capa).style.left=lax+"px"}
        }
    // Set vertical position
  if (lay){
	        if (document.layers){document.layers[capa].top = lay}
    	    else if (document.all){document.all[capa].style.top=lay+incy}
        	else if (document.getElementById){document.getElementById(capa).style.top=lay+"px"}
        }
}
function cargar(capa){
		bot='inf'+capa;
		obj=document.getElementById("color");
   		obj.style.display="block";
		Muestra_Layer(bot,'color');
}
function CountdownTimer()
{
	//alert('OK');
	if (window.CountdownTimerInstance == null)
	{
		window.CountdownTimerInstance = this;
		
		var windowBackGround = document.all["windowBackGround"];
		var _body = document.all["_body_principal"];
		
		if (windowBackGround != null)
		{
			
			windowBackGround.style.width = _body.scrollWidth;//document.body.clientWidth + parseInt(document.body.scrollLeft);
			windowBackGround.style.height = _body.scrollHeight;//document.body.clientHeight + parseInt(document.body.scrollTop);
			windowBackGround.style.top = "0";//parseInt(document.body.scrollTop);
			windowBackGround.style.left = "0";
			windowBackGround.style.display = 'block';
		}
		
		var DivIframeWindowWait = document.all['DivWindowWait'];
		if (DivIframeWindowWait != null)
		{
			DivIframeWindowWait.style.width = "650px";
			DivIframeWindowWait.style.height = "40px";
			DivIframeWindowWait.style.top = (document.body.clientHeight / 2) - (parseInt(DivIframeWindowWait.style.height) / 2) + parseInt(document.body.scrollTop);
			DivIframeWindowWait.style.left = (document.body.clientWidth / 2) - (parseInt(DivIframeWindowWait.style.width) / 2) + parseInt(document.body.scrollLeft);
			DivIframeWindowWait.style.display = 'block';
			//CountdownTimerOff();
			/*var lblMessageWait = document.getElementById("lblMessageWait");
			divWindowWait.innerHTML = "Espere mientras se procese su solicitud.";
			divWindowWait.style.display = 'block';*/
		}
		
		var divWindowWait = document.all['windowWait'];
		if (divWindowWait != null)
		{
			divWindowWait.style.width = "95%"; //aca se cambia la anchura
			divWindowWait.style.height = "0";
			divWindowWait.style.top = (document.body.clientHeight / 2) - (parseInt(divWindowWait.style.height) / 2) + parseInt(document.body.scrollTop);
			divWindowWait.style.left = (document.body.clientWidth / 2) - (parseInt(divWindowWait.style.width) / 2) + parseInt(document.body.scrollLeft);
			divWindowWait.style.display = 'block';
			var theHtml = "&nbsp;&nbsp;<img src=images/indicatorp.gif border=0>&nbsp;<font color=005584>Espere un momento....Buscando Registros</font>";
			Html='<table width="77%"  border="0" cellspacing="0" cellpadding="0">';
			Html=Html+'<tr><td width="80%" colspan=2><p style="margin:2px"><img src="iconos/blank.gif" border=0 height=10></p></td></tr><tr><td><table width="100%"  border="0" cellspacing="3" cellpadding="3"><tr><td class=txt><center>'+theHtml+'</center><img src="iconos/blank.gif" border=0 height=10>&nbsp;</td></tr>';
            Html=Html+'</table></td></tr></table>';
		document.getElementById("lblMessageWait").innerHTML=Html;
			Muestra_Layer('inf','lblMessageWait')
		}
	}
	else
	{
		var lblMessageWait = document.getElementById("lblMessageWait");
		//var divWindowWait = document.all['windowWait'];
		divWindowWait.innerHTML = "Espere mientras se procese su solicitudOKKKKKKKKKKKKKK.";
		divWindowWait.style.display = 'block';
		return null;
	}
}

function CountdownTimerOff()
{
	var windowBackGround = document.all["windowBackGround"];
	var DivIframeWindowWait = document.all['DivWindowWait'];
	var divWindowWait = document.all['windowWait'];
	
	windowBackGround.style.display = 'none';
	window.CountdownTimerInstance = null;
	apagar('lblMessageWait');
}
function apagar(capa){
obj=document.getElementById(capa);
   		obj.style.display="none"
}

