function mod_conferecampos(formulario, $idioma) {
	if ($idioma == '' || $idioma == undefined) {$idioma = 'pt-br';}
	if ($idioma == 'pt-br') {
		var $dicionario = Array(
			'Campo', 
			'não preenchido.', 
			'Você precisa preencher todos os campos obrigatórios.', 
			'Não existe', 
			'Digite a confirmação da senha.', 
			'A confirmação da senha não bate.', 
			'O endereço informado não é válido.', 
			'A data digitada não é válida.', 
			'O CEP digitado não é válido.', 
			'O CPF digitado não é válido.', 
			'O CNPJ digitado não é válido.', 
			'O documento digitado não é válido.', 
			'São obrigatórios ',
			'caracteres para o campo', 
			'caracteres para este campo.');
	} else if ($idioma == 'en-us') {
			
	}
	for ($conta = 0; $conta < formulario.length; $conta++) {
		var tempobj = formulario.elements[$conta];
		if (tempobj.name.substring(0, 8) == 'required') {
			$campo = tempobj.value;
			$title = tempobj.title;
			if (document.getElementById($campo) == undefined) {
				/* $objs = document.getElementsByName($campo);
				if ($objs.length > 0 && $objs[0].type == 'radio') {
					$selec = false;
					$first_id = $objs[0].id;
					for($i = 0; $i < $objs.length; $i++) {
						if ($objs[$i].checked == true) {$selec = true;}
					}
					if ($selec == false) {
						alert($dicionario[0]+' "'+$title+'" '+$dicionario[1]+'\n'+$dicionario[2]);
						document.getElementById($first_id).focus();
						return false;
					}
				} else {
					alert($campo+'\r\n'+$dicionario[3]);
					return false;
				} */
			} else {
				if (document.getElementById($campo).offsetWidth > 0) {
					if (document.getElementById($campo).value == '') {
						if (document.getElementById($campo).className != 'mceEditor') {
							alert($dicionario[0]+' "'+$title+'" '+$dicionario[1]+'\n'+$dicionario[2]);
							document.getElementById($campo).focus();
							return false;
						} else {
							/* if (tinyMCE.get($campo).getContent() == '') {
								alert($dicionario[0]+' "'+$title+'" '+$dicionario[1]+'\n'+$dicionario[2]);
								tinyMCE.execCommand('mceFocus', false, $campo);
								return false;
							} */
						}
					}
				}
			}
		} else if (tempobj.name.substring(0, 14) == 'password_check') {
			$senha = tempobj.value;
			$senha2 = tempobj.value + '2';
			$title = tempobj.title;
			if (document.getElementById($senha2).value == '' && document.getElementById($senha).value != '') {
				alert($dicionario[4]);
				document.getElementById($senha2).focus();
				return false;
			}
			if (document.getElementById($senha).value != document.getElementById($senha2).value && document.getElementById($senha).value != '') {
				alert($dicionario[5]);
				document.getElementById($senha).focus();
				return false;
			}
		} else if (tempobj.name.substring(0, 9) == 'validacao') {
			$campo = tempobj.value;
			if (document.getElementById($campo).value != '') {
				$tipo = tempobj.title;
				if ($tipo == 'email') {
					var reEmail1 = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
					var reEmail2 = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
					var reEmail3 = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
					var reEmail = reEmail3;
					eval("reEmail = reEmail1");
					if (reEmail.test(document.getElementById($campo).value) == false) {
						alert($dicionario[6]);
						document.getElementById($campo).focus();
						document.getElementById($campo).select();
						return false;
					}
				} else if ($tipo == 'ddmmyyyyhhmmss') {

				} else if ($tipo == 'ddmmyyyyhhmm') {

				} else if ($tipo == 'ddmmyyyy') {
					if (document.getElementById($campo).value != '00/00/0000') {
						var reData = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
						if (reData.test(document.getElementById($campo).value) == false) {
							alert($dicionario[7]);
							document.getElementById($campo).focus();
							document.getElementById($campo).select();
							return false;
						}
					}
				} else if ($tipo == 'cep') {
					var reCEP = /^[0-9]{5}-[0-9]{3}$/;
					var reCEP2 = /^[0-9]{8}$/;
					if (reCEP.test(document.getElementById($campo).value) == false && reCEP2.test(document.getElementById($campo).value) == false) {
						alert($dicionario[8]);
						document.getElementById($campo).focus();
						document.getElementById($campo).select();
						return false;
					} else if (reCEP.test(document.getElementById($campo).value) == false) {
						document.getElementById($campo).value = document.getElementById($campo).value.substr(0,5) + "-" + document.getElementById($campo).value.substr(5,8);
					}
				} else if ($tipo == 'cpf') {
					if (!isCpf(document.getElementById($campo).value)) {
						alert($dicionario[9]);
						document.getElementById($campo).focus();
						document.getElementById($campo).select();
						return false;
					} else {
						document.getElementById($campo).value = formatCpfCnpj(document.getElementById($campo).value, true);
					}
				} else if ($tipo == 'cnpj') {
					if (!isCnpj(document.getElementById($campo).value)) {
						alert($dicionario[10]);
						document.getElementById($campo).focus();
						document.getElementById($campo).select();
						return false;
					} else {
						document.getElementById($campo).value = formatCpfCnpj(document.getElementById($campo).value, true, true);
					}
				} else if ($tipo == 'cpf_cnpj' || $tipo == 'cnpj_cpf') {
					if (!isCpf(document.getElementById($campo).value) && !isCnpj(document.getElementById($campo).value)) {
						alert($dicionario[11]);
						document.getElementById($campo).focus();
						document.getElementById($campo).select();
						return false;
					} else if (isCpf(document.getElementById($campo).value)) {
						document.getElementById($campo).value = formatCpfCnpj(document.getElementById($campo).value, true);
					} else if (isCnpj(document.getElementById($campo).value)) {
						document.getElementById($campo).value = formatCpfCnpj(document.getElementById($campo).value, true, true);
					}
				} else if ($tipo.substr(0, 5) == 'chars' && $tipo.length > 5) {
					$tamanho = parseInt($tipo.substr(5));
					if ($tamanho > 0) {
						if (document.getElementById($campo).value.length != $tamanho) {
							if (document.getElementById($campo).title != '') {
								alert($dicionario[12]+$tamanho+' '+$dicionario[13]+' '+document.getElementById($campo).title);
							} else {
								alert($dicionario[12]+$tamanho+' '+$dicionario[14]);
							}
							document.getElementById($campo).focus();
							document.getElementById($campo).select();
							return false;
						}
					}
				}
			} 
		}
	}
	destroy_empty_input_files(formulario);
	return true;
}

