
var originalT;
var T;Tx=0;
var objx = null;
var timeOut = null;

var closez = new Image; closez.src = "marco/close.gif";
var closez_o = new Image; closez_o.src = "marco/close_o.gif";

var searchz = new Image; searchz.src = "marco/search.gif";
var searchz_o = new Image; searchz_o.src = "marco/search_o.gif";

var box_top = new Image; box_top.src = 'marco/top_box.gif';
var box_top_o = new Image; box_top_o.src = 'marco/top_box_o.gif';

var	callOut = new Image; callOut.src = 'marco/box_bottom.png';
var	callOut_o = new Image; callOut_o.src = 'marco/box_bottom_o.png';

var	callOut_right = new Image; callOut_right.src = 'marco/box_bottom_right.png';
var	callOut_right_o = new Image; callOut_right_o.src = 'marco/box_bottom_right_o.png';

var	bottomDrag = new Image; bottomDrag.src = 'marco/box_bottom_drag.png';
var	bottomDrag_o = new Image; bottomDrag_o.src = 'marco/box_bottom_drag_o.png';

var box_top_bottom = new Image; box_top_bottom.src = 'marco/box_tops_bottom.gif';
var box_top_bottom_o = new Image; box_top_bottom_o.src = 'marco/box_tops_bottom_o.gif';

var callOut_top = new Image; callOut_top.src = 'marco/box_bottom_top.gif';
var callOut_top_o = new Image; callOut_top_o.src = 'marco/box_bottom_top_o.gif';

var drop_box_top = new Image; drop_box_top.src = 'marco/drop_top_curve.png';

var drop_box_top_right = new Image; drop_box_top_right.src = 'marco/drop_top_curve_right.png';

var drop_box_top_drag = new Image; drop_box_top_drag.src = 'marco/drop_box_top_drag.png';


var onDiv = new Array("",false,false,false,false,false,false);
var dragx = new Array("",true,true,true,true,true,true);


// upward baloon functions--------------------------------------------------------------------------------------------
function gon2()
{
	objx.style.clip = "rect("+T+"px 319px "+originalT+"px 0px)";
	if(T>=0)
	{
		T-= 5;
		setTimeout("gon2()", showInterval);		
	}
}

function show(linx, object,side) 
{
	
	if(linx.className=="double") linx.style.borderBottom = "1px solid "+linkColor;
	resetWipe(object);
	originalT = document.getElementById(object).offsetHeight;

	T = originalT - 1;
	var no = object.split("divx")[1];

	if((browserDetect('opera'))||(browserDetect('firefox')))
	{
		if(side=="right") document.getElementById("bottomBox_bottom"+no).style.backgroundImage =  "url("+callOut_right.src+")";
		else document.getElementById("bottomBox_bottom"+no).style.backgroundImage =  "url("+callOut.src+")";
	}
	else
	{
		if(side=="right") document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_right.src+"',sizingMethod='scale')";
		else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut.src+"',sizingMethod='scale')";
	}

    if (document.getElementById)
	{
		for(i=1;i<(onDiv.length);i++)
			if(dragx[i])
				document.getElementById("divx0"+i).style.visibility = "hidden";
		
		if((browserDetect('opera'))||(browserDetect('firefox')))
		{
			if(side=="right")
			{
				leftx = (findPosX(linx))-250;
				topx = (findPosY(linx)) - (originalT-5);

			}
			else
			{
				leftx = (findPosX(linx))+15;
				topx = (findPosY(linx)) - (originalT-5);
			}	
		}
		else if(browserDetect('msie'))
		{
			if(side=="right")
			{
				leftx = (findPosX(linx))-250;
				topx = (findPosY(linx)) - (originalT-5);						
			}
			else
			{
				leftx = (findPosX(linx));
				topx = (findPosY(linx)) - (originalT-5);
			}	
		}

        document.getElementById(object).style.left = leftx+'px';
        document.getElementById(object).style.top = topx+'px';
        document.getElementById(object).style.visibility = 'visible';

		objx = document.getElementById(object);
		gon2();	
	}
}

