// --- Display functions -----------------------------------------------------------

function showBubble(carrier, offer) {
  curOpacity = 0;
	o1 = document.getElementById("bubleft");
	o1.src = "images/bub-"+carrier+".gif";
	o2 = document.getElementById("bubright"); 
	o2.src = "images/bub-"+offer+".gif";
  showElement("bubble");
	fadeIn("bubble",100);
}

function hideBubble() {
	hideElement("bubble");
}

function showElement(strID) {
	try { document.getElementById(strID).style.display = "block"; } catch(ex) {}
}
function hideElement(strID) {
	try { document.getElementById(strID).style.display = "none"; } catch(ex) {}
}

// --- Fading ----------------------------------------------------------------------

var curOpacity = 0;

function fadeIn(id, endOpacity) {
	curOpacity += 5;
	if (curOpacity <= endOpacity) {
		setOpacity(id, curOpacity);    
		setTimeout("fadeIn('"+id+"', "+endOpacity+")",20);
  } 
}

function fadeOut(id, endOpacity) {
	curOpacity -= 5;
	if (curOpacity <= endOpacity) {
		setOpacity(id, curOpacity);    
		setTimeout("fadeOut('"+id+"', "+endOpacity+")",20);
  } 
}

function setOpacity(id, curOpacity) {
  var o = document.getElementById(id).style;
	o.opacity = (curOpacity / 100);
	o.MozOpacity = (curOpacity / 100);
	o.KhtmlOpacity = (curOpacity / 100);
	o.filter = "alpha(opacity=" + curOpacity + ")"; 
}