var toolTip2 = { 
	xCord : 0,
	yCord : 0,
	opacity : true,
	tipOver: function(e, data) 
	{
		data = data || {};
		toolTip2.opacity = data.transparency == null ? true : false	;
		
		if ( window.tID )
			clearTimeout(tID);
		if ( window.opacityID )
			clearTimeout(opacityID);
		tID = setTimeout("toolTip2.tipOutImmediate()", 50);

		obj = e;
		toolTip2.xCord = toolTip2.findPosX(obj);
		toolTip2.yCord = toolTip2.findPosY(obj) - 10;
		tID = setTimeout("toolTip2.tipShow(obj,'"+toolTip2.xCord+"','"+toolTip2.yCord+"')", 250);
		$(obj).mouseout(function(){ toolTip2.tipOut(); });
	},
	tipOver2: function(e) 
	{
		if ( window.tID )
			clearTimeout(tID);
		if ( window.opacityID )
			clearTimeout(opacityID);
		
		var obj = document.getElementById('toolTip');
		if (toolTip2.opacity) 
		{
		obj.style.opacity = '.90';
		obj.style.filter = "alpha(opacity:90)";
		}
	},
	tipOut: function(e) 
	{
		if ( window.tID )
			clearTimeout(tID);
		if ( window.opacityID )
			clearTimeout(opacityID);
		tID = setTimeout("toolTip2.tipOutImmediate()", 500);
	},
	tipOutImmediate: function() 
	{
		var div = document.getElementById('toolTip');
		if ( div )
			div.parentNode.removeChild(div);
	},
	tipShow: function(obj,x,y) 
	{
		var newDiv = document.createElement('div');
		var scrX = Number(x);
		var scrY = Number(y);
		var tp = parseInt(scrY + 15);
		var lt = parseInt(scrX - 30);
				
		/* 
		I believe it's the best method, but I don't understand why we need it... it only breaks design
		// the best well known method for detect IE7				
		var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;		
		if (ie7)
			lt = lt-600;		
		**/			
		if(lt + 250 > document.body.clientWidth)
		{
			lt = document.body.clientWidth - 250;
			newDiv.style.width = 235+'px';
		}
		if(lt < 5)
			lt = 5;
		tp += obj.offsetHeight/* - 17*/;
		//var addy = (anch.href.length > 25 ? anch.href.toString().substring(0,25)+"..." : anch.href);
		newDiv.id = 'toolTip';
		newDiv.className = 'tooltipdiv';
		newDiv.style.top = tp+'px'; newDiv.style.left = lt+'px';
		document.body.appendChild(newDiv);
		var objDesc = document.getElementById(obj.id + '_desc');
		if(objDesc)
			newDiv.innerHTML = "<p>" + objDesc.innerHTML + "</p>";
		else
			newDiv.innerHTML = "";
		newDiv.style.opacity = '.1';
		
		$(newDiv).mouseover(function(){ toolTip2.tipOver2(); });
		$(newDiv).mouseout(function(){ toolTip2.tipOut(); });
		
		toolTip2.tipFade('toolTip', 10);
		tID = setTimeout("toolTip2.tipOutImmediate()", 7000);
	},
	tipFade: function(div,opac) 
	{
		var obj = document.getElementById(div);
		var passed = parseInt(opac);
		var newOpac = parseInt(passed + 10);
		if ( newOpac < 90 && toolTip2.opacity) 
		{
			obj.style.opacity = '.'+newOpac;
			obj.style.filter = "alpha(opacity:"+newOpac+")";
			opacityID = setTimeout("toolTip2.tipFade('toolTip','"+newOpac+"')", 15);
		}
		else 
		{ 
			if (toolTip2.opacity) 
			{
			obj.style.opacity = '.90';
			obj.style.filter = "alpha(opacity:90)";
			}
			else
			{
				obj.style.opacity = '1.0';
				obj.style.filter = "alpha(opacity:100)";
			}
		}
	},
	findPosX: function(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;
	},
	findPosY: function(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;
	}
};

