function UA(){
var v = navigator.appVersion.toLowerCase(), u = navigator.userAgent.toLowerCase(), n = navigator.appName;
this.mac = (v.indexOf("mac")+1);
this.win = (v.indexOf("win")+1);
this.nn = (n == "Netscape");
this.ie = (n == "Microsoft Internet Explorer");
this.aol = (u.indexOf("aol")+1);
this.opera = (u.indexOf("opera")+1);
this.ver = (this.ie) ? parseFloat(v.split('msie ')[1]) : parseFloat(v);
this.v4 = (parseInt(v) == 4);
this.os = (this.mac) ? 'mac' : (this.win) ? 'win' : navigator.platform;
this.name = (this.nn) ? 'nn' : (this.ie) ? 'ie' : n;
this.codeName = this.name +'_'+ parseInt(this.ver) + '_'+ this.os;
}
var ua = new UA();
var docloaded = false;
var onloadHandlers = [];
function loadEvents() {
  for(var i=0; i<onloadHandlers.length;i++) {
  eval(onloadHandlers[i]);
  }
docloaded = true;
}
window.onload = loadEvents;

var onresizeHandlers = [];
function resizeEvents() {
 for(var i=0; i<onresizeHandlers.length;i++) {
  eval(onresizeHandlers[i]);
  }
}
window.onresize = resizeEvents;

// legacy function - DO NOT CALL DIRECTLY!!
function getObjByName(name,doc) {
var o = 0;
if(!doc) doc = document;
if(doc[name]) o=doc[name];
if(document.all && doc.all[name]) o=doc.all[name];
  if(o){
  if(!o.getElementsByTagName) o.getElementsByTagName = getElementsArray;
  return o;
  }
if(document.layers) {
  for(var i=0;i < doc.layers.length;i++){
  var lyrdoc = doc.layers[i].document;
  if(lyrdoc[name]) return lyrdoc[name];
    if(lyrdoc.layers.length > 0) {
    var o = getObjByName(name,lyrdoc);
    if(o) return o;
    }
  }
}
return 0;
}
if(!document.getElementById) document.getElementById = getObjByName;
// legacy function - DO NOT CALL DIRECTLY!!
function getElementsArray(el) {
  if(document.layers) {
  var doc = (this == document) ? document : this.document;
    switch(el) {
    case 'img' : return doc.images;
    case 'a' : return doc.links;
    case 'div' : return doc.layers;
    case 'form' : return doc.forms;
    default : return 0;
    }
  }
if(document.all) return this.all.tags(el);
return 0;
}
if(!document.getElementsByTagName) document.getElementsByTagName = getElementsArray;
if(document.layers) Layer.prototype.getElementsByTagName = getElementsArray;

function swapImg() {
if(!document.images) return;
var args = swapImg.arguments;
  for(var i=0;i < args.length;i+=2) {
  var imgSrc = (args[i + 1].indexOf('[') != -1) ? eval(args[i + 1] + '.src') : args[i + 1];
  if(getObjByName(args[i])) getObjByName(args[i]).src = imgSrc;
  }
}

function handleResize(init) {
if(!(ua.nn && ua.v4)) return;
  if(init==true) with (navigator) {
  document.pgW=innerWidth;
  document.pgH=innerHeight;
  onresizeHandlers[onresizeHandlers.length] = 'handleResize()';
  }
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
handleResize(true);

function getWidth(width) {
  if(arguments[1]) {
    if(ua.mac) {
      if(ua.ie) width += 2;
      if(ua.nn) width += 17;
    }
    if(ua.win) {
      width += 16;
      if(ua.aol) width += 20;
    }
  }
  else {
    if(ua.mac) {
      if(ua.ie) width -= 17;
    }
    if(ua.win) {
      if(ua.aol) width += 20;
    }
  }
return width;
}

function getHeight(height) {
  if(arguments[1]) {
    if(ua.mac) {
    if(ua.ie) height -= 15;
    }
    if(ua.win) {
    if(ua.aol) height += 20;
    }
  }
  else {
    if(ua.mac) {
    if(ua.ie) height -= 15;
    }
    if(ua.win) {
    if(ua.aol) height += 20;
    }
  }
return height;
}

function winOpen() {
var a = arguments;
var n,f,s,w,h,t,l;
n = (a[1]) ? a[1] : 'child';
f = (a[6]) ? a[6].toString() : null;
s = (f && f.search(/scrollbars=(1|true)/) != -1);
w = getWidth(a[2],s);
h = getHeight(a[3],s);
t = (a[4]) ? a[4] : 0;
l = (a[5]) ? a[5] : 0;

child = window.open(a[0],n,'width='+w+',height='+h+',top='+t+',left='+l+',directories=0,'+f);
setTimeout('child.focus()',100);
if(f && f.search(/temp=(1|true)/) != -1) window.onfocus = function(){ if(window.child) child.close(); child = null };
}

function sHLayer() {
var args = sHLayer.arguments;
  for(var i = 0; i < args.length; i+=2) {
    csspObj(args[i]).setProperty('visibility',args[i+1]);
  }
}

function show(div) {
sHLayer(div, 'visible');
}

function hide(div) {
sHLayer(div, 'hidden');
}

var remoteOpen = winOpen;
var scrollOpen = winOpen;
var msgWin = winOpen;

var validEmail = /^[a-z_0-9\.\-]+@[a-z_0-9\.\-]+\.[a-z]/i;

function isValidPattern(pattern, str){
return pattern.test(str);
}

function isNull(str){
return (str == "");
}

if (ua.nn && ua.v4) {
  var newSize = "10px";
  document.tags.div.fontSize = newSize;
  document.tags.td.fontSize = newSize;
  document.tags.input.fontSize = newSize;
  document.tags.select.fontSize = newSize;
  document.tags.textarea.fontSize = newSize;
  document.classes.titletxt.all.fontSize = newSize;
}

