
var g_strDivId="divTooltipLayer";
if(document.getElementById(g_strDivId)==null){
document.write("<div id=\"" + g_strDivId + "\" style=\"position:absolute;background-color:#fffac1;z-index:9999;border:1px solid #FF7C33;color:#F03C0F;padding:5px;font-size:12px;font-family:Verdana,Arial,Helvetica,sans-serif;display:none;\"></div>");}
function InitializeToolTip(ctrl,strTip){
var obj=typeof(ctrl)=="string"?document.getElementById(ctrl):ctrl;
if(obj==null){
alert("Error:ctrl {"+ctrl+"} does not exist!");
return false;}
obj.setAttribute("title",strTip);
obj.setAttribute("atl",strTip);
obj.attachEvent("onfocus",(function(p,v){
return function(){
__ShowToolTip(p,v);};})(obj,strTip));
obj.attachEvent("onblur",function(){__HideToolTip();});}
function InitializeTipBox(ctrl,strTip){
var obj=typeof(ctrl)=="string"?document.getElementById(ctrl):ctrl;
if(obj==null){
alert("Error:ctrl {"+ctrl+"} does not exist!");
return false;}
obj.outerHTML+="<input type=\"text\" id=\"" + obj.getAttribute("id") + "_brother\"/>";
obj=typeof(ctrl)=="string"?document.getElementById(ctrl):ctrl;
var objBrother=document.getElementById(obj.getAttribute("id")+"_brother");
__CloneStyle(obj.style,objBrother.style);
objBrother.className=obj.className;
objBrother.disabled=obj.disabled;
objBrother.size=obj.size;
objBrother.style.color=obj.style.color;
objBrother.value=strTip;
objBrother.attachEvent('onfocus',(function(p){
return function(){
var obj=document.getElementById(ctrl);
var objBrother=document.getElementById(ctrl+"_brother");
obj.style.display="";
objBrother.style.display="none";
obj.focus();};})(ctrl));
obj.attachEvent('onblur',(function(p){
return function(){
var obj=document.getElementById(ctrl);
var objBrother=document.getElementById(ctrl+"_brother");
if(obj.value.length>0)
return;
objBrother.style.display="";
obj.style.display="none";};})(ctrl));
if(obj.value.length==0){
obj.style.display="none";
objBrother.style.display="";}
else{
obj.style.display="";
objBrother.style.display="none";}}
function GetOffsetX(obj){
if(obj.getBoundingClientRect!=null){
return parseInt(obj.getBoundingClientRect().left,10);}
var nX=parseInt(obj.offsetLeft,10);
while(obj.offsetParent!=null){
nX+=parseInt(obj.offsetLeft,10);
obj=obj.offsetParent}
return nX;}
function GetOffsetY(obj){
if(obj.getBoundingClientRect!=null&&
parseInt(obj.getBoundingClientRect().top,10)>0){
return parseInt(obj.getBoundingClientRect().top,10);}
var nX=parseInt(obj.offsetTop,10)
while(obj.offsetParent!=null){
obj=obj.offsetParent;
nX+=parseInt(obj.offsetTop,10)}
return nX;}
function __CloneStyle(objSrc,objDest){
if(objSrc==null||
objDest==null){
return;}
for(obj in objSrc){
if(obj==null||
objSrc[obj]==null||
objSrc[obj]==""||
obj=="display"){
continue;}
if(typeof(obj)=='function')
continue;
try{
objDest[obj]=objSrc[obj];}
catch(e){}}}
function __ShowToolTip(obj,strTip){
var objDiv=document.getElementById(g_strDivId);
objDiv.style.left=(parseInt(obj.offsetWidth)+GetOffsetX(obj)+5).toString()+"px";
objDiv.style.top=(GetOffsetY(obj)-5).toString()+"px";
objDiv.innerHTML="&#8736; "+strTip;
objDiv.style.display="";}
function __HideToolTip(){
var objDiv=document.getElementById(g_strDivId);
objDiv.style.display="none";}
var g_aryVal=new Array();
var g_strCurErr="";
function __ValidatorUpdateDisplay(val){
if(!val.isvalid){
if(g_strCurErr==""){
g_strCurErr=val.getAttribute("id");
__ShowToolTip(document.getElementById(val.controltovalidate),val.errormessage);
return;}
else{
for(var i=0;i<g_aryVal.length;i++){
if(g_aryVal[i]==null)
continue;
if(g_aryVal[i].getAttribute("id")==val.getAttribute("id"))
return;}
g_aryVal.push(val);
return;};}
else{
if(g_strCurErr==val.getAttribute("id")){
g_strCurErr="";
__HideToolTip();};
for(var i=0;i<g_aryVal.length;i++){
if(g_aryVal[i]==null)
continue;
if(g_aryVal[i].getAttribute("id")==val.getAttribute("id"))
g_aryVal[i]=null;}
for(var j=g_aryVal.length-1;j>=0;j--){
if(g_aryVal[j]==null)
continue;
val=g_aryVal[j];
g_strCurErr=val.getAttribute("id");
__ShowToolTip(document.getElementById(val.controltovalidate),val.errormessage);}}}

