/****************************************************\
| ClearView UI 1.0                                   |
| Copyright by BonaSource Inc. (bonasource.com) 2003 |
\****************************************************/


hmPics = new Array();
var hmPicsCnt = 0;
var infPAt = new Image();
infPAt.src = 'images/hlinf-at.gif';
function hmPreload(nm, normT, overT, normR, overR, infP, text) {  
  hmPics[hmPicsCnt] = new Array();
  hmPics[hmPicsCnt][0] = nm;
  hmPics[hmPicsCnt][1] = new Image();
  hmPics[hmPicsCnt][1].src = normT;
  hmPics[hmPicsCnt][2] = new Image();
  hmPics[hmPicsCnt][2].src = overT;
  hmPics[hmPicsCnt][3] = new Image();
  hmPics[hmPicsCnt][3].src = normR;
  hmPics[hmPicsCnt][4] = new Image();
  hmPics[hmPicsCnt][4].src = overR;
  hmPics[hmPicsCnt][5] = infP;
  hmPics[hmPicsCnt][6] = text;
  if(normR.indexOf('contact-us') != -1) {
    hmPics[hmPicsCnt][7] = new Image();
	hmPics[hmPicsCnt][7].src = normR.substring(0, normR.indexOf('-n.gif')) + '-top' + normR.substring(normR.indexOf('-n.gif'), normR.length);
	hmPics[hmPicsCnt][8] = new Image();
	hmPics[hmPicsCnt][8].src = overR.substring(0, overR.indexOf('-o.gif')) + '-top' + overR.substring(overR.indexOf('-o.gif'), overR.length);
  }
  else {
    hmPics[hmPicsCnt][7] = null;
	hmPics[hmPicsCnt][8] = null;
  }
  hmPicsCnt++;
}
function initInfoBox() {
  var i, str;
  for (i = 0; i < hmPicsCnt; i++) {
    str = infoTempl1 + hmPics[i][0] + 'dv' + infoTempl2 + hmPics[i][5] + infoTempl3 + hmPics[i][6] + infoTempl4;
    document.write(str);
	hmPics[i][9] = layer(hmPics[i][0] + 'dv');
	hmPics[i][10] = layer('infoBoxPl');
  }
}
function hmOverOn(nm){
  var i;
  for (i = 0; i < hmPicsCnt; i++) {
    if (document.images[hmPics[i][0] + 'i1'] != null && document.images[hmPics[i][0] + 'i2'] != null) {
      if (nm != hmPics[i][0]) {
        document.images[hmPics[i][0] + 'i1'].src = hmPics[i][1].src;
		document.images[hmPics[i][0] + 'i2'].src = hmPics[i][3].src;
		if(hmPics[i][7]) document.images[hmPics[i][0] + 'i3'].src = hmPics[i][7].src;
		if(hmPics[i][9].isExist()) hmPics[i][9].hide();
      } else {
        document.images[hmPics[i][0] + 'i1'].src = hmPics[i][2].src;
		document.images[hmPics[i][0] + 'i2'].src = hmPics[i][4].src;
		if(hmPics[i][8]) document.images[hmPics[i][0] + 'i3'].src = hmPics[i][8].src;
		if(hmPics[i][9].isExist()) {
		  hmPics[i][9].moveTo(hmPics[i][10].getAbsoluteLeft(), hmPics[i][10].getAbsoluteTop());
	      hmPics[i][9].show();
		}
		if(scrTM) clearTimeout(scrTM);
      }
	}
  }
}
function hmOverOff(){
  for (i = 0; i < hmPicsCnt; i++) {
    document.images[hmPics[i][0] + 'i1'].src = hmPics[i][1].src;
	document.images[hmPics[i][0] + 'i2'].src = hmPics[i][3].src;
	if(hmPics[i][7]) document.images[hmPics[i][0] + 'i3'].src = hmPics[i][7].src;
	if(hmPics[i][9].isExist()) hmPics[i][9].hide();
  }
  scrTM = setTimeout("infoBoxText.scroll()", 500);
}

