var arButtons = new Array();
arButtons[0] = 'btop';
arButtons[1] = 'barrow';
arButtons[2] = 'bmain';

var iBoxX = 0;
var iBoxY = 0;
var iArrowX = 0;
var sBubble;

function transpng(){
	for(i=0;i<arButtons.length;i++){
		objMyImg = new OpacityObject(arButtons[i],'images/bubble/' + arButtons[i]);			
		objMyImg.setBackground();
	}
}

function setbubble(iBX,iBY,iAX){
	iBoxX = iBX;
	iBoxY = iBY;
	iArrowX = iAX;
}

function posbubble(){
	clearTimeout();
	box = document.getElementById('bubble');
	arrow = document.getElementById('barrow');
	box.style.left = iBoxX + 'px';
	box.style.top = iBoxY + 'px';
	arrow.style.left = iArrowX + 'px';
	box.style.display = 'block';
}

function initImage(sShow) {
  imageId = 'theimage';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.display = 'block';
  sBubble = sShow;
  fadeIn(imageId,0);
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }else{
		if(sBubble == 'yes'){
			 window.setTimeout("posbubble()", 1000);
		}
	}
  }
}