function destroy_empty_input_files(formulario) {
	for ($conta = 0; $conta < formulario.length; $conta++) {
		var tempobj = formulario.elements[$conta];
		if (tempobj.type == 'file') {
			if (tempobj.value == '') {
				tempobj.parentNode.removeChild(tempobj);
				$conta--;
			}
		}
	}
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

function Trim(str) {
	return str.replace(/^\s+|\s+$/g,"");
}

function ajusta_height_textarea_aux($id) {
	var thisobj = document.getElementById($id);
	$height = thisobj.parentNode.offsetHeight - 9;
	thisobj.style.height = $height+'px';
}

function uppercase(e, obj) {
	obj.value = obj.value.toUpperCase();
}

function input_texto_campo(e, $tipo, myobj) {
	$ok = false;
	if ($tipo == 'nums_letras') {
		var tecla=(window.event)?event.keyCode:e.which;
		if ((tecla > 47 && tecla < 58) || (tecla > 64 && tecla < 91) || (tecla > 96 && tecla < 123) || tecla == 8) {
			$ok = true;
		} else {
			if (tecla == 0) {
				$ok = true;
			} else {
				$ok = false;
			}
		}	
	} else if ($tipo == 'nums') {
		var tecla=(window.event)?event.keyCode:e.which;
		if ((tecla > 47 && tecla < 58) || tecla == 8) {
			$ok = true;
		} else {
			if (tecla == 0) {
				$ok = true;
			} else {
				$ok = false;
			}
			/*tecla = e.keyCode;
			if (tecla != 8 && tecla != 116 && tecla != 37 && tecla != 39 && tecla != 116 && tecla != 40 && tecla != 38 && tecla != 46 && tecla != 9 && tecla != 35 && tecla != 36) {
				$ok = false;
			} else {
				$ok = true;
			}*/
		}
	} else {
		$ok = true;
	}
	return $ok;
}

function no_enter(obj, e) {
	var tecla=(window.event)?event.keyCode:e.which;
	if (tecla == 13) {
		return false;
	} else {
		return true;
	}
}

function retorna_valor_numerico($my_value, $dec_separator) {
	if ($dec_separator === undefined || $dec_separator == '') {$dec_separator = '.';}
	var $value = $my_value;
	if ($dec_separator == ',') {
		$value = $value.replace('.', '');
		$value = $value.replace(',', '.');
	} else {
		$value = $value.replace(',', '');
	}
	var numero = new Number($value);
	return numero;
}

function formata_valor($my_value, $casas, $decsep, $milsep) {
	if ($casas === undefined || $casas === '') {$casas = 2;}
	if ($decsep === undefined || $decsep == '') {$decsep = ',';}
	if ($milsep === undefined || $milsep == '') {$milsep = '.';}
	var $value = new String($my_value);
	if ($value.indexOf($milsep)) {$value = $value.replace($milsep, '');}
	if ($decsep == ',') {$value = $value.replace($decsep, '.');}
	var numero = new Number($value);
	$value = numero.toFixed($casas);
	if ($decsep == ',') {$value = $value.replace(".", ",");}
	return $value;
}

function formata_valor_with_value($obj, $casas, $decsep, $milsep) {
	if ($casas === undefined || $casas === '') {$casas = 2;}
	if ($decsep === undefined || $decsep == '') {$decsep = ',';}
	if ($milsep === undefined || $milsep == '') {$milsep = '.';}
	if ($obj.value == '') {return false;}
	$obj.value = formata_valor($obj.value, $casas, $decsep, $milsep);
}

function formata_data($my_value, $formato) {
	if ($formato === undefined || $formato == '') {$formato = 'D/M/Y';}	
	var $dia, $mes, $ano;
	var $value = $my_value;
	$value = $value.replace(/[^0-9]/g, "");
	if ($formato.substr(0, 1) == 'D' && $formato.substr(2, 1) == 'M' && $formato.substr(4, 1) == 'Y') {
		if ($value.length == 8) {
			$dia = $value.substr(0, 2);
			$mes = $value.substr(2, 2);
			$ano = $value.substr(4, 4);
		} else if ($value.length == 4 || $value.length == 6) {
			$dia = $value.substr(0, 2);
			$mes = $value.substr(2, 2);
			var now = new Date();
			$thisYear = (now.getFullYear()) + '';
			if ($value.length == 4) {
				$ano = $thisYear;
			} else if ($value.length == 6) {
				$ano = $thisYear.substr(0, 2) + $value.substr(4, 2);
			}
		}
		$value = $dia + $formato.substr(1, 1) + $mes + $formato.substr(3, 1) + $ano;
	} else if ($formato.substr(0, 1) == 'M' && $formato.substr(2, 1) == 'D' && $formato.substr(4, 1) == 'Y') {
		if ($value.length == 8) {
			$mes = $value.substr(0, 2);
			$dia = $value.substr(2, 2);
			$ano = $value.substr(4, 4);
		} else if ($value.length == 4 || $value.length == 6) {
			$mes = $value.substr(0, 2);
			$dia = $value.substr(2, 2);
			var now = new Date();
			$thisYear = (now.getFullYear()) + '';
			if ($value.length == 4) {
				$ano = $thisYear;
			} else if ($value.length == 6) {
				$ano = $thisYear.substr(0, 2) + $value.substr(4, 2);
			}
		}
		$value = $mes + $formato.substr(1, 1) + $dia + $formato.substr(3, 1) + $ano;
	}
	if ($dia == undefined || $mes == undefined || $ano == undefined) {
		$value = '';
	} else if (parseInt($mes, 10) < 1 || parseInt($mes, 10) > 12) {
		$value = '';
	} else if (parseInt($dia, 10) < 1 || parseInt($dia, 10) > 31) {
		$value = '';
	} else if (parseInt($ano, 10) < 1 || parseInt($ano, 10) > 9999) {
		$value = '';
	} else if ((parseInt($mes, 10) == 1 || parseInt($mes, 10) == 3 || parseInt($mes, 10) == 5 || parseInt($mes, 10) == 7 || parseInt($mes, 10) == 8 || parseInt($mes, 10) == 10 || parseInt($mes, 10) == 12) && parseInt($dia, 10) > 31) {
		$value = '';
	} else if ((parseInt($mes, 10) == 4 || parseInt($mes, 10) == 6 || parseInt($mes, 10) == 9 || parseInt($mes, 10) == 11) && parseInt($dia, 10) > 30) {
		$value = '';
	} else if (parseInt($mes, 10) == 2 && ((parseInt($ano, 10) % 4 == 0 && parseInt($dia, 10) > 29) || (parseInt($ano, 10) % 4 != 0 && parseInt($dia, 10) > 28))) {
		$value = '';
	}
	return $value;
}

function formata_data_with_value($obj, $formato) {
	if ($formato === undefined || $formato == '') {$formato = 'D/M/Y';}
	$obj.value = formata_data($obj.value, $formato);
}
			
function pre_load_images(imagem_lista) {
	for ($i = 0; $i < imagem_lista.length; $i++) {
		var preload = new Image();
		preload.src = imagem_lista[$i];
	}
}

function confirmar(msg, cmd) {
	if (confirm(msg)) {
		location.href = (cmd);
	}
}

Date.prototype.format = function(format) {
	var returnStr = '';
	var replace = Date.replaceChars;
	for (var i = 0; i < format.length; i++) {
		var curChar = format.charAt(i);
		if (i - 1 >= 0 && format.charAt(i - 1) == "\\") { 
			returnStr += curChar;
		}
		else if (replace[curChar]) {
			returnStr += replace[curChar].call(this);
		} else if (curChar != "\\"){
			returnStr += curChar;
		}
	}
	return returnStr;
};
 
Date.replaceChars = {
	shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
	longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
	longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
	
	// Day
	d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
	D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
	j: function() { return this.getDate(); },
	l: function() { return Date.replaceChars.longDays[this.getDay()]; },
	N: function() { return this.getDay() + 1; },
	S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
	w: function() { return this.getDay(); },
	z: function() { var d = new Date(this.getFullYear(),0,1); return Math.ceil((this - d) / 86400000); }, // Fixed now
	// Week
	W: function() { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - d) / 86400000) + d.getDay() + 1) / 7); }, // Fixed now
	// Month
	F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
	m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
	M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
	n: function() { return this.getMonth() + 1; },
	t: function() { var d = new Date(); return new Date(d.getFullYear(), d.getMonth(), 0).getDate() }, // Fixed now, gets #days of date
	// Year
	L: function() { var year = this.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); },	// Fixed now
	o: function() { var d  = new Date(this.valueOf());  d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear();}, //Fixed now
	Y: function() { return this.getFullYear(); },
	y: function() { return ('' + this.getFullYear()).substr(2); },
	// Time
	a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
	A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
	B: function() { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24); }, // Fixed now
	g: function() { return this.getHours() % 12 || 12; },
	G: function() { return this.getHours(); },
	h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
	H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
	i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
	s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
	u: function() { var m = this.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ?
'0' : '')) + m; },
	// Timezone
	e: function() { return "Not Yet Supported"; },
	I: function() { return "Not Yet Supported"; },
	O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
	P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':00'; }, // Fixed now
	T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
	Z: function() { return -this.getTimezoneOffset() * 60; },
	// Full Date/Time
	c: function() { return this.format("Y-m-d\\TH:i:sP"); }, // Fixed now
	r: function() { return this.toString(); },
	U: function() { return this.getTime() / 1000; }
};