infoTempl1 = '<div  id="';
infoTempl2 = '" style="position:absolute; left:1px; top:1px; z-index:3; visibility: hidden"><table width="105" border="0" cellspacing="0" cellpadding="0"><tr><td width="3"><img src="images/hlinf-cotl.gif" width="3" height="3" /></td><td width="99" class="bgHomeInfoTop"><img src="images/z.gif" width="99" height="1" /></td><td width="3"><img src="images/hlinf-cotr.gif" width="3" height="3" /></td></tr><tr><td class="bgHomeInfoLeftT"><img src="images/z.gif" width="1" height="1" /></td><td align="center" valign="top"><img src="';
infoTempl3 = '" width="99" height="21" /></td><td class="bgHomeInfoRightT"><img src="images/z.gif" width="1" height="1" /></td></tr><tr><td><img src="images/hlinf-cel-c.gif" width="3" height="15" /></td><td class="bgHomeInfoCenterT"><img src="images/z.gif" width="1" height="1" /></td><td><img src="images/hlinf-cer-c.gif" width="3" height="15" /></td></tr><tr><td class="bgHomeInfoLeftB"><img src="images/z.gif" width="1" height="1" /></td><td align="center" valign="top" class="bgHomeInfo"><div class="txHomeInfo">';
infoTempl4 = '</div></td><td class="bgHomeInfoRightB"><img src="images/z.gif" width="1" height="1" /></td></tr><tr><td class="bgHomeInfoLeftB"><img src="images/z.gif" width="1" height="1" /></td><td class="bgHomeInfo"><img src="images/z.gif" width="1" height="7" /></td><td class="bgHomeInfoRightB"><img src="images/z.gif" width="1" height="1" /></td></tr><tr><td><img src="images/hlinf-cobl.gif" width="3" height="3" /></td><td class="bgHomeInfoBottom"><img src="images/z.gif" width="1" height="1" /></td><td><img src="images/hlinf-cobr.gif" width="3" height="3" /></td></tr></table></div>';

//========================================================

var mmBgColorN = '#FFFFFF';
var mmBgColorO = '#DCDFEA';
var mmFgColorN = '#3A4F4D';
var mmFgColorO = '#012EA3';

function mmOver(obj, st) {
  var i, objCol, objSt, colorBg, colorFg;
  if(!isDOM) return;
  colorBg = (st) ? mmBgColorO : mmBgColorN;
  colorFg = (st) ? mmFgColorO : mmFgColorN;
  objSt = (obj.style) ? obj.style : obj;
  objSt.backgroundColor = colorBg;
  objCol = obj.getElementsByTagName('A');
  objSt = (objCol[0].style) ? objCol[0].style : objCol[0];
  objSt.color = colorFg;
}

var smBgColorN = '#DCDFEA';
var smBgColorC = '#BABFD6';
var smFgColorN = '#000000';
var smFgColorO = '#012EA3';

function smOver(obj, st) {
  var i, objCur, objSt, colorFg, colorBg;
  if(!isDOM) return;
  colorBg = (st) ? smBgColorC : smBgColorN;
  colorFg = (st) ? smFgColorO : smFgColorN;
  objCur = document.getElementById(obj.id + 'td');
  objSt = (objCur.style) ? objCur.style : objCur;
  objSt.backgroundColor = colorBg;
  objCur = document.getElementById(obj.id + 'a');
  objSt = (objCur.style) ? objCur.style : objCur;
  objSt.color = colorFg;
}

function mmGo(url) {
  window.location = url;
}

//========================================================

function BSMenu() {
  this.div = new Array();
  this.dcounter = 0;
}

BSM = BSMenu.prototype;

BSM.add = function(bsdObj) {
  this.div[this.dcounter++] = bsdObj;
}

