/* © 2006 Gran Hotel Las Rozas */

var Tip = {
	gId : function(str){ return document.getElementById(str); },
	name : 'tipId',
	offsetX : 0,
	offsetY : 20,
	tip : null,
	
	Init : function()
	{
		if(!tipConID){ var tipConID = 'tipId'; }
		var tipCon = Tip.gId(tipConID);
		if(!tipCon)
		{
			var tipCon = document.createElement('div');
				tipCon.id = tipConID;
			document.getElementsByTagName('body').item(0).appendChild(tipCon);
			Tip.tip = Tip.gId(Tip.name);
			if(Tip.tip) document.onmousemove = function(evt){ Tip.Move(evt) };
		}
		if(Tip.tipFor)
		{
		    for(var i = 0; i < Tip.tipFor.length; i ++)
		    {
			    var tFor = Tip.gId(Tip.tipFor[i]);
				    tFor.setAttribute('tTxt', Tip.tipTxt[i]);				
				    tFor.onmouseover = function(){ Tip.Show(this.getAttribute('tTxt'), 'default') };
				    tFor.onmouseout = function(){ Tip.Hide() };
		    }
		    var tipOptionsTxt = ['Información sobre la compra<br>o uso de esta fotografía', 'Editar fotografía', 'Eliminar fotografía de la galería'];
		    
		    /*'Ampliar fotografía',*/
		    $('span.icoZoom').attr('tTxt', 'Ampliar fotografía');
		    $('span.icoZoom').mouseover
		    (
		        function() 
		        {
		            Tip.Show($(this).attr('tTxt'), 'icon');
		        }
		    );
		    $('span.icoZoom').mouseout
		    (
		        function() 
		        {
		            Tip.Hide();
		        }
		    );
		    
		    for(var j = 0; j < Tip.tipOptions.length; j ++)
		    {
			    var tForLk = Tip.gId(Tip.tipOptions[j]).getElementsByTagName('A');
			    for(var k = 0; k < tForLk.length; k++)
			    {
			        var tFor2 = tForLk[k];
				    tFor2.setAttribute('tTxt', tipOptionsTxt[k]);				
				    tFor2.onmouseover = function(){ Tip.Show(this.getAttribute('tTxt'), 'icon') };
				    tFor2.onmouseout = function(){ Tip.Hide() };
			    }
		    }
		}
	},
	
	Move : function(evt)
	{
		var x=0, y=0;
		if(document.all)
		{
			x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
			y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
			x += window.event.clientX;
			y += window.event.clientY;
		}
		else
		{
			x = evt.pageX;
			y = evt.pageY;
		}
		Tip.tip.style.left = (x + Tip.offsetX) + "px";
		Tip.tip.style.top = (y + Tip.offsetY) + "px";
	},
	
	Show : function(text, mode)
	{
		if (!Tip.tip) return;
		Tip.tip.innerHTML = text;
		Tip.tip.style.display = 'block';
		if(mode == 'default')
		{
		    Tip.tip.style.width = '205px';
			Tip.tip.style.fontSize = '10px';
		}
		else
		{
		    Tip.tip.style.width = 'auto';
			Tip.tip.style.fontSize = '11px';
		}
	},
	
	Hide : function()
	{
		if (!Tip.tip) return;
		Tip.tip.innerHTML = '';
		Tip.tip.style.display = 'none';
	}
}



