

var yhReInitForm=null, yhReInitTarget, yhReInitRefrField=null;
    yhReInitButtonField=null;
    yhReUrl=""; yhReCard=""; SrvLocalUrl="";


function yhRefreshLink(l)
{
    if (l.href.lastIndexOf("?") <0) l.href+="?";
    if (l.href.substr(l.href.length-8,8)!="&_refr=t")
	l.href += "&_refr=t";
}


function yhRefreshButton (b){
   var r;
   yhReInitForm=b.form;
   yhReInitTarget=b.form.target;
   b.form.target = "refrframe";
   r=document.createElement('input');
   r.setAttribute ('type','hidden');  r.setAttribute ('value','t');  r.setAttribute ('name','_refr');
   r.setAttribute ('id','yhReInitRefrField');
   b.parentNode.insertBefore(r,b);
   yhReInitRefrField=document.getElementById('yhReInitRefrField');
   return false;
}

function yhReinitializeRefresh()
{
    if (yhReInitForm) yhReInitForm.target=yhReInitTarget;
   if (yhReInitRefrField) yhReInitRefrField.parentNode.removeChild(yhReInitRefrField);
   yhReInitForm=null;
   yhReInitRefrField=null;
   if (yhReInitButtonField) yhReInitButtonField.value="";
       
}

function yhEndRefresh()
{
    if (window.yhAdjust) yhAdjust();
}


function yhrfNameVal (name,val)
{
   parent.document.getElementsByName(name)[0].value=val;
}


function yhobjspace(){};

var 
     yhobj = new yhobjspace();
			     yhcurobj = yhobj;

function yhRegisterObj (name, obj)
{
   yhcurobj[name]=obj;
}

var yhdorefreshforcereload = false;

function yhDoRefreshForceReload ()
{
   yhdorefreshforcereload = true;
}

function yhDoRefresh (urlpar)
{    if (yhdorefreshforcereload) {
      var l = document.location + "?&" + "card=" + yhReCard + "&" + urlpar;
      setTimeout ("document.location = '"+l+"'",10);      
   } else {
      var l = yhReUrl + "?" + "card=" + yhReCard + "&_refr=t&" + urlpar;
                        setTimeout ("refrframe.document.location = '"+l+"'",10);
   }
}

function yhrfObj_client_show ()
{
   var el;
   el = this.element();
   el.style.display="";
   this.onshow();
}
function yhrfObj_client_toggle ()
{
   var el;
   el=this.element();
   if (el.style.display=="none") this.client_show(); else this.client_hide();
}
function yhrfObj_client_hide ()
{
   var el;
   el = this.element();
   el.style.display="none";
   this.onhide();
}
function yhrfObj_show ()
{
   var el;
   this.client_show();
   yhDoRefresh (this.bid + ".show=t");
}
function yhrfObj_hide ()
{
   var el;
   this.client_hide();
   yhDoRefresh (this.bid + ".hide=t");
}
function yhrfObj_toggle ()
{
   var el;
   el=this.element();
   if (el.style.display=="none") this.show(); else this.hide();
}
function yhObj_element ()
{
   return document.getElementById(this.bid);
}

function yhrfObj(bid,onshow,onhide)
{
   this.bid=bid;
   this.show = yhrfObj_show;
   this.hide = yhrfObj_hide;
   this.client_show = yhrfObj_client_show;
   this.client_toggle = yhrfObj_client_toggle;
   this.client_hide = yhrfObj_client_hide;
   this.toggle = yhrfObj_toggle;
   this.element = yhObj_element;
   this.onshow= onshow;
   this.onhide= onhide;
}

var yhcurpanel=null;

function yhprototype_panel ()
{
   this. control = function (name)
   {
      return document.getElementsByName(this.bid+"."+name)[0];
   }
   this. element = function ()
   {
      return getElementByName (this.bid)[0];
   }
   this. control_name = function (name)
   {
      return this.bid+"."+name;
   }
}

function yhnewpanel(bid,parent)
{
   this.bid=bid; this.parent=parent;
}
yhnewpanel.prototype = new yhprototype_panel;

function yhprototype_sesform()
{
   this.baseproto=yhprototype_panel; this.baseproto();
}
function yhnewsesform(bid,parent)
{
   this.bid=bid; this.parent=parent;
}
yhnewsesform.prototype = new yhprototype_sesform;


var x = 0;
var url = ""
function yhRewriteSpan(t){
    try{
        if(url==""){
          url = parent.frames['refrframe'].location.href;
        }
        if ((parent.frames['refrframe'].document.readyState == "complete" && x > 0) || ((navigator.userAgent.indexOf("MSIE") <0 )&&(url != parent.frames['refrframe'].location.href)))
        {
            for(y=0;y<parent.document.getElementsByTagName("span").length;y++){
              parent.document.getElementsByTagName("span")[y].innerHTML = parent.frames['refrframe'].document.getElementsByTagName("span")[y].innerHTML;
            }
            x=0;
            url = parent.frames['refrframe'].location.href;
            return;
        }
        else{
            x=x+1
            setTimeout('yhRewriteSpan(\''+t+'\')',100);
        }
 }catch(ex){
        if(parent.document.getElementsByTagName("span")[y]==undefined || parent.frames['refrframe'].document.getElementsByTagName("span")[y]==undefined){
            x=x+1;
            setTimeout('yhRewriteSpan(\''+t+'\')',100);
        }else{
            alert("Error--- "+ex.message);
        }
    }
}