BSM.render = function() {
  var bsdc, i, j, obj, ls, rs, str, resstr, arr, arItem, nstrb, nstre, coLt, coClt, coItem;
  arLt = new Array();
  arClt = new Array();
  for(bsdc = 0; bsdc < this.dcounter; bsdc++) {
    obj = this.div[bsdc];
	str = obj.lt; coLt = 0;
	nstrb = 0;
	while((nstre = str.indexOf("##", nstrb)) != -1) {
	  arLt[coLt++] = str.substring(nstrb, nstre);
	  arLt[coLt++] = str.substring(nstre, nstre + 8);
	  nstrb = nstre + 8;
	}
	arLt[coLt] = str.substring(nstrb);
	str = obj.clt; coClt = 0;
	nstrb = 0;
	while((nstre = str.indexOf("##", nstrb)) != -1) {
	  arClt[coClt++] = str.substring(nstrb, nstre);
	  arClt[coClt++] = str.substring(nstre, nstre + 8);
	  nstrb = nstre + 8;
	}
	arClt[coClt] = str.substring(nstrb);
	arr = obj.links;
	resstr = "";
    for(i = 0; i < obj.counter; i++) {
	  if(arr[i].state) {
	    arItem = arLt;
		coItem = coLt;
	  }
	  else {
	    arItem = arClt;
		coItem = coClt;
	  }
	  for(j = 0; j <= coItem; j++) {
	    switch (arItem[j]) {
		  case '##DVID##': resstr += obj.id; break;
		  case '##ITID##': resstr += 't' + i + obj.id; break;
		  case '##LINK##': resstr += arr[i].url; break;
		  case '##TEXT##': resstr += arr[i].text; break;
		  case '##TRGT##': resstr += arr[i].target; break;
		  default: resstr += arItem[j];
		}
	  }
    }
	str = obj.dt;
	nstrb = str.indexOf("##DVID##");
    ls = str.substring(0, nstrb);
    rs = str.substring(nstrb + 8);
    str = ls + obj.id + rs;
    nstrb = str.indexOf("##ITMS##");
    ls = str.substring(0, nstrb);
    rs = str.substring(nstrb + 8);
    str = ls + resstr + rs;
    document.write(str);
  }
}

function BSDiv(id, level, divTempl, linkTempl, curLinkTempl) {
  this.id = "d" + level + id;
  this.level = level;
  this.links = new Array();
  this.counter = 0;
  this.dt = divTempl;
  this.lt = linkTempl;
  this.clt = curLinkTempl;
}

BSD = BSDiv.prototype;

BSD.add = function(state, url, text, target) {
  this.links[this.counter++] = new BSItem(state, url, text, target);
}

BSD.itemOff = function(itm) {
  this.links[itm-1][0] = 0;
}

function BSItem(state, url, text, target) {
  this.state = state;
  this.url = url;
  this.text = text;
  this.target = (!target || target == "") ? "_top" : target;
}

BSI = BSItem.prototype;

divTempl = '<div id="##DVID##" style="position:absolute; left:1px; top:1px; z-index:3; visibility: hidden" onMouseOver="flClose=1; cancelCloseMenuLI(); return true" onMouseOut="flClose=0; hideMenuLI(); return true"><table width="10" border="0" cellspacing="0" cellpadding="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="17"><img src="images/sm-cotl.gif" width="17" height="4" /></td><td width="100%" class="bgSMTop"><img src="images/z.gif" width="1" height="1" /></td><td width="5"><img src="images/sm-cotr.gif" width="5" height="4" /></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="0">##ITMS##</table><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><img src="images/sm-cobl.gif" width="17" height="3" /></td><td width="100%" class="bgSMBottom"><img src="images/z.gif" width="1" height="1" /></td><td><img src="images/sm-cobr.gif" width="5" height="3" /></td></tr></table></td></tr></table></div>';

linkTempl = '<tr id="##ITID##" class="smItemCurN" onMouseOut="smOver(this, 0); return false" onMouseOver="smOver(this, 1); return false" onClick="mmGo(\'##LINK##\'); return false"><td class="bgSMLeft"><img src="images/z.gif" width="1" height="1" /></td><td id="##ITID##td" style="background-color: #DCDFEA;" nowrap="nowrap"><img src="images/z.gif" width="1" height="3" /><br><nobr><img src="images/sm-bulet-n.gif" width="16" height="4" border="0" align="middle" /><a id="##ITID##a" href="##LINK##" class="smItemLinkN" style="color: #000000;">##TEXT##</a><img src="images/z.gif" width="4" height="1" border="0" align="middle" /></nobr><br><img src="images/z.gif" width="1" height="3" /></td><td class="bgSMRight"><img src="images/z.gif" width="1" height="1" /></td></tr><tr class="smItemCurN"><td class="bgSMLeft"><img src="images/z.gif" width="1" height="1" /></td><td width="100%" style="background-color: #FFFFFF;"><img src="images/z.gif" width="1" height="1" /></td><td class="bgSMRight"><img src="images/z.gif" width="1" height="1" /></td></tr>';

