function ApplyHint(aWin){
	aWin.attachEvent('onload',function(){ApplyHintEx(aWin)});
}

function ApplyHintEx(aWin){
	if (!aWin.document.body.getAttribute('noHint')){
		aWin.document.body.insertAdjacentHTML('beforeEnd','<div id="DIV_SailHint" class="SailHint">111</div>');
		aWin.document.getElementById('DIV_SailHint').style.display='none';
		aWin.document.attachEvent('onmousemove',function(){showHint(aWin)});
		aWin.document.attachEvent('onfocusout',function(){ try{aWin.document.getElementById('DIV_SailHint').style.display='none';}catch(e){} });
	}
}

function showHint(aWin){
	var obj=aWin.document.getElementById('DIV_SailHint');
	var sText='';
	try{
		if (aWin.event.srcElement.getAttribute('title')){
			sText = aWin.event.srcElement.title;
			if (sText!='') aWin.event.srcElement.setAttribute('Hint',sText);
			aWin.event.srcElement.title='';
		}
		if (aWin.event.srcElement.getAttribute('Hint')){
			sText = aWin.event.srcElement.Hint;
		}
		if (sText==''){
			obj.style.display='none';
		}else{
			var aEven = aWin.event;
			var aBody = aWin.document.body;
			sText = sText.replace(/\n/g,'<br>')
			obj.innerHTML=sText;
			obj.style.display='';
			obj.style.left=aEven.x + aBody.scrollLeft;
			obj.style.top=aEven.y + aBody.scrollTop + 22;

			if((parseInt(obj.style.left) + parseInt(obj.offsetWidth) - parseInt(aBody.scrollLeft)) > (parseInt(aBody.offsetWidth)-30)){
				obj.style.left = parseInt(aBody.offsetWidth)-parseInt(obj.offsetWidth)+parseInt(aBody.scrollLeft)-20;
				if (parseInt(obj.style.left)<0) obj.style.left=0;
			}
			if((parseInt(obj.style.top) + parseInt(obj.offsetHeight) - parseInt(aBody.scrollTop)) > (parseInt(aBody.offsetHeight)-5)){
				obj.style.top = parseInt(aBody.offsetHeight)-parseInt(obj.offsetHeight)+parseInt(aBody.scrollTop)-5;
				obj.style.left = parseInt(obj.style.left) + 15;
			}
		}
	}catch(e){}
}