function on_div(x,object,side)
{
	var no = object.split("divx")[1];
	temp = parseInt(no.split("0")[1]);
	onDiv[temp] = x;
	if(!x)
	{
		if(dragx[temp]) // not Dragging
			timeOut = setTimeout("hide2('"+object+"')",timerOffdiv);	
	}
	else
	{
		clearTimeout(timeOut);
		var closTD = "closTD"+no;
		var theHandle = document.getElementById("handle"+no);				
		var theRoot   = document.getElementById(object);
		Drag.init(theHandle, theRoot);
		theRoot.onDragStart = function()
		{
			dragx[temp] = false; // don't vanish after dragging
			if((browserDetect('opera'))||(browserDetect('firefox')))
				document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+bottomDrag.src+")";	
			else if(browserDetect('msie'))
				document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag.src+"',sizingMethod='scale')";		
		} 

	}
}

function on_box(bix, objId, objclass,side)
{
	object = document.getElementById(objId).parentNode;
	var no = (object.id).split("divx")[1];
	temp = parseInt(no.split("0")[1]);
	onDiv[temp] = bix;

	if(!bix)
	{
		document.getElementById("topPart"+no).style.backgroundImage = "url("+box_top.src+")";
		if(dragx[temp]) // not Dragging
		{
			if((browserDetect('opera'))||(browserDetect('firefox')))
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+callOut_right.src+")";
				else document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+callOut.src+")";	
			}
			else if(browserDetect('msie'))
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_right.src+"',sizingMethod='scale')";
				else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut.src+"',sizingMethod='scale')";
			}
			timeOut = setTimeout("hide2('"+object.id+"')",timerOffdiv);	
		}
		else // after dragging
		{
			if((browserDetect('opera'))||(browserDetect('firefox')))
				document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+bottomDrag.src+")";
			else if(browserDetect('msie'))
				document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag.src+"',sizingMethod='scale')";
		}
	}
	else
	{
		document.getElementById("topPart"+no).style.backgroundImage = "url("+box_top_o.src+")";

		if((browserDetect('opera'))||(browserDetect('firefox')))
		{
			if(dragx[temp])
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).style.backgroundImage =  "url("+callOut_right_o.src+")";
				else document.getElementById("bottomBox_bottom"+no).style.backgroundImage =  "url("+callOut_o.src+")";
			}
			else document.getElementById("bottomBox_bottom"+no).style.backgroundImage =  "url("+bottomDrag_o.src+")";
		}
		else if(browserDetect('msie'))
		{
			if(dragx[temp])
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_right_o.src+"',sizingMethod='scale')";
				else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_o.src+"',sizingMethod='scale')";
			}
			else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag_o.src+"',sizingMethod='scale')";
		}

		clearTimeout(timeOut);
	
		var theRoot   = object;
		var theHandle = document.getElementById("handle"+no);
	}	
}

function on_DoubleboxTop(bix, objId, objclass,side)
{
	object = document.getElementById(objId).parentNode;
	var no = (object.id).split("divx")[1];
	temp = parseInt(no.split("0")[1]);
	onDiv[temp] = bix;

	if(!bix)
	{
		document.getElementById("topPart"+no).style.backgroundImage = "url("+box_top.src+")";
		document.getElementById("topPart_bottom"+no).style.backgroundImage =  "url("+box_top_bottom.src+")";		
		if(dragx[temp]) timeOut = setTimeout("hide2('"+object.id+"')",timerOffdiv);	// not Dragging - fade out
	}
	else
	{
		document.getElementById("topPart"+no).style.backgroundImage = "url("+box_top_o.src+")";
		document.getElementById("topPart_bottom"+no).style.backgroundImage =  "url("+box_top_bottom_o.src+")";

		clearTimeout(timeOut);
	
		var theRoot   = object;
		var theHandle = document.getElementById("handle"+no);
		Drag.init(theHandle, theRoot);
		theRoot.onDragStart = function()
		{
			dragx[temp] = false; // don't vanish after dragging
			if((browserDetect('opera'))||(browserDetect('firefox')))
				document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+bottomDrag.src+")";
			else if(browserDetect('msie'))
				document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag.src+"',sizingMethod='scale')";		
		} 

	}	
}