//dw_event.js
var dw_Event = {
  
    add: function(obj, etype, fp, cap) {
        cap = cap || false;
        if (obj.addEventListener) obj.addEventListener(etype, fp, cap);
        else if (obj.attachEvent) obj.attachEvent("on" + etype, fp);
    }, 

    remove: function(obj, etype, fp, cap) {
        cap = cap || false;
        if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap);
        else if (obj.detachEvent) obj.detachEvent("on" + etype, fp);
    }, 
    
    DOMit: function(e) { 
        e = e? e: window.event; // e IS passed when using attachEvent though ...
        if (!e.target) e.target = e.srcElement;
        if (!e.preventDefault) e.preventDefault = function () { e.returnValue = false; return false; }
        if (!e.stopPropagation) e.stopPropagation = function () { e.cancelBubble = true; }
        return e;
    },
    
    getTarget: function(e) {
        e = dw_Event.DOMit(e); var tgt = e.target; 
        if (tgt.nodeType != 1) tgt = tgt.parentNode; // safari...
        return tgt;
    }
    
}

// dw_viewreport.js
var dw_Viewport = {
    getWinWidth: function () {
        this.width = 0;
        if (window.innerWidth) 
            this.width = window.innerWidth - 18;
        else if (document.documentElement && document.documentElement.clientWidth) 
            this.width = document.documentElement.clientWidth;
        else if (document.body && document.body.clientWidth) 
            this.width = document.body.clientWidth;
        return this.width;
    },
  
    getWinHeight: function () {
        this.height = 0;
        if (window.innerHeight) 
            this.height = window.innerHeight - 18;
        else if (document.documentElement && document.documentElement.clientHeight) 
            this.height = document.documentElement.clientHeight;
        else if (document.body && document.body.clientHeight) 
            this.height = document.body.clientHeight;
        return this.height;
    },
  
    getScrollX: function () {
        this.scrollX = 0;
        if (typeof window.pageXOffset == "number") 
            this.scrollX = window.pageXOffset;
        else if (document.documentElement && document.documentElement.scrollLeft)
            this.scrollX = document.documentElement.scrollLeft;
        else if (document.body && document.body.scrollLeft) 
            this.scrollX = document.body.scrollLeft; 
        else if (window.scrollX) 
            this.scrollX = window.scrollX;
        return this.scrollX;
    },
    
    getScrollY: function () {
        this.scrollY = 0;    
        if (typeof window.pageYOffset == "number") 
            this.scrollY = window.pageYOffset;
        else if (document.documentElement && document.documentElement.scrollTop)
            this.scrollY = document.documentElement.scrollTop;
        else if (document.body && document.body.scrollTop) 
            this.scrollY = document.body.scrollTop; 
        else if (window.scrollY) 
            this.scrollY = window.scrollY;
        return this.scrollY;
    },
    
    getAll: function () {
        this.getWinWidth(); this.getWinHeight();
        this.getScrollX();  this.getScrollY();
    }
  
}