//addEvent(window,'load',toolTip2.attachToolTipBehavior,false);


var zoomPict2 = { 
	xCord : 0,
	yCord : 0,
/*	attachToolTipBehavior: function() {
		var links = document.getElementsByTagName('a');
		var i;
		for ( i=0;i<links.length;i++ )
			zoomPict2.attachToolTipBehaviorSingle(links[i]);
		links = document.getElementsByTagName('img');
		for ( i=0;i<links.length;i++ )
			zoomPict2.attachToolTipBehaviorSingle(links[i]);
	},
	attachToolTipBehaviorSingle: function(obj) {
		if(obj.title.length > 0)
		{
			addEvent(obj,'mouseover',zoomPict2.tipOver,false);
			addEvent(obj,'mouseout',zoomPict2.tipOut,false);
			obj.setAttribute('tip',obj.title);
			obj.removeAttribute('title');
		}
	},*/
	tipOver: function(e) 
	{
		if ( window.tID )
			clearTimeout(tID);
		if ( window.opacityID )
			clearTimeout(opacityID);
		tID = setTimeout("zoomPict2.tipOutImmediate()", 50);

		obj = e;
		zoomPict2.xCord = zoomPict2.findPosX(obj);
		zoomPict2.yCord = zoomPict2.findPosY(obj);
		tID = setTimeout("zoomPict2.tipShow(obj,'"+zoomPict2.xCord+"','"+zoomPict2.yCord+"')", 50);
		$(obj).mouseout(function(){ zoomPict2.tipOut(); });
	},
	tipOver2: function(e) 
	{
		if ( window.tID )
			clearTimeout(tID);
		if ( window.opacityID )
			clearTimeout(opacityID);
		
		var obj = document.getElementById('toolTip');
		obj.style.opacity = '.90';
		obj.style.filter = "alpha(opacity:90)";
	},
	tipOut: function(e) 
	{
		if ( window.tID )
			clearTimeout(tID);
		if ( window.opacityID )
			clearTimeout(opacityID);
		tID = setTimeout("zoomPict2.tipOutImmediate()", 500);
	},
	tipOutImmediate: function() 
	{
		var div = document.getElementById('toolTip');
		if ( div )
			div.parentNode.removeChild(div);
	},
	tipShow: function(obj,x,y) 
	{
		var newDiv = document.createElement('div');
		var scrX = Number(x);
		var scrY = Number(y);
		var tp = parseInt(scrY);
		var lt = parseInt(scrX);
				
		tp -= 38;
				
		//var addy = (anch.href.length > 25 ? anch.href.toString().substring(0,25)+"..." : anch.href);
		newDiv.id = 'toolTip';
		newDiv.className = 'zoompictdiv';
		newDiv.style.top = tp+'px'; newDiv.style.left = lt+'px';
		document.body.appendChild(newDiv);
		var objDesc = document.getElementById(obj.id + '_desc');
		if(objDesc)
			newDiv.innerHTML = "<p>" + objDesc.innerHTML + "</p>";
		else
			newDiv.innerHTML = "";
		newDiv.style.opacity = '.1';
		
		$(newDiv).mouseover(function(){ zoomPict2.tipOver2(); });
		$(newDiv).mouseout(function(){ zoomPict2.tipOut(); });
		
		zoomPict2.tipFade('toolTip', 100);
		tID = setTimeout("zoomPict2.tipOutImmediate()", 7000);
	},
	tipFade: function(div,opac) 
	{
		var obj = document.getElementById(div);
		var passed = parseInt(opac);
		var newOpac = parseInt(passed + 10);
		if ( newOpac < 90 ) 
		{
			obj.style.opacity = '.'+newOpac;
			obj.style.filter = "alpha(opacity:"+newOpac+")";
			opacityID = setTimeout("zoomPict2.tipFade('toolTip','"+newOpac+"')", 15);
		}
		else 
		{ 
			obj.style.opacity = '.90';
			obj.style.filter = "alpha(opacity:90)";
		}
	},
	findPosX: function(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;
	},
	findPosY: function(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;
	}
};