curLinkTempl = '<tr class="smItemCurC"><td class="bgSMLeft"><img src="images/z.gif" width="1" height="1" /></td><td style="background-color: #DCDFEA;" nowrap="nowrap"><img src="images/z.gif" width="1" height="3" /><br><nobr><img src="images/sm-bulet-c.gif" width="16" height="6" border="0" align="middle" /><span class="smItemLinkC">##TEXT##</span><img src="images/z.gif" width="2" height="1" border="0" align="middle" /></nobr><br><img src="images/z.gif" width="1" height="3" /></td><td class="bgSMRight"><img src="images/z.gif" width="1" height="1" /></td></tr><tr class="smItemCurC"><td class="bgSMLeft"><img src="images/z.gif" width="1" height="1" /></td><td width="100%" style="background-color: #FFFFFF;"><img src="images/z.gif" width="1" height="1" /></td><td class="bgSMRight"><img src="images/z.gif" width="1" height="1" /></td></tr>';

//========================================================

var tm, flClose = 0, coM = 0, curTM = 1000;
upMenuIni = new Array();
for(i=0; i<100; i++) {
  upMenuIni[i] = 0;
}
upMenu = new Array();
for(i=0; i<100; i++) {
  upMenu[i] = 0;
}

function initMenuLI(nm) {
  upMenuIni[coM] = new Array();
  upMenuIni[coM][0] = nm;
  coM++;
}

function renderMenuLI() {
  var i;
  for(i = 0; i < coM; i++) {
    upMenu[i] = new Array();
    upMenu[i][0] = upMenuIni[i][0];
    upMenu[i][1] = layer('d1' + upMenuIni[i][0]);
	upMenu[i][2] = layer(upMenuIni[i][0]);
  }
}

function showMenuLI(mItemName) {
  var i, p, mPosX, mPosY;
  imPos = new Array();
  for(i=0; i<coM; i++) {
    if(mItemName != upMenu[i][0]) {
      if(upMenu[i][1].isExist()) upMenu[i][1].hide();
    }
    else {
      cancelCloseMenuLI();
      if(upMenu[i][1].isExist()) {
        mPosX = upMenu[i][2].getAbsoluteLeft() - 4;
        if(mPosX + upMenu[i][1].getWidth() > getWindowWidth())
          if((mPosX = getWindowWidth() - upMenu[i][1].getWidth()) < 0) mPosX = 0;
        mPosY = upMenu[i][2].getAbsoluteTop() + upMenu[i][2].getHeight() + 2;
        if(mPosY + upMenu[i][1].getHeight() > getWindowHeight())
          if((mPosY = (imPos[1] - 24 < 0)) < 0) mPosY = 0;
        upMenu[i][1].moveTo(mPosX, mPosY);
        upMenu[i][1].show();
        curTM = 1000;
      }
      else {
        curTM = 0;
      }
    }
  }
}

function hideMenuLI() {
  if(self.tm) clearTimeout(tm);
  if(!flClose) tm=setTimeout("totalHideMenuLI()", curTM);
}

function totalHideMenuLI(){
  var i;
  for(i=0; i<coM; i++) {
    if(upMenu[i][1].isExist()) upMenu[i][1].hide();
  }
}

function cancelCloseMenuLI(){
  if(self.tm) clearTimeout(tm);
}

//========================================================

var KS=[];
var KScounter=0;
var scrTM;

function KScrolling(text){
  if(text == "") {
    this.text = false;
	return;
  }
  this.number = KScounter++;
  this.speed = 50;
  this.text = text+"<br>"+text+"<br>"+text+"<br>"+text;
  KS[this.number] = this;
}