//dw_tooltip.js
var dw_Tooltip = {
    offX: 12,
    offY: 12,
    showDelay: 100,
    hideDelay: 100,
    hoverDelay: 500, // for hover tip
    tipID: "tipDiv",
    actuatorClass: "showTip",
    maxLoops: 2, // for actuator check (linked image, etc.)
    activateOnfocus: true,
    provideShim: false, // iframe shim for ie optional (fixed as of ie7 ?)
    
    tip: null, shim:null, timer: 0, hoverTimer: 0,
    active: false, actuator: null, resetFlag: false, restored: true,
    on_show: function() {}, on_position: function() {}, on_hide: function() {},
    
    init: function() {
        var _this = dw_Tooltip, el;
        if ( _this.hasSupport()  ) {
            // already exists?
            if ( !(el = document.getElementById(_this.tipID) ) ) {
                el = document.createElement("div");
                el.id = _this.tipID; 
                document.body.appendChild(el);
            }
            el.style.position = 'absolute'; el.style.visibility = 'hidden'; el.style.zIndex = 10000;
            _this.tip = document.getElementById( _this.tipID);
            _this.setDefaults();
            if ( _this.checkOverlaySupport() ) { _this.prepOverlay(); }
            _this.setPosition(0, 0);
        }
    },
    
    hasSupport: function () {
        if ( document.createElement && document.getElementsByTagName
             && ( document.addEventListener || document.attachEvent ) ) {
            return true;
        }
        return false;
    },
    
    setDefaults: function() { // called when props changed (resetFlag set)
        if ( !this.defaultProps ) this.defaultProps = {};
        // prop name, type, default
        var list = [  ['followMouse', 'boolean', true], ['sticky', 'boolean', false], ['klass', 'string', ''],
            ['hoverable', 'boolean', false], ['duration', 'number', 0], 
            ['jumpAbove', 'boolean', true], ['jumpLeft', 'boolean', true],
            ['Left', 'boolean', false], ['Above', 'boolean', false],
            ['positionFn', 'function', this.positionRelEvent], 
            ['wrapFn', 'function', function(str) { return str; } ]  ];
        
        for (var i=0; list[i]; i++) {
            this[ list[i][0] ] = ( typeof this.defaultProps[ list[i][0] ] == list[i][1] )? 
                this.defaultProps[ list[i][0] ]: list[i][2];
        }
        
        this.tip.className = this.klass;
        this.coordinateOptions();
    },
    
    activate: function(e, tgt, msg, id) {
        var _this = dw_Tooltip; if (!_this.tip) return;
        _this.clearTimer('timer');  _this.clearTimer('hoverTimer');
        if ( !_this.restored ) _this.handleRestore();
        _this.actuator = tgt; dw_Viewport.getAll();  
        _this.getContent(e, tgt, msg, id); _this.restored = false;
        if ( !_this.tip.innerHTML ) return; _this.active = true;
        _this.handleOptions(e);  _this.positionFn(e, tgt); _this.adjust();
        _this.timer = setTimeout(_this.show, _this.showDelay);
    },

    getContent: function(e, tgt, msg, id) {
        msg = msg || '';
        if (id && !msg) {
            var obj = (id && this.content_vars && this.content_vars[id])? this.content_vars[id]: false;
            if ( typeof obj == 'string' ) {
                msg = obj;
            } else if ( typeof obj == 'object' ) {
                this.checkForProps( obj );
                if ( obj['content'] ) { 
                    msg = obj['content'];
                } else if ( obj['html_id'] ) { // id of page element
                    var el = document.getElementById( obj['html_id'] ); 
                    if (el) msg = el.innerHTML;
                } else { 
                    msg = obj;  // wrapFn will obtain props from obj 
                }
            }
        }        
        this.writeTip(msg);
    },
    
    writeTip: function(msg, bReqFlag) {
        if ( this.pendingReq && this.respRecd && !bReqFlag ) return;
        msg = this.wrapFn(msg); this.tip.innerHTML = msg;
    },
    
    positionRelEvent: function(e, tgt) {
        var _this = dw_Tooltip; 
        if (typeof e == 'object') { // event 
            if ( e.type == 'mouseover' || e.type == 'mousemove' ) {
                _this.evX = _this.getMouseEventX(e);
                _this.evY = _this.getMouseEventY(e);
            } else { // focus
                var pos = dw_Util.getPageOffsets( tgt );
                _this.evX = pos.x;
                _this.evY = pos.y;
            }
        }
        
        var coords = _this.calcPosCoords(e, tgt);
        _this.setPosition(coords.x, coords.y);
    },
    
    calcPosCoords: function(e, tgt) {
        var x = this.evX; var y = this.evY; var xXd, yXd;
        var maxX = this.getMaxX(); var maxY = this.getMaxY(); // tip width/height too
        
        var tx = x + this.offX;
        var altx = x - ( this.width + this.offX );
        var spL =  x - dw_Viewport.scrollX > dw_Viewport.width/2;
        
        if ( typeof e == 'object' && e.type && ( e.type == 'focus' || e.type == 'focusin' ) ) {
            var tgtWidth = tgt.offsetWidth;
            if ( tx + tgtWidth  < maxX ) {
                x = this.evX = x + tgtWidth;
                tx += tgtWidth; 
            } else if (tx + 20 < maxX ) {
                x = this.evX = x + 20;
                tx += 20
            }
            y = this.evY = y + 10;
        }
        
        var ty = y + this.offY;
        var alty = y - ( this.height + this.offY );
        var spA =  y - dw_Viewport.scrollY > dw_Viewport.height/2;
        
        if ( !this.Left && tx < maxX ) {
            x = tx;
        } else if ( ( this.Left && altx >= dw_Viewport.scrollX ) || 
                ( this.jumpLeft && tx >= maxX && altx >= dw_Viewport.scrollX ) ) {
            x = altx;
        } else if ( ( this.Left && altx < dw_Viewport.scrollX ) || 
                ( !this.Left && this.jumpLeft && altx < dw_Viewport.scrollX && spL ) ) {
            x = dw_Viewport.scrollX; // place at left edge
            xXd = 'Left'; // check later whether yXd too
        } else if ( !this.Left && tx >= maxX && ( !this.jumpLeft || 
                ( this.jumpLeft && altx < dw_Viewport.scrollX && !spL ) ) ) {
            x = maxX; xXd = 'Right';
        }
        
        if ( !this.Above && ty < maxY ) {
            y = ty;
        } else if ( ( this.Above && alty >= dw_Viewport.scrollY ) || 
                ( this.jumpAbove && ty >= maxY && alty >= dw_Viewport.scrollY ) ) {
            y = alty;
        } else if ( ( this.Above && alty < dw_Viewport.scrollY ) || 
                ( !this.Above && this.jumpAbove && alty < dw_Viewport.scrollY && spA )  ) {
            y = dw_Viewport.scrollY; // place at top
            yXd = 'Above';
        } else if ( !this.Above && ty >= maxY && ( !this.jumpAbove || 
                ( this.jumpAbove && alty < dw_Viewport.scrollY && !spA ) ) ) {
            y = maxY; yXd = 'Below';
        }
        
        if ( xXd && yXd ) { // over link (will flicker) calc least distance to uncover
            var dx = (xXd == 'Left')? dw_Viewport.scrollX - altx: tx - maxX;
            var dy = (yXd == 'Above')? dw_Viewport.scrollY - alty: ty - maxY;
            if ( dx <= dy ) {
                x = (xXd == 'Left')? altx: tx;
            } else {
                y = (yXd == 'Above')? alty: ty;
            }
        }
        return { x: x, y: y }
    },
    
    adjust: function() {
        var _this = dw_Tooltip;
        var imgs = _this.tip.getElementsByTagName('img');
        var img = imgs.length? imgs[imgs.length - 1]: null;
        checkComplete();
        
        function checkComplete() {
            if ( !_this.active ) return;
             _this.positionFn();
            if (img && !img.complete) {
                setTimeout( checkComplete, 50);
            }
        }
    },
    
    setPosition: function(x, y) {
        this.tip.style.left = x + 'px';
        this.tip.style.top = y + 'px';
        this.setOverlay(); this.on_position();
    },

    show: function() {
        var _this = dw_Tooltip;
        _this.tip.style.visibility = 'visible';
        if ( _this.shim ) _this.shim.style.visibility = 'visible';
        _this.on_show();
    },

    deactivate: function(e) {
        var _this = dw_Tooltip; if (!_this.tip || !_this.active || _this.sticky ) return;
        e = e? e: window.event;
        if (e.type && e.type == 'mouseout' && !dw_Util.mouseleave(e, _this.actuator) ) return;
        _this.clearTimer('timer');  _this.clearTimer('hoverTimer');
        
        if ( _this.hoverable ) { // delayed call to hide (time to check if hovered over tip)
            _this.hoverTimer = setTimeout( _this.hide, _this.hoverDelay );
            return;
        }
        if ( _this.duration ) {
            _this.timer = setTimeout( _this.hide, _this.duration );
            return;
        }
        _this.timer = setTimeout( _this.hide, _this.hideDelay );
    },
    
    hide: function() {
        var _this = dw_Tooltip; if (!_this.tip) return;
        _this.tip.style.visibility = 'hidden';
        if ( _this.shim ) _this.shim.style.visibility = 'hidden';
        _this.handleRestore(); _this.on_hide();
    },
    
    handleOptions: function(e) {
        this.coordinateOptions();
        if ( this.klass ) { this.tip.className = this.klass; }
        if ( this.hoverable ) {
            this.tip.onmouseout = dw_Tooltip.tipOutCheck;
            this.tip.onmouseover = function() { dw_Tooltip.clearTimer('hoverTimer'); }
        }
        if ( this.followMouse && !this.hoverable && !(e.type == 'focus' || e.type == 'focusin') ) {
            dw_Event.add(document, 'mousemove', this.positionRelEvent);
        }
        
        if ( this.sticky || this.duration ) {
            dw_Event.add( document, "mouseup", dw_Tooltip.checkDocClick );
        }
    },
    
    coordinateOptions: function() {
        if ( this.sticky || this.hoverable || this.duration ) { this.followMouse = false; }
        if ( this.sticky ) { this.hoverable = false; this.duration = 0; }
        if ( this.hoverable ) { this.duration = 0; }
        if ( this.positionFn != this.positionRelEvent ) this.followMouse = false;
    },

    handleRestore: function() {
        if ( this.followMouse ) {
            dw_Event.remove(document, 'mousemove', this.positionRelEvent);
        }
        if ( this.sticky || this.duration ) {
            dw_Event.remove( document, "mouseup",   dw_Tooltip.checkDocClick, false );
        }
        this.tip.onmouseover = this.tip.onmouseout = function() {}
        
        if ( this.resetFlag ) this.setDefaults(); 
        this.writeTip('');
        
        this.active = false; this.actuator = null;
        this.tip.style.width = ''; 
        this.restored = true;
    },
    
    // first class name is actuatorClass, second class would point to content 
    getTipClass: function(cls) {
        if (!cls) return ''; var c = '';
        var classes = cls.split(/\s+/);
        if ( classes[0] == this.actuatorClass && classes[1] ) {
            c = classes[1];
        }
        return c; // return second class name or ''
    },
    
    checkForProps: function(obj) {
        var list = ['jumpAbove', 'jumpLeft', 'Above', 'Left', 'sticky', 'duration', 
                'hoverable', 'followMouse', 'klass', 'positionFn', 'wrapFn'];
        for (var i=0; list[i]; i++) {
            if ( typeof obj[ list[i] ] != 'undefined' ) {
                this[ list[i] ] = obj[ list[i] ];
                this.resetFlag = true;
            }
        }
    },

    tipOutCheck: function(e) { // hover tip
        var _this = dw_Tooltip; e = dw_Event.DOMit(e);
        var tip = this; // assigned to onmouseover property of tip
        if ( dw_Util.mouseleave(e, tip) ) {
            _this.timer = setTimeout( _this.hide, _this.hideDelay);
        }
    },

    checkEscKey: function(e) { // for sticky, duration, and onfocus activation
        e = e? e: window.event;  if ( e.keyCode == 27 ) dw_Tooltip.hide();
    },

    checkDocClick: function(e) { 
        if ( !dw_Tooltip.active ) return;
        var tgt = dw_Event.getTarget(e);
        // hide tooltip if you click anywhere in the document 
        // except on the tooltip, unless that click is on the tooltip's close box    
        var tip = document.getElementById(dw_Tooltip.tipID);
        if ( tgt == tip || dw_Util.contained(tgt, tip) ) {
            if ( tgt.tagName && tgt.tagName.toLowerCase() == "img" ) tgt = tgt.parentNode; 
            if ( tgt.tagName.toLowerCase() != "a" || tgt.href.indexOf("dw_Tooltip.hide") != -1 ) return;
        }
        // slight delay to avoid crossing onfocus activation and doc click hide 
        dw_Tooltip.timer = setTimeout( dw_Tooltip.hide, 50);
    },
    
    // check need for and support of iframe shim (for ie win and select lists)
    checkOverlaySupport: function() {
        if (  this.provideShim && navigator.userAgent.indexOf("Windows") != -1 && 
            typeof document.body != "undefined" && 
            typeof document.body.insertAdjacentHTML != "undefined" && 
            !window.opera && navigator.appVersion.indexOf("MSIE 5.0") == -1 
            ) return true;
        return false;
    }, 
    
    prepOverlay: function() {
        document.body.insertAdjacentHTML("beforeEnd", '<iframe id="tipShim" src="javascript: false" style="position:absolute; left:0; top:0; z-index:500; visibility:hidden" scrolling="no" frameborder="0"></iframe>');
        this.shim = document.getElementById('tipShim'); 
        if (this.shim && this.tip) {
            this.shim.style.width = this.tip.offsetWidth + "px";
            this.shim.style.height = this.tip.offsetHeight + "px";
        }
    },
    
    setOverlay: function() { // position and dimensions
        if ( this.shim ) {
            this.shim.style.left = this.tip.style.left;
            this.shim.style.top = this.tip.style.top;
            this.shim.style.width = this.tip.offsetWidth + "px";
            this.shim.style.height = this.tip.offsetHeight + "px";
        }
    },
    
    clearTimer: function(timer) {
        if ( dw_Tooltip[timer] ) { clearTimeout( dw_Tooltip[timer] ); dw_Tooltip[timer] = 0; }
    },
    
    getWidth: function() { return this.width = this.tip.offsetWidth; },
    getHeight: function() { return this.height = this.tip.offsetHeight; },
    getMaxX: function() { return dw_Viewport.width + dw_Viewport.scrollX - this.getWidth() - 1; },
    getMaxY: function() { return dw_Viewport.height + dw_Viewport.scrollY - this.getHeight() - 1; },
    getMouseEventX: function(e) { return e.pageX? e.pageX: e.clientX + dw_Viewport.scrollX; },
    getMouseEventY: function(e) { return e.pageY? e.pageY: e.clientY + dw_Viewport.scrollY; }
    
}

