// JavaScript Document
	var ns4 = (document.layers) ? true : false;
	var ie4 = (document.all) ? true : false;
	var ns6 = (document.getElementById&&!document.all) ? true:false;


	function getElementStyle(whichLayer) {		
		if (document.getElementById) {
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
		} else if (document.all) {
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
		} else if (document.layers) {
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
		}
		
		return style2;
	}

	function getElement(whichLayer) {
		if (document.getElementById) {
			// this is the way the standards work
			var objElement = document.getElementById(whichLayer);
		} else if (document.all) {
			// this is the way old msie versions work
			var objElement = document.all[whichLayer];
		} else if (document.layers) {
			// this is the way nn4 works
			var objElement = document.layers[whichLayer];
		}
		
		return objElement;
	}

	function getElements() {
		if (document.all) {
			var objElements = document.all;
		} else {
			var objElements = document.layers;
		}
		
		return objElements;
	}

	function goToWebSite(obj) {
			if (obj.options[obj.selectedIndex].value!="") {
					obj.form.action = obj.options[obj.selectedIndex].value;
					obj.form.submit();
			}
	}

	function goToURL(strLink, strTarget) {
		eval(strTarget + ".document.location.href = '" + strLink + "'");
	}


	function onDelete(formulario, msg) {
		resp = confirm(msg);
		return resp;
	}

	function onDeleteLink(wlink, msg) {
		resp = confirm(msg);
		if (resp == true) {
			window.location.href = wlink;
		}
	}

	function Tecla(e)
	{
		if (document.all) // Internet Explorer
			var tecla = event.keyCode;
		else if(document.layers) // Nestcape
			var tecla = e.which;
	
		if (tecla > 47 && tecla < 58) // numeros de 0 a 9
			return true;
		else{
			if (tecla != 8) // backspace
				event.keyCode = 0;
				//return false;
			else
				return true;
		}
	}	
	
	function WindowPopup(page, tg, width, height){
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2;
		newwindow = window.open(page, tg,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,WIDTH=' + width + ',HEIGHT=' + height + ',top=' + top + ',left=' + left);
		newwindow.focus();
	}	
	
	function ChangeRowStyle(objElementRow, strClass) {
		objElementRow.className = strClass;
		for (intCount=0;intCount<objElementRow.childNodes.length;intCount++) {		
			objElementRow.childNodes[intCount].className = strClass;
		}			
	}	
	
function getViewportDimensions() {
    var intH = 0, intW = 0;
    
    if(self.innerHeight) {
       intH = window.innerHeight;
       intW = window.innerWidth;
    } 
    else {
        if(document.documentElement && document.documentElement.clientHeight) {
            intH = document.documentElement.clientHeight;
            intW = document.documentElement.clientWidth;
        }
        else {
            if(document.body) {
                intH = document.body.clientHeight;
                intW = document.body.clientWidth;
            }
        }
    }

    return {
        height: parseInt(intH, 10),
        width: parseInt(intW, 10)
    };
}

function centerElement(elem) {
    var viewport = getViewportDimensions();
    var left = (viewport.width == 0) ? 50 : parseInt((viewport.width - elem.offsetWidth) / 2, 10);
    var top = (viewport.height == 0) ? 50 : parseInt((viewport.height - elem.offsetHeight) / 2, 10);

    if (ie6) {
        elem.style.left = (left + 90) + 'px';
        elem.style.top = (top - 10) + 'px';    
    } else {
        elem.style.left = (left - 178) + 'px';
        elem.style.top = (top - 220) + 'px';
    }

    viewport, left, top, elem = null;    
}

function showModalLayer(divModalLayer) {
    var modalElem = document.getElementById(divModalLayer);

    if(modalElem != null) {
        centerElement(modalElem);
        modalElem.style.display = 'block';
        window.onresize = function() {
            centerElement(document.getElementById(divModalLayer));
        }
    }
}

function hideModalLayer(divModalLayer) {
    var modalElem = document.getElementById(divModalLayer);

    if(modalElem != null) {
        modalElem.style.display = 'none';
        window.onresize = null;
    }
}