KScrolling.prototype.print=function(){
  if(!this.text) return "<img src=\"images/z.gif\" class=\"txHomeIS\">";
  if(isMSIE || isMozilla || isOpera7) {
    return ("<div id='KSborder" + this.number + "' class=\"txHomeIS\"><div id='KStext" + this.number + "' class=\"txHomeISText\" style='position: relative; top: 0px; left: 0px; visibility: hidden'>" + this.text + "</div></div>");
  }
  else {
    return (this.text);
    this.badBrowser = true;
  }
}

KScrolling.prototype.scroll=function() {
  if(!this.text) {
    if(isMSIE || isMozilla || isOpera7) {
      document.getElementById('infoBoxPl').style.visibility = 'hidden';
	}
	else {
	  document.images["hlsinfAt"].src = "images/hlinf-text-blank.gif";
	}
	return;
  }
  if(this.badBrowser) return;
  if(!this.layer) {
    this.layer = layer("KStext" + this.number);
    this.layer.show();
    this.offset = 0;
  }
  else {
    this.offset = (this.offset + 1) % (this.layer.getHeight() / 2);
    this.layer.moveY(-this.offset);
  }
  scrTM = setTimeout("KS[" + this.number + "].scroll()", this.speed);
}

KScrolling.prototype.stopScroll=function() {
  if(scrTM) clearTimeout(scrTM);
}

//========================================================

aRepCat = new Array();
var cRepCat = 0;

function addRepCat(id, col) {
  if(!isDOM || isOpera) return;
  var i, k;
  aRepCat[cRepCat] = new Array();
  aRepCat[cRepCat][0] = id;
  aRepCat[cRepCat][1] = col;
  aRepCat[cRepCat][2] = false;
  aRepCat[cRepCat][3] = document.getElementById(id + "TR");
  for(i = 4; i < col + 4; i++) {
    aRepCat[cRepCat][i] = document.getElementById(id + "STR" + (i - 3));
  }
  cRepCat++;
}

function openRepCat(obj) {
  if(!isDOM || isOpera) return;
  var i, j, id = obj.id;
  for(i = 0; i < cRepCat; i++) {
    if(aRepCat[i][0] != id) {
	  if(aRepCat[i][2]) {
	    for(j = 4; j < aRepCat[i][1] + 4; j++) {
		  aRepCat[i][j].style.display = "none";
		}
		aRepCat[i][2] = false;
	  }
	}
	else {
	  if(!aRepCat[i][2]) {
	    for(j = 4; j < aRepCat[i][1] + 4; j++) {
		  aRepCat[i][j].style.display = "inline";
		}
		aRepCat[i][2] = true;
	  }
	}
  }
}

//========================================================

var isOK;

/*
function checkEmail(fld) {
  var i = 0, coS = 0, cStr, flDot = true;
  var str = document.forms['form3'].elements[fld].value;
  while((i = str.indexOf('@', i + 1)) != -1) coS++;
  while((i = str.indexOf('.', i + 1)) != -1)
    if(str.indexOf('.', i + 1) != -1 && (str.indexOf('.', i + 1) - i) == 1) flDot = false;
  if(coS == 1 && flDot && str.indexOf(' ') == -1 && str.charAt(0) != '.') {
    var lStr = str.substring(0, str.indexOf('@'));
	var rStr = str.substring(str.indexOf('@') + 1, str.length);
	if(lStr.charAt(lStr.length - 1) != '.' && rStr.charAt(0) != '.') {
	  if((coS = rStr.lastIndexOf('.')) != -1) {
	    if((str.lastIndexOf('.') - str.indexOf('@')) > 1) {
	      rStr = rStr.substring(coS + 1, str.length);
	      if(rStr.length > 1) {
		    isOK = true;
		    return true;
		  }
	    }
      }
	}
  }
  isOK = false;
  alert('Please enter valid email');
  return false;
}
*/


dWriteDiv = '<div id="zoomDIVfix" class="divFixSize">WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW</div>';
dWriteDiv += '<div id="zoomDIV" class="divSize" onresize="resDoc();">WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW</div>';

function resDoc() {
  var cz = Math.round(document.all.zoomDIV.offsetWidth / document.all.zoomDIVfix.offsetWidth * 100);
  if(cz > 95 && cz < 105) cz = 100;
  document.body.style.zoom = cz + "%";
}

function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