// code for event delegation
dw_Tooltip.initHandlers = function () {
    dw_Event.add(document, 'mouseover', dw_Tooltip.checkActuatorMouseover);
    dw_Event.add( document, "keydown", dw_Tooltip.checkEscKey,  true ); // for sticky 
    dw_Event.add( window, 'blur', dw_Tooltip.deactivate, true ); 
    dw_Event.add( window, 'unload', dw_Tooltip.deactivate, true ); // firefox needs
    
    // see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
    if ( dw_Tooltip.activateOnfocus ) {
        document.onfocusin = dw_Tooltip.checkActuatorFocus; // ie
        if ( window.addEventListener ) {
            dw_Event.add(document, 'focus', dw_Tooltip.checkActuatorFocus, true);
        }
    }
}

dw_Tooltip.checkActuatorMouseover = function (e) {
    var tgt = dw_Event.getTarget(e); var tipAct = null;
    // limit number of loops 
    var ctr = 0; var maxCnt = dw_Tooltip.maxLoops; 
    do {
        if ( (tipAct = dw_Tooltip.getActuatorInfo(tgt)) ) {
            var msg = tipAct.msg; var id = tipAct.id;
            dw_Tooltip.activate(e, tgt, msg, id);
            if ( window.attachEvent ) { // avoid multiples for ie (?)
                dw_Event.remove( tgt, 'mouseout', dw_Tooltip.deactivate); 
            }
            dw_Event.add( tgt, 'mouseout', dw_Tooltip.deactivate); 
            break;
        }
        ctr++;
    } while ( ctr < maxCnt && (tgt = tgt.parentNode) ); 

}

