function elementMouseTarget(e) {
	var targ;
	
	if (!e) var e = window.event;
	
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
		
	return targ;
}

function elementMouseFrom(e) {
	if (!e) var e = window.event;
	var relTarg = e.relatedTarget || e.fromElement;
	
	return relTarg;
}

function elementMouseTo(e) {
	if (!e) var e = window.event;
	var relTarg = e.relatedTarget || e.toElement;
	
	return relTarg;
}

function coorMousePos(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	
	return [posx, posy];
}

var t;
function updateTextChanged(txtBox, timeout) {
    //clearTimeout(t);
    //if(txtBox.value.length > 0) {
        //t = window.setTimeout("__doPostBack('" + txtBox.id + "','')", parseInt(timeout));
        //function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit)
        //t = window.setTimeout("WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('" + txtBox.name + "', '', true, '', '', false, true))", parseInt(timeout));
    //}

    updateTextChanged(txtBox, timeout, false, '');
}
function updateTextChanged(txtBox, timeout, validation, validationGroup) {
    clearTimeout(t);
    t = window.setTimeout("WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('" + txtBox.name + "', '', " + validation + ", '" + validationGroup + "', '', false, true))", parseInt(timeout));
}

function insertDateNow(objField) {
	 if(objField.value.length != 0)
	    return;
	 
	 var datNow = new Date();
	 var strDay = datNow.getDate();
	 var strMonth = 1 + datNow.getMonth();
	 var strYear = datNow.getYear();
	 
	 if(strDay < 10) { strDay = "0" + strDay; }
	 if(strMonth < 10) { strMonth = "0" + strMonth; }
	 if(strYear < 2000) { strYear = strYear + 1900; }
	 
	 var strDateNow = strDay + "-" + strMonth + "-" + strYear;
	 
	 objField.value = strDateNow;
}
