///***********************************************************************///
///***<!-- Contains Copyrighted Materials by (c) ISPRODUCTIONS 2006 -->***///
///***********************************************************************///

var floatiewidthLB="77px";  //"45px" //default width of floatie in px
var floatieheightLB="47px"; //"10px" //default height of floatie in px. Set to "" to let floatie content dictate height.
var floatiebgcolorLb="#E5E5E5" //default bgcolor of floatie
// tova e izneseno v fmain.asp v getHead ... 
//RemImg = '<img src="images/removeTooltip.png" USEMAP="#RemImgMap">';
var fadespeedLb=70 //speed of fade (5 or above). Smaller=faster.

var offsetXpointFlotieLB=5; //Customize x offset of floatie tooltip
var offsetYpointFlotieLB=5; //Customize y offset of floatie tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enableflotieLb=false
if (ie||ns6)
var browserdetectLb;
var highlightingLb

var idObjFloatieLB = "lbthumbfloatie";
var floatobjLB=document.getElementById(idObjFloatieLB)
var leaveLb = false;
var niceLb = true;

var baseopacityLb=0
function slowhighLb(which2){
	imgobj=which2
	browserdetectLb=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
	instantsetLb(baseopacityLb)
	highlightingLb=setInterval("gradualfadeLb(imgobj)",fadespeedLb)
}

function instantsetLb(degree){
	cleartimerLb()
	if (browserdetectLb=="mozilla")
	imgobj.style.MozOpacity=degree/100
	else if (browserdetectLb=="ie")
	imgobj.filters.alpha.opacity=degree
}

function cleartimerLb(){
if (window.highlightingLb) clearInterval(highlightingLb)
}

function gradualfadeLb(cur2){
    if(cur2)
    {
        if (browserdetectLb=="mozilla" && cur2.style.MozOpacity<1)
        cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
        else if (browserdetectLb=="ie" && cur2.filters.alpha.opacity<100)
                    cur2.filters.alpha.opacity+=10;
        else if (window.highlightingLb)
        clearInterval(highlightingLb)
    }
}

function ietruebodyLb(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function paramexistsLb(what){
	
	return(typeof what!="undefined" && what!="")
}
var isOverImageLb = false;
function showRemoveLB(imageid, e, optbgColor, optWidth, optHeight, thetext){
	//thetext = '<span onclick="javascript:addtomybox2('+ imageid +');QuitToLB();">Remove</span>';
	if (thetext == null || thetext == 'undefined')
	{
	    thetext = '<map name="RemImgMap" id="#RemImgMap">'+
	              '<area shape="poly" coords="8,10,68,10,68,29,44,30,38,36,32,30,8,29" href="javascript:addtomybox2('+ imageid +');QuitToLB();" />'+
	              '</map>'
	    //thetext += '<a href="javascript:addtomybox2('+ imageid +');QuitToLB();">'+RemImg+'</a>';
        
        thetext += RemImg;
        floatobjLB.className = "";
        floatobjLB.style.backgroundColor = "Transparent";
    }
    else
    {
        floatobjLB.className = "tooltipmsg";
        floatobjLB.style.backgroundColor = "#666666";
        floatobjLB.style.color = "#ffffff";
    }    
    
    
    isOverImageLb = true;
	
	var dsocx=(window.pageXOffset)? pageXOffset: ietruebodyLb().scrollLeft;
	var dsocy=(window.pageYOffset)? pageYOffset : ietruebodyLb().scrollTop;
	
	floatobjLB.style.display="block";
	
/*	
	if( paramexistsLb(optbgColor) )
	    floatobjLB.className = optbgColor;
	else
	    floatobjLB.style.backgroundColor = floatiebgcolorLb;
*/	
	floatobjLB.style.width=paramexistsLb(optWidth)? optWidth+"px" : floatiewidthLB
	floatobjLB.style.height=paramexistsLb(optHeight)? optHeight+"px" : floatieheightLB!=""? floatieheightLB : ""
	floatobjLB.innerHTML = thetext;
	
	var floatWidth=floatobjLB.offsetWidth>0? floatobjLB.offsetWidth : floatobjLB.style.width
	var floatHeight=floatobjLB.offsetHeight>0? floatobjLB.offsetHeight : floatobjLB.style.width
	var winWidth=document.all&&!window.opera? ietruebodyLb().clientWidth : window.innerWidth-20
	var winHeight=document.all&&!window.opera? ietruebodyLb().clientHeight : window.innerHeight
	e=window.event? window.event : e
	floatobjLB.style.left=dsocx+winWidth-floatWidth-5+"px"
	if (e.clientX>winWidth-floatWidth && e.clientY+20>winHeight-floatHeight){
		floatobjLB.style.top=dsocy+5+"px";
		 }
	else {
		floatobjLB.style.top=dsocy+winHeight-floatHeight-5+"px";
		
		}
	slowhighLb(floatobjLB)
	enableflotieLb = true;
	positionflotieLB(e,imageid);
}

function hidefloatieLB(){
    if (!isOverImageLb) {
	    var floatobjLB=document.getElementById(idObjFloatieLB)
	    floatobjLB.style.display="none"
	    enableflotieLb = false;
    }
}
function getPosLb(e) {
    var posx = 0; var posy = 0; 
    if (!e) var e = window.event; 
    if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } 
    else if (e.clientX || e.clientY) { 
        posx = e.clientX + document.body.scrollLeft; posy = e.clientY + document.body.scrollTop; } // posx and posy contain the mouse position relative to the document // Do something with this information 

}