dw_Tooltip.checkActuatorFocus = function (e) {
    e = e? e: window.event; var tipAct = null;
    var tgt = dw_Event.getTarget(e);
    if ( tgt && (tipAct = dw_Tooltip.getActuatorInfo(tgt) ) ) {
        if ( dw_Tooltip.active && tgt == dw_Tooltip.actuator ) { 
            return; // if already activated onmouseover
        }
        var msg = tipAct.msg; var id = tipAct.id;
        dw_Tooltip.activate(e, tgt, msg, id);
        if ( window.attachEvent ) { 
            tgt.onfocusout = dw_Tooltip.deactivate;
        } else {
            dw_Event.add( tgt, 'blur', dw_Tooltip.deactivate, true); 
        }
    }
}

// Check whether the target is an actuator and the content can be located 
// Either the content itself or the identifier in content_vars will be returned in obj {msg: msg, id: id}
dw_Tooltip.getActuatorInfo = function (tgt) {
    var qual = dw_Tooltip.defaultProps['actuatorQual'] || 'actuatorClass';
    var source = dw_Tooltip.defaultProps['content_source'] || 'content_vars';
    var msg = '', id = '';
    dw_Tooltip.resetReqFlags();
    switch (qual) {
        case 'actuatorClass' : 
            var cls = dw_Tooltip.getTipClass(tgt.className);
            if (!cls) break;
            if ( source == 'content_vars' ) {
                id = (dw_Tooltip.content_vars && dw_Tooltip.content_vars[cls])? cls: '';
            } else if ( source == 'class_id' ) {
                var el = document.getElementById(cls);
                if (el) msg = el.innerHTML;
            }
            break;
        case 'queryVal' :
            var queryVal = dw_Tooltip.defaultProps['queryVal'];
            var val = queryVal? dw_Util.getValueFromQueryString(queryVal, tgt ): '';
            id = (val && dw_Tooltip.content_vars && dw_Tooltip.content_vars[val])? val: '';
            // Even if the content source is ajax, would check content_vars (see below)
            // dw_updateTooltip should be set up to save results in content_vars
            if ( val && source == 'ajax' && !id ) {
                // Something to display in the tooltip while awaiting response. Empty string won't suffice!  
                msg = 'Retrieving info ...'; 
                dw_Tooltip.pendingReq = true; 
                var queryData = encodeURIComponent(queryVal) + '=' + encodeURIComponent(val);
                dw_TooltipRequest( queryData, val ); // val passed as means to save response
            }
            break;
        case 'id' :
            id = (tgt.id && dw_Tooltip.content_vars && dw_Tooltip.content_vars[tgt.id])? tgt.id: '';
            break;
    }
    //if ( id && !msg ) { // check content_vars (for previously saved ajax result, or more complex data for ajax request)  }
    if ( id || msg ) {
        return {msg: msg, id: id}
    }
    return false;
}