function on_DoubleboxBottom(bix, objId, objclass,side)
{
	object = document.getElementById(objId).parentNode;
	var no = (object.id).split("divx")[1];
	temp = parseInt(no.split("0")[1]);
	onDiv[temp] = bix;

	if(!bix)
	{
		document.getElementById("bottomPart"+no).style.backgroundImage = "url("+callOut_top.src+")";
		if(dragx[temp]) // not Dragging
		{
			if((browserDetect('opera'))||(browserDetect('firefox')))
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+callOut_right.src+")";
				else document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+callOut.src+")";
			}
			else if(browserDetect('msie'))
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_right.src+"',sizingMethod='scale')";
				else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut.src+"',sizingMethod='scale')";
			}
			timeOut = setTimeout("hide2('"+object.id+"')",timerOffdiv);	
		}
		else // after dragging
		{
			if((browserDetect('opera'))||(browserDetect('firefox')))
				document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+bottomDrag.src+")";
			else if(browserDetect('msie'))
				document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag.src+"',sizingMethod='scale')";
		}
	}
	else
	{
		document.getElementById("bottomPart"+no).style.backgroundImage = "url("+callOut_top_o.src+")";
		if((browserDetect('opera'))||(browserDetect('firefox')))
		{
			if(dragx[temp])
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+callOut_right_o.src+")";
				else document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+callOut_o.src+")";
			}
			else document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+bottomDrag_o.src+")";
		}
		else if(browserDetect('msie'))
		{
			if(dragx[temp])
			{
				if(side=="right") document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_right_o.src+"',sizingMethod='scale')";
				else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+callOut_o.src+"',sizingMethod='scale')";
			}
			else document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag_o.src+"',sizingMethod='scale')";
		}

		clearTimeout(timeOut);
	
		var theRoot   = object;
		var theHandle = document.getElementById("handle"+no);
		Drag.init(theHandle, theRoot);
		theRoot.onDragStart = function()
		{
			dragx[temp] = false; // don't vanish after dragging
			if((browserDetect('opera'))||(browserDetect('firefox')))
				document.getElementById("bottomBox_bottom"+no).style.backgroundImage = "url("+bottomDrag.src+")";
			else if(browserDetect('msie'))
				document.getElementById("bottomBox_bottom"+no).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+bottomDrag.src+"',sizingMethod='scale')";					
		} 

	}	
}


// -------------------------------------------------------------------------------------------------------------------------------------

function resetWipe(restObj)
{
	T = originalT-1;
	Tx = 0;
	var no = (restObj).split("divx")[1];
	temp = parseInt(no.split("0")[1]);
	
	dragx[temp] = true;
	clearTimeout(timeOut);	
}

function browserDetect(text) {
   str = (navigator.userAgent.toLowerCase()).indexOf(text) + 1;
   data = text;
   return str;
}

function hide(links, object) {
	clearTimeout(timeOut);
	if(links.className=="double") links.style.borderBottom = "1px solid "+borderColor;	
	timeOut = setTimeout("hide2('"+object+"')",timerOfflink);
}


function hide2(obj) {
	var no = obj.split("divx")[1];
	temp = parseInt(no.split("0")[1]);
	if(!onDiv[temp])
	{
	    if (document.getElementById) document.getElementById(obj).style.visibility = 'hidden';
		clearTimeout(timeOut);
		resetWipe(obj);
		set_flash('vid1', 'stopFlash')
	}
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop+100;
}


//hiding the baloon on close button
function closeDiv(obj)
{
    if (document.getElementById) document.getElementById(obj).style.visibility = 'hidden';
	resetWipe(obj);
}

// choosing the style of the link

function find_link2()
{
	for(a=0;a<(document.getElementsByTagName("A").length);a++)
	{
		obj = document.getElementsByTagName("A").item(a);
		if(document.getElementsByTagName("A").item(a).className=="onpage") // dotted line
		{
			obj = document.getElementsByTagName("A").item(a);
			obj.style.backgroundColor = linkColor;
			obj.style.color = linkColor;
		}
		else if(document.getElementsByTagName("A").item(a).className=="button") // button
		{
			obj.style.color = linkColor;		
		}
		else if(document.getElementsByTagName("A").item(a).className=="double") // double line
		{
			obj.style.textDecoration = "underline";
			obj.style.color = linkColor;
			obj.style.borderBottom = "1px solid "+borderColor;
			if((browserDetect('opera'))||(browserDetect('firefox'))) obj.style.paddingBottom = "1px;"
		}
	}
}

function pickTab(objId)
{
	var objTable = document.getElementById('konatabs_Table');
	var A_Arr = objTable.getElementsByTagName("A");
	var A_Length = A_Arr.length;
	
	for(i=0; i<A_Length; i++)
	{
		A_Arr[i].className = "";
		A_Arr[i].href = "javascript:pickTab('konaTab0"+(i+1)+"')";
	}
	
	var selectedObj = document.getElementById(objId);
	selectedObj.className = "selected";
}