function positionflotieLB(e,img){
    
      var selectedPosX = 0;
      var selectedPosY = 0;
      var theElement = MM_findObj('lbimg'+img);
      
      if (theElement) {            
          while(theElement != null){
            selectedPosX += theElement.offsetLeft;
            selectedPosY += theElement.offsetTop;
            theElement = theElement.offsetParent;
          }
      	  if (enableflotieLb){
                floatobjLB.style.left = selectedPosX-20+'px';   //selectedPosX+25+'px';
                floatobjLB.style.top = selectedPosY-28+'px';    //selectedPosY-10+'px';
                floatobjLB.style.visibility="visible"
            }
        }
      else {
          if (enableflotieLb){
	        var curX=(ns6)?e.pageX : event.x+ietruebodyLb().scrollLeft;
	        var curY=(ns6)?e.pageY : event.y+ietruebodyLb().scrollTop;
        	
        	
	        //Find out how close the mouse is to the corner of the window
	        var rightedge=ie&&!window.opera? ietruebodyLb().clientWidth-event.clientX-offsetXpointFlotieLB : window.innerWidth-e.clientX-offsetXpointFlotieLB-20
            if (ie&&!window.opera)	{
                var bottomedge = ietruebodyLb().clientHeight-event.clientY-offsetYpointFlotieLB ;

	        }
           else	
		        var bottomedge = document.body.offsetHeight-e.clientY-offsetYpointFlotieLB-20;

            
          
	        var leftedge=(offsetXpointFlotieLB<0)? offsetXpointFlotieLB*(-1) : -1000;
        //	if the horizontal distance isn't enough to accomodate the width of the context menu
	        if (rightedge<floatobjLB.offsetWidth)
		          //move the horizontal position of the menu to the left by it's width
		        floatobjLB.style.left=ie? ietruebodyLb().scrollLeft+event.clientX-floatobjLB.offsetWidth+"px" : window.pageXOffset+e.clientX-floatobjLB.offsetWidth+"px"
	        else if (curX<leftedge)
		          floatobjLB.style.left="5px"
	              else
		          //position the horizontal position of the menu where the mouse is positioned
		          floatobjLB.style.left=curX+offsetXpointFlotieLB+"px"

	        //same concept with the vertical position
	        floatobjLB.style.top=ie? ietruebodyLb().scrollTop+event.clientY-floatobjLB.offsetHeight-offsetYpointFlotieLB+"px" : e.pageY-floatobjLB.offsetHeight-offsetYpointFlotieLB+"px"	

            floatobjLB.style.visibility="visible"
	     }
	 }
}

var toidLb=0;

function ClearToLB() {
	if (toidLb!=0) {
		clearTimeout(toidLb);
		toidLb = 0;
	}
}
function QuitToLB() {
	if (toidLb!=0)
		ClearToLB();
    isOverImageLb = false;
	toidLb = setTimeout('hidefloatieLB()',300); 

}