// check so don't overwrite response if already received (localhost speed)
dw_Tooltip.resetReqFlags = function () {
    this.respRecd = false;
    this.pendingReq = false;
}

/////////////////////////////////////////////////////////////////////
// Helper functions 

var dw_Util; if (!dw_Util) dw_Util = {};

dw_Util.mouseleave = function (e, oNode) {
    e = dw_Event.DOMit(e);
    var toEl = e.relatedTarget? e.relatedTarget: e.toElement? e.toElement: null;
    if ( oNode != toEl && !dw_Util.contained(toEl, oNode) ) {
        return true;
    }
    return false;
}

dw_Util.contained = function (oNode, oCont) {
    if (!oNode) return null; // in case alt-tab away while hovering (prevent error)
    while ( (oNode = oNode.parentNode) ) if ( oNode == oCont ) return true;
    return false;
}

// Get position of element in page (treacherous cross-browser territory! Don't expect perfect results)
// can get weird results in ie
dw_Util.getPageOffsets = function (el) {
	var left = 0, top = 0;
    do {
        left += el.offsetLeft;
        top += el.offsetTop;
    } while ( (el = el.offsetParent) );
    return { x:left, y:top };
}

// obj: link or window.location
dw_Util.getValueFromQueryString = function (name, obj) {
    obj = obj? obj: window.location; 
    if (obj.search && obj.search.indexOf(name != -1) ) {
        var pairs = obj.search.slice(1).split("&"); // name/value pairs
        var set;
        for (var i=0; pairs[i]; i++) {
            set = pairs[i].split("="); // Check each pair for match on name 
            if ( set[0] == name && set[1] ) {
                return set[1];
            }
        }
    }
    return '';
}

//dw_tooltip_aux.js
// Used when the tooltip content is in HTML elements with tipContent class attached 
dw_Tooltip.writeStyleRule = function() {
    if ( dw_Tooltip.hasSupport() ) {
        document.write('<style type="text/css" media="screen">.tipContent { display:none; }</style>');
    }
}

///////////////////////////////////////////////////////////////////////////////////
//  Initialization: init tooltip and set up event delegation

dw_Event.add( window, 'load', dw_Tooltip.init );
dw_Event.add( window, 'load', dw_Tooltip.initHandlers );

// removed in favor of event delegation
function dw_initShowTip() {} // empty fn to avoid errors 

// fn's for ajax in head of ajax demo
function dw_TooltipRequest() {}

/////////////////////////////////////////////////////////////////////
//  Positioning algorithms 

dw_Tooltip.positionWindowCenter = function() {
    var x = Math.round( (dw_Viewport.width - dw_Tooltip.tip.offsetWidth)/2 ) + dw_Viewport.scrollX;
    var y = Math.round( (dw_Viewport.height - dw_Tooltip.tip.offsetHeight)/2 ) + dw_Viewport.scrollY;
    dw_Tooltip.setPosition(x,y);
}

// more later or TBA

/////////////////////////////////////////////////////////////////////
// formatting and display functions 

