/************************************************************************************************************
Ajax dynamic list
Copyright (C) September 2005  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com
	
************************************************************************************************************/	
//GLOBAL VARS
var NUM_TOOLTIPS = 11;  //Change this variable for the number of bubble tooltips you want to use

function showToolTip(div,heading,text,step){
    //position of original element
    var positionX = 0;
    var positionY = 0;
    var objHeight = 0;
    var divHeight = div.offsetHeight;
    var stepNumber = step;
	
	//set up the bubble tooltip 
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	
	//set up text and whatever images and links needed inside bubble tooltip
	obj2.innerHTML = "<div style='position:absolute;left:208px'><a href='javascript:hideToolTip("+stepNumber+")';><image src=close.gif alt=Close  /></a></div><div style=width:200px;font-weight:bold>" + heading + "<br/><br/></div><div>" + text + "<br /><br /><div style=text-align:right><a href=../../enroll/enroll.aspx>&gt; Join Ziggs</a></div>";
	
	//following three lines are a bit of a hack to obtain the bubble tooltip height
	obj.style.display = 'block';
    objHeight = obj.offsetHeight;
    obj.style.display = 'none';
    
	//delay the appearance of the bubble tooltip
	setTimeout("showObj("+stepNumber+");",100);
    
    //gets position of the hovered element	 
    while (div != null)
    {
	positionX += div.offsetLeft;
	positionY += div.offsetTop;
	div = div.offsetParent;
	}
	obj.style.left = positionX  + 'px';
	obj.style.top = positionY  - objHeight + divHeight  + 'px';
	
	//Hide the initial step bubble tooltip
	//while making sure all the other initial step tooltips remain shown
	var count1 = 0;
	while((++count1)<=NUM_TOOLTIPS)
	{
	if(count1 == step){document.getElementById('step'+count1).style.display = 'none';}
	else{document.getElementById('step'+count1).style.display = 'block';}	
	}
	
	//Also hide any outlines not equal to the shown step
	var count2 = 0;
	while((++count2)<=NUM_TOOLTIPS)
	{
	if(count2 != step){document.getElementById('outline'+count2).style.display = 'none';}
	}
}	

//helper function for showing bubble tooltip
function showObj(step)
{ 
    var obj = document.getElementById('bubble_tooltip');
    var outline = document.getElementById('outline'+step);
    obj.style.display = 'block';
    outline.style.display = 'block';
    
}

function hideToolTip(showstep)
{
	document.getElementById('bubble_tooltip').style.display = 'none';
	document.getElementById('outline'+showstep).style.display = 'none';
	document.getElementById('step'+showstep).style.display = 'block';
}

function hideAllToolTips()
{   
    var count = 0;
    while(++count <= NUM_TOOLTIPS)
    {
        hideToolTip(count);
    }
}

/**testing function for fading in bubble tooltips
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 
**/