var sOld = 's1';
var isOpera = false;
var isIE;
var digHEX = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'];
function StringBuffer() {this.buffer = []} 
StringBuffer.prototype.append = function append(string) {this.buffer.push(string)} 
StringBuffer.prototype.xAppend = 
function xAppend(strings)
{
 var i,ALen;
 ALen = strings.length;
 for (i=0;i<ALen;i++) this.buffer.push(strings[i]);
}
StringBuffer.prototype.cleanUp = function cleanUp(){this.buffer = []}
StringBuffer.prototype.toString = function toString(){return this.buffer.join("")}
StringBuffer.prototype.toSpacedString = function toSpacedString(){return this.buffer.join(" ")}
function biggerOf(a,b){return (a>b)?a:b}
function B2H(ANum)
{
 var BNum = ANum % 16;
 ANum = (ANum - BNum)/16;
 return digHEX[ANum] + digHEX[BNum];
}
function LSF(AFlag,AShift){return (AFlag)?1 << AShift:0}
String.prototype.wrap = function(){return "'" + this + "'"}
function SignOf(ANum){return (ANum < 0)?-1:((ANum == 0)?0:1)}
function WhenSelected(AId)
{
 var e = document.getElementById(AId);
 if ((e == null) || (e.selectedIndex == 0)) return; 
 document.location = e.options[e.selectedIndex].value;
}
function WhenChosen()
{
 var e1 = document.getElementById('selcb');
 var e2 = document.getElementById('selection');
 e2.innerHTML = e1.options[e1.selectedIndex].value; 
}
function floodBorders()
{
 var e = document.getElementById('main');
 var e1 = document.getElementById('imain');
 var e2 = document.documentElement;
 var h = (isOpera)?e2.scrollHeight:e2.clientHeight;
 e.style.height =biggerOf(h,e1.scrollHeight + 15) + 'px';
}

function haveLILOCookie()
{
 var et4 = getCookie('et4');
 return (et4 != null) && (et4.length > 0);
}

function WatchSize()
{
 if (!isOpera) floodBorders();
 var y = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
 var h = window.innerHeight || document.documentElement.clientHeight;
 var w = window.innerWidth || document.documentElement.clientWidth;
 var e = document.getElementById('ologo');
 e.style.top = y + 0 + 'px';
 var h1 = y + e.clientHeight + 20 + 'px';
 e = document.getElementById('nxbk');
 if (e != null) {
 e.style.display = 'block';
 e.style.top = h1}
 
 e = document.getElementById('affads');
 if (e != null) {
 e.style.left = document.body.offsetWidth - 150 + 'px';
 e.style.top = y + 'px';
 e.style.display = (screen.width >= 1024)?'block':'none';
 }
 
 hLC = haveLILOCookie();
 e = document.getElementById('lilo');
 if (e != null) e.value = (hLC)?'Logout':'Login/Register';
 e = document.getElementById('mlilo');
 if (e != null) e.innerHTML = (hLC)?'Logout':'Login/Register';
}

function getCookie(cName)
{
 if (document.cookie.length > 0)
 {
  start = document.cookie.indexOf(cName+"=");
  if (start != -1)
  {
   start += cName.length+1;
   finish = document.cookie.indexOf(";", start);
   if (finish == -1) finish = document.cookie.length;
   return unescape(document.cookie.substring(start,finish));
  }
 }
 return null;
}

function customize(){}

function SizeWatch()
{
 isOpera=(window.opera!=undefined) && (!isNaN(window.opera.buildNumber()));
 isIE = !isOpera && (document.all != null) && (document.getElementById('main').innerText != null);
 floodBorders();
 setInterval("WatchSize()",50);
 customize();
}
function ButChange(AButs,AValue)
{
 var i,e;
 for (i=0;i<AButs.length;i++)
 {
  e = document.getElementById(AButs[i]);
  e.style.borderStyle = AValue;
 }
}
function PrintDoc()
{
 var e = document.getElementById('prd');
 e.href = location.href;
 window.print();
}

function mmExCon(AMenu,AHt)
{
 var e = document.getElementById(AMenu);
 e.style.height=AHt;
}

function CCC(a,b,c){return String.fromCharCode(Math.pow(a,b) - c)}
   
function Radr(AId,ASubj){
var e = document.getElementById(AId)
if (e == null) return; 
e.href="mai" + CCC(8,2,-12) + "to" + CCC(8,2,6) + AId + 
CCC(8,2,0) + 'brandspatch' + CCC(7,2,3) + 'com' + 
CCC(8,2,1) + 'sub' + CCC(10,2,-6) + 'ect' + CCC(8,2,3) + ASubj}

function hideError()
{
 var d= document.getElementById('errdiv');
 if (d!=null) d.style.display='none';
};

function doLogOut()
{
 var x = (isIE)?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();
 x.open('GET','/etscr/et_lo.php',false);
 x.send(null);
 ((x.status == 200) && (x.responseText.length > 0))?alert(x.responseText):hideError();
 x = null;
}

function doLILO()
{
 (haveLILOCookie())?doLogOut():document.location='/etscr/et_reg.shtml';
}