// for style sheet specs: id for stickyTable,
// stickyBar class for tr, div classes: stickyTitle, stickyContent (inside td's)
dw_Tooltip.wrapSticky = function(str, title) {
    title = title || '';
    var src = dw_Tooltip.defaultProps['closeBoxImage'];
    var msg = '<table id="stickyTable" border="0" cellpadding="0" cellspacing="0" width="100%"><tr class="stickyBar">' + 
        '<td><div class="stickyTitle">' + title + '</div></td>' + 
        '<td style="text-align:right"><a href="javascript: void dw_Tooltip.hide()">' + 
        '<img style="float:right" src="' + src + '" border="0" /></a></td></tr>' + 
        '<tr><td colspan="2"><div class="stickyContent">' + str + '</div></td></tr></table>';
    return msg;
}

// optional caption, optional width supported by all these wrapFn's

dw_Tooltip.wrapToWidth = function(obj) {
    if (!obj) return ''; var str = obj['str']; 
    var caption = obj['caption'] || '';
    if ( this.sticky && this.defaultProps['showCloseBox'] ) {
        str = dw_Tooltip.wrapSticky(str, caption );
    } else {
        if (caption) { str = '<div class="caption">' + obj['caption']  + '</div>' + str; }
    }
    if ( obj['w'] ) this.setTipWidth( obj['w'] );
    return str;
}

// w, h in obj are width and height of image
dw_Tooltip.wrapImageToWidth = function(obj) {
    if (!obj) return ''; dw_Util.getImage( obj['img'] );
    var caption = obj['caption'] || ''; var w = obj['w'];
    var str = '<img src="' + obj['img'] + '" width="' +w + '" height="' + obj['h'] + '" alt="">';
    if ( this.sticky && this.defaultProps['showCloseBox'] ) {
        str = dw_Tooltip.wrapSticky(str, caption );
        w += 8; // attempt to account for padding etc of inner wrapper
    } else {
        if (caption) { str = '<div class="caption">' + obj['caption']  + '</div>' + str; }
    }
    if (w) this.setTipWidth(w);
    return str;
}

// Image and text side by side
// w is width to set tipDiv
dw_Tooltip.wrapTextByImage = function(obj) {
    if (!obj) return ''; dw_Util.getImage( obj['img'] );
    var caption = obj['caption'] || '';
    var str = '<table cellpadding="0" cellspacing="0" border="0"><tr>' + 
        '<td><div class="txt">' + obj['txt'] + '</div></td>' + 
         '<td><div class="img"><img src="' + obj['img'] + '" /></div>' + 
         '</td></tr></table>';
    
    if ( this.sticky && this.defaultProps['showCloseBox'] ) {
        str = dw_Tooltip.wrapSticky(str, caption );
    } else {
        if (caption) { str = '<div class="caption">' + obj['caption']  + '</div>' + str; }
    }
    if ( obj['w'] ) this.setTipWidth( obj['w'] );
    return str;
}

dw_Tooltip.wrapImageOverText = function(obj) {
    if (!obj) return ''; dw_Util.getImage( obj['img'] );
    var caption = obj['caption'] || '';
    var str = '<div class="img"><img src="' + obj['img'] + '" /></div><div class="txt">' + obj['txt'] + '</div>';
    if ( this.sticky && this.defaultProps['showCloseBox'] ) {
        str = dw_Tooltip.wrapSticky(str, caption );
    } else {
        if (caption) { str = '<div class="caption">' + obj['caption']  + '</div>' + str; }
    }
    if ( obj['w'] ) this.setTipWidth( obj['w'] );
    return str;
}

dw_Tooltip.wrapTextOverImage = function(obj) {
    if (!obj) return ''; dw_Util.getImage( obj['img'] );
    var caption = obj['caption'] || '';
    var str = '<div class="txt">' + obj['txt'] + '</div><div class="img"><img src="' + obj['img'] + '" /></div>';
    if ( this.sticky && this.defaultProps['showCloseBox'] ) {
        str = dw_Tooltip.wrapSticky(str, caption );
    } else {
        if (caption) { str = '<div class="caption">' + obj['caption']  + '</div>' + str; }
    }
    if ( obj['w'] ) this.setTipWidth( obj['w'] );
    return str;
}

// several functions include option of setting width 
dw_Tooltip.setTipWidth = function(w) {
    w += dw_Util.forBackCompatWidth( this.tip ); // in case padding and border set on tipDiv
    this.tip.style.width = w + "px";
}

/////////////////////////////////////////////////////////////////////
//  a few  utility functions 

var dw_Util; if (!dw_Util) dw_Util = {};

dw_Util.getImage = function (src) {
    var img = new Image();
    img.src = src;
}

// To obtain padding and border for setting width on an element
dw_Util.forBackCompatWidth = function (el) {
    var val = 0;
    var getStyle = dw_Util.getCurrentStyle;
    if ( el.currentStyle && !window.opera && (document.compatMode == null || document.compatMode == "BackCompat") ) {
        var pl = parseInt( dw_Util.getCurrentStyle(el, 'paddingLeft') );
        var pr = parseInt( dw_Util.getCurrentStyle(el, 'paddingRight') );
        var bl = parseInt( dw_Util.getCurrentStyle(el, 'borderLeftWidth') );
        var br = parseInt( dw_Util.getCurrentStyle(el, 'borderRightWidth') );
        val = (!isNaN(pl)? pl: 0) + (!isNaN(pr)? pr: 0) + (!isNaN(bl)? bl: 0) + (!isNaN(br)? br: 0); // p + b;
    }
    return val;
}

// prop must be camelCase (e.g., paddingLeft, borderLeftWidth)
dw_Util.getCurrentStyle = function (el, prop) {
    var val = '';
    if (document.defaultView && document.defaultView.getComputedStyle) {
        val = document.defaultView.getComputedStyle(el, null)[prop];
    } else if (el.currentStyle) {
        val = el.currentStyle[prop];
            // from jquery, dean edwards, see http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
            if ( !/^\d+(px)?$/i.test(val) && /^\d/.test(val) ) {
				var style = el.style.left;
				var runtimeStyle = el.runtimeStyle.left;
				el.runtimeStyle.left = el.currentStyle.left;
				el.style.left = val || 0;
				val = el.style.pixelLeft + "px";
				el.style.left = style;
				el.runtimeStyle.left = runtimeStyle;
			}
    }
    return val;
}
